+ All Categories
Home > Documents > Cdma Detection Using Optical Codes

Cdma Detection Using Optical Codes

Date post: 05-Apr-2018
Category:
Upload: krishna-chaitanya
View: 229 times
Download: 0 times
Share this document with a friend

of 81

Transcript
  • 8/2/2019 Cdma Detection Using Optical Codes

    1/81

    Simulation of a CDMA system based on

    optical orthogonal codes

    Examensarbete utfort i Datatransmissionvid Tekniska Hogskolan i Linkoping

    av

    Andreas Karlsson

    Reg nr: LiTH-ISY-EX-3532-2004

    Linkoping 2004

  • 8/2/2019 Cdma Detection Using Optical Codes

    2/81

  • 8/2/2019 Cdma Detection Using Optical Codes

    3/81

    Simulation of a CDMA system based on

    optical orthogonal codes

    Examensarbete utfort i Datatransmission

    vid Tekniska Hogskolan i Linkopingav

    Andreas Karlsson

    Reg nr: LiTH-ISY-EX-3532-2004

    Supervisor: Danyo Danev

    Tobias Ahlstrom

    Examiner: Danyo Danev

    Linkoping 14th April 2004.

  • 8/2/2019 Cdma Detection Using Optical Codes

    4/81

  • 8/2/2019 Cdma Detection Using Optical Codes

    5/81

    !"!"#

    $$

    %&$

    '(')*+, -$.(-$.+

    &+*.$, -/0

    12"'3"-,""!

    4" "

    1.0$

    $ 5555

    !+6(()))77.7(/800((!((

    "

    1.

    '.$49:0;$.*

    '.49:0*&.+$.&*

    #!:+

    :*.

    :0&1*$++$+*&0+0&&&0&&&..)...*+&+.7

  • 8/2/2019 Cdma Detection Using Optical Codes

    6/81

    Abstract

    To take advantage of the high speed in an optic fiber, one of the basic concept infiber optic communication is to allow several users to simultaneously transmit dataover the channel. One technique that provides multiple access is fiber optic-code

    division multiple access (FO-CDMA). In FO-CDMA each user is assigned one ormore signature sequences called codewords, which are subsets of a type of opticalorthogonal code (OOC). The channel input/output consists of the superposition ofseveral users codewords and at the receiver end an optical correlator extracts theinformation.

    In the parallel code constructions, presented in this report, each user j is as-signed a subset Cj from a code C. The subsets are disjoint and their union is thewhole set C. A new way to map the information bits is to insert up to L zerosbefore each codeword from Cj and let this represent information aswell. This giveshigh rates for active users but an investigation is needed to ensure that this doesnot compromise the systems wanted property of sending information with a smallprobability of errors for all users. Therefore a simulation environment has been

    implemented in Matlab.The result from these simulations shows that BER for the L parallel codes isacceptable and not much higher than for the traditional constructions. Because ofthe higher rate these construction should be preferred but an analysis if a hardwareimplementation is possible might be needed.

    Keywords: CDMA, FO-CDMA, superimposed, OOC, correlation, cardinality,multiple access, MAI, BER, Matlab, simulation

    i

  • 8/2/2019 Cdma Detection Using Optical Codes

    7/81

    ii

  • 8/2/2019 Cdma Detection Using Optical Codes

    8/81

    Preface

    This report is the result of my thesis work simulation of a CDMA system based onoptical orthogonal codes which comprise 20p and was done in datatransmission atISY in Linkoping. The thesis work started in November 2003 and was completed

    in April 2004 and it finally means the end of my university studies and a Masterof engineering in electronics design.

    The report is split into 5 chapters:

    chapter 1 is an introduction to the report and gives the background, purpose andlimitations for this thesis.

    chapter 2 tells the basics of FO-CDMA as it is used today and the orthogonalcodes needed for this technique to work.

    chapter 3 presents the L parallel code constructions, that are later used in thesimulations.

    chapter 4 presents how the L parallel code constructions have been implementedin Matlab.

    chapter 5 contains the results and conclusions from the simulations. Also sug-gestions for further studies are presented here.

    iii

  • 8/2/2019 Cdma Detection Using Optical Codes

    9/81

    iv

  • 8/2/2019 Cdma Detection Using Optical Codes

    10/81

    Abbreviations

    AOOC Acyclic Optical Orthogonal CodeBER Bit Error Rate.TDMA Time Division Multiple Access.

    FDMA Frequency Division Multiple Access.CDMA Code Division Multiple Access.FO-CDMA Fiber Optic Code Division Multiple Access.L,PCWS L Parallel Code Without Synchronization.L,PCVS L Parallel Code with Varying Synchronization element.L,PCFS L Parallel Code with Fixed Synchronization element.L,PCE L Parallel Code with Error detecting property.L,PCEC L Parallel Code with Error Correcting property.MAI Multiple Access Interference.OOC Optical Orthogonal Code

    v

  • 8/2/2019 Cdma Detection Using Optical Codes

    11/81

    vi

  • 8/2/2019 Cdma Detection Using Optical Codes

    12/81

    Contents

    1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    2 Fiber optic communication 32.1 FO-CDMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 Optical orthogonal codes . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Acyclic optical orthogonal codes . . . . . . . . . . . . . . . . . . . . 8

    3 L parallel code 113.1 L parallel code without synchronization . . . . . . . . . . . . . . . . 12

    3.1.1 Cardinality and rate for L,PCWS . . . . . . . . . . . . . . . 12

    3.1.2 Decoding L,PCWS . . . . . . . . . . . . . . . . . . . . . . . 133.2 L parallel code with varying synchronization element . . . . . . . . . 143.2.1 Cardinality and rate for L , P C V S . . . . . . . . . . . . . . . 153.2.2 Decoding L , P C V S . . . . . . . . . . . . . . . . . . . . . . . 16

    3.3 L parallel code with fixed synchronization element . . . . . . . . . . 173.3.1 Cardinality and rate for L,PCFS . . . . . . . . . . . . . . . 173.3.2 Decoding L,PCFS. . . . . . . . . . . . . . . . . . . . . . . . 19

    3.4 L parallel code with error detecting property . . . . . . . . . . . . . 193.4.1 Cardinality and rate for L,PCE . . . . . . . . . . . . . . . . 193.4.2 Decoding L,PCE . . . . . . . . . . . . . . . . . . . . . . . . 21

    3.5 L parallel code with error correcting property . . . . . . . . . . . . . 213.5.1 Cardinality and rate for L,PCEC . . . . . . . . . . . . . . . 223.5.2 Decoding L,PCEC . . . . . . . . . . . . . . . . . . . . . . . 23

    3.6 Summary of the L parallel code schemes . . . . . . . . . . . . . . . . 24

    4 Matlab implementation of the L parallel code schemes 294.1 Code generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294.2 Implemented encoders . . . . . . . . . . . . . . . . . . . . . . . . . . 304.3 Implemented decoders . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    vii

  • 8/2/2019 Cdma Detection Using Optical Codes

    13/81

    viii Contents

    4.4 Main functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    5 Results and conclusions 415.1 System performance as a function of number of active users . . . . . 415.2 System performance as a function ofL . . . . . . . . . . . . . . . . . 505.3 Further studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

  • 8/2/2019 Cdma Detection Using Optical Codes

    14/81

    Contents ix

    List of Figures

    2.1 A FO-CDMA system with i users . . . . . . . . . . . . . . . . . . . . 32.2 Superposition of codewords. . . . . . . . . . . . . . . . . . . . . . . . 52.3 Example of ordinary parallel code. . . . . . . . . . . . . . . . . . . . 52.4 The message (0,1,0,1,1,1,1,0) encoded by the ordinary parallel code

    with four codewords. . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.5 Cyclic shifted codeword. . . . . . . . . . . . . . . . . . . . . . . . . . 72.6 Acyclic shifted codeword. . . . . . . . . . . . . . . . . . . . . . . . . 9

    3.1 The message (0,0,1,1,1,0,1,0,1,0,0,0) encoded by L,PCWSwith twocodewords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    3.2 Rate as a function ofL and a comparison with the ordinary parallelcode with rate K/n. . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    3.3 Rate as a function of codeword length . . . . . . . . . . . . . . . . . 27

    4.1 Overview of the Matlab functions. . . . . . . . . . . . . . . . . . . . 40

    5.1 BER as a function of number of active users for the ordinary parallelcode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    5.2 BER as a function of number of active users for L , P C V S . . . . . . . 435.3 System performance as a function of number of active users for

    L,PCWS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445.4 System performance as a function of number of active users for

    L,PCFS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455.5 System performance as a function of number of active users for

    L,PCE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

    5.6 System performance as a function of number of active users forL,PCEC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    5.7 Summary of BER as a function of number of active codewords. . . . 485.8 Summary of idle mode errors as a function of number of active code-

    words. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495.9 Rate as a function ofL for the codes used in the simulations. . . . . 525.10 System performance as a function of L for L,PCWS, P=0.2. . . . . 535.11 System performance as a function of L for L,PCWS, P=0.3. . . . . 545.12 System performance as a function of L for L,PCWS, P=0.4. . . . . 555.13 BER as a function ofL for L , P C V S . . . . . . . . . . . . . . . . . . 565.14 System performance as a function of L for L,PCFS, P=0.2. . . . . 575.15 System performance as a function of L for L,PCFS, P=0.3. . . . . 58

    5.16 System performance as a function of L for L,PCE, P=0.2. . . . . . 595.17 System performance as a function of L for L,PCE, P=0.3. . . . . . 605.18 System performance as a function of L for L,PCEC, P=0.2. . . . . 615.19 System performance as a function of L for L,PCEC, P=0.3. . . . . 62

  • 8/2/2019 Cdma Detection Using Optical Codes

    15/81

    x Contents

    List of Tables

    2.1 Required codeword length for a given cardinality and weight for anoptimal OOC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    3.1 Properties for L and K for the L parallel code constructions. . . . . 243.2 Cardinality and rate for the L parallel code constructions. . . . . . . 243.3 Expression for what L0 that gives the maximum rate. . . . . . . . . 25

    5.1 Properties for L, K, and rate in the simulations for system capacity. 50

  • 8/2/2019 Cdma Detection Using Optical Codes

    16/81

    Chapter 1

    Introduction

    Ever since the mid 90s optical fibers have been used for point to point communi-cation at a very high speed. Often the optical fiber offers much higher speed thanthe speed of electronic signal processing at both ends of the fiber. So to be ableto take the full advantage of the speed in optical fibers one of the basics conceptsin fiber optic communication is the idea of allowing several users to transmit datasimultaneously over the communication channel. This is called multiple access.

    There are several techniques to provide multiple access and one of them isfiber optic-code division multiple access (FO-CDMA). In FO-CDMA each user isassigned one or more binary signature sequence, so called codewords. The datato be sent is mapped onto the codewords and the different users codewords aremixed together and sent over the channel. At the receiver end a decoder, which

    is individual for each user, compares the incoming sequence with stored copies ofthe codewords to be able to extract the information bits.

    A set of codes that are suitable for FO-CDMA are optical orthogonal codes(OOC) and was first introduced by Saheli [7], and are presented in chapter 2.These have the desired property that it should be easy to extract data with thedesired codeword in the presence of other users codewords.

    1.1 Background

    The traditional encoding process for FO-CDMA is to send a codeword or the equalamount of zeros depending on the information bit being 1 or 0. This means that tobe able to transmit one information bit we are sending a whole codeword and if thecodewords are long the rate could be rather low. However this is often acceptablebecause of the high speed in the fiber optic channel. But as the speed of electronicsignal processing increases it becomes more important to have a high rate in theoptical channel. This can be achieved by an effective mapping of the informationbits onto the codewords in the encoding process.

    A new way of mapping the data bits onto the codewords is called L parallel

    1

  • 8/2/2019 Cdma Detection Using Optical Codes

    17/81

    2 Introduction

    code [1], [2]. Here the information bits are encoded not only by the codewordsitself but also by the successive delays between the transmission of the codewords(formal definitions will be given later). This gives high rates for active users butan investigation is needed to ensure that this does not compromise the systemswanted property of sending information with a small probability of errors for allusers.

    1.2 Purpose

    High rates and many active users often result in many codewords are sent simul-taneously over the channel and this can cause interference between users. This iscalled multiple access interference (MAI). The purpose of this thesis work has beento create a model for the L parallel scheme described in chapter 3 and investigate

    how MAI affect the probability of error.

    1.3 Method

    The model has been implemented in Matlab because of its easy handling withvectors and matrices. For the encoding and decoding process each of the fiveL parallel codes were implemented in a Matlab function, which are called by afunction that simulates transmitting and receiving.

    For the simulation a suitable OOC has been chosen and each L parallel codehas been simulated separately.

    1.4 LimitationsIn the real case there can be interference from noise in the fiber optic channel. Inthis report all physical noise (such as shot, thermal and beat noise) is neglected andit focus only on the crosstalk between users, i.e. MAI. This is an approximationbecause the inclusion of physical noise may have affect on the system performance[3]. However the purpose of this work is to investigate the performance with respectto MAI.

    There are more or less complex decoding techniques that can use all userscodewords to statistically decide whether or not a codeword has been sent. In thesimulation environment created for this work the simplest decoder has been used,namely only comparison with the users own codewords.

    Another limitation in the model is the absence of an external error correction

    method, such as a forward error correction (FEC) scheme. This might decrease thesystem performance but on the other hand the result of this model can be used fordecision of what (FEC) scheme is necessary.

  • 8/2/2019 Cdma Detection Using Optical Codes

    18/81

    Chapter 2

    Fiber optic communication

    Code division multiple access (CDMA) is a technique that are used for severalcommunication systems. Other techniques for multiple access are Frequency Divi-sion Multiple Access (FDMA) or Time Division Multiple Access (TDMA) but oneof the main advantages of CDMA is its flexibility. When a FDMA system has auser in every frequency channel or a TDMA system has a user in each time slotthe systems are full and no more users are allowed to use the channel. In CDMAthe maximum number of users are not fixed but allowing more users to access thechannel means lower rates for active users. In a CDMA system you can controlthe potential number of active users versus the rate and this makes the systemflexible. The figure below shows a FO-CDMA network with i pairs of transmittersand receivers.

    User 1

    User 2

    User i

    Data in

    Data in

    Data in Encoder 1

    Encoder 2

    Encoder i

    Optical fiber

    Decoder 1

    Decoder 2

    Decoder i

    Codegenerator

    +

    Figure 2.1. A FO-CDMA system with i users

    3

  • 8/2/2019 Cdma Detection Using Optical Codes

    19/81

    4 Fiber optic communication

    In this chapter we will discuss how CDMA is used today in fiber optic commu-nication and the orthogonal codes needed for this technique to work.

    2.1 FO-CDMA

    Fiber optic code-division multiple access (FO-CDMA) is one technique to allowseveral users to transmit simultaneously over the same optical fiber. A FO-CDMAsystem can, for each user, be described by a data source, containing the datathat will be sent, followed by an encoder and then a laser that maps the signalfrom electrical form to an optical pulse sequence. At the receiver end an opticalcorrelator is used to extract the encoded data.

    In a FO-CDMA system it is common that each user is assigned one signaturesequence called codeword. Each bit of information data is encoded by the signature

    sequence consisting of a number of shorter bits called chips. When this sequenceis sent it represent that a user with that unique signature has sent the informationbit 1. If the information bit is 0 it simply means that we send the correspondinglength of zeros i.e. no light pulses during that interval.

    All users encoded data are then added together chip by chip and the result,which is called the superposition, are sent over the channel. If a light pulse representthe binary bit 1 (mark that this is a chip and not an information bit) and theabsence of a light pulse represent the binary bit 0 the superposition mechanismhas the following properties.

    0 + 1 = 1 + 0 = 1 + 1 = 1

    0 + 0 = 0(2.1)

    In this report we will consider the system to be chip synchronized, that is allusers chip durations (pulse widths) are of equal lengths and when creating thesuperposition of chips they overlap each other precisely. Of course the users canbe delayed relative each other. Figure 2.2 on the next page shows an example ofhow the bits are encoded and the superposition of the users codewords that aresent over the channel. Here user 1 is delayed with 3 chips relative user 2.

    The individual receivers, consisting of optical correlators, continuously observethe superposition of all incoming pulse transmissions and recovers the data fromthe corresponding transmitter. This is done by correlation between the incomingsignal and stored copies of that users unique sequence. The correlator will givea peak if the incoming stream of optical pulses contains the unique sequence andthe presence of other users will be considered as noise. The decoding process isaccomplished by using optical correlation.

    If a user is assigned one codeword of length n it means that n chips will carryone information bit. However some users require higher rate and are thereforeassigned more codewords [6]. If a user is assigned K codewords we can encodea block of K information bits onto n chips and we call this costruction ordinaryparallel code. As an example (see figure 2.3) we consider a user having K = 4

  • 8/2/2019 Cdma Detection Using Optical Codes

    20/81

    2.1 FO-CDMA 5

    Encoder 1

    Encoder 2

    data=(0,1)

    User 1

    data=(1,1)

    User 2

    +

    c2:

    c1:

    Superposition

    Figure 2.2. Example of superposition of codewords. User 1 is delayed 3 chips relativeuser 2

    S/P

    0

    1

    0

    1

    data=(0101)User 1

    c1idlec2idle

    c3

    idlec4

    idle

    +

    +

    other users

    Figure 2.3. Example of ordinary parallel code. User 1 is assigned four codewords andsends the message (0,1,0,1)

    codewords (c1, c2, c3, c4) and will send the message m1=(0,1,0,1). This will beencoded by c2 + c4 where

    + indicates component wise addition according to(2.1). The message m2=(1,1,1,0) will be encoded by c1 + c2 + c3. When encoding(m1, m2)=(0,1,0,1,1,1,1,0) the user will send (c2 + c4, c1 + c2 + c3), which is twoconsecutive blocks each of length n. This is shown in figure 2.4 below.

    c2 + c4 c1 + c2 + c3

    n

    n

    Figure 2.4. The message (0,1,0,1,1,1,1,0) encoded by the ordinary parallel code withfour codewords (c1, c2, c3, c4).

    An important property for a code is its rate, which is a measurement betweenthe length of information bits and the length of the encoded sequence. So for user

  • 8/2/2019 Cdma Detection Using Optical Codes

    21/81

    6 Fiber optic communication

    with K codewords of length n we obtain the rate for the ordinary parallel code as.

    R = Kn

    (2.2)

    Each user is assigned a subset from a code C. The assignment for the usersj = 1, 2,...,M is done by partitioning of C, so that each user j is assigned distinctsubsets Cj . The subsets form a partitioning if they are disjoint and their union isthe whole set C, i.e.

    Mj=1

    Cj = C and Ci

    Cj = {} for i = j (2.3)

    A prerequisite to successfully recover the data is that the signature sequences

    comes from a family of orthogonal codes. These codes are presented in the nextsection and have special properties for correlation between codewords and if thecorrelation is kept low it reduces the crosstalk between users. One of the main goalof a FO-CDMA system is that as many users as possible should be able to accessthe channel simultaneously and this with a low probability of error. However ifwe want to produce |C| number of codewords from an OOC with weight w (thenumber of ones each codeword has) and lowest possible correlation between thecodewords, this require a codeword length n which is approximately [4].

    n |C|w(w 1) (2.4)

    This tells us that if we want to produce more codewords of the same weightthis means we get larger codewords. Because one codeword sent over the channel

    corresponds to one information bit we get a lower rate.Therefore methods to develop codes with the desired properties are an essential

    part of FO-CDMA. Optical orthogonal codes was first introduced by Saheli [7],and these are presented in the next section.

    2.2 Optical orthogonal codes

    To reduce the crosstalk between users, an important property of the sequences(codewords) is that they produce a low correlation. OOC are a set of binary se-quences with special auto- and crosscorrelation properties. The correlation beinglow tells us that each sequence in the code can easily be distinguished from a shiftedversion of itself i.e. the autocorrelation is low, and it can easily be distinguishedfrom any combination of shifted versions of other sequences in C i.e. the crosscor-relation is low. The size of the code is the number of codewords in C and is calledits cardinality and is denoted |C|.

    An (n,w,a, c) optical orthogonal code C is a set of (0,1) sequences of lengthn and weight w (the number of ones in every codeword). The set is constructed sothat it has the following two properties [4].

  • 8/2/2019 Cdma Detection Using Optical Codes

    22/81

    2.2 Optical orthogonal codes 7

    1. Autocorrelation property: for any x C and any integer , 0 < n

    n1t=0

    xtxt a (2.5)

    2. Crosscorrelation property: for any x = y C and any integer

    n1i=0

    xtyt c (2.6)

    The codewords can be cyclic shifted (see figure 2.5) and therefore denotesmodulo n so the correlation becomes periodic correlation. a and c are often calledthe correlation constraints and from now on we will only discuss a = c = = 1,

    which is the lowest possible correlation, and the notation for an OOC will become(n,w, 1).

    c1(0), ..., c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    Opticalcorrelator

    Figure 2.5. The incoming sequence (c1, c1, c1). The correlator looks at cyclic shiftedcodewords.

    Often an OOC is denoted by the positions where C has ones. As an ex-ample consider the code C = {c1, c2} = {110100000000000, 100010000100000},which is an (15, 3, 1) OOC with two codewords. This can be written as C ={{0, 1, 3}15, {0, 4, 9}15}.

    What the correlation constraint ( = 1) also say is that no distances betweenthe positions of ones in the code (C) are repeated. For example the distancebetween the first and the second one in c1 is 1, but as we look at two consecu-tive c1s (cyclic shifted) the distance 14 will also be taken into consideration. Inthe code above the distances are {1, 14, 3, 12, 2, 13, 4, 11, 9, 6, 5, 10}. The distances

  • 8/2/2019 Cdma Detection Using Optical Codes

    23/81

    8 Fiber optic communication

    {14, 12, 13, 11, 6, 10} are due to cyclic shifts of the codewords (when we look at twoconsecutive codewords). We see here that no distance is repeated and thereforethe code is an OOC with = 1. If = 2 it means that any distance between thepositions of ones cannot be repeated more than once.

    A desirable property of a code is that it should be as large as possible, i.e.contain as many codewords as possible. This to enable more users to access thechannel. An OOC is said to be optimal if it has the maximum cardinality for agiven n,w,. As mentioned in the previous section the codeword length n increaseswith increasing cardinality and weight (2.4). In the table below some optimalconstructions are presented and it shows what codeword length n is required toconstruct a code with given size |C| and weight w.

    |C| w n12 5 24114 5 2816 6 181

    21 6 63111 7 46321 7 88318 8 100966 8 3697

    Table 2.1. Example of required codeword length n for a given cardinality |C| and weightw for an optimal OOC construction.

    These optimal constructions are presented in [5] and are later used in the sim-ulations for the FO-CDMA system.

    When the codewords are sent without any separation between them the cor-relator looks at cyclic shifted versions of the codewords. The cyclic shifts mustbe taken into consideration when producing an OOC and the correlation must betaken modulo n. But if the codewords are separated with at least the codewordlength the correlator only look at acyclic shifted codewords (see figure 2.5). There-fore one can produce codes that only takes acyclic shifts into consideration and wecall these codes acyclic optical orthogonal codes (AOOC).

    2.3 Acyclic optical orthogonal codes

    For the different constructions ofL parallel code, that will be presented in the nextchapter, the sent codewords are separated with at least the codeword length. Thismeans that the correlator only looks at acyclic shifted codewords.

    If c = (c0, c1, . . . , cn1) is a codeword of length n then c, || < n 1, is the

    acyclic shifted version of c defined as.

  • 8/2/2019 Cdma Detection Using Optical Codes

    24/81

    2.3 Acyclic optical orthogonal codes 9

    c1(0), ..., c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ..., c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ...,c1(n 1)

    c1(0), ..., c1(n 1)

    0, 0, 0, 0, ...,0, 0, 0

    0, 0, 0, 0, ..., 0, 0, 0

    0, 0, 0, 0, ..., 0, 0, 0

    0, 0, 0, 0, ...,0, 0, 0

    0, 0, 0, 0, ...,0, 0, 0

    Opticalcorrelator

    Figure 2.6. The incoming sequence (c1, c1) separated with n zeros. The correlator looksat acyclic shifted codewords.

    c =

    (c0, c1, . . . , cn1) if = 0(0, . . . , 0

    , c0, . . . , cn1+) if (n 1) < 0

    (c, . . . , cn1, 0, . . . , 0

    ) if n 1 > 0

    (0, . . . , 0 n

    ) if || n

    (2.7)

    The auto- and cross correlation from the previous section were calculated withcyclic shifted codewords so the operations where taken modulo n and we called thisperiodic correlation. If we instead produce the correlation with a acyclic shiftedcodeword (|| < n 1) we call this aperiodic correlation and the produced code Cwill be an acyclic optical orthogonal code (AOOC) that only takes acyclic shiftsinto consideration.

    The OOC presented in the previous section obviously fulfil aperiodic correlationas well but it can be reduced to only fulfil aperiodic correlation. The code thenbecomes C = {1101000000, 1000100001}. The codewords are now reduced to length10 and do not fulfil periodic correlation because the zeros in the end are removedand some distances are therefore repeated (if we look at cyclic shifts). Howeverit fulfils aperiodic correlation and this code is therefore an AOOC with = 1. Ifthe codewords are separated in the channel this code should not cause greater biterror rate (BER) for the system, but this is one of the questions this report willinvestigate.

    Because we can remove the zeros at the end of the codewords it should be

  • 8/2/2019 Cdma Detection Using Optical Codes

    25/81

    10 Fiber optic communication

    possible to find constructions with the same cardinality and weight as an OOC butwith shorter codewords. The rate depends of the lengths of the codewords so thismeans that if we can use an AOOC instead of an OOC this will give us higherrates.

  • 8/2/2019 Cdma Detection Using Optical Codes

    26/81

    Chapter 3

    L parallel code

    In this chapter five types of L parallel code constructions are presented. As forthe ordinary parallel code presented in the previous chapter, every user is givena number of codewords that are a subset Cj from a larger code C (2.3). Theseconstructions are all a version of the ordinary parallel code but the mapping ofinformation bits onto the codewords is different here to gain a higher rate. In theordinary parallel code the mapping simply means the codewords are sent or notdepending on the information bits being 1 or 0.

    The L parallel codes also use a delay between sent codewords to representinformation. If a codeword has been detected by the decoder it can calculate thedelay b etween that codeword and other received codewords from the same user. Ifwe know what codewords have been sent from a user and the delay between them,

    we can use this information to recover the encoded data. First a definition of adelayed codeword is needed.

    Definition 1 ((L, l) delayed codeword) For a codeword c = (c0, c1,...,cn1)and every (L, l) 0 l L, we define the (L, l) delayed codeword cL(l) to bethe sequence of length 2n + L.

    cL(l) = (0, 0, ..., 0 n+l

    , c0, c1,...,cn1 n

    , 0, 0,..., 0 Ll

    ) (3.1)

    Because the (L, l) delayed codeword start with at least n zeros the sent code-words are separated with at least the codeword length. This means that the code-words do not need to fulfil periodic correlation because we only look at acyclicshifted codewords.

    For a given L the codeword can be delayed in L + 1 different ways (l =0, 1, 2,...,L), and therefore the codeword can be represented in L + 1 differentways. One can also represent information by the codeword not being sent, as inthe ordinary parallel code presented in the previous chapter. So the number ofcombinations of binary information bits one codeword can represent can be up to

    11

  • 8/2/2019 Cdma Detection Using Optical Codes

    27/81

    12 L parallel code

    L + 2. Because the information bits are binary these combinations corresponds tolog

    2(L + 2) number of bits.

    In the next sections the five different L parallel codes are presented.

    3.1 L parallel code without synchronization

    The L parallel code without synchronization uses every codeword in C to carryinformation. Each codeword can be delayed between 0 and L or not being sent.The definition for L parallel code without synchronization can be expressed as.

    Definition 2 (L parallel code without synchronization) From a code Cwith the codewords {cj }Kj=1 as elements, and for an integer L, the L parallel code

    without synchronization, CL,PCWS is the set.

    CL,PCWS = K

    j=1

    bj cLj

    (lj ) : (b1, b2,...,bK ) {0, 1}K ,

    (l1, l2,...,lK ) {0, 1,...,L}K (3.2)

    The sum means the superposition (2.1) of all (L, l) delayed codeword in C. bjbeing 1 or 0 simply means the codeword being present in the combination or not.So what the definition above means is that every codeword can be delayed between0 and L or not being present in the combination at all.

    3.1.1 Cardinality and rate for L,PCWS

    The cardinality or the size, |C|, of a code C is the number of codewords the codecontains. So if a user is given K codewords we have |C| = K, but if we applyL,PCWS onto these codewords we get another cardinality |CL,PCWS |. This isthe number of combinations L,PCWS can produce for a given K and L.

    As discussed in the section above every codeword in C can have L + 2 differentcombinations due to lj = (0, 1,...L) or the codeword could not be sent, which alsois a combination. If there are K codewords in C this gives us that the total numberof combinations |CL,PCWS | for a given L and K to be.

    |CL,PCWS | = (L + 2)K (3.3)

    Another important property of a code is its rate, which is the relation betweenthe length of the information bits and the length of the encoded sequence. Forthe ordinary parallel code the rate where K/n, which means that a user havingK codewords can encode K information bits onto n chips, n being the codewordlength.

    For L,PCWSwe have (L+ 2)K different combinations so the number of binaryinformation bits this can represent is log2(L + 2)

    K . From (3.1) we have that the

  • 8/2/2019 Cdma Detection Using Optical Codes

    28/81

    3.1 L parallel code without synchronization 13

    length of the delayed codewords is 2n + L so the rate is given by.

    RL,PCWS = log2(L + 2)K

    2n + L= Klog

    2(L + 2)2n + L

    (3.4)

    The expression tells us that if we double K the rate is doubled so the maximumrate is independent of the number of codewords and depends only on L (for a givenn).

    d

    dL(RL,PCWS ) =

    K

    ln(2)

    2n + L (L + 2)ln(L + 2)

    (L + 2)(2n + L)2(3.5)

    Setting the expression to zero we obtain the expression for L0 which gives themaximum rate.

    (L0 + 2)ln(L0 + 2) L0 = 2n (3.6)

    Because we want log2(L + 2) to be a positive integer L must have the following

    properties.L = 2i 2 : i N, i 2 (3.7)

    To further explain how the mapping of information bits onto the codewordsworks, consider the following example.

    Suppose a user having two codewords (c1, c2), (K = 2) and L = 6. We canhave L + 1 different delays for every codeword or it may not be sent. This givesus (L + 2) = 8 different combinations for each codeword which corresponds tolog2(L + 2) = 3 binary bits. The mapping can be expressed as.

    (0, 0, 0) bj = 0

    (0, 0, 1) lj = 0

    (0, 1, 0) lj = 1

    (0, 1, 1) lj = 2

    (1, 0, 0) lj = 3

    (1, 0, 1) lj = 4

    (1, 1, 0) lj = 5

    (1, 1, 1) lj = 6

    The first three bits are mapped onto c1, the next three bits are mapped ontoc2 and so on. The user has two codewords so the number of bits that can bemapped onto these codewords is Klog2(L + 2) = 6. For example the messagem1=(0,0,1,1,1,0) will be encoded as c

    61(0)+c

    62(5) and the message m2=(1,0,1,0,0,0)

    will be encoded as c61(4).When encoding (m1, m2)=(0,0,1,1,1,0,1,0,1,0,0,0) the user

    will send (c

    6

    1(0)+c

    6

    2(5), c

    6

    1(4)), which is two consecutive blocks each of length 2n+L.This is shown in figure 3.1 on the next page.

    3.1.2 Decoding L,PCWS

    The decoding process for L,PCWS works in a similar way as for the ordinaryparallel code described in chapter 2. The difference here is that the decoder also

  • 8/2/2019 Cdma Detection Using Optical Codes

    29/81

    14 L parallel code

    c61(0) + c6

    2(5) c6

    1(4)

    2n+L

    2n+L

    Figure 3.1. The message (0,0,1,1,1,0,1,0,1,0,0,0) encoded by L,PCWSwith two code-words (c1, c2) and L = 6.

    has to compare the delay of the detected codewords. If two codewords have beendetected using optical correlation the decoder can calculate the delay between thembut to calculate the actual lj it has to know where the block starts. So a systemusing L,PCWS has to have synchronized receivers and senders to calculate theactual delay. The decoder then becomes a block-decoder in the sense that thedecoder knows when each block of length 2n + L starts. It then knows exactly the

    delay lj for detected codewords and the data can be recovered.For L,PCWSwe gain a high rate but the systems flexibility might be decreased

    because the receivers and senders have to be synchronized during transmission. Asolution to this problem can be to always send one codeword without delay ( lj = 0),called synchronization element, so that the delay of the next detected codewordscan be compared to this. These constructions are presented in the next sections.

    3.2 L parallel code with varying synchronization

    element

    The L parallel code with varying synchronization element, L , P C V S also uses every

    codeword in C to carry information, but only the synchronization element can besent without delay (lj = 0), and the other codewords are delayed between 1 andL. The definition for L parallel code with varying synchronization element can beexpressed as.

    Definition 3 (L parallel code with varying synchronization element) Acode C with the codewords {cj }

    Kj=1 as elements, and for an integer L, the L parallel

    code with varying synchronization element, CL,PCV S is the set.

    CL,PCV S =

    cLs (0) +

    Kj=1j=s

    bj cLj

    (lj) : s {1, 2,...,K},

    bj {0, 1}, lj {1, 2,...,L}, j {1, 2,...,K}, j = s

    (3.8)

    The encoding process works in a similar way as for L,PCWS (3.2), but onecodeword is always sent without delay and the rest, if they are sent, have a delaybetween 1 and L. Which codeword that is chosen to be the synchronization elementmay vary between the encoded blocks. The remaining K 1 codewords can thenhave a delay between 1 and L or not being sent at all.

  • 8/2/2019 Cdma Detection Using Optical Codes

    30/81

    3.2 L parallel code with varying synchronization element 15

    The choice of synchronization element depends on the first log2(K) bits ofinformation in each block that will be encoded. For example if K = 2 this canrepresent two binary sequences, 0 and 1, and depending on the first bit in the blockof information being 0 or 1 the first respectively second codeword in C becomes thesynchronization one. If a user has been given four codewords (c1, c2, c3, c4), thechoice of synchronization element will depend on the first two bits of the informationblock.

    (0, 0) cL1 (0)

    (0, 1) cL2 (0)

    (1, 0) cL3 (0)

    (1, 1) cL4 (0)

    This implies that every user must have at least two codewords to be able tosend information and the number of codewords K given to each user should bechosen as.

    K = 2i : i Z+ (3.9)

    This is of course a limitation but one advantage is that the synchronizationelement will be able to carry information.

    3.2.1 Cardinality and rate for L,PCVS

    The synchronization element can be chosen in K different ways. The remainingK 1 codewords in C are then allowed to be delayed with lj = (1, 2,...,L) or maynot be sent at all. This gives us the total number of combinations or the cardinality

    for L , P C V S for a given K and L to be.

    |CL,PCV S | = K(L + 1)K1 (3.10)

    The total number of combinations can then be used to encode a binary infor-mation sequence of length log2(K(L + 1)

    K1). The length of the superimposeddelayed codewords (3.1) is 2n + L so the rate for L , P C V S will be.

    RL ,P C V S =log2(K(L + 1)

    K1)

    2n + L=

    log2(K) + (K 1)log2(L + 1)

    2n + L(3.11)

    This means that K codewords and an integer L can encode log2(K(L + 1)K1)

    information bits onto 2n + L chips. The expression for rate differs from (3.4)because the maximum rate depends both on L and K. To get this expression thederivative with respect to L for a fixed K is calculated and set to zero.

    d

    dL(RL ,P C V S ) =

    ln(K)

    (2n + L)2ln(2)+ (K 1)

    2n + L (L + 1)ln(L + 1)

    (2n + L)2(L + 1)

    =ln(K)(L + 1) + (K 1)(2n + L (L + 1)(ln(L + 1))

    (2n + L)2ln(2)(L + 1)

    (3.12)

  • 8/2/2019 Cdma Detection Using Optical Codes

    31/81

    16 L parallel code

    Setting this to zero we obtain the expression for what L0 that gives the maxi-mum rate for a given K.

    (K 1)(2n + L0 (L0 + 1)(ln(L0 + 1)) = ln(K)(L0 + 1) (3.13)

    We have already made some limitation for what values K can be. We also wantlog2(L + 1) to be a positive integer so the following restriction for L is needed.

    L = 2i 1 : i Z+ (3.14)

    To explain how the encoding process works for L , P C V S consider the followingexample.

    Suppose a user having four codewords (c1, c2, c3, c4), (K = 4) and L = 7. Thefirst log2(K) = 2 information bits are encoded by the synchronization element,which can be any of the four codewords. The remaining three codewords are then

    used in a similar way as L,PCWS except the delay cannot be zero (lj = 0). Themapping for the remaining codewords can be expressed as.

    (0, 0, 0) bj = 0

    (0, 0, 1) lj = 1

    (0, 1, 0) lj = 2

    (0, 1, 1) lj = 3

    (1, 0, 0) lj = 4

    (1, 0, 1) lj = 5

    (1, 1, 0) lj = 6

    (1, 1, 1) lj = 7

    So the first two bits are mapped onto the synchronization element. The nextthree bits are mapped onto c2, and the next three bits are mapped onto c3 and soon. Each of the remaining codewords can then be used to map log2(L + 1) = 3information bits so the three codewords can totally map (K1)log2(L+1) = 9 bits.The message (0,1,1,0,1,1,0,0,1,1,1) will then be encoded by c72(0)+ c

    71(5)+ c

    73(4)+

    c74(7), and the message (1,1,0,0,0,0,0,1,1,1,0) will be encoded by c74(0)+c

    72(1)+c

    73(6).

    The + here means chip wise addition according to (2.1).

    3.2.2 Decoding L,PCVS

    An advantage when decoding L , P C V S is that the receiver does not need to besynchronized with the sender. The decoder is searching for the synchronizationelement with optical correlation described in chapter 1 and when this element hasbeen found the remaining (K 1) codewords should be found within L light pulsesand the data can be recovered. To be sure that the detected codeword really isa synchronization element and not interference from all other users codeword onecan compare the time arrival with the last detected and approved synchronizationelement, which should be 2n + L chips before. For the approval of the first found

  • 8/2/2019 Cdma Detection Using Optical Codes

    32/81

    3.3 L parallel code with fixed synchronization element 17

    synchronization element, a buffer can be used and search 2n+L chips forward afterthe next synchronized element.

    The interference from other users codewords and the interference from the usersown codewords can cause that a synchronization element can be detected andapproved in a wrong place. When using L , P C V S we still obtain a large ratebut the decoding process where any codeword can be the synchronized one can berather complex and decrease the systems flexibility. A way to further increase theflexibility is to let one fixed codeword to always be the synchronization element.

    3.3 L parallel code with fixed synchronization el-

    ement

    L parallel code with fixed synchronization, L,PCFS, works in a similar way as

    L , P C V S except that the synchronization element is fixed and cannot carry anyinformation itself. What codeword that is chosen to always be the synchronizationelement has to be known for the decoder to successfully recover the encoded data.This codeword is always sent without delay and the remaining codewords canthen be delayed between 0 and L. The definition for L parallel code with fixedsynchronization element can be expressed as.

    Definition 4 (L parallel code with fixed synchronization element) Froma code C with the codewords {cj }Kj=1 as elements and for an integer L, the L par-

    allel code with fixed synchronization element, CL,PCFS with c1 as synchronizationelement is the set.

    CL,PCFS =cL1 (0) +K

    j=2

    bj cLj (lj ) : (b2,...,bK ) {0, 1}K1,

    (l2,...,lK ) {0, 1,...,L}K1

    (3.15)

    The synchronization element is sent for every block i.e. every period of length2n + L. The remaining K 1 codewords from C are then delayed between 0 andL or not being sent at all.

    3.3.1 Cardinality and rate for L,PCFS

    IfC contains K codewords (|C| = K), one of them is always sent as a synchroniza-tion element that do not carry information itself. The remaining K 1 codewords

    can each produce L + 2 combinations because lj = (0, 1,...,L) or the codeword isnot sent. The cardinality for L,PCFS will then become.

    |CL,PCFS| = (L + 2)K1 (3.16)

    The total number of combinations can then be used to encode log2(L + 2)K1

    binary information bits. The length of the superimposed delayed codewords (3.1)

  • 8/2/2019 Cdma Detection Using Optical Codes

    33/81

    18 L parallel code

    is 2n + L so the rate for L,PCFS will be.

    RL,PCFS = log2(L + 2)K1

    2n + L= (K 1)log

    2(L + 2)2n + L

    (3.17)

    This means that K codewords and the integer L can encode log2(L + 2)K1

    information bits onto 2n + L chips. As for L,PCWS the maximum rate onlydepends on L.

    d

    dL(RL,PCFS ) =

    K 1

    ln(2)

    2n + L (L + 2)ln(L + 2)

    (L + 2)(2n + L)2(3.18)

    Setting the expression to zero we obtain the expression for L0 which gives themaximum rate. This is exactly the same expression that gives the maximum ratefor L,PCWS (3.6).

    (L0 + 2)ln(L0 + 2) L0 = 2nFor log2(L + 2) to be a positive integer L must follow (3.7). Because the syn-

    chronization element does not carry any information all users must at least beassigned two codewords (K 2) to be able to send information.

    Consider the following example. A user has been assigned the codewords(c1, c2, c3), (K = 3) and L = 14. The first element c1 is the synchronizationelement and is always sent without delay. The remaining K 1 = 2 codewords canhave L + 1 different delays each or it may not be sent. This gives us ( L + 2) = 16different combinations for each codeword which can represent log2(L + 2) = 4 bi-nary information bits. The mapping for each of the remaining codewords can beexpressed as.

    (0, 0, 0, 0) bj = 0

    (0, 0, 0, 1) lj = 0

    (0, 0, 1, 0) lj = 1

    (0, 0, 1, 1) lj = 2

    (0, 1, 0, 0) lj = 3

    (0, 1, 0, 1) lj = 4

    (0, 1, 1, 0) lj = 5

    (0, 1, 1, 1) lj = 6

    (1, 0, 0, 0) lj = 7

    (1, 0, 0, 1) lj = 8

    (1, 0, 1, 0) lj = 9

    (1, 0, 1, 1) lj = 10

    (1, 1, 0, 0) lj = 11

    (1, 1, 0, 1) lj = 12

    (1, 1, 1, 0) lj = 13

    (1, 1, 1, 1) lj = 14

  • 8/2/2019 Cdma Detection Using Optical Codes

    34/81

    3.4 L parallel code with error detecting property 19

    So the remaining two codewords can encode (K 1)log2(L + 2) = 8 bits. Themessage (1,0,0,0,1,0,1,1) will be encoded with c14

    1(0) + c14

    2(7) + c14

    3(10) and the

    message (0,0,0,0,1,1,1,1) will be encoded as c141 (0) + c143 (14).

    3.3.2 Decoding L,PCFS

    If a user is sending information the synchronization element will be sent in every2n + L period. The decoder is continuously searching for the synchronizationelement and when it has been found we know that the remaining codewords thatcarry the information should appear within L light pulses. To further ensure thatthe found synchronization element is found in the right position one could compareits time arrival with the last found synchronization element, which should havebeen found 2n + L chips before. For the approval of the first found synchronizationelement, a buffer can be used and search 2n + L chips forward after the next

    synchronized element.It is a desirable property that the code itself can detect errors when decoding

    the incoming sequence. The code presented in the next section is constructed insuch way.

    3.4 L parallel code with error detecting property

    L parallel code with error detecting property, L,PCE, works in a similar wayas L,PCFS but every codeword in C is sent in each period. In every period of2n + L the synchronization element is sent without delay and all of the remainingcodewords are sent with a delay between 0 and L. The definition for L parallelcode with error detecting property can be expressed as.

    Definition 5 (L parallel code with error detecting property) From a codeC with the codewords {cj }

    Kj=1 as elements and for an integer L, the L parallel code

    with error detecting property, CL,PCE with c1 as synchronization element is theset.

    CL,PCE =

    cL1 (0) +

    Kj=2

    cLj (lj ) : (l2,...,lK ) {0, 1,...,L}K1

    (3.19)

    Because every codeword from C is sent exactly once in every period of 2n + Lone can make the decision that an error has occurred if a codeword is found morethan once within L light pulses after the detection of the synchronization elementor if all codewords are not found.

    3.4.1 Cardinality and rate for L,PCE

    If C contains K codewords (|C| = K), one of them is always sent as a synchro-nization element without delay and do not carry information itself. The remaining

  • 8/2/2019 Cdma Detection Using Optical Codes

    35/81

    20 L parallel code

    K 1 codewords are always sent and can each produce L + 1 combinations becausel

    j= (0, 1,...,L). The cardinality for L,PCEwill then become.

    |CL,PCE| = (L + 1)K1 (3.20)

    The total number of combinations can then be used to encode log2(L + 1)K1

    binary information bits. The length of the superimposed delayed codewords (3.1)is 2n + L so the rate for L,PCEwill be.

    RL,PCE =log2(L + 1)

    K1

    2n + L=

    (K 1)log2(L + 1)

    2n + L(3.21)

    This means that K codewords and the integer L can encode log2(L + 1)K1

    information bits onto 2n + L chips. As for L,PCFS and L,PCWSthe maximumrate only depends on L.

    ddL

    (RL,PCE) = K 1ln(2) 2n + L (L + 1)ln(L + 1)(L + 1)(2n + L)2 (3.22)

    Setting the expression to zero we obtain the expression for L0 which gives themaximum rate.

    (L0 + 1)ln(L0 + 1) L0 = 2n (3.23)

    Because the synchronization element does not carry any information all usersmust at least be assigned two codewords (K 2). We also want log2(L + 1) to bean integer so L must follow (3.14).

    The following example shows how the encoding process for L,PCEmight work.A user is assigned five codewords (c1, c2, c3, c4, c5), (K = 5) and L = 7. Thefirst element in C is chosen to be the synchronization element and is always sentwithout delay (l1 = 0). The remaining four codewords are always sent with a delay

    lj = (0, 1, ..., 7). This gives us L + 1 = 8 combinations for each codewords, whichcan be used to map log2(L + 1) = 3 information bits for each remaining codeword.The mapping can be expressed as.

    (0, 0, 0) lj = 0

    (0, 0, 1) lj = 1

    (0, 1, 0) lj = 2

    (0, 1, 1) lj = 3

    (1, 0, 0) lj = 4

    (1, 0, 1) lj = 5

    (1, 1, 0) lj = 6

    (1, 1, 1) lj = 7

    The first three bits are mapped onto c2, the next three bits are mapped onto c3and so on. The remaining four codewords are then be used to map a total of ( K1)log2(L+1) = 12 information bits. The message (0,1,0,1,0,1,1,1,0,0,0,0) is encodedby c71(0) + c

    72(2) + c

    73(5) + c

    74(6) + c

    75(0) and the message (0,0,0,0,0,0,1,1,1,1,0,1)

    will be encoded as c71(0) + c72(0) + c

    73(0) + c

    74(7) + c

    75(5).

  • 8/2/2019 Cdma Detection Using Optical Codes

    36/81

    3.5 L parallel code with error correcting property 21

    3.4.2 Decoding L,PCE

    When decoding L,PCEthe decoder is continuously searching for the synchroniza-tion element (which codeword that has been chosen to be the synchronized oneis of course known by the decoder). When this has been found we know that allthe remaining codewords should be found within L light pulses. If a codewordis detected more than once within L pulses we know that an error has occurredand the incorrect bits can be retransmitted. If however an incorrect detection of acodeword is due to interference from the users own codeword the same combinationof delayed codewords will be sent again and the same error will occur.

    If we have not detected all codewords L pulses after the detection of the syn-chronization element we know that these detection is due to interference and canbe disregarded, and not be used to restore data.

    The L parallel code with error detecting property can correct errors to the

    extension that it can discard detections when all codewords have not been detectedwithin L pulses, but it can only detect errors when a codeword has been foundmore than once within L pulses after the synchronization element. It is thereforedesirable to have a code that can correct these errors as well. In the next sectionsuch construction is presented.

    3.5 L parallel code with error correcting property

    In all the code constructions above we have used definition (3.1) for delayed code-words. In L parallel code with error correcting property, L,PCEC, every codewordis sent twice with a separation parameter S between them so a new definition fordelayed codeword is needed. This construction is presented in [2].

    Definition 6 ((L, l) delayed repeated codeword with separation S) If wehave a codeword c = (c0, c1,...,cn1), then for every (L, l) 0 l L, we definethe (L, l) delayed repeated codeword with separation S, cS,L(l) to be the sequenceof length 3n + L + S.

    cS,L(l) = (0, 0, ..., 0 n+l

    , c(0), c(1),...,c(n 1) n

    , 0, 0,..., 0 S

    , c(0), c(1),...,c(n 1) n

    , , 0, 0, ..., 0 Ll

    )

    (3.24)

    What this means is that every delayed codeword to be sent is repeated with aseparation of S chips, where S is between 0 and n (n being the codeword length).One should therefore be able to detect this copy n + S chips after the first repeatedcodeword. If we choose S = 0, the codeword is repeated without separation so thecorrelator will look at cyclic shifted codewords and we will need an OOC. If weinstead choose S = n the codewords are separated with the codeword length andwe only look at acyclic shifted codewords. If S = n we should then be able to usean AOOC discussed in section 2.3 on page 8.

    L,PCECworks in a similar way as L,PCEin the sense that a synchronizationelement (known to both sender and receiver) is sent without delay (lj = 0) and

  • 8/2/2019 Cdma Detection Using Optical Codes

    37/81

    22 L parallel code

    the remaining codewords are always sent and are delayed between 0 and L. Thedifference is that the delayed codewords are repeated once with the separation S.The definition for L parallel code with error correcting property can be expressedas.

    Definition 7 (L parallel code with error correcting property) From acode C with the codewords {cj }

    Kj=1 as elements that satisfy correlation based on

    S {0, 1,...,n}, and for an integer L, the L parallel code with error correctingproperty, CL,PCEC with c1 as synchronization element is the set.

    CL,PCEC =

    cS,L1 (0) +

    Kj=2

    cS,Lj (lj ) : (l2,...,lK ) {0, 1,...,L}K1

    (3.25)

    This means that the synchronization is sent in every period of 3n + L + S and

    a repeated copy n + S chips after. The remaining K 1 codewords are alwayssent with a delay between 0 and L, (lj = 0, 1,...,L), and a repeated copy n + Schips after. Because every codeword is sent in every period we have the same errordetecting property as for L,PCE. But we also know that if a codeword has beendetected there should appear a copy of that codeword n+Safter. If there is no suchcopy one can make the decision that the codeword is detected due to interference.

    3.5.1 Cardinality and rate for L,PCEC

    If C contains K codewords (|C| = K), one of them is always sent as a synchro-nization element without delay and do not carry information itself. The remainingK 1 codewords can each produce L + 1 combinations because lj = (0, 1,...,L).The cardinality for L,PCEC will then become.

    |CL,PCEC| = (L + 1)K1 (3.26)

    This is the same cardinality as for L,PCE (3.20) and the mapping of infor-mation bits onto the codewords works in a similar way. So the total number ofinformation bits that can be mapped in each block is then log2(L + 1)

    K1. Thelength of the superimposed delayed repeated codewords (3.24) is 3n + L + S so therate for L,PCEC will be.

    RL,PCEC =log2(L + 1)

    K1

    3n + L + S=

    (K 1)log2(L + 1)

    3n + L + S(3.27)

    Like L,PCFS, L,PCWS and L,PCEthe maximum rate only depends on L.

    d

    dL(RL,PCEC) =

    K 1

    ln(2)

    3n + L + S (L + 1)ln(L + 1)

    (L + 1)(3n + L + S)2(3.28)

    Setting the expression to zero we obtain the expression for L0 which give themaximum rate.

    (L0 + 1)ln(L0 + 1) L0 = 3n + S (3.29)

  • 8/2/2019 Cdma Detection Using Optical Codes

    38/81

    3.5 L parallel code with error correcting property 23

    Because of the similarity with L,PCE, L and K must have the same propertiesas for L,PCE. The mapping of information bits onto the delayed repeated code-words works in the same way as L,PCEwith the difference that we use definition1 instead of definition 6 for the delayed elements. Consider the following exampleon how the mapping works for L,PCEC.

    A user is assigned three codewords (K = 3), (c1, c2, c3), that is a partition of anOOC satisfying (2.5) and (2.6). Because we have an OOC we choose S = 0. Fur-thermore we choose L = 15 so that each codeword can produce L+1 = 16 differentcombinations. The synchronization element is always sent without delay (c0,151 (0)).These combinations can be used to map log2(L + 1) = 4 binary information bitsfor each of the remaining two codewords. So the total remaining codewords canbe used to map (K 1)log2(L + 1) = 8 bits. The message (0,0,1,0,1,1,1,1) will beencoded as c0,151 (0) + c

    0,152 (2) + c

    0,153 (15), and the message (1,1,0,1,1,0,1,1) will be

    encoded as c0,151 (0) + c0,152 (13) + c

    0,153 (11).

    3.5.2 Decoding L,PCEC

    The decoder searches for the synchronization element and before it approves thatdetection as a synchronization element it must be confirmed that there exists acopy of that element n + S chips forward. If it has been approved all of theremaining codewords should be detected within L light pulses after the approvedsynchronization element. As a further assurance it also confirms all the detectedcodewords with their respective copy n + S chips forward. If all these propertiesare not fulfilled we know that the codewords are detected due to interference andshould be discarded and not be used to restore any data.

    The code construction can correct the following errors.

    If a potential synchronization element is not followed by a copy n + S chipsforward, it is discarded.

    If all remaining codewords are not found within L light pulses after the syn-chronization element, the ones found where detected due to interference.

    If anydetected codewords does not have a copy n + S chips forward, one canmake the decision that they are detected due to interference.

    If a codeword has been found more than once within L pulses after thedetection of the synchronization element, one can make the decision that

    the one with a copy n + S forward is the correct one.

    If a codeword has been found twice within L pulses and they both have a copywe can still detect this error but not correct it because we cannot confirm whichis the correct one. The incorrect data can then be retransmitted. However if thisinterference is due to the users own codewords the same error will occur againbecause the same superposition of delayed repeated codewords will be sent.

  • 8/2/2019 Cdma Detection Using Optical Codes

    39/81

    24 L parallel code

    3.6 Summary of the L parallel code schemes

    L,PCWS is the construction that gives the highest rate but the senders and re-ceivers must be synchronized for this to work. L , P C V S gives a slightly lower ratebut here a synchronization element is sent so there are no need for the system to besynchronized. Still, because the element chosen to be the synchronized one variesfor every block, the decoding process might be rather complex. If we choose a fixedsynchronization element, as for L , P C F S , the decoding process might become moresimplified but the rate is decreased. L,PCE also uses a fixed synchronization el-ement and can also detect errors (and correct to some extension) to the expenseof lower rate. L,PCEC can detect errors in the same way as L,PCE and to beable to correct errors in the decoding process, a copy of each codeword is sent.Every detected codeword can then be confirmed as an information carrier and notinterference.

    In the tables below some properties for the L parallel code constructions aresummarized.

    L K

    L,PCWS 2i 2 : i N, i 2 1

    L , P C V S 2i 1 : i Z+ 2i : i Z+

    L , P C F S 2i 2 : i N, i 2 2

    L,PCE 2i 1 : i Z+ 2

    L,PCEC 2i 1 : i Z+ 2

    Table 3.1. Properties for L and K for the L parallel code constructions.

    |C| Rate

    L,PCWS (L + 2)K Klog2(L+2)2n+L

    L, PCV S K (L + 1)K1 log2(K)+(K1)log2(L+1)2n+L

    L,PCFS (L + 2)K1 (K1)log2(L+2)2n+L

    L,PCE (L + 1)K1 (K1)log2(L+1)2n+L

    L,PCEC (L + 1)K1 (K1)log2(L+1)3n+L+S

    Table 3.2. Cardinality and rate for the L parallel code constructions.

  • 8/2/2019 Cdma Detection Using Optical Codes

    40/81

    3.6 Summary of the L parallel code schemes 25

    L0 that gives maximum rate

    L,PCWS (L0 + 2)ln(L0 + 2) L0 = 2nL , P C V S (K 1)(2n + L0 (L0 + 1)(ln(L0 + 1)) = ln(K)(L0 + 1)

    L , P C F S (L0 + 2)ln(L0 + 2) L0 = 2n

    L,PCE (L0 + 1)ln(L0 + 1) L0 = 2n

    L,PCEC (L0 + 1)ln(L0 + 1) L0 = 3n + S

    Table 3.3. Expression for what L0 that gives the maximum rate.

    The tables above are arranged in descending rate with L,PCWS as the codewith highest rate. To easier be able to see how the rate differs between the different

    L parallel codes, the figures on the next page shows the rate as a function of L.In this example an OOC with codeword length n = 337 respectively n = 1873 hasbeen used and every user is assigned two codewords i.e. K = 2. Because we havean OOC, S is set to S = 0 in the case for L,PCEC. They are also compared withthe ordinary parallel code with a rate K/n (2.2).

  • 8/2/2019 Cdma Detection Using Optical Codes

    41/81

    26 L parallel code

    0 2 4 6 8 10 12 140

    0.002

    0.004

    0.006

    0.008

    0.01

    0.012

    0.014

    0.016

    0.018

    Rate

    L,PCWSL,PCVSL,PCFSL,PCEL,PCECK/n

    log2(L)

    (a) n=337

    0 2 4 6 8 10 12 14 160

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    4.5x 10

    3

    Rate

    L,PCWSL,PCVSL,PCFSL,PCEL,PCECK/n

    log2(L)

    (b) n=1873

    Figure 3.2. Rate as a function ofL and a comparison with the ordinary parallel codewith rate K/n. Codeword length is (a) n = 337 and (b) n= 1873, number of codewordsassigned to each user is K= 2. S= 0 for L,PCEC

  • 8/2/2019 Cdma Detection Using Optical Codes

    42/81

    3.6 Summary of the L parallel code schemes 27

    As one can see the rate for the L parallel code constructions is greater than K/nif L is chosen properly. Note also the similarity between L,PCFS and L,PCEwhich have almost the same rate.

    In the figure below rate is plotted as a function of the codeword length n andL is chosen for maximum rate for every value of n.

    0 500 1000 1500 2000 2500 3000 3500 400010

    4

    103

    102

    101

    codeword length n

    Rate

    L,PCWS

    L,PCVS L,PCFSL,PCE

    L,PCEC:S=0

    L,PCEC:S=n

    ordinaryPC

    Figure 3.3. Rate as a function of codeword length n. L is chosen for maximum rate forevery value ofn. Codewords assigned to each user is K= 2

    To summarize this chapter one can say that to gain a more flexible and stablesystem the rate becomes lower. Another maybe even more important propertyis how the bit error rate, BER, for the system is affected by the choice of codeconstruction. To be able to analyze this (which is the main part of this thesis) asimulation environment has been implemented in Matlab.

  • 8/2/2019 Cdma Detection Using Optical Codes

    43/81

    28 L parallel code

  • 8/2/2019 Cdma Detection Using Optical Codes

    44/81

    Chapter 4

    Matlab implementation of

    the L parallel code schemes

    Often when investigating a systems performance it is interesting to know howBER depends on the number of simultaneously active users. This is of course aninteresting property for the L parallel codes as well, so the program is created tosimulate that. As discussed in the previous chapter the rate depends on the choiceof L. Therefore the program is also able to simulate how BER depends on L.

    To be able to simulate this some suitable codes must be generated.

    4.1 Code generators

    In this report we want to compare acyclic codes with cyclic codes. To generateOOCs exampleOOC.m has been used and AOOCs are generated with cre-ateAOOC.m.

    exampleOOC.m takes weight w as input. The user then chooses codewordlength n from a presented list and the function returns an optimal OOC asa matrix with codewords as rows. The construction comes from [5]. How-ever for some lengths the construction cannot return an optimal OOC and ifsuch length has been chosen it is stored in nfaliure.mat and will not bepresented the next time the list of possible codeword lengths are shown.

    modulo.m returns the rest after division. Matlabs own function mod.m cannotdeal with to great numbers so this function uses mod.m in several steps.

    distance.m takes a code matrix C as input and calculates all the distances be-tween the position of ones in the code. It does not calculate distances forcyclic shifts.

    codetest.m takes a code matrix as input and returns true if no acyclic distancesare repeated. This function is used for the testing of created codes.

    29

  • 8/2/2019 Cdma Detection Using Optical Codes

    45/81

    30 Matlab implementation of the L parallel code schemes

    createAOOC.m returns an AOOC with codewords as rows, that only take acyclicshifts into consideration. Input parameters are cardinality, weight and corre-lation constraints.

    To explain how the simulation environment works we start by explaining howthe encoding process has been implemented.

    4.2 Implemented encoders

    The encoders for the different L parallel codes are implemented in five Matlabfunctions. They are all block encoders, which means that the output is a vectorof length 2n + L or 3n + L + S depending on the chosen code construction. Theinput parameters are:

    - C , which is the code matrix with codewords as rows.

    - L is the chosen value of delay parameter L.

    - K ,the number of codewords that will be used when encoding data

    - data is the information that will be encoded. The length is one block lengththat depends on L and K and the choice of code construction.

    - S is the separation parameter when encoding with L,PCEC.

    Below is a description of how the encoders have been implemented. Thefunctions delayedCodeword.m and delayedCodewordSeparation.m hasbeen used to create the delayed codewords respectively delayed repeated codewords.

    The superposition of all delayed codewords is created with a simple or operator.The returned result is the superposition of delayed codewords in C having length2n + L and 3n + L + S respectively.

    LPCWS.m: With definition L,PCWS it encodes the binary vector data oflength Klog2(L + 2). If it is not of right length an error message is shown.data is divided into K parts of length log2(L + 2), where each part will beencoded with one codeword in C. These binary sequences are converted todecimal form and depending on the result the codeword has different delaybetween 0 and L, or not being sent at all if the result is zero.

    LPCVS.m: Encodes the vector dataof length log2(K)+ (K 1)log2(L +1) withL , P C V S . The first log2(K) elements in the vector data are converted todecimal, and depending on the result different codewords in C will becomethe synchronization element, which is sent without delay. The remaining(K 1)log2(L + 1) bits are divided into K 1 parts of length log2(L + 1),and each part is encoded with one of the remaining codewords in C. Theseparts are converted to decimal and the delayed codewords are created (delaybetween 1 and L). If the decimal result is zero the respectively codeword isnot sent.

  • 8/2/2019 Cdma Detection Using Optical Codes

    46/81

    4.3 Implemented decoders 31

    LPCFS.m: Encodes dataof length (K 1)log2(L + 2) with L,PCFS. The firstcodeword in C is always sent without delay so the (L, 0) delayed codewordfor the first row in C is created. data is divided into K 1 parts of lengthlog2(L + 2), where each part will be encoded with one of the remainingcodewords in C. These parts are converted to decimal and if the resultis not zero the delayed codeword is created based on the decimal result andadded to the superposition.

    LPCE.m: Encodes a vector of length (K 1)log2(L + 1) with L,PCE. Thefirst row in C is the synchronization element so the (L, 0) delayed codewordfor the first element is created. The remaining K 1 codewords are thenused to each encode parts of log2(L + 1) bits from the data vector. Theyare converted to decimal and the result mdec is used to create the (L, mdec)delayed codeword. The superposition of all the delayed codewords in C is

    then returned.LPCEC.m: Encodes a vector of length (K 1)log2(L + 1) with L,PCEC. The

    (L, 0) delayed repeated codeword with separation S for the first element iscreated representing the synchronization element. The remaining K1 code-words are then used to each encode log2(L +1) information bits. These partsare converted to decimal and the result mdec is used to create the (L, mdec)delayed repeated codeword with separation S. The superposition of all thedelayed repeated codewords of length 3n + L + S is then returned.

    If we want to encode a very long sequence, it must be divided into blocks ofthe corresponding block length for each construction. Every encoded block is thenadded together as for the case in figure 3.1 where two blocks is shown.

    To be able to compare the L parallel code constructions with the ordinaryparallel code from chapter 2, an encoder for this construction has also been imple-mented.

    ordinaryPC.m: This is not a block encoder, so the length of the input vectordata, that will be encoded, is arbitrary. This vector is searched in steps of Kand depending on the combination of the K data bits different superpositionsof length n from the K codewords is added to the already encoded vector.When all information bits have been searched the encoded vector is returned.

    4.3 Implemented decoders

    The decoders for the five L parallel code constructions have been implemented

    in each Matlab function. In the case L,PCWS the senders and receivers aresynchronized so the receiver knows where each block starts. decodeLPCWS.mis therefore a block decoder that decodes a block of length 2 n+L. All other decodersare not block decoders, so they can take a vector of arbitrary length and decode it.

    The input parameters for the implemented decoders are:

    - C , which is the code matrix with codewords as rows.

  • 8/2/2019 Cdma Detection Using Optical Codes

    47/81

    32 Matlab implementation of the L parallel code schemes

    - L is the chosen value of L. It has the same value as for the encoding process.

    - K ,the number of codewords that the user is assigned. It has the same valueas for the encoding process.

    - Encoded is the sequence that will be decoded.

    - Statistics is a string that says how much information from the decoding pro-cess that will be shown on the screen. For decodeLPCWS.m this is notan input.

    - S is the separation parameter for L,PCEC.

    The decoders are searching for codewords in the encoded sequences by correla-tion, which has been implemented in Matlab as:

    sum(and(encoded(i:i+n-1),C(j,:)))==weight

    The decoder makes the decision that a codeword has been found if the correla-tion between the incoming sequence and the codeword equals the weight of thecodeword.

    decodeLPCWS.m: Decodes a block of length 2n+L. This is possible becausethe senders and receivers are synchronized so the receiver always knows whenevery block starts. The decoder loops the encoded sequence and when thecorrelation equals the weight of the codewords it decides that a codeword hasbeen sent. A codeword found on position i means that the correlation between

    the codeword and encoded(i:i+n-1) equals the weight. When a codeword isfound on position i=n+1 it has delay lj = 0. Because this is a block decoder itcan decide if the codeword is found in a suitable position, and some detectionswill therefore be rejected. No codewords should be found on position 1:n. Thisis due to the definition of delayed codewords (3.1). When the entire blockhas been searched the information can be recovered because we know whatcodewords have been found and their respectively delay.

    The four other decoders works in a different way because the constructionstheir selves are synchronized with one element from the code. Here the encodedvector can be of arbitrary length and the decoder is looping the entire encodedvector and continuously searching for the synchronization element. But beforeapproval of a found synchronization element we look at the position of the lastfound synchronization element, which should have been found 2n + L positionsbefore. If the position for the last found is not 2n+L before (or if a synchronizationelement not yet has been found), it searches 2n + L forward to confirm that theit has been found in an appropriate position. This result in a limitation, becausewe must sent at least two blocks for any synchronization element to be approved.However this limitation is not a problem in the simulations where a large amount

  • 8/2/2019 Cdma Detection Using Optical Codes

    48/81

    4.3 Implemented decoders 33

    of data is sent and two blocks corresponds to a rather small information sequence.The approval of synchronization element uses some logical variables and the Matlabcode typically look like this, where i is the current position:

    %%LOGIC1: if correlation equals weight%LOGIC2: there is a sync. element 2n+L before%LOGIC3: there is a sync. element 2n+L forward%LOGIC1=logical(0); LOGIC2=logical(0); LOGIC3=logical(0); %initial valuesLOGIC1=logical(sum(and(encoded(i:i+n-1),C(1,:)))==weight);if(LOGIC1) %check 2n+L backwards

    if(

    isempty(lastSynch) )LOGIC2=logical(i-lastSynch==2n+L );endif( LOGIC2 & (i-(2n+L))>0)

    LOGIC2=logical( sum(and(encoded(i-(2n+L):i-(n+L+1)),C(1,:)))==weight);end

    endif( (i+2n+L+n-1)

  • 8/2/2019 Cdma Detection Using Optical Codes

    49/81

    34 Matlab implementation of the L parallel code schemes

    must exist a synhronization element 2n+L positions backwards (LOGIC2=true) orforward (LOGIC3). And last, if it is the first one we find (isempty(lastSync)) or thelast found is more then or equal to 2n+L positions before ((i-lastSynch)(2n+L))).

    For decodeLPCVS.m the search looks a little different because the syn-chronization element can be any element in C. For decodeLPCEC.m the dif-ference between the found synchronization elements is 3n + L + S and not 2n + L.Here it also searches for the repeated copy n+S positions forward before approvingthe found synchronization element.

    If a synchronization element has been found and approved (i.e. the logicalexpression above returns true) a new loop then searches L positions forward tofind the rest of the codewords.

    decodeLPCVS.m: When a synchronization element has been found, it is usedto restore log2(K) information bits. The decoder then enters a new loop and

    searches L positions forward (not including the synchronized position becausethe delay for the rest of the codewords cannot be zero). If a codeword is founda flag is set and the delay is stored. The delay is given here by the differencein position between the found codeword and the synchronized one. Whenall L positions have been searched the flags and their respectively delay areused to restore the rest of the data in that block. For later comparisons, thesynchronized position for this block is stored and the main loop then jumps Lpositions forward and the search for the next synchronization element begins.

    decodeLPCFS.m: When a synchronization element has been found and ap-proved the decoder searches L positions forward for the remaining (K 1)codewords. This search includes the synchronized positions because all ele-ments can be delayed between 0 and L. For a found codeword a flag is set

    and the delay is stored and after all positions have been searched, informa-tion from this block can be recovered (decoded). The position for this blockssynchronization element is stored for later comparisons. The main loop thenjumps L positions forward and searches for the next synchronization element.

    decodeLPCE.m: From the synchronized position and L pulses forward thedecoder searches for the remaining (K 1) codewords in a sub loop. If acodeword is found a flag is set to 1 and the respectively delay is stored.When all positions have been searched the decoder checks if all remaining(K1) codewords have been found. If so, the information from this block canbe restored using all codewords respectively delay (except the synchronizationelement). The position for this blocks synchronization element is stored forlater comparisons, and the main loop then jumps L positions forward to

    search for the next synchronization element. If however all the remainingcodewords are not found within L positions, the codewords that were foundare disregarded and the decoder will continue search for a synchronizationelement in the next position and forward.

    decodeLPCEC.m: This decoder works in a similar way as for L,PCE. Whena synchronization element has been found and approved the next L positions

  • 8/2/2019 Cdma Detection Using Optical Codes

    50/81

    4.4 Main functions 35

    are searched for the remaining (K 1) codewords. Every found codewordmust be confirmed with their respectively copy that should be n+S positionsforward. The delay for every codeword is then used to recover the informationfrom this block. When this block has been decoded the synchronized positionis stored and the main loop jumps n + S positions forward to continue thesearch for the next synchronization element. If all codewords are not foundor if not all of them are confirmed with their respectively copy n + S forward,the codewords that were found are disregarded and the main loop continue tosearch for the next synchronization element in the next position and forward.

    Because of interference from other users (MAI), the same codeword can be foundmore than once within L positions and the decoder therefore has to make a choice.This has been implemented so that the decoder chooses the first found codeword,and when multiple detections within L positions occur a counter increases. Output

    for the decoders is then the counter that keeps track of the number of times thedecoder had to make a choice and the recovered data vector.The decoder for the ordinary parallel code can be described as.

    decodeordinaryPC.m: This is a simplified model for the decoder becauseit has a start vector as input to synchronize the decoding process. Thishowever is acceptable because we are only interested in the BER caused bythe crosstalk between users. The decoder searches for the users codewordsusing correlation. When a codeword has been found it checks if the positionof the last detected codeword was found n positions before. When the entireencoded vector has been searched the vector with the decoded information isreturned.

    4.4 Main functions

    The program should be able to run two types of simulations.

    simulate how BER depends on the number of active users. With active usersmeans the number of users that are simultaneously using the channel.

    simulate how BER depends on the delay parameter L. This is interestingbecause the rate depends on L. Here every user is given a probability of beingactive, where active means here that the user is active some time during theperiod.

    For a given datasize and number of users, the function encodeDecode.m

    encodes every users data, creates the superposition and finally decodes it. Theoriginal data is then compared with the decoded data to calculate errors and BER.The input parameters for this function is:

    - C , which is the code matrix with codewords as rows.

    - L , is the chosen value of the delay parameter L.

  • 8/2/2019 Cdma Detection Using Optical Codes

    51/81

    36 Matlab implementation of the L parallel code schemes

    - S , is the separation parameter for L,PCEC.

    - Kperuser , is a vector specifying how many codewords each user is assigned.The length of this vector is the total number of users for the system, activeor not active.

    - start , is a vector that gives for every user the start position. This can beconsidered the relative chip delay between the users.

    - datasize , is a vector that specifies how much data each individual user willsend.

    - definition , is a string input that gives what type code construction that willbe used. Some type of L parallel code or the ordinary parallel code.

    - Statistics is a string that says how much information from the decoding pro-cess and the result that will be shown on the screen.

    encodeDecode: First of all it checks if Kperuser, start and datasize are ofequal lengths. It also checks if L and the number of codewords assigned toeach user have suitable values depending on the chosen parallel code con-struction.

    In a loop every users data is created and encoded one at a time. In thevector datasize the individual datasizes can be found and the data is randomcreated with Matlabs function randsrc.m. For not active users i.e. userswith zero datasize, nothing is sent. Because all encoders are block encoderswe want the datasize to be a multiple of the block length, so if necessaryzeros are added at the end of the data vector to fulfil this. The created datais then stored in a .mat file for later comparison. In a sub loop the data isencoded block by block with the chosen code construction. From the inputvector start, zeros are added at the beginning of the encoded vector thatcorresponds to that users start position. To get every users encoded vectorof equal lengths the end is filled out with zeros for the shorter ones. With abinary or operator the encoded vector is added to the already encoded usersto create the superposition. Because L,PCWS needs synchronized sendersand receivers the vector start is reduced mod(2n + L).

    In the decoding process the encoded vector (the superposition of all activeusers encoded data) is looped for every user one at a time. For the block de-coder decodeLPCWS.m, user i starts decoding at position start(i) anddecodes every block of length 2n + L. The recovered data is then storedin a .mat file to later compare it with the original data. All other de-coders decodeLPCVS.m, decodeLPCFS.m , decodeLPCE.mand decodeLPCEC.m takes the entire encoded vector as input, decodesit and returns the recovered data. This is done for every user, active and notactive, and all users decoded data is stored in their own .mat file.

  • 8/2/2019 Cdma Detection Using Optical Codes

    52/81

    4.4 Main functions 37

    When all users are decoded the comparison begins. In a loop the originaldata and the decoded data is loaded for one user at a time. With a binaryxor operator the sequences are compared and the BER is calculated.

    The function returns two matrices. The variable activeBERtot consistsof four rows, which corresponds to every users number of codewords, errors,datasize (with the zeros added to get the right block length) and calculatedBER. The other variable is notactiveerrorstot, which contains for everyuser their number of codewords and idle mode errors, which is the amount ofinformation that was decoded from a inactive user.

    The other main function is simulation.m, which uses encodeDecode.m inseveral step to run the two types of simulations specified in the beginning of thissection. The input parameters for this function is:

    - C ,which is the code matrix with codewords as rows.

    - Kperuser is a two row matrix containing the number of codewords each useris assigned and the second row gives the probability of the individual usersending information. If Kperuser only has one row the default value forprobability is 100% for all users.

    - statistics is a string that says how much information that will be shown onthe screen during the simulation progress.

    Before the simulation begins, the user has to specify some other parameters theprogram asks for. If we want to simulate BER vs. L the following will be shownin the Matlab prompt:

    >> [ activeBER,notActiveErrors ] =simulation(C,Kperuser,statoff);Enter what to simulateTYPE=1: Simulate BER for different L.TYPE=2: Simulate BER vs number of active users,

    all users have the same number of codewords.TYPE= ?: 1choose definition (LPCWS, LPCVS, LPCFS, LPCE, LPCEC)?: LPCEif L=2i-1, i=1,2...give minimum i ?: 3give maximum i ?: 10

    Give the number of simulations for each Lto be able to create a meanvalue ?: 50Give maximum start value, delay between usersif no input the start value will be arbitrary ?:Give minimum datasize ?: 1000Give maximum datasize ?: 5000

  • 8/2/2019 Cdma Detection Using Optical Codes

    53/81

    38 Matlab implementation of the L parallel code schemes

    The program works a bit different depending on what type of simulation wechoose. Below is a description how the program works for TYPE1 (BER vs. L).

    simulation.m when simulating BER vs. L: When all input parameters havebeen specified, the main loop starts from i=Lmin to i=Lmax. For everyval


Recommended