report 1 final

58
SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING Dept of ECE, PESIT-BSC 1 CONTENTS SL NO. CHAPTER PAGE NO. 1 PREAMBLE 1.1 Introduction 6 1.2 Overview 7 1.3 Basic Block Diagram 8 2 PROJECT PLANNING 2.1 Activities and Gantt Chart 10 2.2 Milestones and Targets 11 2.3 Work Execution 12 3 LITERATURE REVIEW 3.1 Network Coding Schemes 14 3.1.1 Traditional Scheme(TS) 15 3.1.2 Straightforward Network Coding(SNC) 15 3.1.3 Physical-Layer Network Coding(PNC) 16 3.2 Digital Modulation Techniques 17 3.2.1 Binary Phase Shift Keying(BPSK) 17 3.2.2 Quadrature Phase Shift Keying(QPSK) 19 3.3 Software 3.3.1 MatLab 22 3.3.2 Simulink 22 4 DESIGN AND IMPLEMENTATION 4.1 PNC 4.1.1 PNC using BPSK 24 4.1.2 PNC using QPSK 30 4.2 BER Analysis and Throughput 4.2.1 Bit Error Rate 36 4.2.2 Algorithms for BER Analysis 37

Upload: meghana-m-patil

Post on 16-Jan-2016

4 views

Category:

Documents


0 download

DESCRIPTION

physical layer network coding

TRANSCRIPT

Page 1: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 1

CONTENTS

SL NO. CHAPTER PAGE NO.

1 PREAMBLE

1.1 Introduction 6

1.2 Overview 7

1.3 Basic Block Diagram 8

2 PROJECT PLANNING

2.1 Activities and Gantt Chart 10

2.2 Milestones and Targets 11

2.3 Work Execution 12

3 LITERATURE REVIEW

3.1 Network Coding Schemes 14

3.1.1 Traditional Scheme(TS) 15

3.1.2 Straightforward Network Coding(SNC) 15

3.1.3 Physical-Layer Network Coding(PNC) 16

3.2 Digital Modulation Techniques 17

3.2.1 Binary Phase Shift Keying(BPSK) 17

3.2.2 Quadrature Phase Shift Keying(QPSK) 19

3.3 Software

3.3.1 MatLab 22

3.3.2 Simulink 22

4 DESIGN AND IMPLEMENTATION

4.1 PNC

4.1.1 PNC using BPSK 24

4.1.2 PNC using QPSK 30

4.2 BER Analysis and Throughput

4.2.1 Bit Error Rate 36

4.2.2 Algorithms for BER Analysis 37

Page 2: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 2

SL NO. CHAPTER PAGE NO.

4.2.3 Algorithm for Throughput 38

5 RESULTS AND DISCUSSION

5.1 PNC using BPSK 40

5.2 PNC using QPSK 43

5.3 BER comparison for BPSK, QPSK and PNC 47

5.4 Throughput comparison 48

6 CONCLUSION AND FUTURE SCOPE

6.1 Conclusion 50

6.2 Future Scope 50

REFERENCES 51

APPENDIX 53

Page 3: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 3

LIST OF FIGURES

FIGURE NO. NAME PAGE NO.

1.1 Basic block diagram 8

2.1 Gantt chart 10

2.2 Milestones and targets set 11

2.3 Milestones and targets achieved 11

3.1 Traditional Scheme 15

3.2 Straightforward Network Coding 16

3.3 Physical-Layer Network Coding 16

3.4 BPSK transmitter 18

3.5 BPSK receiver 18

3.6 BPSK Modulation 19

3.7 QPSK transmitter 20

3.8 QPSK receiver 21

3.9 QPSK modulation 21

4.1 Complete Simulink model for PNC using BPSK 26

4.2 Simulink model for BPSK modulation 28

4.3 Simulink model for mapper at relay 29

4.4 Simulink model for BPSK demodulation 29

4.5 Simulink model for XOR operation performed at the nodes 30

4.6 Simulink model for PNC using QPSK 33

4.7 Simulink model for even and odd bits generation 34

4.8 Simulink model for QPSK modulation 34

4.9 Simulink Model for Mapper at the relay 35

4.10 Simulink model for QPSK demodulation 35

4.11 Simulink Model for XOR operation performed at the nodes 36

5.1 BPSK modulation at node 1 40

5.2 BPSK modulation at node 2 40

5.3 Received data at relay 41

5.4 Mapping process outputs 41

5.5 BPSK demodulation 42

Page 4: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 4

FIGURE NO. NAME PAGE NO.

5.6 Output at node 1 42

5.7 Output at node 2 43

5.8 Iphase and qphase components at node 1 43

5.9 Iphase and qphase components at node 2 44

5.10 Mapped iphase output 44

5.11 Mapped qphase output 45

5.12 Iphase demodulation 45

5.13 Qphase demodulation 46

5.14 Output at node 1 46

5.15 Output at node 2 47

5.16 BER comparison of BPSK, QPSK and PNC 47

5.17 Throughput comparison for TS, SNC and PNC 48

LIST OF TABLES

TABLE NO. NAME PAGE NO.

2.1 Work distribution 12

4.1 PNC mapping using BPSK 24

4.2 Received data at nodes 1 and 2 (BPSK) 25

4.3 PNC mapping using QPSK 31

4.4 Received data at nodes 1 and 2 (QPSK) 31

Page 5: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 5

CHAPTER 1

PREAMBLE

Page 6: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 6

CHAPTER 1

PREAMBLE

1.1 INTRODUCTION

One of the biggest challenges in the wireless communication research is to deal with

the interference at the receiver when signals from multiple sources arrive

simultaneously. In the radio channel of the physical layer of wireless networks, data

are transmitted through electromagnetic (EM) waves in a broadcast manner. The

interference between these EM waves causes the data to be scrambled.

To overcome its negative impact, most schemes attempt to find ways to either reduce

or avoid interference through receiver design or transmission scheduling. For

example, in 802.11 networks, the carrier-sensing mechanism manages the nodes

within the same broadcast range so that at most one source can transmit or receive at

any time. However, network coding arithmetic is generally only applied on bits that

have already been correctly received. That is, when the EM waves from multiple

sources overlap and mutually interfere, network coding cannot be used to resolve the

data at the receiver.

This project proposes the application of network coding directly within the radio

channel at the physical layer. We call this scheme Physical-layer Network Coding

(PNC). The main idea of PNC is to make use of a technique similar to network

coding, but at the physical layer that deals with EM signal reception and modulation.

We show that PNC requires only two time slots for the two end nodes to exchange

two frames, one in each direction, via the middle relay node. By contrast, three time

slots are needed in straightforward network coding, and four time slots are needed if

network coding is not used at all.

Page 7: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 7

1.2 OVERVIEW

A main distinguishing feature of a wireless network compared with a wired network

is its broadcast nature, in which the signal transmitted by a node may reach several

other nodes, and a node may receive signals from several other nodes simultaneously.

Rather than a blessing, this feature is treated more as an interference-inducing

nuisance in most wireless networks today .In this project we have tried to bring out

this advantage by simulating a wireless transmission scheme intended to work at the

physical layer.

The simulation of PNC using different modulation techniques has been performed

using Simulink. The various issues faced while trying to implement hardware were

low cost, low power transmitters and receivers are not feasible. PNC requires tight

synchronization due to which complexity in implementation increases. Mapping at

relay is not similar to normal demodulation techniques because of which a new

complex mapping system needs to be designed which in turn increases the cost. Thus,

hardware implementation of the project was not feasible. Instead of the same, BER

analysis and Throughput Comparison was simulated in MatLab.

Page 8: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 8

1.3 BASIC BLOCK DIAGRAM

The basic block diagram of PNC can be shown in Fig. 1.1. It consists of two user

nodes, the channel, the node acting as a relay consists of demodulator, PNC mapper

and the modulator.

Fig. 1.1 Basic block diagram of physical layer network coding

Input data at user nodes 1 and 2 are modulated and sent to relay node at the same time

in one time slot. Relay demodulates the superimposed received signal and maps it to

the XORed signal. This XORed signal is modulated and broadcasted back to two

nodes in one timeslot. Each node demodulates and decodes the received signal by

performing XOR operation using its own data in order to obtain the data sent from

other user.

Different modulation techniques like BPSK, QPSK are used for Physical Layer

Network Coding which is discussed in later chapters.

Page 9: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 9

CHAPTER 2

PROJECT PLANNING

Page 10: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 10

CHAPTER 2

PROJECT PLANNING

2.1 ACTIVITIES AND GANTT CHART

Fig. 2.1 Gantt chart

Page 11: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 11

2.2 MILESTONES AND TARGETS

Fig. 2.2 Milestones and Targets set

Fig. 2.3 Milestones and targets achieved

Page 12: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 12

2.3 WORK EXECUTION

The various Software based works which includes Simulink models, algorithm

formulation and coding were divided among the team members present in the group

and the table 2.1 shows the same.

SL

NO.

TASK TEAM MEMBERS

1 Simulink model for BPSK

modulation and demodulation

Sumeet and Abhilash

2 Simulink model for BPSK -

PNC mapping

Meghana and Vishruth

3 Simulink model for QPSK

modulation and demodulation

Meghana and Vishruth

4 Simulink model for QPSK -

PNC mapping

Sumeet and Abhilash

5 BER analysis of BPSK,

QPSK and PNC

Meghana and Vishruth

6 Throughput Comparison for

PNC, SNC and TS

Sumeet and Abhilash

Table 2.1 Work distribution

Page 13: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 13

CHAPTER 3

LITERATURE REVIEW

Page 14: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 14

CHAPTER 3

LITERATURE REVIEW

Wireless networks have been designed using the wired network as the blueprint. The

design abstracts the wireless channel as a point-to-point link, and grafts wired

network protocols onto the wireless environments. For example, routing uses shortest

path protocols, routers forward packets but do not modify the data, and reliability

relies on retransmissions. The design has worked well for wired networks, but less so

for the unreliable and unpredictable wireless medium.

Wireless networks have been designed using the wired network as the blueprint. The

design abstracts the wireless channel as a point-to-point link, and grafts wired

network protocols onto the wireless environments. For example, routing uses shortest

path protocols, routers forward packets but do not modify the data, and reliability

relies on retransmissions. The design has worked well for wired networks, but less so

for the unreliable and unpredictable wireless medium.

3.1 NETWORK CODING SCHEMES

It is a simple fact in physics that when multiple EM waves come together within the

same physical space, they add. This mixing of EM waves is a form of network

coding, performed by nature. Network coding has aroused a lot of attention for its

potential to enhance the throughput and robustness of multicast networks. It has been

realized by performing linear operations, such as logic exclusive-OR (XOR), on two

signals at the network layer, so as to share the same network link and reduce the

required network resources. There are various schemes of network coding. The three

main schemes of network coding discussed here are Traditional scheme (TS),

Straightforward Network Coding scheme (SNC) and Physical-Layer Network Coding

scheme (PNC).

Page 15: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 15

3.1.1 TRADITIONAL SCHEME (TS)

Without the use of network coding, and with a design principle that tries to avoid

interference, a total of four time slots are needed to exchange two packets, one in each

direction.

Fig. 3.1 Traditional Scheme

This is illustrated in Fig. 3.1. In time slot 1, node 1 transmits a packet S1 to relay R;

in time slot 2, relay R forwards S1 to node 2; in time slot 3, node 2 transmits a packet

S2 to relay R; and in time slot 4, relay R forwards S2 to node 1. This technique is

commonly called Traditional scheme (TS).

3.1.2 STRAIGTHFORWARD NETWORK CODING (SNC)

A straightforward way of applying network coding can reduce the number of time

slots to three. We shall refer to this non-physical-layer network coding scheme simply

as straightforward network coding (SNC). By reducing the number of time slots from

four to three, SNC has a throughput improvement of 33% over TS. As shown in

figure 3.2, in time slot 1, node 1 transmits S1 to relay R; and in time slot 2, node 2

transmits S2 to relay R. After receiving S1 and S2, relay R forms a network-coded

packet SR. In time slot 3, relay R broadcasts SR to both nodes 1 and 2.

Page 16: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 16

Fig. 3.2 Straightforward Network Coding Scheme (SNC)

3.1.3 PHYSICAL LAYER NETWORK CODING (PNC)

Physical-layer network coding (PNC) has been proposed to further improve the

network throughput. Instead of avoiding physical-layer interference, PNC exploits the

interference of two signal frames so as to increase network capacity. PNC further

reduces the number of time slots to two. It allows nodes 1 and 2 to transmit together

and exploits the network coding operation performed by nature in the superimposed

EM waves. By doing so, PNC can improve the performance of TS by 100%.

Fig. 3.3 illustrates the idea. In the first time slot, nodes 1 and 2 transmit S1 and S2

simultaneously to relay R. Based on the superimposed EM waves that carry S1 and S2

, relay R deduces SR = S1 ⊕ S2. Then, in the second time slot, relay R broadcasts SR

to nodes 1 and 2.

Fig. 3.3 Physical Layer Network Coding (PNC)

Physical Layer Network Coding which is made use of in this project is explained in

detail later using different modulation techniques. But first, we need to know about

Page 17: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 17

the different modulation techniques and how these modulation techniques are applied

to PNC. They are explained in the later chapters.

3.2 DIGITAL MODULATION TECHNIQUES

Modulation is defined as the process by which some characteristics of a carrier is

varied in accordance with a modulating wave. The fundamental concept of digital

communication is to move digital information from one point to another over an

analog channel. More specifically, passband digital communication involves

modulating the amplitude, phase or frequency of an analog carrier signal with a

baseband information-bearing signal. By definition, frequency is the time derivative

of phase; therefore, we may generalize phase modulation to include frequency

modulation. Ordinarily, the carrier frequency is much greater than the symbol rate of

the modulation, though this is not always so. In many digital communications

systems, the analog carrier is at a radio frequency (RF), hundreds or thousands of

MHz’s. The two main modulation techniques which we are concentrating here are

BPSK and QPSK.

3.2.1 BINARY PHASE SHIFT KEYING (BPSK)

Binary phase shift keying (BPSK) is the simplest form of digital phase modulation.

For BPSK, each symbol consists of a single bit. Accordingly, we must choose two

distinct values, one to represent 0, and one to represent 1.

1( ) cos(2 )bc

b

ES t f tT

; for symbol 1

2 ( ) cos(2 ) - cos(2 )b bc c

b b

E ES t f t f tT T

; for symbol 0

In the case of PSK, there is only one basis function of Unit energy which is given by

12( ) cos(2 )cb

t f tT

; 0 bt T

Therefore the transmitted signals are given by

Page 18: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 18

1 1( ) ( )bS t E t ; 0 bt T ; for symbol 1

2 1( ) ( )bS t E t ; 0 bt T ; for symbol 0

Block diagram of a BPSK transmitter can be shown in the figure 3.4.

Fig. 3.4 BPSK Transmitter

Block diagram of a BPSK Receiver can be shown in the figure 3.5.

Fig. 3.5 BPSK Receiver

PRODUCT MODULATOR

BINARY DATA SEQUENCE

BINARY PSK SIGNAL

Choose 1 if x1>0

Choose 0 if x1<0

THRESHOLD

DECISION DEVICE

Page 19: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 19

BPSK modulated signal can be shown in the figure 3.6.

Fig. 3.6 BPSK Modulation

3.2.2 QUADRATURE PHASE SHIFT KEYING (QPSK)

Digital phase modulation need not be limited to the simple binary case. By grouping

bits together and choosing the phase modulation accordingly, we obtain M-ary PSK.

BPSK is the result when M = 2. For M = 4, we group the bits into pairs, called

‘dibits’, and the resulting signal is known as quadrature phase shift keying (QPSK).

The mathematical analysis shows that QPSK can be used either to double the data

rate compared with a BPSK system while maintaining the same bandwidth of the

signal, or to maintain the data-rate of BPSK but halving the bandwidth needed.

In QPSK system the information carried by the transmitted signal is contained in the

phase. The transmitted signals are given by

Page 20: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 20

2( ) cos 2 2 14

sn c

s

ES t f t nT

; n = 1,2,3,4.

In the case of QPSK, basis functions of Unit energy which is given by

12( ) cos 2 c

s

t f tT

22( ) sin 2 cs

t f tT

Block diagram of a QPSK transmitter can be shown in the figure 3.7.

Fig. 3.7 QPSK Transmitter

Block diagram of a QPSK receiver can be shown in the figure 3.8.

QPSK SIGNAL

BINARY SIGNAL

DEMULTIPLEXER

Page 21: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 21

Fig. 3.8 QPSK receiver

QPSK modulated signal can be shown in the figure 3.9.

Fig. 3.9 QPSK Modulation

OUTPUT BINARY SIGNAL

MUX

DECISION DEVICE

DECISION DEVICE

RECEIVED SIGNAL

Page 22: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 22

3.3 .1 MATLAB

The name MATLAB stands for MATrix LABoratory. MATLAB was written

originally to provide easy access to matrix software developed by the LINPACK

(linear system package) and EISPACK (Eigen system package) projects. MATLAB is

a high-performance language for technical computing. It integrates computation,

visualization, and programming environment. Furthermore, MATLAB is a modern

programming language environment: it has sophisticated data structures, contains

built-in editing and debugging tools, and supports object-oriented programming.

These factors make MATLAB an excellent tool for teaching and research. MATLAB

has many advantages compared to conventional computer languages (e.g. C,

FORTRAN) for solving technical problems. MATLAB is an interactive system

whose basic data element is an array that does not require dimensioning. The software

package has been commercially available since 1984 and is now considered as a

standard tool at most universities and industries worldwide.

It has powerful built-in routines that enable a very wide variety of computations. It

also has easy to use graphics commands that make the visualization of results

immediately available. Specific applications are collected in packages referred to as

toolbox. There are toolboxes for signal processing, symbolic computation, control

theory, simulation, optimization, and several other fields of applied science and

engineering.

3.3.2 SIMULINK

Simulink is an environment for simulation and model-based design for dynamic and

embedded systems. It provides an interactive graphical environment and a

customizable set of block libraries that let you design, simulate, implement, and test a

variety of time-varying systems, including communications, controls, signal

processing, video processing, and image processing.

Simulink offers a quick way of develop your model in contrast to text based-

programming language such as e.g., C. Simulink has integrated solvers. In text based-

programming language such as e.g., C you need to write your own solver.

Page 23: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 23

CHAPTER 4

DESIGN AND IMPLEMENTATION

Page 24: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 24

CHAPTER 4

DESIGN AND IMPLEMENTATION

4.1 .1 PNC USING BPSK

Two neighboring nodes transmit simultaneously to a common receiver. Assuming

perfect transmission synchronization in physical layer, based on the additive nature of

simultaneously arriving electromagnetic (EM) waves, the receiver detects the added

signal of the two transmitted modulated signals. Using a suitable mapping scheme,

they show that for certain modulation schemes, there exists a mapping scheme such

that the relationship between the two transmitted binary bits and the decoded binary

bit follows the XOR principle.

We here revisit the PNC operation and its mapping scheme to achieve the XOR

principle. Consider two senders, N1 and N3, and a common receiver N2. Let a1 and a3

be the binary bit transmitted by N1 and N3 at a particular time respectively, and a2 be

the decoded binary bit. Based on BPSK modulation, we have

2 1 3 1 3sin 2 sin 2 sin 2c c cr t a f t a f t a a f t

Where r2(t) is the received signal, a1 and a3 are the transmitted amplitudes, and fc is

the carrier frequency.

PNC mapping for BPSK can be shown in the Table 4.1

Table 4.1 PNC Mapping using BPSK

Page 25: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 25

Data received at Nodes 1 and 2 can be shown in the Table 4.2

Table 4.2 Received data at Nodes 1 and 2

Using Simulink, a model for PNC using BPSK modulation can be shown in the figure

4.1.

Page 26: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 26

Fig. 4.1 Complete Simulink model for PNC using BPSK

Page 27: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 27

Blocks used in the simulink models of PNC using BPSK

• Bernoulli Binary Generator

The Bernoulli Binary Generator block generates random binary numbers using

a Bernoulli distribution. The Bernoulli distribution with parameter p produces

zero with probability p and one with probability 1-p.

• Sine Wave

The Sine Wave block provides a sinusoid.

• Switch

The Switch block passes through the first input or the third input based on the

value of the second input. The first and third inputs are called data inputs. The

second input is called the control input.

• Inport

Inport blocks are the links from outside a system into the system.

• Outport

Outport blocks are the links from a system to a destination outside the system.

• Scope

The Scope block displays its input with respect to simulation time. The Scope

block can have multiple axes (one per port); all axes have a common time

range with independent y-axes. The Scope allows you to adjust the amount of

time and the range of input values displayed.

• Unit delay

The Unit Delay block delays its input by the specified sample period.

• Logical Operator

The Logical Operator block performs the specified logical operation on its

inputs. An input value is TRUE (1) if it is nonzero and FALSE (0) if it is zero.

• Sample and Hold

The Sample and Hold block acquires the input at the signal port whenever it

receives a trigger event at the trigger port. The block then holds the output at

the acquired input value until the next triggering event occurs.

• Clock

Digital clock for logic systems.

Page 28: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 28

• Quantizer

The Quantizer block passes its input signal through a stair-step function so

that many neighboring points on the input axis are mapped to one point on the

output axis. The effect is to quantize a smooth signal into a stair-step output.

• Compare to constant

The Compare To Constant block compares an input signal to a constant.

• Abs

The Abs block outputs the absolute value of the input.

• Gain

The Gain block multiplies the input by a constant value (gain).

Fig. 4.2 Simulink model for BPSK Modulation

Figure 4.2 shows Simulink model for BPSK modulation. The binary data at the nodes

is given to the BPSK modulator which generates a signal of high frequency and two

different phases. Bit 1 is represented by a sinusoidal wave and bit 0 is represented by

a sinusoidal wave out of phase by 180 degrees.

When the modulated signals are transmitted wirelessly they interfere which leads to

an added up BPSK signal. The added up bpsk signal is given to a sample and hold

circuit. The output is then applied to various stages of digitization to obtain the pnc

mapped signal. The mapping process is carried out using the model shown in the

figure 4.3.

Page 29: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 29

Fig. 4.3 Simulink Model for Mapper at the relay

Figure 4.4 shows BPSK demodulation. At the nodes the received signal is

demodulated using a product modulator, the output of which is given to a filter. Then

by comparative and logical operations the data is obtained.

Fig. 4.4 Simulink model for BPSK Demodulation

Page 30: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 30

Fig. 4.5 Simulink model for XOR operation performed at the nodes.

Figure 4.5 shows the Simulink model used to obtain the data from other node by

XORing it data present at its own node

4.1.2 PNC USING QPSK

Let us assume the use of QPSK modulation in all the nodes. We further assume

symbol-level and carrier-phase synchronization, and the use of power control, so that

the frames from N1 and N3 arrive at N2 with the same phase and amplitude. The

combined passband signal received by N2 during one symbol period is

2 1 3

2 1 1 3 3

2 1 3 1 3

cos(2 ) b sin(2 ) cos(2 ) b sin(2 )

( ) cos(2 ) b b sin(2 )c c c c

c c

S t S t S t

S t a f t f t a f t f t

S t a a f t f t

PNC mapping for QPSK can be shown in the Table 4.3

Page 31: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 31

Table 4.3 PNC Mapping using QPSK

Data received at Nodes 1 and 2 can be shown in the Table 4.4

Table 4.4 Received data at nodes 1 and 2

Using Simulink, a model for PNC using QPSK modulation can be shown in the figure

4.6.

Blocks used in the simulink models of PNC using QPSK are

• Real-Imag to complex

The Real-Imag to Complex block converts real and/or imaginary inputs to a

complex-valued output signal.

• Data Type Conversion

The Data Type Conversion block converts an input signal of any Simulink

data type to the data type and scaling specified by the block's Output data type

parameter.

• Constant

The Constant block generates a real or complex constant value.

• D Flip Flop

The block satisfies the truth table of a D-flip flop.

• Unipolar to bipolar

Page 32: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 32

The Unipolar to Bipolar Converter block maps the unipolar input signal to a

bipolar output signal.

• Sign

The Sign block indicates the sign of the input:The output is 1 when the input

is greater than zero.The output is 0 when the input is equal to zero.The output

is -1 when the input is less than zero.

Page 33: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 33

Fig. 4.6 Simulink Model for PNC using QPSK

Page 34: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 34

Fig. 4.7 Simulink Model for Even and odd bits generation

In QPSK, the input data is splitted into even and odd bits. These even and odd bits are

modulated using sinosoidal waveforms known as in-phase and quadrature-phase

components. The in-phase and quadrature-phase components are obtained from the

Simulink model shown in the figure 4.7. The iphase and qphase components are

modulated using the model shown in the figure 4.8.

Fig. 4.8 Simulink model for QPSK Modulation

The iphase and qphase components are combined to form a complex signal. The

complex signals from both the nodes are sent to the realy. They get added up in the

Page 35: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 35

channel. The iphase and qphase signals are obtained back from the complex signal.

These signas is given to a sample and hold circuit. The outputs are then applied to

various stages of digitization to obtain the pnc mapped signals. The mapping process

is carried out using the model shown in the figure 4.9.

Fig. 4.9 Simulink Model for Mapper at the relay

Fig. 4.10 Simulink Model for QPSK Demodulation

Page 36: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 36

Figure 4.10 shows QPSK demodulation. At the nodes the received signal is

demodulated using a product modulator, the output of which is given to a filter. Then

by comparative and logical operations the data is obtained

The ouput at node 1 is obtained by XORing the received data with its own data.

Similarly, at node 2 also. Simulink model used for the same is shown in the figure

4.11.

Fig. 4.11 Simulink Model for XOR operation performed at the nodes

4.2 .1 BIT ERROR RATE

In digital transmission, the number of bit errors is the number of received bits of

a data stream over a communication channel that has been altered due

to noise, interference, distortion or bit synchronization errors.

The bit error rate or bit error ratio (BER) is the number of bit errors divided by the

total number of transferred bits during a studied time interval. BER is a unit less

performance measure, often expressed as a percentage.

The bit error probability pe is the expectation value of the BER. The BER can be

considered as an approximate estimate of the bit error probability. This estimate is

accurate for a long time interval and a high number of bit errors.

Page 37: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 37

In a communication system, the receiver side BER may be affected by transmission

channel noise, interference, distortion, bit synchronization problems, attenuation,

wireless multipath fading, etc.

The BER may be improved by choosing a strong signal strength (unless this causes

cross-talk and more bit errors), by choosing a slow and robust modulation scheme

or line coding scheme, and by applying channel coding schemes such as

redundant forward error correction codes.

The transmission BER is the number of detected bits that are incorrect before error

correction, divided by the total number of transferred bits (including redundant error

codes). The information BER, approximately equal to the decoding error probability,

is the number of decoded bits that remain incorrect after the error correction, divided

by the total number of decoded bits (the useful information). Normally the

transmission BER is larger than the information BER. The information BER is

affected by the strength of the forward error correction code.

4.2.2 ALGORITHMS FOR BER ANALYSIS

The following algorithm was implemented in matlab for BER analysis of BPSK and

QPSK:

• Random input is generated and modulated.

• For a set of SNR values, Random noise is is generated and added to the

modulated signal.

• Signum function is used to convert the sinosoidal signal received back to bits.

• The number of error bits is calculated from the transmitted and received bits

and BER is computed.

The following algorithm was implemented in matlab for BER analysis of PNC:

• Two Random inputs are generated and modulated.

• These two signals get added up and are received at the relay.

• For a set of SNR values, Random noise is is generated and added to the

received modulated signal.

• Signum function is used to convert the sinosoidal signal received back to bits.

Page 38: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 38

• The number of error bits is calculated from the transmitted(i.e. XOR of

transmitted inputs) and received bits and BER is computed.

4.2.3 ALGORITHM FOR THROUGHPUT COMPARISON

The following algorithm was implemented in matlab for throughput comparison of

Traditional Scheme(TS), Straightforward Network Coding(SNC) and Physical-Layer

Network Coding(PNC).

Throughput is Calculated for TS, SNC and PNC considering a range of

number of nodes upto 50 starting from 1.

Throughput comparison is done for the obtained values and the results are

plotted.

Page 39: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 39

CHAPTER 5

RESULTS AND DISCUSSION

Page 40: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 40

5.1 PNC USING BPSK

Considering the simulation of PNC using BPSK in the previous chapters, modulated

outputs at both the nodes that need to be transmitted are shown in figures 5.1 and 5.2.

The digital data is being sent at amplitude of 1V and the carrier signal also has

amplitude of 1V. The corresponding BPSK signal has amplitude of 1V.

Fig. 5.1 BPSK Modulation at node 1

Fig. 5.2 BPSK Modulation at node 2

When the modulated signals are transmitted wirelessly they interfere which leads to

an added up BPSK signal. At the relay the two BPSK modulated signals get added up

yielding a signal in the range of -2V to +2V.The ouput waveforms of the same is

shown in the figure 5.3.

Page 41: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 41

Fig. 5.3 Received data at relay

The output is then applied to various stages of digitization to obtain the PNC mapped

signal. The mapping process outputs obtained are shown in figure 5.4.

Fig. 5.4 mapping process outputs

To get the data back, we give the BPSK modulated signal to the product modulator

which yields a signal in the range -1V to +1V. The output of the filter and then the

comparator both yield a signal with amplitude 1V. The output waveforms of the same

are shown in the figure 5.5.

Page 42: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 42

Fig. 5.5 BPSK Demodulation

From the waveforms obtained as shown in the figures 5.6 and 5.7, we can infer that

the input signal and the received signal do not vary in their amplitude but received

signal has a slight delay.

Fig. 5.6 Output at node 1

Page 43: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 43

Fig. 5.7 Output at node 2

5.2 PNC USING QPSK

Considering the simulation of PNC using QPSK in the previous chapters, iphase and

qphase components required for QPSK modulation obtained are shown in figures 5.8

and 5.9 at nodes 1 and 2 respectively.

Fig. 5.8 Inphase and Quadrature phase components at node 1

Page 44: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 44

Fig. 5.9 Inphase and Quadrature phase components at node 2

The output is then applied to various stages of digitization to obtain the PNC mapped

signal. The mapping process of inphase and qphase outputs obtained are shown in

figures 5.10 and 5.11.

Fig. 5.10 mapped in-phase output

Page 45: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 45

Fig. 5.11 mapped q-phase output

To get the data back, we give the iphase and qphase components of QPSK modulated

signal to the product modulator which yields a signal in the range -1V to +1V. The

output of the filter and then the comparator both yield a signal with amplitude 1V.

The output waveforms of the same are shown in the figures 5.12 and 5.13.

Fig. 5.12 Iphase Demodulation

Page 46: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 46

Fig. 5.13 Qphase Demodulation

Fig. 5.14 Output at node 1

From the waveforms obtained as shown in the figures 5.14 and 5.15, we can infer

that the input signal and the received signal do not vary in their amplitude but

received signal has a slight delay.

Page 47: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 47

Fig. 5.15 Output at node 2

5.3 BER COMPARISON FOR BPSK,QPSK AND PNC

Using MATLAB, BER analysis for BPSK, QPSK and PNC is performed and the results is shown in the figure 5.16. It is observed that BER analysis of PNC is comparable to that of BPSK and QPSK and hence PNC can be used for wireless transmission.

Fig. 5.16 BER comparison of BPSK, QPSK and PNC

Page 48: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 48

5.4 THROUGHPUT COMPARISON

Using MATLAB, Throughput Comparison for TS, SNC and PNC is performed and

the results is shown in the figure 5.17. And in doing so, PNC can potentially achieve

100% and 50% throughput increases compared with traditional transmission and

straightforward network coding, respectively, in multi-node networks.

Fig. 5.17 Throughput Comparison for TS,SNC and PNC

Page 49: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 49

CHAPTER 6

CONCLUSION AND FUTURE

SCOPE

Page 50: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 50

CHAPTER 6

CONCLUSION AND FUTURE SCOPE

6.1 CONCLUSION

This project has introduced a novel scheme called Physical-layer Network Coding

(PNC) that significantly enhances the throughput performance of multi-hop wireless

networks. Instead of avoiding interference caused by simultaneous electromagnetic

waves transmitted from multiple sources, PNC embraces interference to effect

network-coding operation directly from physical-layer signal modulation and

demodulation. With PNC, signal scrambling due to interference, which causes packet

collisions in the MAC layer protocol of traditional wireless networks (e.g., IEEE

802.11), can be eliminated. For PNC to be feasible, network-coding arithmetic must

be realized with direct electromagnetic-wave mixing, coupled with appropriate

modulation and demodulation schemes.

PNC using BPSK and QPSK is simulated using Simulink. BER analysis is done for

BPSK, QPSK and PNC using MATLAB and expected results are obtained.

6.2 FUTURE SCOPE

The concept of PNC can not only be applied using phase modulation schemes but

also for frequency modulation schemes and OFDM. Here, we assume the carrier

frequencies and the symbol duration should be same. But, if the carrier frequencies

and symbol duration vary for different users, then the PNC mapping schemes and the

demodulation techniques vary. When multiple nodes are trying to communicate

between them, then the user nodes must act as a relay also, because at any given point

of time only two nodes can communicate. A scheduling algorithm should be

implemented so that which node transmits its data at a given time.

Page 51: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 51

REFERENCES

[1] Simon Haykin, Communication Systems, Wiley, 4th edition, 2001

[2] Physical Layer Network Coding, Shengli Zhang, Soung-Chang Liew, and Patrick, P. K. Lam

[3] Physical-layer network coding: Tutorial, survey, and beyond, Soung Chang Liew,

Department of Information Engineering, The Chinese University of Hong Kong, Hong

Kong, Shengli Zhang, Lu Lu, Department of Communication Engineering, Shenzhen

University, China

[4] http://en.wikipedia.org/wiki/Linear_network_coding

[5] http://en.wikipedia.org/wiki/Phase-shift_keying

Page 52: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 52

APPENDIX

Page 53: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 53

LIST OF ABBREVIATIONS

ABBREVIATION DEFINITION

BER Bit Error Rate

BPSK Binary Phase Shift Keying

EM Electro Magnetic

MATLAB Matrix Laboratory

PNC Physical-Layer Network Coding

QPSK Quadrature Phase Shift Keying

RF Radio Frequency

RX Receiver

SNC Straightforward Network Coding

TS Traditional Scheme

XOR eXclusive-OR

Page 54: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 54

USER MANUAL

PROJECT TITLE: SIMULATION AND ANALYSIS OF PHYSICAL LAYER

NETWORK CODING

PROJECT NO.: PES13FYP11

GROUP MEMBERS: MEGHANA M PATIL 1PE10EC059

VISHRUTH D 1PE10EC118

SUMEET KUMAR 1PE09EC097

ABHILASH AM 1PE11EC400

GUIDE: ASST. PROFESSOR HRUSHIKESHA SHASTRY B S

Page 55: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 55

ABOUT THE PROJECT:

This project shows that the concept of network coding can be applied at the physical layer to

turn the broadcast property into a capacity-boosting advantage in wireless networks. In

contrast to “straightforward” network coding which performs coding arithmetic on digital bit

streams after they have been received, PNC makes use of the additive nature of

simultaneously arriving electromagnetic (EM) waves for equivalent coding operation. And in

doing so, PNC can potentially achieve 100% and 50% throughput increases compared with

traditional transmission and straightforward network coding, Respectively.

CONCEPT:

MA Phase - Multiple Access Phase

BC Phase - Broadcast Phase

In multiple access phase, the two users transmit their data simultaneously that results in

interference. This signal is received by the relay.

In broadcast phase, the relay performs physical layer network coding and the coded signal is

transmitted simultaneously to the nodes.

The nodes perform demodulation and xor the data received with its data to obtain the other

nodes data.

Page 56: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 56

The concept of physical layer network coding can be applied to

MIMO wireless networks.

A pair-to-pair wireless routing paradigm can be enabled by PNC.

Light is also a form of EM wave, hence PNC can be applied for light wave

communication.

GSM Satellites and other wireless networks.

BLOCK DIAGRAM:

Input data at user nodes 1 and 2 are modulated and sent to relay node at the same time

in one time slot. Relay demodulates the superimposed received signal and maps it to

the XORed signal. This XORed signal is modulated and broadcasted back to two

nodes in one timeslot. Each node demodulates and decodes the received signal by

performing XOR operation using its own data in order to obtain the data sent from

other user.

Page 57: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 57

USING SIMULINK

Open MATLAB and select SIMULINK tool as shown in the figure 1

Using Simulink

Simulink Library Browser

Page 58: Report 1 Final

SIMULATION AND ANALYSIS OF PHYSICAL LAYER NETWORK CODING

Dept of ECE, PESIT-BSC 58

The Simulink Library Browser is the library where you find all the blocks you may

use in Simulink. Simulink software includes an extensive library of functions

commonly used in modelling a system.

Open the Simulink model from the library

Click on the run button on the toolbar

Click on the various scopes to view the output waveforms

The toolbar of the scope has options for changing the axis parameter to enable

the user for proper analysis of the waveform.