simulation of a cdma system based on optical orthogonal codes

81
Simulation of a CDMA system based on optical orthogonal codes Examensarbete utf¨ort i Datatransmission vid Tekniska H¨ogskolan i Link¨oping av Andreas Karlsson Reg nr: LiTH-ISY-EX-3532-2004 Link¨oping2004

Upload: phungbao

Post on 08-Dec-2016

231 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Simulation of a CDMA system based on optical orthogonal codes

Simulation of a CDMA system based on

optical orthogonal codes

Examensarbete utfort i Datatransmission

vid Tekniska Hogskolan i Linkoping

av

Andreas Karlsson

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

Linkoping 2004

Page 2: Simulation of a CDMA system based on optical orthogonal codes
Page 3: Simulation of a CDMA system based on optical orthogonal codes

Simulation of a CDMA system based on

optical orthogonal codes

Examensarbete utfort i Datatransmission

vid Tekniska Hogskolan i Linkoping

av

Andreas Karlsson

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

Supervisor: Danyo Danev

Tobias Ahlstrom

Examiner: Danyo Danev

Linkoping 14th April 2004.

Page 4: Simulation of a CDMA system based on optical orthogonal codes
Page 5: Simulation of a CDMA system based on optical orthogonal codes

������������ � � ����������������� �� ��

����� � � ������������ � ����������������������

��

�� ����� �� !" !" #�

���������$��$�

��

������ ���%�� �&� $����

��

������

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

� � ��&� �� ��+��*.��$�,� -/������0 �

��

���������12"�'3"-,"����"� !����

�� ��� �

� � 4"��� ��� �"��� ��

��

����� � �������������������1� .�������������0���$�

������

�� � � ����$����� �� 5555��

� ��

� � ��

���� !������ ���������������+ 6(()))77.��7�(/8�00(���(� !(����(�

� �

"� ���1� .��

'���.���$���� �4�9:���� ��0���� �;�� ������� �$���.����*����'���.� ���������4�9:���� ��0��*����� �&�.��� +�$���.�&�*��

#!� � �����:� +���

:�*�������.������

��

������ � ����:0� ��& �1�� ����*��� �$���� +�+�$+��*�������� �&���0��������� +�0���&�&��& ������0��� �&�&������&� ������� ���..�)�����.������ ������. �����.�� ������ �*� ������ +�&+���.7�<�� &+��=�� +� �����*����. �.��&&������� ���0��� �&"&�*�*����������. �.��&&���>?<"4�9:@7����?<"4�9:��&+������������$�*�������������$�� ����=��&��&�..*�&�*)��*���)+�&+������0� ������� ������ �&�.��� +�$���.�&�*�><<4@7�1+�&+���.���� (�� � �&����� ����� +������� �����������.������&�*)��*����*�� � +��&�����*����� �&�.�&���.� ���/ ��& �� +�������� ���7����� +����...�&�*�&��� ��& ��������� *���� +������ ���&+�����8��������$�*�����0� �48��������&�*�47�1+���0� �����*��8��� ���*� +������������ +�)+�.�� �47�:��)�)��� ����� +�������� ����0� ����� ������ ��� ����A����0�����&+�&�*)��*������48���*�. � +������� �������� ������)..7�1+���$����+�$+��� �������& ��������0� �������� �$� ��������**� ������� +� � +���*����� �&�������� +���� ���)�� *���� �������*��$�������� ����)� +������..���0�0�.� ����������������..�����7�1+�����������.� ������������ �+���0����.�� *����9� .�07��1+����. ������ +������.� ������+�)�� +� �B-%����� +������...�&�*������&& �0.���*��� ���&+�+�$+�� +������� +� ��*� ����.�&��� ��& ����7�B&������� +�+�$+���� � +��&��� ��& �����+��.*�0�����*�0� �������.����������+��*)�����.�� � �����������0.7���

������������)��*�4�9:��?<"4�9:���������*��<<4��&���.� �����&��*���.� �����. �.��&&����9 :���B-%��9� .�0������.� �����

Page 6: Simulation of a CDMA system based on optical orthogonal codes

Abstract

To take advantage of the high speed in an optic fiber, one of the basic concept in

fiber optic communication is to allow several users to simultaneously transmit data

over the channel. One technique that provides multiple access is fiber optic-codedivision multiple access (FO-CDMA). In FO-CDMA each user is assigned one or

more signature sequences called codewords, which are subsets of a type of optical

orthogonal code (OOC). The channel input/output consists of the superposition of

several users codewords and at the receiver end an optical correlator extracts the

information.

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 the

whole set C. A new way to map the information bits is to insert up to L zeros

before each codeword from Cj and let this represent information aswell. This gives

high rates for active users but an investigation is needed to ensure that this does

not compromise the systems wanted property of sending information with a small

probability 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 is

acceptable and not much higher than for the traditional constructions. Because of

the higher rate these construction should be preferred but an analysis if a hardware

implementation is possible might be needed.

Keywords: CDMA, FO-CDMA, superimposed, OOC, correlation, cardinality,

multiple access, MAI, BER, Matlab, simulation

i

Page 7: Simulation of a CDMA system based on optical orthogonal codes

ii

Page 8: Simulation of a CDMA system based on optical orthogonal codes

Preface

This report is the result of my thesis work ”simulation of a CDMA system based on

optical orthogonal codes” which comprise 20p and was done in datatransmission at

ISY 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 Master

of engineering in electronics design.

The report is split into 5 chapters:

chapter 1 is an introduction to the report and gives the background, purpose and

limitations for this thesis.

chapter 2 tells the basics of FO-CDMA as it is used today and the orthogonal

codes needed for this technique to work.

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

simulations.

chapter 4 presents how the L parallel code constructions have been implemented

in Matlab.

chapter 5 contains the results and conclusions from the simulations. Also sug-

gestions for further studies are presented here.

iii

Page 9: Simulation of a CDMA system based on optical orthogonal codes

iv

Page 10: Simulation of a CDMA system based on optical orthogonal codes

Abbreviations

AOOC Acyclic Optical Orthogonal Code

BER 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

Page 11: Simulation of a CDMA system based on optical orthogonal codes

vi

Page 12: Simulation of a CDMA system based on optical orthogonal codes

Contents

1 Introduction 1

1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.3 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Fiber optic communication 3

2.1 FO-CDMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 Optical orthogonal codes . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.3 Acyclic optical orthogonal codes . . . . . . . . . . . . . . . . . . . . 8

3 L parallel code 11

3.1 L parallel code without synchronization . . . . . . . . . . . . . . . . 12

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

3.1.2 Decoding L,PCWS . . . . . . . . . . . . . . . . . . . . . . . 13

3.2 L parallel code with varying synchronization element . . . . . . . . . 14

3.2.1 Cardinality and rate for L,PCV S . . . . . . . . . . . . . . . 15

3.2.2 Decoding L,PCV S . . . . . . . . . . . . . . . . . . . . . . . 16

3.3 L parallel code with fixed synchronization element . . . . . . . . . . 17

3.3.1 Cardinality and rate for L,PCFS . . . . . . . . . . . . . . . 17

3.3.2 Decoding L,PCFS . . . . . . . . . . . . . . . . . . . . . . . . 19

3.4 L parallel code with error detecting property . . . . . . . . . . . . . 19

3.4.1 Cardinality and rate for L,PCE . . . . . . . . . . . . . . . . 19

3.4.2 Decoding L,PCE . . . . . . . . . . . . . . . . . . . . . . . . 21

3.5 L parallel code with error correcting property . . . . . . . . . . . . . 21

3.5.1 Cardinality and rate for L,PCEC . . . . . . . . . . . . . . . 22

3.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 29

4.1 Code generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.2 Implemented encoders . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.3 Implemented decoders . . . . . . . . . . . . . . . . . . . . . . . . . . 31

vii

Page 13: Simulation of a CDMA system based on optical orthogonal codes

viii Contents

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

5 Results and conclusions 41

5.1 System performance as a function of number of active users . . . . . 41

5.2 System performance as a function of L . . . . . . . . . . . . . . . . . 50

5.3 Further studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Page 14: Simulation of a CDMA system based on optical orthogonal codes

Contents ix

List of Figures

2.1 A FO-CDMA system with i users . . . . . . . . . . . . . . . . . . . . 3

2.2 Superposition of codewords. . . . . . . . . . . . . . . . . . . . . . . . 5

2.3 Example of ordinary parallel code. . . . . . . . . . . . . . . . . . . . 5

2.4 The message (0,1,0,1,1,1,1,0) encoded by the ordinary parallel code

with four codewords. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.5 Cyclic shifted codeword. . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.6 Acyclic shifted codeword. . . . . . . . . . . . . . . . . . . . . . . . . 9

3.1 The message (0,0,1,1,1,0,1,0,1,0,0,0) encoded by L,PCWS with two

codewords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.2 Rate as a function of L and a comparison with the ordinary parallel

code 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 parallel

code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

5.2 BER as a function of number of active users for L,PCV S. . . . . . . 43

5.3 System performance as a function of number of active users for

L,PCWS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

5.4 System performance as a function of number of active users for

L,PCFS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.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 for

L,PCEC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

5.7 Summary of BER as a function of number of active codewords. . . . 48

5.8 Summary of idle mode errors as a function of number of active code-

words. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

5.9 Rate as a function of L for the codes used in the simulations. . . . . 52

5.10 System performance as a function of L for L,PCWS, P=0.2. . . . . 53

5.11 System performance as a function of L for L,PCWS, P=0.3. . . . . 54

5.12 System performance as a function of L for L,PCWS, P=0.4. . . . . 55

5.13 BER as a function of L for L,PCV S. . . . . . . . . . . . . . . . . . 56

5.14 System performance as a function of L for L,PCFS, P=0.2. . . . . 57

5.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. . . . . . 59

5.17 System performance as a function of L for L,PCE, P=0.3. . . . . . 60

5.18 System performance as a function of L for L,PCEC, P=0.2. . . . . 61

5.19 System performance as a function of L for L,PCEC, P=0.3. . . . . 62

Page 15: Simulation of a CDMA system based on optical orthogonal codes

x Contents

List of Tables

2.1 Required codeword length for a given cardinality and weight for an

optimal OOC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

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

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

3.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

Page 16: Simulation of a CDMA system based on optical orthogonal codes

Chapter 1

Introduction

Ever since the mid 90’s optical fibers have been used for point to point communi-

cation at a very high speed. Often the optical fiber offers much higher speed than

the speed of electronic signal processing at both ends of the fiber. So to be able

to take the full advantage of the speed in optical fibers one of the basics concepts

in fiber optic communication is the idea of allowing several users to transmit data

simultaneously over the communication channel. This is called multiple access.

There are several techniques to provide multiple access and one of them is

fiber optic-code division multiple access (FO-CDMA). In FO-CDMA each user is

assigned one or more binary signature sequence, so called codewords. The data

to be sent is mapped onto the codewords and the different users codewords are

”mixed” 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 of

the 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 the

desired 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 equal

amount of zeros depending on the information bit being 1 or 0. This means that to

be able to transmit one information bit we are sending a whole codeword and if the

codewords are long the rate could be rather low. However this is often acceptable

because of the high speed in the fiber optic channel. But as the speed of electronic

signal processing increases it becomes more important to have a high rate in the

optical channel. This can be achieved by an effective mapping of the information

bits onto the codewords in the encoding process.

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

1

Page 17: Simulation of a CDMA system based on optical orthogonal codes

2 Introduction

code [1], [2]. Here the information bits are encoded not only by the codewords

itself 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 but

an investigation is needed to ensure that this does not compromise the systems

wanted property of sending information with a small probability of errors for all

users.

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 is

called multiple access interference (MAI). The purpose of this thesis work has been

to 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 with

vectors and matrices. For the encoding and decoding process each of the five

L parallel codes were implemented in a Matlab function, which are called by a

function that simulates transmitting and receiving.

For the simulation a suitable OOC has been chosen and each L parallel code

has been simulated separately.

1.4 Limitations

In the real case there can be interference from noise in the fiber optic channel. In

this report all physical noise (such as shot, thermal and beat noise) is neglected and

it focus only on the crosstalk between users, i.e. MAI. This is an approximation

because 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 respect

to MAI.

There are more or less complex decoding techniques that can use all users

codewords to statistically decide whether or not a codeword has been sent. In the

simulation 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 the

system performance but on the other hand the result of this model can be used for

decision of what (FEC) scheme is necessary.

Page 18: Simulation of a CDMA system based on optical orthogonal codes

Chapter 2

Fiber optic communication

Code division multiple access (CDMA) is a technique that are used for several

communication systems. Other techniques for multiple access are Frequency Divi-

sion Multiple Access (FDMA) or Time Division Multiple Access (TDMA) but one

of the main advantages of CDMA is its flexibility. When a FDMA system has a

user in every frequency channel or a TDMA system has a user in each time slot

the systems are full and no more users are allowed to use the channel. In CDMA

the maximum number of users are not fixed but allowing more users to access the

channel means lower rates for active users. In a CDMA system you can control

the potential number of active users versus the rate and this makes the system

flexible. The figure below shows a FO-CDMA network with i pairs of transmitters

and 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

Page 19: Simulation of a CDMA system based on optical orthogonal codes

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 allow

several users to transmit simultaneously over the same optical fiber. A FO-CDMA

system can, for each user, be described by a data source, containing the data

that will be sent, followed by an encoder and then a laser that maps the signal

from electrical form to an optical pulse sequence. At the receiver end an optical

correlator is used to extract the encoded data.

In a FO-CDMA system it is common that each user is assigned one signature

sequence called codeword. Each bit of information data is encoded by the signature

sequence consisting of a number of shorter bits called chips. When this sequence

is sent it represent that a user with that unique signature has sent the information

bit ’1’. If the information bit is ’0’ it simply means that we send the corresponding

length 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 represent

the binary bit 1 (mark that this is a chip and not an information bit) and the

absence of a light pulse represent the binary bit 0 the superposition mechanism

has 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 all

users chip durations (pulse widths) are of equal lengths and when creating the

superposition of chips they overlap each other precisely. Of course the users can

be delayed relative each other. Figure 2.2 on the next page shows an example of

how the bits are encoded and the superposition of the users codewords that are

sent over the channel. Here user 1 is delayed with 3 chips relative user 2.

The individual receivers, consisting of optical correlators, continuously observe

the superposition of all incoming pulse transmissions and recovers the data from

the corresponding transmitter. This is done by correlation between the incoming

signal and stored copies of that users unique sequence. The correlator will give

a peak if the incoming stream of optical pulses contains the unique sequence and

the presence of other users will be considered as noise. The decoding process is

accomplished by using optical correlation.

If a user is assigned one codeword of length n it means that n chips will carry

one information bit. However some users require higher rate and are therefore

assigned more codewords [6]. If a user is assigned K codewords we can encode

a 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

Page 20: Simulation of a CDMA system based on optical orthogonal codes

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

c1

idlec2

idle

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 be

encoded 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 two

consecutive 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 between

the length of information bits and the length of the encoded sequence. So for user

Page 21: Simulation of a CDMA system based on optical orthogonal codes

6 Fiber optic communication

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

R =K

n(2.2)

Each user is assigned a subset from a code C. The assignment for the users

j = 1, 2, ...,M is done by partitioning of C, so that each user j is assigned distinct

subsets Cj . The subsets form a partitioning if they are disjoint and their union is

the whole set C, i.e.

M⋃

j=1

Cj = C and Ci

Cj = {∅} for i 6= 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 next

section and have special properties for correlation between codewords and if the

correlation is kept low it reduces the crosstalk between users. One of the main goal

of a FO-CDMA system is that as many users as possible should be able to access

the channel simultaneously and this with a low probability of error. However if

we want to produce |C| number of codewords from an OOC with weight w (the

number of ones each codeword has) and lowest possible correlation between the

codewords, 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 weight

this 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 being

low tells us that each sequence in the code can easily be distinguished from a shifted

version of itself i.e. the autocorrelation is low, and it can easily be distinguished

from 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 called

its cardinality and is denoted |C|.An (n,w, λa, λc) optical orthogonal code C is a set of (0,1) sequences of length

n and weight w (the number of ones in every codeword). The set is constructed so

that it has the following two properties [4].

Page 22: Simulation of a CDMA system based on optical orthogonal codes

2.2 Optical orthogonal codes 7

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

n−1∑

t=0

xtxt⊕τ ≤ λa (2.5)

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

n−1∑

i=0

xtyt⊕τ ≤ λc (2.6)

The codewords can be cyclic shifted (see figure 2.5) and therefore ⊕ denotes

modulo n so the correlation becomes periodic correlation. λa and λc are often called

the 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 between

the positions of ones in the code (C) are repeated. For example the distance

between the first and the second one in c1 is 1, but as we look at two consecu-

tive c1’s (cyclic shifted) the distance 14 will also be taken into consideration. In

the code above the distances are {1, 14, 3, 12, 2, 13, 4, 11, 9, 6, 5, 10}. The distances

Page 23: Simulation of a CDMA system based on optical orthogonal codes

8 Fiber optic communication

{14, 12, 13, 11, 6, 10} are due to cyclic shifts of the codewords (when we look at two

consecutive codewords). We see here that no distance is repeated and therefore

the code is an OOC with λ = 1. If λ = 2 it means that any distance between the

positions 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 the

channel. An OOC is said to be optimal if it has the maximum cardinality for a

given n,w, λ. As mentioned in the previous section the codeword length n increases

with increasing cardinality and weight (2.4). In the table below some optimal

constructions are presented and it shows what codeword length n is required to

construct a code with given size |C| and weight w.

|C| w n12 5 241

14 5 281

6 6 181

21 6 631

11 7 463

21 7 883

18 8 1009

66 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 must

be taken into consideration when producing an OOC and the correlation must be

taken modulo n. But if the codewords are separated with at least the codeword

length 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 we

call these codes acyclic optical orthogonal codes (AOOC).

2.3 Acyclic optical orthogonal codes

For the different constructions of L parallel code, that will be presented in the next

chapter, the sent codewords are separated with at least the codeword length. This

means that the correlator only looks at acyclic shifted codewords.

If c = (c0, c1, . . . , cn−1) is a codeword of length n then cτ , |τ | < n − 1, is the τacyclic shifted version of c defined as.

Page 24: Simulation of a CDMA system based on optical orthogonal codes

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, . . . , cn−1) if τ = 0

(0, . . . , 0︸ ︷︷ ︸

−τ

, c0, . . . , cn−1+τ ) if − (n − 1) ≤ τ < 0

(cτ , . . . , cn−1, 0, . . . , 0︸ ︷︷ ︸

τ

) if n − 1 ≥ τ > 0

(0, . . . , 0︸ ︷︷ ︸

n

) if |τ | ≥ n

(2.7)

The auto- and cross correlation from the previous section were calculated with

cyclic shifted codewords so the operations where taken modulo n and we called this

periodic correlation. If we instead produce the correlation with a τ acyclic shifted

codeword (|τ | < n− 1) we call this aperiodic correlation and the produced code Cwill be an acyclic optical orthogonal code (AOOC) that only takes acyclic shifts

into consideration.

The OOC presented in the previous section obviously fulfil aperiodic correlation

as well but it can be reduced to only fulfil aperiodic correlation. The code then

becomes C = {1101000000, 1000100001}. The codewords are now reduced to length

10 and do not fulfil periodic correlation because the zeros in the end are removed

and some distances are therefore repeated (if we look at cyclic shifts). However

it fulfils aperiodic correlation and this code is therefore an AOOC with λ = 1. If

the codewords are separated in the channel this code should not cause greater bit

error rate (BER) for the system, but this is one of the questions this report will

investigate.

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

Page 25: Simulation of a CDMA system based on optical orthogonal codes

10 Fiber optic communication

possible to find constructions with the same cardinality and weight as an OOC but

with shorter codewords. The rate depends of the lengths of the codewords so this

means that if we can use an AOOC instead of an OOC this will give us higher

rates.

Page 26: Simulation of a CDMA system based on optical orthogonal codes

Chapter 3

L parallel code

In this chapter five types of L parallel code constructions are presented. As for

the ordinary parallel code presented in the previous chapter, every user is given

a number of codewords that are a subset Cj from a larger code C (2.3). These

constructions are all a version of the ordinary parallel code but the mapping of

information bits onto the codewords is different here to gain a higher rate. In the

ordinary parallel code the mapping simply means the codewords are sent or not

depending on the information bits being 1 or 0.

The L parallel codes also use a delay between sent codewords to represent

information. If a codeword has been detected by the decoder it can calculate the

delay between that codeword and other received codewords from the same user. If

we 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 a

delayed codeword is needed.

Definition 1 ((L, l) delayed codeword) For a codeword c = (c0, c1, ..., cn−1)

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, ..., cn−1︸ ︷︷ ︸

n

, 0, 0, ..., 0︸ ︷︷ ︸

L−l

) (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 acyclic

shifted 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 different

ways. One can also represent information by the codeword not being sent, as in

the ordinary parallel code presented in the previous chapter. So the number of

combinations of binary information bits one codeword can represent can be up to

11

Page 27: Simulation of a CDMA system based on optical orthogonal codes

12 L parallel code

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

log2(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 carry

information. 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

bjcLj(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. bj

being 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 between

0 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 code

contains. So if a user is given K codewords we have |C| = K, but if we apply

L,PCWS onto these codewords we get another cardinality |CL,PCWS |. This is

the 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 different

combinations due to lj = (0, 1, ...L) or the codeword could not be sent, which also

is a combination. If there are K codewords in C this gives us that the total number

of 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 between

the length of the information bits and the length of the encoded sequence. For

the ordinary parallel code the rate where K/n, which means that a user having

K codewords can encode K information bits onto n chips, n being the codeword

length.

For L,PCWS we have (L+2)K different combinations so the number of binary

information bits this can represent is log2(L + 2)K . From (3.1) we have that the

Page 28: Simulation of a CDMA system based on optical orthogonal codes

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=

Klog2(L + 2)

2n + L(3.4)

The expression tells us that if we double K the rate is doubled so the maximum

rate is independent of the number of codewords and depends only on L (for a given

n).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 the

maximum 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 codewords

works, consider the following example.

Suppose a user having two codewords (c1, c2), (K = 2) and L = 6. We can

have L + 1 different delays for every codeword or it may not be sent. This gives

us (L + 2) = 8 different combinations for each codeword which corresponds to

log2(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 onto

c2 and so on. The user has two codewords so the number of bits that can be

mapped onto these codewords is Klog2(L + 2) = 6. For example the message

m1=(0,0,1,1,1,0) will be encoded as c61(0)+c6

2(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 (c61(0)+c6

2(5), c61(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 ordinary

parallel code described in chapter 2. The difference here is that the decoder also

Page 29: Simulation of a CDMA system based on optical orthogonal codes

14 L parallel code

c6

1(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, PCWS with two code-words (c1, c2) and L = 6.

has to compare the delay of the detected codewords. If two codewords have been

detected using optical correlation the decoder can calculate the delay between them

but to calculate the actual lj it has to know where the block starts. So a system

using L,PCWS has to have synchronized receivers and senders to calculate the

actual delay. The decoder then becomes a block-decoder in the sense that the

decoder 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,PCWS we gain a high rate but the systems flexibility might be decreased

because the receivers and senders have to be synchronized during transmission. A

solution 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 codewords

can 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,PCV S also uses every

codeword in C to carry information, but only the synchronization element can be

sent without delay (lj = 0), and the other codewords are delayed between 1 and

L. The definition for L parallel code with varying synchronization element can be

expressed 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) +

K∑

j=1j 6=s

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

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

(3.8)

The encoding process works in a similar way as for L,PCWS (3.2), but one

codeword is always sent without delay and the rest, if they are sent, have a delay

between 1 and L. Which codeword that is chosen to be the synchronization element

may vary between the encoded blocks. The remaining K − 1 codewords can then

have a delay between 1 and L or not being sent at all.

Page 30: Simulation of a CDMA system based on optical orthogonal codes

3.2 L parallel code with varying synchronization element 15

The choice of synchronization element depends on the first log2(K) bits of

information in each block that will be encoded. For example if K = 2 this can

represent two binary sequences, 0 and 1, and depending on the first bit in the block

of information being 0 or 1 the first respectively second codeword in C becomes the

synchronization one. If a user has been given four codewords (c1, c2, c3, c4), the

choice of synchronization element will depend on the first two bits of the information

block.

(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 to

send information and the number of codewords K given to each user should be

chosen as.

K = 2i : ∀i ∈ Z+ (3.9)

This is of course a limitation but one advantage is that the synchronization

element will be able to carry information.

3.2.1 Cardinality and rate for L, PCV S

The synchronization element can be chosen in K different ways. The remaining

K − 1 codewords in C are then allowed to be delayed with lj = (1, 2, ..., L) or may

not be sent at all. This gives us the total number of combinations or the cardinality

for L,PCV S for a given K and L to be.

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

The total number of combinations can then be used to encode a binary infor-

mation sequence of length log2(K(L + 1)K−1). The length of the superimposed

delayed codewords (3.1) is 2n + L so the rate for L,PCV S will be.

RL,PCV S =log2(K(L + 1)K−1)

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)K−1)

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 the

derivative with respect to L for a fixed K is calculated and set to zero.

d

dL(RL,PCV 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)

Page 31: Simulation of a CDMA system based on optical orthogonal codes

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 want

log2(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,PCV S consider the following

example.

Suppose a user having four codewords (c1, c2, c3, c4), (K = 4) and L = 7. The

first 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 6= 0). The

mapping 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 next

three bits are mapped onto c2, and the next three bits are mapped onto c3 and so

on. Each of the remaining codewords can then be used to map log2(L + 1) = 3

information bits so the three codewords can totally map (K−1)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) + c7

1(5) + c73(4) +

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

4(0)+c72(1)+c7

3(6).

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

3.2.2 Decoding L, PCV S

An advantage when decoding L,PCV S is that the receiver does not need to be

synchronized with the sender. The decoder is searching for the synchronization

element with optical correlation described in chapter 1 and when this element has

been found the remaining (K−1) codewords should be found within L light pulses

and the data can be recovered. To be sure that the detected codeword really is

a synchronization element and not interference from all other users codeword one

can compare the time arrival with the last detected and approved synchronization

element, which should be 2n + L chips before. For the approval of the first found

Page 32: Simulation of a CDMA system based on optical orthogonal codes

3.3 L parallel code with fixed synchronization element 17

synchronization element, a buffer can be used and search 2n+L chips forward after

the next synchronized element.

The interference from other users codewords and the interference from the users

own codewords can cause that a synchronization element can be detected and

approved in a wrong place. When using L,PCV S we still obtain a large rate

but the decoding process where any codeword can be the synchronized one can be

rather complex and decrease the systems flexibility. A way to further increase the

flexibility 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,PCV S except that the synchronization element is fixed and cannot carry any

information itself. What codeword that is chosen to always be the synchronization

element has to be known for the decoder to successfully recover the encoded data.

This codeword is always sent without delay and the remaining codewords can

then be delayed between 0 and L. The definition for L parallel code with fixed

synchronization 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

bjcLj(lj) : (b2, ..., bK) ∈ {0, 1}K−1,

(l2, ..., lK) ∈ {0, 1, ..., L}K−1}

(3.15)

The synchronization element is sent for every block i.e. every period of length

2n + L. The remaining K − 1 codewords from C are then delayed between 0 and

L or not being sent at all.

3.3.1 Cardinality and rate for L, PCFS

If C 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 is

not sent. The cardinality for L,PCFS will then become.

|CL,PCFS | = (L + 2)K−1 (3.16)

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

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

Page 33: Simulation of a CDMA system based on optical orthogonal codes

18 L parallel code

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

RL,PCFS =log2(L + 2)K−1

2n + L=

(K − 1)log2(L + 2)

2n + L(3.17)

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

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

depends 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 the

maximum rate. This is exactly the same expression that gives the maximum rate

for L,PCWS (3.6).

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

For 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 be

assigned 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 synchronization

element and is always sent without delay. The remaining K −1 = 2 codewords can

have L + 1 different delays each or it may not be sent. This gives us (L + 2) = 16

different combinations for each codeword which can represent log2(L + 2) = 4 bi-

nary information bits. The mapping for each of the remaining codewords can be

expressed 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

Page 34: Simulation of a CDMA system based on optical orthogonal codes

3.4 L parallel code with error detecting property 19

So the remaining two codewords can encode (K − 1)log2(L + 2) = 8 bits. The

message (1,0,0,0,1,0,1,1) will be encoded with c141 (0) + c14

2 (7) + c143 (10) and the

message (0,0,0,0,1,1,1,1) will be encoded as c141 (0) + c14

3 (14).

3.3.2 Decoding L, PCFS

If a user is sending information the synchronization element will be sent in every

2n + L period. The decoder is continuously searching for the synchronization

element and when it has been found we know that the remaining codewords that

carry the information should appear within L light pulses. To further ensure that

the found synchronization element is found in the right position one could compare

its time arrival with the last found synchronization element, which should have

been found 2n+L chips before. For the approval of the first found synchronization

element, 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 in

such way.

3.4 L parallel code with error detecting property

L parallel code with error detecting property, L,PCE, works in a similar way

as L,PCFS but every codeword in C is sent in each period. In every period of

2n + L the synchronization element is sent without delay and all of the remaining

codewords are sent with a delay between 0 and L. The definition for L parallel

code 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) +

K∑

j=2

cLj (lj) : (l2, ..., lK) ∈ {0, 1, ..., L}K−1

}

(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 more

than once within L light pulses after the detection of the synchronization element

or 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

Page 35: Simulation of a CDMA system based on optical orthogonal codes

20 L parallel code

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

lj = (0, 1, ..., L). The cardinality for L,PCE will then become.

|CL,PCE | = (L + 1)K−1 (3.20)

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

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

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

RL,PCE =log2(L + 1)K−1

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)K−1

information bits onto 2n + L chips. As for L,PCFS and L,PCWS the maximum

rate only depends on L.

d

dL(RL,PCE) =

K − 1

ln(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 the

maximum rate.

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

Because the synchronization element does not carry any information all users

must at least be assigned two codewords (K ≥ 2). We also want log2(L + 1) to be

an integer so L must follow (3.14).

The following example shows how the encoding process for L,PCE might work.

A user is assigned five codewords (c1, c2, c3, c4, c5), (K = 5) and L = 7. The

first element in C is chosen to be the synchronization element and is always sent

without 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, which

can 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 c3

and so on. The remaining four codewords are then be used to map a total of (K −1)log2(L+1) = 12 information bits. The message (0,1,0,1,0,1,1,1,0,0,0,0) is encoded

by c71(0) + c7

2(2) + c73(5) + c7

4(6) + c75(0) and the message (0,0,0,0,0,0,1,1,1,1,0,1)

will be encoded as c71(0) + c7

2(0) + c73(0) + c7

4(7) + c75(5).

Page 36: Simulation of a CDMA system based on optical orthogonal codes

3.5 L parallel code with error correcting property 21

3.4.2 Decoding L, PCE

When decoding L,PCE the decoder is continuously searching for the synchroniza-

tion element (which codeword that has been chosen to be the synchronized one

is 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 codeword

is detected more than once within L pulses we know that an error has occurred

and the incorrect bits can be retransmitted. If however an incorrect detection of a

codeword is due to interference from the users own codeword the same combination

of 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 can

be 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 detected

within L pulses, but it can only detect errors when a codeword has been found

more than once within L pulses after the synchronization element. It is therefore

desirable to have a code that can correct these errors as well. In the next section

such 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 codeword

is sent twice with a separation parameter S between them so a new definition for

delayed 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, ..., cn−1), 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︸ ︷︷ ︸

L−l

)

(3.24)

What this means is that every delayed codeword to be sent is repeated with a

separation 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 repeated

codeword. If we choose S = 0, the codeword is repeated without separation so the

correlator will look at cyclic shifted codewords and we will need an OOC. If we

instead choose S = n the codewords are separated with the codeword length and

we only look at acyclic shifted codewords. If S = n we should then be able to use

an AOOC discussed in section 2.3 on page 8.

L,PCEC works in a similar way as L,PCE in the sense that a synchronization

element (known to both sender and receiver) is sent without delay (lj = 0) and

Page 37: Simulation of a CDMA system based on optical orthogonal codes

22 L parallel code

the remaining codewords are always sent and are delayed between 0 and L. The

difference is that the delayed codewords are repeated once with the separation S.

The definition for L parallel code with error correcting property can be expressed

as.

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) +

K∑

j=2

cS,Lj (lj) : (l2, ..., lK) ∈ {0, 1, ..., L}K−1

}

(3.25)

This means that the synchronization is sent in every period of 3n + L + S anda repeated copy n + S chips after. The remaining K − 1 codewords are always

sent 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 error

detecting property as for L,PCE. But we also know that if a codeword has been

detected there should appear a copy of that codeword n+S after. If there is no such

copy 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 remaining

K − 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)K−1 (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 of

information bits that can be mapped in each block is then log2(L + 1)K−1. The

length of the superimposed delayed repeated codewords (3.24) is 3n+L+S so the

rate for L,PCEC will be.

RL,PCEC =log2(L + 1)K−1

3n + L + S=

(K − 1)log2(L + 1)

3n + L + S(3.27)

Like L,PCFS, L,PCWS and L,PCE the 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 the

maximum rate.

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

Page 38: Simulation of a CDMA system based on optical orthogonal codes

3.5 L parallel code with error correcting property 23

Because of the similarity with L,PCE, L and K must have the same properties

as for L,PCE. The mapping of information bits onto the delayed repeated code-

words works in the same way as L,PCE with the difference that we use definition

1 instead of definition 6 for the delayed elements. Consider the following example

on how the mapping works for L,PCEC.

A user is assigned three codewords (K = 3), (c1, c2, c3), that is a partition of an

OOC 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 different

combinations. The synchronization element is always sent without delay (c0,151 (0)).

These combinations can be used to map log2(L + 1) = 4 binary information bits

for each of the remaining two codewords. So the total remaining codewords can

be used to map (K − 1)log2(L + 1) = 8 bits. The message (0,0,1,0,1,1,1,1) will be

encoded 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) + c

0,152 (13) + c

0,153 (11).

3.5.2 Decoding L, PCEC

The decoder searches for the synchronization element and before it approves that

detection as a synchronization element it must be confirmed that there exists a

copy of that element n + S chips forward. If it has been approved all of the

remaining codewords should be detected within L light pulses after the approved

synchronization element. As a further assurance it also confirms all the detected

codewords with their respective copy n + S chips forward. If all these properties

are not fulfilled we know that the codewords are detected due to interference and

should 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 chips

forward, 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 any detected codewords does not have a copy n+S chips forward, one can

make the decision that they are detected due to interference.

• If a codeword has been found more than once within L pulses after the

detection 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 copy

we can still detect this error but not correct it because we cannot confirm which

is the correct one. The incorrect data can then be retransmitted. However if this

interference is due to the users own codewords the same error will occur again

because the same superposition of delayed repeated codewords will be sent.

Page 39: Simulation of a CDMA system based on optical orthogonal codes

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,PCV S gives a slightly lower rate

but here a synchronization element is sent so there are no need for the system to be

synchronized. Still, because the element chosen to be the synchronized one varies

for every block, the decoding process might be rather complex. If we choose a fixed

synchronization element, as for L,PCFS, the decoding process might become more

simplified 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 expense

of lower rate. L,PCEC can detect errors in the same way as L,PCE and to be

able 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 not

interference.

In the tables below some properties for the L parallel code constructions are

summarized.

L K

L,PCWS 2i − 2 : ∀i ∈ N, i ≥ 2 ≥ 1

L,PCV S 2i − 1 : ∀i ∈ Z+ 2i : ∀i ∈ Z+

L,PCFS 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)K−1 log2(K)+(K−1)log2(L+1)2n+L

L,PCFS (L + 2)K−1 (K−1)log2(L+2)2n+L

L,PCE (L + 1)K−1 (K−1)log2(L+1)2n+L

L,PCEC (L + 1)K−1 (K−1)log2(L+1)3n+L+S

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

Page 40: Simulation of a CDMA system based on optical orthogonal codes

3.6 Summary of the L parallel code schemes 25

L0 that gives maximum rate

L,PCWS (L0 + 2)ln(L0 + 2) − L0 = 2n

L, PCV S (K − 1)(2n + L0 − (L0 + 1)(ln(L0 + 1)) = ln(K)(L0 + 1)

L,PCFS (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 code

with 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 has

been used and every user is assigned two codewords i.e. K = 2. Because we have

an OOC, S is set to S = 0 in the case for L,PCEC. They are also compared with

the ordinary parallel code with a rate K/n (2.2).

Page 41: Simulation of a CDMA system based on optical orthogonal codes

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

Rat

e

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

Rat

e

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

log2(L)

(b) n=1873

Figure 3.2. Rate as a function of L 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

Page 42: Simulation of a CDMA system based on optical orthogonal codes

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 and

L is chosen for maximum rate for every value of n.

0 500 1000 1500 2000 2500 3000 3500 400010

−4

10−3

10−2

10−1

codeword length n

Rat

e

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 of n. Codewords assigned to each user is K = 2

To summarize this chapter one can say that to gain a more flexible and stable

system the rate becomes lower. Another maybe even more important property

is how the bit error rate, BER, for the system is affected by the choice of code

construction. To be able to analyze this (which is the main part of this thesis) a

simulation environment has been implemented in Matlab.

Page 43: Simulation of a CDMA system based on optical orthogonal codes

28 L parallel code

Page 44: Simulation of a CDMA system based on optical orthogonal codes

Chapter 4

Matlab implementation of

the L parallel code schemes

Often when investigating a systems performance it is interesting to know how

BER depends on the number of simultaneously active users. This is of course an

interesting property for the L parallel codes as well, so the program is created to

simulate that. As discussed in the previous chapter the rate depends on the choice

of 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 generate

OOC’s example−OOC.m has been used and AOOC’s are generated with cre-

ateAOOC.m.

example−OOC.m takes weight w as input. The user then chooses codeword

length n from a presented list and the function returns an optimal OOC as

a matrix with codewords as rows. The construction comes from [5]. How-

ever for some lengths the construction cannot return an optimal OOC and if

such length has been chosen it is stored in n−faliure.mat and will not be

presented the next time the list of possible codeword lengths are shown.

modulo.m returns the rest after division. Matlab’s own function mod.m cannot

deal 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 for

cyclic shifts.

codetest.m takes a code matrix as input and returns true if no acyclic distances

are repeated. This function is used for the testing of created codes.

29

Page 45: Simulation of a CDMA system based on optical orthogonal codes

30 Matlab implementation of the L parallel code schemes

createAOOC.m returns an AOOC with codewords as rows, that only take acyclic

shifts into consideration. Input parameters are cardinality, weight and corre-

lation constraints.

To explain how the simulation environment works we start by explaining how

the encoding process has been implemented.

4.2 Implemented encoders

The encoders for the different L parallel codes are implemented in five Matlab

functions. They are all block encoders, which means that the output is a vector

of length 2n + L or 3n + L + S depending on the chosen code construction. The

input 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 length

that 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. The

functions delayed−Codeword.m and delayed−Codeword−Separation.m has

been 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 length

2n + L and 3n + L + S respectively.

L−PCWS.m: With definition L,PCWS it encodes the binary vector data of

length 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 be

encoded with one codeword in C. These binary sequences are converted to

decimal form and depending on the result the codeword has different delay

between 0 and L, or not being sent at all if the result is zero.

L−PCVS.m: Encodes the vector data of length log2(K)+(K−1)log2(L+1) with

L,PCV S. The first log2(K) elements in the vector data are converted to

decimal, and depending on the result different codewords in C will become

the 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. These

parts are converted to decimal and the delayed codewords are created (delay

between 1 and L). If the decimal result is zero the respectively codeword is

not sent.

Page 46: Simulation of a CDMA system based on optical orthogonal codes

4.3 Implemented decoders 31

L−PCFS.m: Encodes data of length (K − 1)log2(L+2) with L,PCFS. The first

codeword in C is always sent without delay so the (L, 0) delayed codeword

for the first row in C is created. data is divided into K − 1 parts of length

log2(L + 2), where each part will be encoded with one of the remaining

codewords in C. These parts are converted to decimal and if the result

is not zero the delayed codeword is created based on the decimal result and

added to the superposition.

L−PCE.m: Encodes a vector of length (K − 1)log2(L + 1) with L,PCE. The

first row in C is the synchronization element so the (L, 0) delayed codeword

for the first element is created. The remaining K − 1 codewords are then

used to each encode parts of log2(L + 1) bits from the data vector. They

are 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.

L−PCEC.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 is

created representing the synchronization element. The remaining K−1 code-

words are then used to each encode log2(L+1) information bits. These parts

are converted to decimal and the result mdec is used to create the (L,mdec)

delayed repeated codeword with separation S. The superposition of all the

delayed 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 of

the corresponding block length for each construction. Every encoded block is then

added 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 ordinary

parallel code from chapter 2, an encoder for this construction has also been imple-

mented.

ordinary−PC.m: This is not a block encoder, so the length of the input vector

data, that will be encoded, is arbitrary. This vector is searched in steps of Kand depending on the combination of the K data bits different superpositions

of 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 are

synchronized so the receiver knows where each block starts. decode−L−PCWS.m

is therefore a block decoder that decodes a block of length 2n+L. All other decoders

are 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.

Page 47: Simulation of a CDMA system based on optical orthogonal codes

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 value

as 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 decode−L−PCWS.m this is not

an 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 the

codeword.

decode−L−PCWS.m: Decodes a block of length 2n+L. This is possible because

the senders and receivers are synchronized so the receiver always knows when

every block starts. The decoder loops the encoded sequence and when the

correlation equals the weight of the codewords it decides that a codeword has

been 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 is

found on position i=n+1 it has delay lj = 0. Because this is a block decoder it

can decide if the codeword is found in a suitable position, and some detections

will therefore be rejected. No codewords should be found on position 1:n. This

is due to the definition of delayed codewords (3.1). When the entire block

has been searched the information can be recovered because we know what

codewords have been found and their respectively delay.

The four other decoders works in a different way because the constructions

their selves are synchronized with one element from the code. Here the encoded

vector can be of arbitrary length and the decoder is looping the entire encoded

vector and continuously searching for the synchronization element. But before

approval of a found synchronization element we look at the position of the last

found synchronization element, which should have been found 2n + L positions

before. If the position for the last found is not 2n+L before (or if a synchronization

element not yet has been found), it searches 2n + L forward to confirm that the

it has been found in an appropriate position. This result in a limitation, because

we 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

Page 48: Simulation of a CDMA system based on optical orthogonal codes

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 Matlab

code 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)<length(encoded) & LOGIC1 & ∼LOGIC2)

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

LOGIC3=logical(0);end

The logical varables are, for every i in the loop, initially set to zero (false).

If a potential synchronization element has been found LOGIC1 is set to true. If

LOGIC1=true we check if there is a stored position for the last found synchroniza-

tion element in the variable lastSynch and if i-lastSynch=2n+L. If so, LOGIC2 is set

to true. If the last stored position was not 2n+L before we still try to calculate the

correlation 2n+L positions backwards. This is done so that we are not bound to a

position found in the beginning of the encoded vector. If a potential synchroniza-

tion element has been found but there does not exist one 2n+L positions before

(LOGIC2=false), we look 2n+L positions forward. If a synchronization element is

found there LOGIC3 is set to true.

The logical expression for approving the synchronization element then look like

this:

LOGIC1 & (LOGIC2 | LOGIC3) & (isempty(lastSynch) | (i-lastSynch)≥(2n+L))

This means that for an synchronization element to be approved, the correla-

tion with that element must equal its weight (LOGIC1=true). Furthermore, there

Page 49: Simulation of a CDMA system based on optical orthogonal codes

34 Matlab implementation of the L parallel code schemes

must exist a synhronization element 2n+L positions backwards (LOGIC2=true) or

forward (LOGIC3). And last, if it is the first one we find (isempty(lastSync)) or the

last found is more then or equal to 2n+L positions before ((i-lastSynch)≥(2n+L))).For decode−L−PCVS.m the search looks a little different because the syn-

chronization element can be any element in C. For decode−L−PCEC.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 approving

the found synchronization element.

If a synchronization element has been found and approved (i.e. the logical

expression above returns true) a new loop then searches L positions forward to

find the rest of the codewords.

decode−L−PCVS.m: When a synchronization element has been found, it is used

to restore log2(K) information bits. The decoder then enters a new loop and

searches L positions forward (not including the synchronized position because

the delay for the rest of the codewords cannot be zero). If a codeword is found

a flag is set and the delay is stored. The delay is given here by the difference

in position between the found codeword and the synchronized one. When

all L positions have been searched the flags and their respectively delay are

used to restore the rest of the data in that block. For later comparisons, the

synchronized position for this block is stored and the main loop then jumps Lpositions forward and the search for the next synchronization element begins.

decode−L−PCFS.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 blocks

synchronization element is stored for later comparisons. The main loop then

jumps L positions forward and searches for the next synchronization element.

decode−L−PCE.m: From the synchronized position and L pulses forward the

decoder searches for the remaining (K − 1) codewords in a sub loop. If a

codeword 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

(K−1) codewords have been found. If so, the information from this block can

be restored using all codewords respectively delay (except the synchronization

element). The position for this blocks synchronization element is stored for

later comparisons, and the main loop then jumps L positions forward to

search for the next synchronization element. If however all the remaining

codewords are not found within L positions, the codewords that were found

are disregarded and the decoder will continue search for a synchronization

element in the next position and forward.

decode−L−PCEC.m: This decoder works in a similar way as for L,PCE. When

a synchronization element has been found and approved the next L positions

Page 50: Simulation of a CDMA system based on optical orthogonal codes

4.4 Main functions 35

are searched for the remaining (K − 1) codewords. Every found codeword

must be confirmed with their respectively copy that should be n+S positions

forward. The delay for every codeword is then used to recover the information

from this block. When this block has been decoded the synchronized position

is stored and the main loop jumps n + S positions forward to continue the

search for the next synchronization element. If all codewords are not found

or 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 to

search for the next synchronization element in the next position and forward.

Because of interference from other users (MAI), the same codeword can be found

more 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 the

decoder had to make a choice and the recovered data vector.

The decoder for the ordinary parallel code can be described as.

decode−ordinary−PC.m: This is a simplified model for the decoder because

it has a start vector as input to synchronize the decoding process. This

however is acceptable because we are only interested in the BER caused by

the crosstalk between users. The decoder searches for the users codewords

using correlation. When a codeword has been found it checks if the position

of the last detected codeword was found n positions before. When the entire

encoded vector has been searched the vector with the decoded information is

returned.

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 users

means the number of users that are simultaneously using the channel.

• simulate how BER depends on the delay parameter L. This is interesting

because the rate depends on L. Here every user is given a probability of being

active, where active means here that the user is active some time during the

period.

For a given datasize and number of users, the function encode−Decode.m

encodes every users data, creates the superposition and finally decodes it. The

original 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.

Page 51: Simulation of a CDMA system based on optical orthogonal codes

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, active

or not active.

- start , is a vector that gives for every user the start position. This can be

considered the relative chip delay between the users.

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

send.

- definition , is a string input that gives what type code construction that will

be 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.

encode−Decode: First of all it checks if K−per−user, start and datasize are of

equal lengths. It also checks if L and the number of codewords assigned to

each 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 the

vector datasize the individual datasizes can be found and the data is random

created with Matlabs function randsrc.m. For not active users i.e. users

with zero datasize, nothing is sent. Because all encoders are block encoders

we want the datasize to be a multiple of the block length, so if necessary

zeros are added at the end of the data vector to fulfil this. The created data

is then stored in a .mat file for later comparison. In a sub loop the data is

encoded block by block with the chosen code construction. From the input

vector start, zeros are added at the beginning of the encoded vector that

corresponds to that users start position. To get every users encoded vector

of equal lengths the end is filled out with zeros for the shorter ones. With a

binary ”or” operator the encoded vector is added to the already encoded users

to create the superposition. Because L,PCWS needs synchronized senders

and receivers the vector start is reduced mod(2n + L).

In the decoding process the encoded vector (the superposition of all active

users encoded data) is looped for every user one at a time. For the block de-

coder decode−L−PCWS.m, user i starts decoding at position start(i) and

decodes every block of length 2n + L. The recovered data is then stored

in a .mat file to later compare it with the original data. All other de-

coders decode−L−PCVS.m, decode−L−PCFS.m , decode−L−PCE.m

and decode−L−PCEC.m takes the entire encoded vector as input, decodes

it and returns the recovered data. This is done for every user, active and not

active, and all users decoded data is stored in their own .mat file.

Page 52: Simulation of a CDMA system based on optical orthogonal codes

4.4 Main functions 37

When all users are decoded the comparison begins. In a loop the original

data and the decoded data is loaded for one user at a time. With a binary

”xor” operator the sequences are compared and the BER is calculated.

The function returns two matrices. The variable active−BER−tot consists

of four rows, which corresponds to every users number of codewords, errors,

datasize (with the zeros added to get the right block length) and calculated

BER. The other variable is not−active−errors−tot, which contains for every

user their number of codewords and idle mode errors, which is the amount of

information that was decoded from a inactive user.

The other main function is simulation.m, which uses encode−Decode.m in

several step to run the two types of simulations specified in the beginning of this

section. 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 user

is assigned and the second row gives the probability of the individual user

sending information. If Kperuser only has one row the default value for

probability is 100% for all users.

- statistics is a string that says how much information that will be shown on

the screen during the simulation progress.

Before the simulation begins, the user has to specify some other parameters the

program asks for. If we want to simulate BER vs. L the following will be shown

in the Matlab prompt:

>> [ activeBER,notActiveErrors ] =simulation(C,Kperuser,’stat−off’);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 (L−PCWS, L−PCVS, L−PCFS, L−PCE, L−PCEC)?: L−PCEif L=2i-1, i=1,2...give minimum i ?: 3give maximum i ?: 10Give 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

Page 53: Simulation of a CDMA system based on optical orthogonal codes

38 Matlab implementation of the L parallel code schemes

The program works a bit different depending on what type of simulation we

choose. Below is a description how the program works for TYPE1 (BER vs. L).

simulation.m when simulating BER vs. L: When all input parameters have

been specified, the main loop starts from i=Lmin to i=Lmax. For every

value of L a new loop begins. This corresponds to the number of simulations

we run for each L to be able to create a mean value. For every of these

simulations a vector is created that contains flags that corresponds to which

users are active. This is done with Matlabs function randsrc.m and every

users specific probability of sending data. Active here means that the user

sends information some time during the interval. For those with a flag set

to ’1’ their datasize is random created between the maximum and minimum

datasize specified from the input parameters. The start vector is then created.

If we have an input value for maximum start value (startMax), the elements

of the vector is random between ’0’ and startMax. If startMax is not specified

from the input, we estimate the length of the encoded vector for every user

(encodedLength). The start value for user i is then random created between

’0’ and (max(encodedLength)-encodedLength(i)).

When all parameters needed to run one simulation is calculated we call

encode−Decode.m, which returns activeBER and notActiveErrors. The

active errors and respectively datasize are stored in a matrix together with

previous results from this value of L. The idle mode errors for every users

are also stored.

When every simulation for a value of L is finished, BER is created with the

sum of all errors from all simulations divided by the sum of all datasizes.

Users with different rate (number of assigned codewords) are separated, so

we achieve different BER for different rates.

The result from this L is put in a matrix together with the results from other

values of L.

When all values of L has been looped the result is displayed on the screen

and BER vs. L is plotted with different curves for different rates.

If we instead want to simulate TYPE2 (BER vs. number of active users) the

following will be shown in the Matlab prompt:

Page 54: Simulation of a CDMA system based on optical orthogonal codes

4.4 Main functions 39

>> [ activeBER,notActiveErrors ] =simulation(C,Kperuser,’stat−off’);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= ?: 2choose definition (L−PCWS, L−PCVS, L−PCFS,L−PCE, L−PCEC,ord−PC)?: L−PCECGive separation parameter S, if no input S is set to n ?: 0Give L, if no input L is chosen for max rate ?:L=255 chosenGive the number of simulationsto be able to create a meanvalue ?: 50Give minimum datasize ?: 1000Give maximum datasize ?: 5000Give minimum number of users ?: 1Give maximum number of users ?: 14

This type of simulation can be seen as a special case of the previous. Here

we have a fixed value of L and by number of active users we mean that they (all

active users) are all sending information during the entire interval. To get a correct

result all the users have the same rate, that is they have all been assigned the same

number of codewords.

simulation.m when simulating BER vs number of active users: When all

input parameters are specified, the program starts a loop from i=minUsersto i=maxUsers. To be able to create a mean value, several simulations from

encode−Decode.m are used for every such i. Which i users that will be

active for every simulation is random selected. All results from this i are

added together and BER is calculated. Also the idle mode errors is added

together.

When all different number of active users have been simulated the result

is shown on the screen and BER as a function of number of active user is

plotted. The number of idle mode errors is plotted as a function number of

not active users.

On the next page an overview of the Matlab functions is shown.

Page 55: Simulation of a CDMA system based on optical orthogonal codes

40 Matlab implementation of the L parallel code schemes

Simulation.m (C,Kperuser)

encode_Decode.m(C,L,K,Kperuser,start,datasize,definition)

L_PCWS.m

L_PCVS.m

L_PCFS.m

L_PCE.m

L_PCEC.m

ordinary_PC.m

Encoders (Cj,L,K,data)

decode_L_PCWS.m

decode_L_PCVS.m

decode_L_PCFS.m

decode_L_PCE.m

decode_L_PCEC.m

decode_ordinary_PC.m

Decoders (Cj,L,K,encoded)

1

2 3 4

5

Figure 4.1. Overview of the Matlab functions. The sequence 1 to 5 is done several timesto create a mean value from every simulation.

The main function simulation.m has then been used to simulate the error

probability properties. The result from the simulations are presented in the next

chapter.

Page 56: Simulation of a CDMA system based on optical orthogonal codes

Chapter 5

Results and conclusions

The L parallel codes should be able to use codes with aperiodic correlation and it

is interesting to know how the performance depends on the choice of code. The

codes used for the simulations are:

OOC: The parameters for this optical orthogonal code is λ = 1, w = 4, cardinality

|C| = 28 and codeword length n = 337.

AOOC: This acyclic optical orthogonal code has the following parameters, λ = 1,

w = 4, cardinality |C| = 28 and codeword length n = 229.

They are created to have the same weight and cardinality to be comparable to

each other. The first investigation is to simulate the systems capacity, that is how

the systems performance depends on the number of active users.

5.1 System performance as a function of number

of active users

For these simulations every user has been assigned the minimum number of code-

words. This means that for L,PCWS every user has K = 1 codeword and for the

rest of the L parallel codes every user has K = 2 codewords. For every number of

active users 50 simulations has been used to be able to create a mean value. For

every such simulation every active user sends an equal amount of data between

1000 to 2000 bits and L is always chosen for maximum rate. So ”active” means

here that all active users sends data during the same period. When simulating

L,PCEC using the AOOC, S is set to S = n and for the OOC S = 0.

L,PCV S has a rather complex decoding process so to reduce the simulation

time only active users has been decoded. As a consequence we do not obtain any

result of how the number of idle mode errors depends on the number of active users

for this code construction.

For the simulation of the ordinary parallel code, some other codes have been

used. The parameters for these are λ = 1, w = 3, cardinality |C| = 27 and

41

Page 57: Simulation of a CDMA system based on optical orthogonal codes

42 Results and conclusions

codeword length for the OOC is n = 163 and for the AOOC n = 98. Even though

the codewords are cyclic shifted it can be interesting to see how good (or bad) the

AOOC works compared to the OOC. Each user is assigned K = 1 codeword. For

each number of active users, 100 simulations have been used to create a mean value

and the active users send an equal amount of data between 100 and 1000 bits. The

inactive users are not decoded so no result from idle mode errors are returned. All

this to reduce the simulation time, which otherwise will be substantial.

The results from the simulations of system capacity are presented in the next

pages.

Page 58: Simulation of a CDMA system based on optical orthogonal codes

5.1 System performance as a function of number of active users 43

5 10 15 20 25 3010

−5

10−4

10−3

10−2

10−1

number of active users

BER

OOC AOOC

Figure 5.1. BER as a function of number of active users for the ordinary parallel code.λ = 1, w = 3, |C| = 27. n = 163 for the OOC and n = 98 for the AOOC. Every user isassigned K = 1 codeword.

2 4 6 8 10 12 1410

−5

10−4

10−3

10−2

10−1

number of active users

BER

OOC AOOC

Figure 5.2. BER as a function of number of active users for L, PCV S. Every user isassigned K = 2 codewords and L = 127.

Page 59: Simulation of a CDMA system based on optical orthogonal codes

44 Results and conclusions

5 10 15 20 25 3010

−6

10−5

10−4

10−3

10−2

10−1

Number of active users

BER

OOC AOOC

(a) BER as a function of number of active users

25 2015105010

−2

10−1

100

101

102

103

Number of active users

idle

mod

e er

rors

OOC AOOC

(b) idle mode errors as a function of number of active users

Figure 5.3. System performance as a function of number of active users for L, PCWS.Every user is assigned K = 1 codeword and L = 126.

Page 60: Simulation of a CDMA system based on optical orthogonal codes

5.1 System performance as a function of number of active users 45

2 4 6 8 10 12 1410

−6

10−5

10−4

10−3

10−2

10−1

number of active users

BER

OOC AOOC

(a) BER as a function of number of active users

12 108 6 4 2010

−1

100

101

102

103

number of active users

idle

mod

e er

rors

OOC AOOC

(b) idle mode errors as a function of number of active users

Figure 5.4. System performance as a function of number of active users for L, PCFS.Every user is assigned K = 2 codewords and L = 126.

Page 61: Simulation of a CDMA system based on optical orthogonal codes

46 Results and conclusions

2 4 6 8 10 12 1410

−6

10−5

10−4

10−3

10−2

10−1

number of active users

BER

OOC AOOC

(a) BER as a function of number of active users

1412108 6 4200

2

4

6

8

10

12

14

number of active users

idle

mod

e er

rors

OOC AOOC

(b) idle mode errors as a function of number of active users

Figure 5.5. System performance as a function of number of active users for L, PCE.Every user is assigned K = 2 codewords and L = 127.

Page 62: Simulation of a CDMA system based on optical orthogonal codes

5.1 System performance as a function of number of active users 47

2 4 6 8 10 12 1410

−5

10−4

10−3

10−2

number of active users

BER

OOC AOOC

(a) BER as a function of number of active users

14 12108 6 4200

0.05

0.1

0.15

0.2

0.25

0.3

0.35

number of active users

idle

mod

e er

rors

OOCAOOC

(b) idle mode errors as a function of number of active users

Figure 5.6. System performance as a function of number of active users for L, PCEC.Every user is assigned K = 2 codewords and L = 255.

Page 63: Simulation of a CDMA system based on optical orthogonal codes

48 Results and conclusions

0 5 10 15 20 25 3010

−6

10−5

10−4

10−3

10−2

10−1

number of active codewords

BER

L,PCWSL,PCVSL,PCFSL,PCEL,PCEC:S=0

(a) BER as a function of number of active codewords for the OOC.

0 5 10 15 20 25 3010

−6

10−5

10−4

10−3

10−2

10−1

number of active codewords

BER

L,PCWSL,PCVSL,PCFSL,PCEL,PCEC:S=n

(b) BER as a function of number of active codewords for the AOOC

Figure 5.7. Summary of BER as a function of number of active codewords. In (a) theOOC has been used and in (b) the AOOC has been used.

Page 64: Simulation of a CDMA system based on optical orthogonal codes

5.1 System performance as a function of number of active users 49

3025201510500

10

20

30

40

50

60

number of active codewords

idel

mod

e er

rors

L,PCWSL,PCFSL,PCEL,PCEC:S=0

(a) Idle mode errors as a function of number of active codewords for the OOC.

3025201510500

20

40

60

80

100

120

140

160

180

number of active codewords

idle

mod

e er

rors

L,PCWSL,PCFSL,PCEL,PCEC:S=n

(b) Idle mode errors as a function of number of active codewords for the AOOC

Figure 5.8. Summary of idle mode errors as a function of number of active codewords.In (a) the OOC has been used and in (b) the AOOC has been used.

Page 65: Simulation of a CDMA system based on optical orthogonal codes

50 Results and conclusions

When comparing the OOC to the AOOC we observe that we gain lower BER

for the OOC. This is due to the smaller codeword length for the AOOC. With a

smaller codeword length, the risk for several codewords overlap each other causing

interference is higher. However the cost for the OOC having lower BER is lower

rate.

L K Rate (n = 337) Rate (n = 229)

L,PCWS 126 1 0.0088 0.0120

L,PCV S 127 2 0.0100 0.0137

L,PCFS 126 2 0.0088 0.0120

L,PCE 127 2 0.0087 0.0120

L,PCEC 255 2 0.0063 0.0068

L K Rate (n = 163) Rate (n = 98)

ordinaryPC - 1 0.0061 0.010

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

For a given number of users L,PCWS has the lowest BER. This is of course

due to every user only is assigned one codeword. For L,PCEC the difference in

BER between the OOC and the AOOC is very small but the difference in rate is

also very small because the acyclic codewords are separated.

A difference between the L parallel code construction is found when observing

idle mode errors. For inactive users (idle mode) L,PCWS and L,PCFS produces

many errors but for L,PCE and L,PCEC almost nothing is decoded for inactive

users. Mark that the number of idle mode errors for a given number of active users

is the mean value of every 50 simulations. These values are not the probability

of decoding information for inactive users but should only be used to compare the

constructions relative each other.

When studying the result from the ordinary code in figure 5.1, we observe that

BER does not increase that much with increasing number of users. For a rather

small number of active users BER is still rather high. Even though the codewords

are cyclic shifted in the channel the acyclic code can be used if those values for

BER is accepted. If we compare with the L parallel code constructions we see that

BER for the ordinary code is not much larger despite the smaller codeword length

and weight. However in the table above we see that the rate is still lower for the

ordinary code.

5.2 System performance as a function of L

Since the rate depends on the choice of delay parameter L, it is interesting to

simulate how BER and idle mode errors depends on L. Here every user is given

the same number of codewords (K = 2) for each of the two types (OOC and

AOOC) to easier be able to compare them. For every value of L, 50 simulations

has been used to create a mean value. All users have the same probability, P , of

Page 66: Simulation of a CDMA system based on optical orthogonal codes

5.2 System performance as a function of L 51

sending data (being active). The data size for every user is between 300 and 1500

bits. When a user is active it means here that the user sends data some time during

the period, i.e. the users do not have the same data size. For L,PCV S, inactive

users have not been decoded to reduce the simulation time, so we do not get any

result for the idle mode errors for this construction. If L = 2i − 1 or L = 2i − 2,

the values for L that has been simulated is between i = 3, 4, ..., 10. On the next

page the analytical values for the rate is plotted. On the following pages BER an

idle mode errors are shown for each L parallel code construction and for different

probabilities of the users being active.

Page 67: Simulation of a CDMA system based on optical orthogonal codes

52 Results and conclusions

2 3 4 5 6 7 8 9 100.008

0.01

0.012

0.014

0.016

0.018

0.02

0.022

0.024

Rat

e

OOCAOOC

log2(L)

(a) Rate forL, PCWS

2 3 4 5 6 7 8 9 105

6

7

8

9

10

11

12

13

14x 10

−3

Rat

e

OOCAOOC

log2(L)

(b) Rate for L, PCV S

2 3 4 5 6 7 8 9 104

5

6

7

8

9

10

11

12x 10

−3

Rat

e

OOCAOOC

log2(L)

(c) Rate for L, PCFS

2 3 4 5 6 7 8 9 104

5

6

7

8

9

10

11

12x 10

−3

Rat

e

OOCAOOC

log2(L)

(d) Rate for L, PCE

2 3 4 5 6 7 8 9 102.5

3

3.5

4

4.5

5

5.5

6

6.5

7x 10

−3

Rat

e

OOC: S=0AOOC: S=n

log2(L)

(e) Rate for L, PCEC

Figure 5.9. Rate as a function of L for the OOC (n = 337) and the AOOC (n = 229).Codewords assigned to each user is K = 2.

Page 68: Simulation of a CDMA system based on optical orthogonal codes

5.2 System performance as a function of L 53

2 3 4 5 6 7 8 9 100

0.5

1

1.5

2

2.5

3x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 100

0.5

1

1.5

2

2.5

3

3.5

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.10. System performance as a function of L for L, PCWS. Every user isassigned K = 2 codewords and the probability of sending data is for every user P = 0.2.

Page 69: Simulation of a CDMA system based on optical orthogonal codes

54 Results and conclusions

2 3 4 5 6 7 8 9 100

2

4

6

8x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 100

5

10

15

20

25

30

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.11. System performance as a function of L for L, PCWS. Every user isassigned K = 2 codewords and the probability of sending data is for every user P = 0.3.

Page 70: Simulation of a CDMA system based on optical orthogonal codes

5.2 System performance as a function of L 55

2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2x 10

−3

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 100

2

4

6

8

10

12

14

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.12. System performance as a function of L for L, PCWS. Every user isassigned K = 2 codewords and the probability of sending data is for every user P = 0.4.

Page 71: Simulation of a CDMA system based on optical orthogonal codes

56 Results and conclusions

2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L. Probability of sending data is for every user P = 0.2.

2 3 4 5 6 7 8 9 100

2

4

6

8x 10

−4

BER

OOCAOOC

log2(L)

(b) BER as a function of L. Probability of sending data is for every user P = 0.3.

Figure 5.13. BER as a function of L for L, PCV S. Every user is assigned K = 2codewords.

Page 72: Simulation of a CDMA system based on optical orthogonal codes

5.2 System performance as a function of L 57

2 3 4 5 6 7 8 9 100

0.5

1

1.5

2

2.5

3x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.14. System performance as a function of L for L, PCFS. Every user is assignedK = 2 codewords and the probability of sending data is for every user P = 0.2.

Page 73: Simulation of a CDMA system based on optical orthogonal codes

58 Results and conclusions

2 3 4 5 6 7 8 9 100

2

4

6

8x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 100

2

4

6

8

10

12

14

16

18

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.15. System performance as a function of L for L, PCFS. Every user is assignedK = 2 codewords and the probability of sending data is for every user P = 0.3.

Page 74: Simulation of a CDMA system based on optical orthogonal codes

5.2 System performance as a function of L 59

2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 10−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.16. System performance as a function of L for L, PCE. Every user is assignedK = 2 codewords and the probability of sending data is for every user P = 0.2.

Page 75: Simulation of a CDMA system based on optical orthogonal codes

60 Results and conclusions

2 3 4 5 6 7 8 9 100

2

4

6

8x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 100

0.02

0.04

0.06

0.08

0.1

0.12

0.14

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.17. System performance as a function of L for L, PCE. Every user is assignedK = 2 codewords and the probability of sending data is for every user P = 0.3.

Page 76: Simulation of a CDMA system based on optical orthogonal codes

5.2 System performance as a function of L 61

2 3 4 5 6 7 8 9 100

0.5

1

1.5

2

2.5

3

3.5

4x 10

−5

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 10−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.18. System performance as a function of L for L, PCEC. Every user isassigned K = 2 codewords and the probability of sending data is for every user P = 0.2.The separation parameter is set to S = 0 for the OOC and S = n for the acyclic code.

Page 77: Simulation of a CDMA system based on optical orthogonal codes

62 Results and conclusions

2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4x 10

−4

BER

OOCAOOC

log2(L)

(a) BER as a function of L

2 3 4 5 6 7 8 9 10−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

idle

mod

e er

rors

OOCAOOC

log2(L)

(b) idle mode errors as a function of L

Figure 5.19. System performance as a function of L for L, PCEC. Every user isassigned K = 2 codewords and the probability of sending data is for every user P = 0.3.The separation parameter is set to S = 0 for the OOC and S = n for the acyclic code.

Page 78: Simulation of a CDMA system based on optical orthogonal codes

5.3 Further studies 63

From these results we observe that the AOOC in general has higher BER and

more idle mode errors than the OOC. This confirms the conclusion that has already

been made in the simulations for system capacity. This is the cost of higher rate

due to the smaller codeword length. One can also see that the values for L that

gives high rates (from figure 5.9) causes higher BER and more idle mode errors. If

we choose a great value for L the codewords are more separated and the chance of

several codewords overlap each other causing incorrect detections is rather small.

If instead the value of L is small the code cannot map that many information bits

at a time so we get more delayed codewords in the channel. Because they are

separated with the codeword length this result in a lower risk of codewords overlap

each other and thus causes interference. But a too small or too great value of Lreduces the rate. However the difference in BER for different values of L is rather

small and the value for which L gives the maximum rate should be the best one to

use.

When comparing the L parallel codes we see that BER do not differ a lot

between the constructions. The most significant difference we find for L,PCECthat has a lower BER for both the OOC and the AOOC. The difference between

the L parallel codes is found when observing the idle mode errors. For L,PCEC,

no idle mode errors where found and for L,PCE only a very small amount was

found, as for the other constructions a substantial amount of information where

decoded for inactive users.

5.3 Further studies

In the simulations for the L parallel codes only two type of codes has been com-

pared, the OOC and the AOOC. It would be interesting to test other codes with

different weight and cardinality and investigate how BER depends on the weight.

For systems where some users are assigned more codewords (higher rate), the

constructions L,PCE and L,PCEC should make more use of their error detecting

and correcting properties. Its even possible that more codewords assigned to each

user will actually decrease BER and idle mode errors for these constructions. For a

code with greater cardinality one can then simulate such a system with more users,

where some users have higher rate.

To gain more reliable values for BER many more and larger simulations should

have been used. In this thesis work there was no more time for such simulations,

since the simulations above has taken a total time of 1250 hours using several rather

fast computers (2.6GHz).

Page 79: Simulation of a CDMA system based on optical orthogonal codes

64 Results and conclusions

Page 80: Simulation of a CDMA system based on optical orthogonal codes

Bibliography

[1] Tobias Ahlstrom and Danyo Danev. A class of superimposed codes for cdma

over fiber optic channels. Internal Report LiTH-ISY-R-2543, Department of

Electrical Engineering, Linkoping University, Linkoping, Sweden, 2003.

[2] Tobias Ahlstrom and Danyo Danev. A family of error correcting superimposed

codes for cdma over fiber optic channels. Internal Report LiTH-ISY-R-????, De-

partment of Electrical Engineering, Linkoping University, Linkoping, Sweden,

2003.

[3] A.Stok and E.H Sargent. Comarsion of diverse optical cdma codes using a

normalized throughput metric. IEEE communications letters, 7(5):242–244,

May 2003.

[4] Jawad A. Saheli Fan R. K. Chung. Optical orthogonal codes: Design, analysis,

and applications. IEEE transactions on information theory, 35(3):595–604, May

1989.

[5] Habong Chung P.Vijay Kumar. Optical orthogonal codes–new bounds and an

optimal construction. IEEE transactions on information theory, 36(4):866–873,

July 1990.

[6] S.V. Maric K.N Lau. Multirate fiber-optic cdma: System design an performance

analysis. Journal of lightwave technology, 16(1):9–17, January 1998.

[7] J.A. Salehi. Code division multiple-access techniques in optical fiber networks–

part 1: Fundamental principles. IEEE Transactions on communications,37(8):824–833, August 1989.

65

Page 81: Simulation of a CDMA system based on optical orthogonal codes

På svenska Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under en längre tid från publiceringsdatum under förutsättning att inga extra-ordinära omständigheter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art.

Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ In English The publishers will keep this document online on the Internet - or its possible replacement - for a considerable time from the date of publication barring exceptional circumstances.

The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for your own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility.

According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement.

For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its WWW home page: http://www.ep.liu.se/

© [Andreas Karlsson]