Vous êtes sur la page 1sur 17

Cooperative Relaying

Matlab Prototype Report


Green Group, 2008-04-29
Abstract
The Matlab prototype in our project includes two parts: First, the Matlab simulation of
the three-node communication system including Source, Relay, and Destination
nodes. We simulate three different types of relaying protocols (Amplify-and-forward,
Decode-and-forward, Detect-and-forward) and then provide the comparison and
analysis of the results. Second, the data transmission from one instance of Matlab
running on one node to another instance of Matlab running on another node through
the Rayleigh fading channel on DSP board(a SISO system). We then provide the BER
performance of this SISO system.
1 SISO system
Bit source Channel Transmitter Receiver Bit sink
Figure 1 SISO system
The SISO system is the basic idea of this project. It consists of a bit source,
transmitter, channel, receiver, and a bit sink. The bit source generates a stream of
information bits to be transmitted by the transmitter. Typically, we employ a random
bit generator as a bit source in simulations. The transmitter encodes the bits into
coded bits by using the channel encoder and then appends the guard bits and training
1
bits at the beginning of the coded bits and converts these bits into symbols and applies
pulse shaping in order to have the proper bandwidth of transmitted signal before
transmitting through the band-limited channel.
At this point we have the frame of information. The transmitter also up-converts the
information frame into the pass band signal and then feed through a channel, which is
a Rayleigh fading channel with limited bandwidth. The receiver block will do
processing frame-by-frame; first takes the output from the channel, estimates timing
and channel coefficients, demodulates the received symbols into bits, and decode
these bits into the information bits which are fed to the bit sink. In our simulation, the
bit sink simply counts the number of errors that occurred to gather statistics used for
investigating the performance of the system (Bit error probability).
The following parts will provide the details and algorithms that we have used to
simulate the system in our project.
1.1 Transmitter
Training sequence
& Guard bits
Channel encoder
Symbol
mapping
Up-sample &
Pulse shaping
Carrier
modulation
Carrier
modulation
Other
Baseband
waveforms
Add Pilot &
Zeros
Frame
Multiplexing
Appending
Figure 2 Transmitter
The transmitter basically contains blocks of processing units that work together to
transmit the information bits in the appropriate form corresponding to the channel
characteristics. The details of each block are provided in the following.
1.1.1 Channel Encoder
We use 1/2 rate convolution channel coding and use Viterbi algorithm for decoding at
the receiver.
T T
Input Bit
Sequence
Output Bit
Sequence
R
c
=2R
b
R
b
X
Y2
Y1
Figure 3 1/2 rate Convolution Channel Encoding
2
1.1.2 Training sequence
In the system, training sequences are used for synchronization, channel estimation,
and SNR estimation at the receiver. The correlation properties of the training
sequence are important as they affect the estimation accuracy. Ideally, the
autocorrelation function for the training sequence should equal a delta pulse. In this
project, a Maximum-length shift-register sequence (M-sequence) of length 32 bits is
used and the autocorrelation is shown in Figure 4.
0 10 20 30 40 50 60 70
-0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
Figure 4 Autocorrelation of the training sequence
1.1.3 Guard bits
The guard bits are used to provide tolerance of error due to the frame synchronization.
We simply use bit-1 of length 12 for this guard bits.
1.1.4 Frame structure
In the project, we use 256 information bits with 12 guard bits and 32 Training bits
sequence in the beginning of every frame.
A packet consists of 40 frames and a pilot sequence of length 128 is also added for
packet synchronization in the beginning. In order to compensate the delay and the
transient effect of real channel, 1000 zeros and 2328 zeros are added in the beginning
and end, respectively (according to experiment).
3
.
Frame
#1
Frame
#3
Frame
#2
Frame
#40
P Z Z
Zeros at the
beginning of packet
Pilot
sequence
512 coded bits (256 Information bit) 32 Training 12 Guard
Zeros at the end
of packet
Figure 5 Frame structure
1.1.5 Modulation (Symbol mapping)
QPSK modulator with Gray mapping for the data is used in our system. For the
inverse mapping from symbols to bits, we use hard decision. The constellation of
QPSK with Gray mapping is shown in Figure 6.
X 00
X 01
X 10
X 11
Q
I
Figure 6 Constellation of QPSK
1.1.6 Upsampling
8
{1,2} {1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0}
Figure 7 Upsampling
We simulate the upsampled system by using upsampling factor Q =8 to provide an
ease and accuracy in processing at the receiver. This upsampling is done by inserting
7 zeros between every symbol.
1.1.7 Pulse shaping
A (truncated) root raised cosine pulse is used in our system because it has much
improved spectral properties than a rectangular pulse shape. The root raised cosine
pulse (with roll-off factor= 0.22) used in our system is shown in Figure 8.
4
0 10 20 30 40 50 60 70 80 90
-0.1
-0.05
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
Figure 8 Root raised cosine pulse (with roll-off factor= 0.22)
-25 -20 -15 -10 -5 0 5 10 15 20 25
0
0.5
1
1.5
2
2.5
3
f/KHz
Figure 9 Root raised cosine pulse in frequency domain
And after pulse shaping, the signal is limited within the bandwidth of the real channel
9.6Khz.(See Figure 10). We can also calculate the approximated bandwidth of the
transmitted signal as follows
1 1 0.22
{ } 48000 7.32
8 s
Q
B T kHz
T F
+ +

5
-25 -20 -15 -10 -5 0 5 10 15 20 25
0
200
400
600
800
1000
1200
1400
f (KHz)
The baseband transmitted signal
Figure 10 Transmitted signals in baseband
1.1.8 Up-conversion
Complex baseband
exp( 2 )
c
s
f
j n
f

I jQ +
cos(2 ) sin(2 )
c c
s s
f f
I n Q n
f f
+
sin(2 ) cos(2 )
c c
s s
f f
I n Q n
f f
+
I-component
Q-component
Figure 11 Up-conversion
Up-conversion is used to move the baseband signals to passband. The carrier
frequency is set to be 10 KHz in our system which can fulfill the requirement of the
real channel on board.
6
-25 -20 -15 -10 -5 0 5 10 15 20 25
0
500
1000
1500
2000
2500
3000
f (KHz)
The passband transmitted signal
Figure 12 Transmitted signals in passband
1.2 Channel
a
-b
b
a
cos(2 ) sin(2 )
c c
s s
f f
I n Q n
f f
+
sin(2 ) cos(2 )
c c
s s
f f
I n Q n
f f
+
Figure 13 Simulated complex channel
The channel is simulated in baseband (a+jb) to be a Rayleigh flat fading channel with
Doppler frequency shift 0.5 Hz by using Jakes model.
1.3 Receiver
1.3.1 Synchronization
Since there is a delay of the channel on board, synchronization is implemented in
order to find the start point of the signal sequence.
The synchronization algorithm used here is based on the complex training sequence.
By cross-correlating the received complex-valued samples with a locally generated
time-shifted replica of the training sequence, we can find the first sampling time from
the position of the maximum points.
7
1.3.2 Down-conversion
I-component
Q-component
exp( 2 )
c
s
f
j n
f

LP
I-component
Q-component
Figure 14 Down-conversion
The signals are down converted to baseband after synchronization.
1.3.3 Channel estimation
Channel estimation is based on Least-square criteria.
c = qpsk(b_train);
r_tr = r(1: length(c));
a_hat = r_tr *c'*inv(c*c');
The estimated channel coefficients and original channel coefficients are shown in
Figure 15.
0 1 2 3 4 5 6 7 8 9 10
x 10
4
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1.2
1.3


Estimated channel coefficients
Original channel coefficients
Figure 15 Channel coefficients
1.3.4 Detection
Three kinds of detectors can be used at receiver: ZF (Zero Forcing), MMSE
8
(Minimum Mean Square Error) and ML (Maximum Likelihood).
2 Relay system
The whole system includes a source, a relay, a destination and three independent
Rayleigh fading channels.
Channel Source
Relay
Destination
Channel
Channel
Figure 16 Relay system
It is a half duplex, orthogonal system. In the first timeslot, signals are transmitted
from the source to both relay and destination. Relay does some pocessing to the
recieived signal, then in the second timeslot, they are transimitted to destination.
(a) First timeslot
(b) Second timeslot
Figure 17 Relay system
9
Source
Destination
Relay
Source
Destination
Relay
2.1 Relay
2.1.1 Amplify-and-forward
In this case, the relay amplifies and transmits the received signal. To remain within its
power constraint, we can derive that the amplifier gain is depend on the fading
channel coefficients :
where P is the power of transmit signal and is the power of the noise from
channel.
2.1.2 Decode-and-forward
In this case, we decode the received signals at relay and transmit the fresh codeword
using the same code to destination.
As mentioned in section 1, three kinds of detectors can be used here: ZF (Zero
Forcing), MMSE (Minimum Mean Square Error) and ML (Maximum Likelihood).
2.1.3 Detect-and-forward
The relay transmits the detected symbol.
2.1.4 Combining
At destination, we use different methods of combining for different relay prototypes.
A. Improved Maximum Ratio Combining (MRC)
This method is used in amplify-and-forward relay. The destination combines the
received signals using MRC, where the diversity combining coefficients for the two
branches can be shown as,
B. Maximum Ratio Combining (MRC)
In the decode-and-forward, MRC is used for combining. The signal after combining is
where and are the estimated channel coefficients of channel between relay
and destination, source and destination. and are received signals from relay
10
and source, respectively.
C. Optimal Combining for detect-and-forward
We derive combining methods for detect-and-forward relaying based on linear MMSE
and ML criteria.
a. Linear MMSE
The received signals at the destination from the source and the relay are:
We set the signal after combining to be . So
We can get
Similarly,
b. ML
We also got the motivation from Receiver Design for Wireless Relay Channels with
Regenerative Relays, Majid Nasiri Khormuji and Erik G. Larsson to use an optimal
detector in order to obtain the improved performance. The optimal detector will
search for the symbol such that it maximizes the posterior probabilities defined as
(symbol was transmitted | , ) m sd rd P s r r
,
1, 2, 3, 4 m
11
which we abbreviate as
( | , ) m sd rd P s r r
.
By using Bayes rule, the posterior probabilities may be expressed as
( , | ) ( )
( | , )
( , )
sd rd m m
m sd rd
sd rd
P P
P
P

r r s s
s r r
r r
where
( , | ) sd rd m P r r s
is the conditional PDF of
the received signal given
m s
, and
( ) m P s
is the a priori probability of the mth symbol
being transmitted. After some simplification, the criterion turns to be the maximum-
likelihood (ML) criterion with
( , | ) sd rd m P r r s
as the likelihood function.
Further we derive this function in terms of the received signals from source and relay
as the following
{ 1, 2, 3, 4}
arg max ( , | ) m sd rd m
s s s s s
P

s r r s
{ 1, 2, 3, 4}
arg max ( | ) ( | ) ( | ) sd rd
s s s s s
P P p


r s r s s s
2 2
{ 1, 2, 3, 4}
1 1
arg max exp exp ( | )
sd sd rd rd
s s s s s
o o o o
a a
p
N N N N

| `
] ]


] ]

] ]
] ]
. ,

r s r s
s s
We define
2
1( )
1
exp
sd sd
o o
a
N N
g

]
]
]
S
r s
@
2
2( )
1
exp
rd rd
o o
a
N N
g

]
]
]
S
r s
@
,
So we have
( ) 1 2 2
{ 1, 2, 3, 4}
arg max ( ) (1 ) ( ) ( ) m i i
s s s s s
g s g s g s

+ s
where

is the average symbol error


probability at the relay and
i

.
2.2 Chanel model
Three independent Rayleigh fading channels with Additive White Gaussian Noise
(AWGN) are exploited in the system model for channel simulation. The Doppler shift
is 0.5 Hz for all the channels.
12
Relay Simulation in Matlab
3.1 Constellation
The constellations for different relay protocols are plot in Figure 18 (SNR=5dB).
-2 -1 0 1 2
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Q
u
a
d
r
a
t
u
r
e
In-Phase
Scatter plot
-2 -1 0 1 2
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Q
u
a
d
r
a
t
u
r
e
In-Phase
Scatter plot
(a)Amplify-and-forward (b)Decode-and-forward,
-2 -1 0 1 2
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Q
u
a
d
r
a
t
u
r
e
In-Phase
Scatter plot
-2 -1 0 1 2
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Q
u
a
d
r
a
t
u
r
e
In-Phase
Scatter plot
(c)Detect-and-forward (b)One link
Figure 18 Constellations for different relay protocols
3.2 BER comparison
The BER of different relay protocols are plotted in Figure 19.
13
2 4 6 8 10 12 14 16 18 20 22
10
-5
10
-4
10
-3
10
-2
10
-1
10
0
SNR(dB)
B
E
R


Amplify
Decode
Detect
No Relay
Figure 19 BER comparison
From the result, we can see that the relay system performs better than the SISO
system in this simulation. This result agrees with the fact that the relay system can
gain the advantage of spatial diversity of 2 when the channel between source and
destination and channel between relay and destination are uncorrelated. To provide
the comparison of BER performance among three different relaying protocols, the
channel characteristics in the system and combining algorithms are the major factors.
It is not obvious to provide the exact comparison that which relaying protocol
performs better than the others. However, in this simulation we use one set of channel
characteristics and obtain the result such that the Amplify-and-forward protocol
performs the best. This can be explained that in the simulation we use MRC combing
and the link between source and relay is not too bad in the sense of noise level so the
MRC combining here is optimal for the Amplify-and-forward. In the simulation we
also apply the MRC combining for the other two relaying protocols and obtain worse
results than the Amplify-and-forward. One of the reasons is that the MRC is not
optimal for these two protocols since there can be errors occurred in the decoded (or
detected) bits. This can be improved by applying the optimal detector for Detect-and-
forward protocol which will be done in the project later on.
In addition the result shows that the Decoded-and-forward protocol performs better
than the Detect-and-forward protocol. The reason for this could be the benefit of the
coding system for the communication through fading channel.
14
4 SISO Simulation on DSP Board
We simulate the SISO system using the channel enumerated on DSP board. The
system works in the way that the receiver always keeps listening to the incoming
signal and measure the variance of it. The receiver will check if the incoming signals
variance is larger than the noise variance threshold. And when the signal is
transmitted at the transmitter, the receiver can detect it and start do processing later
on.
4.1 Synchronization
To start do processing on the received signal, we need to synchronize the packet we
received to find the starting point of the data packet. Here we use the known pilot
sequence at receiver to do correlation with the received signal in order to obtain the
starting point of packet. The plot of received signal and correlation between received
signal and pilot sequence is shown below.
0 1 2 3 4 5 6
x 10
4
-150
-100
-50
0
50
100
150
X: 2.283e+004
Y: -5
Figure 20 The received signal
15
2 2.1 2.2 2.3 2.4 2.5 2.6 2.7
x 10
4
0
500
1000
1500
2000
2500
3000
3500
4000
X= 22838
Y= 3763.4924
Figure 21 Correlation between received signal and pilot sequence
4.2 BER
-10 -8 -6 -4 -2 0 2 4 6 8 10
10
-2
10
-1
10
0
Eb/No(SNR)
B
E
R

i
n

l
o
g

s
c
a
l
e
Figure 22 The BER performance versus estimated SNR for SISO system
16
We obtain the BER performance of the SISO system which is reasonable for the
Rayleigh flat fading channel. Here we plot the BER versus the estimated SNR so it is
not obvious to compare the result with the theoretical one.
17

Vous aimerez peut-être aussi