modelling a transmission channel based on the tcn · pdf filesimulation tool in matlab. the...

172
Modelling a Transmission Channel based on the TCN-Standard (IEC 61375-1) using Manchester Code and Multi Carrier Modulation Ulrich Hammes Diploma Thesis Universidad Pontifica Comillas de Madrid (ICAI) Institut für Nachrichtentechnik, Universität Karlsruhe June 21, 2005

Upload: tranlien

Post on 04-Feb-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Modelling a Transmission Channel based

on the TCN-Standard (IEC 61375-1) using

Manchester Code and Multi Carrier

Modulation

Ulrich Hammes

Diploma Thesis

Universidad Pontifica Comillas de Madrid (ICAI)

Institut für Nachrichtentechnik, Universität Karlsruhe

June 21, 2005

Page 2: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

CONTENTS

Contents

1 Introduction 1

1.1 Introduction to the Subject . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.3 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Basic Principles of the TCN-Standard 3

2.1 Opening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 Introduction to the WTB and MVB . . . . . . . . . . . . . . . . . . . . . 3

2.2.1 Multifunction vehicle bus(MVB) . . . . . . . . . . . . . . . . . . 4

2.3 Data traffic of the WTB and MVB . . . . . . . . . . . . . . . . . . . . . 5

2.3.1 TCN-Standard using Manchester Code . . . . . . . . . . . . . . 6

3 Cable Model 7

3.1 Balanced Transmission and Differential Mode . . . . . . . . . . . . . . . 8

3.2 Adaption of the Impedance of the MVB . . . . . . . . . . . . . . . . . . 11

3.3 Impedance Measurements . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.3.1 Determination of Transmission Line Parameters with Impedance

Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.4 Cable Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.5 Implementation of the Cable Characteristics in MATLAB . . . . . . . . . 21

4 Transmission System 23

4.1 Modulation of Manchester-Code . . . . . . . . . . . . . . . . . . . . . . 24

4.2 Demodulator and Detector of Manchester Code Signals . . . . . . . . . . 26

4.2.1 Standard Receiver . . . . . . . . . . . . . . . . . . . . . . . . . 27

4.2.2 Correlation Demodulator . . . . . . . . . . . . . . . . . . . . . . 28

4.2.3 Bit Error Probability of the Standard Receiver and Correlation

Demodulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4.3 TCN-Frames Including CRC Bits . . . . . . . . . . . . . . . . . . . . . 34

4.3.1 Introduction to the Structure of a TCN-Frame . . . . . . . . . . . 34

i

Page 3: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

CONTENTS

4.4 Binary Block Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

4.4.1 General Properties of Binary Block Codes . . . . . . . . . . . . . 35

4.4.2 Generating Polynomial and Generator Matrix . . . . . . . . . . . 36

4.4.3 Encoding ofcode words . . . . . . . . . . . . . . . . . . . . . . 38

4.5 Block Decoding and Error Detection . . . . . . . . . . . . . . . . . . . . 39

4.5.1 Parity check matrix H . . . . . . . . . . . . . . . . . . . . . . . 40

4.5.2 Decoding and error correction . . . . . . . . . . . . . . . . . . . 41

4.6 Implementation of Binary Block Codes in MATLAB . . . . . . . . . . . 46

5 Noise Sources 48

5.1 White and Colored Noise . . . . . . . . . . . . . . . . . . . . . . . . . . 48

5.1.1 MATLAB Model of the White and Colored Noise . . . . . . . . . 52

5.2 Periodic Impulsive Noise . . . . . . . . . . . . . . . . . . . . . . . . . . 53

5.2.1 Implementation of the Impulsive Noise in MATLAB . . . . . . . 55

6 Multicarrier Modulation and OFDM 56

6.1 FDM and DMT versus OFDM . . . . . . . . . . . . . . . . . . . . . . . 57

6.2 OFDM Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

6.2.1 Interleaving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

6.2.2 Orthogonality in Time and Frequency Domain . . . . . . . . . . 62

6.2.3 Subcarrier Modulation and Arrangement . . . . . . . . . . . . . 66

6.2.4 QAM Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

6.2.5 Guard Interval . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

6.2.6 IQ Modulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

6.3 Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

6.3.1 IQ Demodulator . . . . . . . . . . . . . . . . . . . . . . . . . . 73

6.4 The Peak-to-Average Power Problem . . . . . . . . . . . . . . . . . . . . 74

6.5 Choice of OFDM Parameters . . . . . . . . . . . . . . . . . . . . . . . . 75

6.6 Manchester-Code and OFDM in the same Transmission Line . . . . . . . 77

6.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

ii

Page 4: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

CONTENTS

7 Simulation Model 80

7.1 Introduction to the MATLAB Model . . . . . . . . . . . . . . . . . . . . 81

7.1.1 Development and Structure of the Main Program . . . . . . . . . 84

7.1.2 Basic Considerations . . . . . . . . . . . . . . . . . . . . . . . . 85

7.2 Programming Structure of the Main Functionupdate_all . . . . . . . . . 86

7.3 Transmission of OFDM signals . . . . . . . . . . . . . . . . . . . . . . . 88

7.3.1 OFDM Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . 89

7.3.2 Channel and recover filter . . . . . . . . . . . . . . . . . . . . . 94

7.3.3 OFDM Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . 96

7.4 Programming structure of the OFDM system . . . . . . . . . . . . . . . 100

8 Conclusions and Future Prospects 104

9 Estudios Económicos 106

References 107

I Generator and Parity Check Matrix 110

II Signal space diagrams withGray encoding 111

III Digital Filters 114

IV Matlab Code 117

iii

Page 5: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

LIST OF FIGURES

List of Figures

1 Wire Train Bus and Multifunction Vehicle Bus . . . . . . . . . . . . . . 4

2 Equipment of a locomotive connected by the MVB . . . . . . . . . . . . 5

3 cross-section of theRaychem 99M1121twisted pair cable . . . . . . . . . 7

4 Unbalanced transmission circuit . . . . . . . . . . . . . . . . . . . . . . 8

5 balanced transmission circuit . . . . . . . . . . . . . . . . . . . . . . . . 9

6 Signal A and signal B on the TCN bus . . . . . . . . . . . . . . . . . . . 10

7 Differential signal A-B . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

8 Plan of a bus system with termination impedances . . . . . . . . . . . . . 11

9 Nominal T section of a short length of transmission line . . . . . . . . . . 14

10 Gain and phase characteristics of theRaychem 99M1121twisted pair cable 20

11 Group delay of theRaychem 99M1121twisted pair cable . . . . . . . . . 20

12 Flow chart of the functionCableCharacteristics. . . . . . . . . . . . . . 21

13 Flow chart of the functionAttenuateSpectrum. . . . . . . . . . . . . . . 22

14 Transmission System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

15 s1(t) ands0(t) Manchester signals . . . . . . . . . . . . . . . . . . . . . 24

16 Spectrum of the Manchester code . . . . . . . . . . . . . . . . . . . . . . 26

17 tolerances of the received signals . . . . . . . . . . . . . . . . . . . . . . 27

18 Matched filter, Correlator . . . . . . . . . . . . . . . . . . . . . . . . . . 29

19 Signal space diagram for Manchester-Code . . . . . . . . . . . . . . . . 30

20 Conditional PDFs of two Manchester signals . . . . . . . . . . . . . . . 30

21 Cumulative density functionwith σ2 = 1 andµ = 0 . . . . . . . . . . . . 33

22 Probability of a bit error in dependence on the SNR . . . . . . . . . . . . 33

23 Frame structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

24 Probability of bit errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

25 Flow chart of functionDecoding . . . . . . . . . . . . . . . . . . . . . . 47

26 Power spectral density and autocorrelation function of white noise . . . . 49

27 Model for the generation of colored noise . . . . . . . . . . . . . . . . . 50

28 power spectral densityand autocorrelation function of colored noise . . . 51

iv

Page 6: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

LIST OF FIGURES

29 Time signals of white and colored noise . . . . . . . . . . . . . . . . . . 52

30 Flow chart of the functionAdd_ColoredNoise. . . . . . . . . . . . . . . 53

31 time signal of a periodic noise process . . . . . . . . . . . . . . . . . . . 54

32 Flow chart of the functionAdd_PeriodicNoise. . . . . . . . . . . . . . . 55

33 Partitioning of the cable bandwidth of the twisted pair cable . . . . . . . 56

34 Comparison of bandwidth of an conventional MC system with an OFDM

system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

35 OFDM Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

36 OFDM signal in the time domain(100 Samples) . . . . . . . . . . . . . . 64

37 Spectrum of an OFDM signal . . . . . . . . . . . . . . . . . . . . . . . 65

38 Spectrum of a real versus spectrum of a complex time signal . . . . . . . 67

39 Signal space diagram of 4 and 16 QAM signals . . . . . . . . . . . . . . 68

40 Bit error probability of QAM signals in dependence on the SNR . . . . . 69

41 OFDM cyclic extension with a guard intervall . . . . . . . . . . . . . . . 70

42 IQ Modulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

43 OFDM Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

44 IQ Demodulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

45 OFDM included in a MVB bus system . . . . . . . . . . . . . . . . . . . 78

46 Main window of the programCableModell.m . . . . . . . . . . . . . . . 81

47 Flow chart of the main program . . . . . . . . . . . . . . . . . . . . . . 84

48 Flow chart of the functionupdate_all. . . . . . . . . . . . . . . . . . . . 87

49 Flow chart of the functionupdate_all. . . . . . . . . . . . . . . . . . . . 88

50 Main Menu which is opened whenOFDM is chosen in the Modulation

Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

51 Sub menu to verify the signals at an OFDM Transmitter . . . . . . . . . . 90

52 Discrete baseband time signal and its spectrum . . . . . . . . . . . . . . 91

53 Digital time signal and its spectrum . . . . . . . . . . . . . . . . . . . . 92

54 Continuous time signal and its spectrum . . . . . . . . . . . . . . . . . . 93

55 Up-converted continuous time signal and its spectrum . . . . . . . . . . . 94

56 Time signal of Manchester,OFDM1, OFDM2and its spectrum . . . . . . 95

v

Page 7: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

57 Submenu to verify the signals at the OFDM Receiver . . . . . . . . . . . 96

58 Received signal after down conversion . . . . . . . . . . . . . . . . . . . 97

59 Received signal after carrier suppression . . . . . . . . . . . . . . . . . . 98

60 Discrete signal after sampling . . . . . . . . . . . . . . . . . . . . . . . 99

61 Received QAM symbols . . . . . . . . . . . . . . . . . . . . . . . . . . 100

62 Flow chart of the functionOFDM_system . . . . . . . . . . . . . . . . . 101

63 second part of the flow chart of the functionOFDM_system. . . . . . . . 102

64 Signal space diagram 4 QAM signals . . . . . . . . . . . . . . . . . . . . 112

65 Signal space diagram 16 QAM signals . . . . . . . . . . . . . . . . . . . 113

66 Anti aliasing filter in the OFDM transmitter . . . . . . . . . . . . . . . . 114

67 Reconstruction filter in the OFDM receiver . . . . . . . . . . . . . . . . 115

68 Recover filter to isolate the Manchester signals . . . . . . . . . . . . . . 115

69 Recover filter to isolate the Manchester signals . . . . . . . . . . . . . . 116

70 Recover filter to isolate the Manchester signals . . . . . . . . . . . . . . 116

vi

Page 8: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

abstract

abstract

TheTrain Communication Network(TCN) that is defined in the IEC 61375-1 standard has

been applied in trains for several years in order to communicate among equipments and

different waggons. This protocol standard was founded by the International Electrotechni-

cal Committee (IEC) in 1999 and is used to transfer information concerning train control,

diagnostics and passenger information. The coding scheme which is used by this protocol

is the Manchester-Code with a data rate of 1.5Mbit/s.

Nowadays new applications lead us to the transmission of audio and video data which

are composed of huge data packets. For these kind of transmissions, an enlargement of

the data rate has become necessary. This enlargement could be achieved by usingmulti

carrier modulation(MC) such asDiscrete Multi Tone(DMT), Frequency Division Multi-

plexing(FDM) or Orthogonal Frequency Division Multiplexing(OFDM).

The goal of this project is to validate a simultaneous transmission of Manchester signals

in base band and MC signals in higher frequency bands. This is achieved by developing a

simulation tool in MATLAB. The aforementioned TCN-Standard should be respected in

this model.

Due to the fact that OFDM uses the available bandwidth of a transmission channel in the

most effective way, this modulation scheme has been chosen and implemented.

The channel of the simulation tool shall represent a typical cable used in trains. For this

reason theRaychem 99M1121shielded twisted-pair cable, used in several trains, was

measured and its characteristics have been implemented in the simulation model.

Furthermore, different noise sources with variable SNR have been implemented in order

to run the simulation under realistic conditions.

The model allows the user to change interactively various parameters of the channel, such

as cable length, noise sources, modulation scheme, signal amplitudes, and so on. The

simulation steps with these new values are calculated directly and the impacts may be

seen in several control windows and in a TXT-file output which provides a summary of

the computed simulation.

vii

Page 9: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

abstract

An enlargement of the data rate of the aforementioned channel, has been achieved by us-

ing a OFDM/Frequency Division Duplexing(FDD) system with two frequency bands of

approximately2.2MHz. The upstream band is centered at the carrier frequency of 5MHz

and the downstream band is centered at the carrier frequency of 9MHz. Manchester sig-

nals are transmitted in baseband as required by the TCN-Standard. Depending on the

modulation scheme of the OFDM signals, wether is 4 or 16 QAM, an overall data rate of

7.5Mbit/s or 13.5Mbit/s may be achieved.

This work is concerned with the physical layer and the data link layer of theOpen Sys-

tems Interconnection(OSI) Model. The physical layer treats the transmission of a raw

bit stream over a cable and defines different techniques to do so. For this purpose, the

Manchester code and OFDM are explained in this report and implemented.

Besides, error detection and correction methods are defined in the data link layer and

applied to TCN frames in the proposed model.

viii

Page 10: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

resúmen

resúmen

La especificación TCNTrain Communication Networkse ha venido utilizando desde hace

años con el propósito de comunicar los distintos equipos de los vagones de un tren. Este

protocolo emplea una modulación conocida como Manchester-Code, que tiene una tasa

de bit de 1.5Mbit/s.

En la actualidad las nuevas herramientas multimedia dan lugar a transmisiones de audio y

vídeo con gran cantidad de datos. Para este tipo de transmisiones convendría incrementar

la tasa de bit. Este incremento podría obtenerse mediante una modulación de multiporta-

dores (multi carrier modulation o MC), como elDiscrete Multi Tone(DMT), Frequency

Division Multiplexing(FDM), Orthogonal Frequency Division Multiplexing(OFDM).

El objetivo principal de este proyecto consiste en validar la transmisión simultánea de las

señales Manchester en banda base y las señales MC en bandas de frecuencia más altas.

Esto ha sido alcanzado mediante el desarollo de una herramienta de simulación en MAT-

LAB basada en el protocolo TCN. El OFDM utiliza el ancho de banda disponible en el

medio de transmisión de la manera más eficiente, razón por la cual se ha elegido e imple-

mentado este esquema de modulación.

El modelo del canal de simulación debería representar un cable típico utilizado en los

trenes. Por esta razón, el cable de par trenzado Raychem 99M1121 fue medido y sus car-

acteristicas de ganancia y fase implementadas en el modelo propuesto. Varios modelos

de ruido con valores variables para la relación señal-ruido (SNR) fueron desarollados e

implementados para obtener un modelo que representara las condiciones reales en los

trenes.

Se ha creado un banco de pruebas que permite al usuario modificar los parámetros de

longitud de cable, fuentes de ruido y su relación señal-ruido, así como la amplitud de las

señales Manchester, entre otros. Los pasos de simulación se calculan sobre los parámet-

ros de entrada, lo que permite al usario visualizar los efectos directamente sobre varias

ventanas de control y un archivo de texto que pone a su disposición un resúmen de la

ix

Page 11: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

resúmen

simulación realizada.

Se ha alcanzado un incremento de la tasa de bits del canal utilizando un sistema OFDM/

Frequency Division Duplexing(FDD) con dos bandas de frecuencia de 2.2MHz. La banda

de subida está centrada en 5MHz y la banda de bajada está centrada en 9MHz. Como exige

el estándar TCN, las señales Manchester se transmiten en el banda base que está exigido

del estándar TCN. Dependiendo del esquema de modulación de las señales OFDM, 4 ó 16

QAM, podemos alcanzar una tasa de bit total de 7.5Mbit/s o 13.5Mbit/s, respectivamente.

Este proyecto abarca la capa fisica y la capa de enlace del modeloOpen Systems Inter-

connection(OSI) con modulación en Manchester/OFDM y con detección y corrección de

errores en las tramas de TCN.

x

Page 12: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Introduction

1 Introduction

1.1 Introduction to the Subject

The Train Communication Network(TCN) is defined in the IEC 61375-1 standard [1].

It has been applied in trains for several years in order to communicate among equip-

ments and different waggons. This protocol standard was founded by the International

Electrotechnical Committee (IEC) in 1999 and is used to transfer information concerning

different train functions.

On the one hand this information concerns essential train control and diagnostics data for

door opening, brakes, power electronics and so on. This is considered security relevant

data and must be transmitted in a correct way.

On the other hand the busses defined in the TCN-Standard transfer data based on passen-

ger information such as reservations, travel information etc.

The coding scheme used in this protocol is the Manchester-Code with a data rate of

1.5Mbit/s.

1.2 Motivation

Nowadays clients demand new multimedia applications in trains such as video and audio

entertainment. Furthermore, security monitoring is needed in some trains used in urban

areas and airports in order to assure safety for the passengers.

In order to transmit these types of information, composed of huge data packets, an en-

largement of the data rate becomes necessary. Because the TCN-Standard has been cre-

ated recently and has been working successfully for several years, it is not convenient to

change this standard by increasing the transmission frequency of the Manchester-Code.

Furthermore, the Manchester-Code requires a high bandwidth which does not allow a

strong increase of the data rate.

However, an enlargement of the data rate could be achieved by usingmulti carrier modu-

lation (MC) such asDiscrete Multi Tone(DMT), Frequency Division Multiplexing(FDM)

orOrthogonal Frequency Division Multiplexing(OFDM) in higher frequency bands whereas

1

Page 13: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Introduction

the Manchester signals based on the TCN-Standard are transmitted in base band.

1.3 Objectives

The goal of this project is to develop a model of a communication system which is used

in trains in MATLAB. This model should be based on the TCN-Standard. It shall validate

the functionality of a simultaneous transmission of Manchester signals in the base band

and the signals ofmulti carrier modulation(MC) in radio frequency(RF) bands. Hence,

an adequate modulation technique has to be chosen for this purpose and implemented

into the MATLAB model. The frames in base band contain control data concerning the

TCN-Standard, whereas audio and video data should be transmitted in higher frequency

bands.

In order to design a realistic model, the gain and phase characteristics of a twisted pair

cable used in trains has to be measured and implemented. In addition, models of various

noise sources shall be developed to simulate data transmission in different train environ-

ments.

Furthermore, a user friendly tool that contains facilities to change different transmission

parameters such as cable length, amplitude, noise environments andSignal-to-Noise-

Ratio (SNR) shall be designed and integrated. This user interface must display binary

inputs, the transmitted and received signals with their frequency spectra, binary outputs

as well as possibly bit errors.

This work is concerned with the physical layer and the data link layer of theOpen Sys-

tems Interconnection(OSI) Model. The physical layer treats the transmission of a raw

bit stream over a cable and defines different techniques to do so. For this purpose, the

Manchester code and amulti carrier modulationscheme are explained and applied in the

computer model.

The data link layer contains definitions of putting raw data into frames in order to transmit

them via the physical layer. Besides, error detection and correction methods are defined

in this layer. In this work, error detection and correction are applied to TCN frames.

2

Page 14: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Basic Principles of the TCN-Standard

2 Basic Principles of the TCN-Standard

2.1 Opening

The Train Communication Network(TCN) was adopted as the international standard of

the International Electrotechnical Committee (IEC) in 1999. Professionals from over 20

different countries, including many European nations, the USA, Japan and China worked

for several years in order to define this communication network.

The groundwork of this standardization was furnished by the International Railways

Union(Union Internationale de Chemins de Fer, or UIC) and the IEC, to develop an auto-

matic coupling between the electronic equipments of different train vehicles. To introduce

this automatic coupling, an international standardization of onboard communications was

required.

This standardization is required for the train and the vehicle levels to assure the compati-

bility of the system. It has several advantages:

At the vehicle level, the standardization serves manufacturers, suppliers and rail opera-

tors. Manufacturers could assemble units that include their own computers, but fabricated

by subcontractors. Part suppliers working for different manufacturers could reduce their

development costs by adhering to one standard. Besides railroad operators could reduce

their stock of spare parts and simplify maintenance and part replacement [2].

2.2 Introduction to the WTB and MVB

The TCN architecture comprises the train bus connecting the different vehicles and the

vehicle bus connecting the equipment in each vehicle. Both busses use a Master-Slave

protocol to regulate the communication among different equipments and waggons [3].

3

Page 15: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Basic Principles of the TCN-Standard

Figure 1: Wire Train Bus and Multifunction Vehicle Bus

The standard distinguishes between theWire Train Bus(WTB) and theMultifunction Ve-

hicle Bus(MVB), as represented in figure 1. The WTB is capable to span 860m, a distance

corresponding 22 to UIC vehicles, without using a repeater. The principal advantage of

the WTB is that it automatically numbers nodes in sequential order and also distinguishes

the nodes of the different sides and fore and aft directions.

The WTB is out of the scope of this project. Therefore, it will not be explained in more

detail. Further explanations of this bus are to be found in [1], [2] and [3].

2.2.1 Multifunction vehicle bus(MVB)

In order to simplify assembly, commissioning and subsystem reuse, the TCN architecture

specifies the MVB as a vehicle bus which connects the equipment within a vehicle or

within different vehicles in closed train sets.

Since the MVB bus has been integrated in trains, a considerable reduction in the amount

of cabling has been achieved. Furthermore, the reliability has been increased with respect

to conventional wiring. Figure 2 shows the different types of subsystems used in a loco-

motive.

4

Page 16: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Basic Principles of the TCN-Standard

Figure 2: Equipment of a locomotive connected by the MVB

The MVB operates at a data rate of 1.5Mbit/s over different types of medias:

• Optical fibres for distances over 200m and for environments which are sensitive to

electromagnetic interference (in locomotives)

• Transformer-coupled, 120 Ohm twisted-pair wire pairs which is used for distances

up to 200m to connect two or three vehicles in a train set

• RS-485/120 Ohm cable for cost effective device connections within the same cabi-

net with no galvanic separation. When this cable is galvanically separated, it can be

used to connect equipments in different vehicles in closed train sets

In this work, the RS-485/120 Ohm cable is treated, without considering the use of re-

peaters between the different vehicles. This cable is described in chapter 3.

2.3 Data traffic of the WTB and MVB

Despite there are some differences at the physical and link layer, the WTB and the MVB

adhere to the same operating principles. Both busses use two types of data for the trans-

mission process: Process variables and messages.

The process variables contain information about the train’s state, such as speed, motor

current and operator’s commands. Therefore the transfer time of these variables has to be

5

Page 17: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Basic Principles of the TCN-Standard

short and deterministic.

Message data carry infrequent information like diagnostics or passenger information. The

size of the messages vary between a few byte and several kilobytes. In this case the mes-

sage transmission delay has to be short on the average and the application tolerates delays

up to several seconds. So the transfer time of the message is non deterministic [2].

However, further explanations of the data traffic of the MVB and WTB buses are out of

the scope of this project. For more detail, refer to [1] and [2].

2.3.1 TCN-Standard using Manchester Code

The binary data, explained in the previous section, which is transmitted over the cable

uses the Manchester encoding scheme which is a very robust and a reliable coding. It

encodes bits in fixed time slots(cells) whereby a one is represented as a positive transition

in the middle of this cell and a zero is a negative transition in the middle of the cell. There

is always only one transition per bit, so the signal clock may be easily recovered from the

signal. A Manchester signal can be obtained by an XOR condition of the clock and the

information signal.

Manchester is decoded by sensing the zero crossings of the signal or by correlation tech-

niques that will be described in section 4.2.1 and in section 4.2.2. The synchronization

in the receiver is accomplished by aPhase-Locked Loop(PLL) and at the beginning of a

frame, the data must be preceded by a preamble with a known sequence to allow the PLL

to adjust itself. RS-485 transceivers have to be used in order to integrate a transmission

system with Manchester signals of the MVB.

The advantage of the Manchester code lies in its reliability. The clock is included in the

information signal and that’s why the signal is easy to detect at the receiver side.

The mayor disadvantage of this coding-scheme is the need of a huge bandwidth because

of its narrow rectangular pulses which cove half of the bit time. More detailed and further

explanations of this code are to be found in the chapter 4.11.

1figures one and two are taken from [2]

6

Page 18: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

3 Cable Model

In chapter 2.1 the WTB and the MVB bus were described and different kinds of cables

for the MVB were mentioned.

In this section, the shielded twisted pair cableRaychem 99M1121/120Ω which is used

for the MVB is described and the measured gain and phase characteristics are shown and

evaluated. Also the group delay is evaluated in order to conclude on the distortions of the

transmitted signals.

To cope with the harsh conditions in a conducting train like mechanical vibrations, dust

and dirt, strong variations in temperature, etc., the cable has to satisfy several conditions

concerning robustness:

• High temperature resistance

• Flame and fire retardant

• Non corrosive and non toxic cable

• High mechanical properties

• High chemical resistance towards oil, acids, etc.

For this kind of application the companyRaychemdeveloped the shielded twisted pair

cable especially. A cross-section of this cable is shown in figure 14:

Figure 3: cross-section of theRaychem 99M1121twisted pair cable

7

Page 19: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

Due to the fact that such a cable has to satisfy several conditions concerning robustness

and reliability, as I mentioned before, the attenuation characteristics of these kind of cables

is worse than those of a normally twisted pair cable used in standard networks. However,

the gain and phase characteristics of theRaychem 99M1121twisted pair cable will be

described in section 3.3.

3.1 Balanced Transmission and Differential Mode

The aforementioned cable has two twisted pair wires and consequently provides a bal-

anced signal transmission. In this section the differences between balanced and unbal-

anced transmission are derived.

One of the wires in a pair in an unbalanced circuit is grounded at both ends. An example

is RS-232 protocol of the physical layer. These signals are represented by voltage levels

with respect to the ground. One of the main problems with this is that any noise produced

from an external source is added to the signal and will be seen as data. This is because

any noise on the ground wire will be dropped to earth and any noise appearing on the

signal wire will be added or subtracted to the signal. Therefore, the signals may be dis-

torted strongly which means that the cable length and data rate of these kind of cables are

strongly limited.

Figure 4 shows a circuit of an unbalanced reception.

Figure 4: Unbalanced transmission circuit

A better way to resolve this issue is to use a balanced circuit. TheMultifunction Vehicle

Bususes a balanced circuit which is defined in the standard protocol RS-485 of the phys-

ical layer. This only requires a twisted pair cable. In comparison to an unbalanced circuit

8

Page 20: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

which has one of the wire pair grounded at both ends, in a balanced circuit both wire pairs

are used to transmit data. A balun transformer isolates the wires from the circuitry.

Let us consider that one of the twisted pair wires is designated asA and the other one is

designated asB. Then, we transmit a logical one of Manchester code when lineA trans-

mits a positive transition in the middle of a cell and lineB transmits a negative transition

in the middle of a cell, please refer to section 2.3 and section 4.1 for Manchester signals.

Thus, each wire passes the opposite signal of the other wire’s signal, meaning only the

difference between wiresA andB matters.

Figure 5 shows a circuit of a balanced data transmission system. For a balanced trans-

mission system which is also designated as a transmission in differential mode, we need

drivers with differential inputs/outputs. Thus, the costs of a balanced transmission system

are much higher than those of an unbalanced transmission system.

One of the major advantages of the differential mode is the rejection of common mode

noise. Noises are introduced into the cable which means that the same amount of noise is

picked up by both wires, meaning the voltage difference of this noise betweenA andB

is almost zero. The receiver does the calculationA-B in order to obtain the signal which

will be demodulated. Therefore, the noise is also subtracted and thus eliminated and we

obtain a proper signal.

Figure 5: balanced transmission circuit

The same is true for crosstalk from neighboring lines and other sources of interference,

as long as the maximum voltage of the receiver is not exceeded.

Now, we observe the Manchester signals of the TCN-Bus which are measured at the input

of a transceiver. The signalA is represented in figure 6 below and shows the beginning

of a TCN frame with Manchester signals. Also signalB is represented in this figure and

9

Page 21: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

shows us the opposite signal ofA.

Figure 6: Signal A and signal B on the TCN bus

These two signal are subtracted in the receiver and we obtain a signal with twice the

amplitude of signalA. This signal is shown in figure 7.

Figure 7: Differential signal A-B

10

Page 22: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

3.2 Adaption of the Impedance of the MVB

The TCN bus uses theautomatic repeat request(ARQ) protocol for error control in a

data transmission. When the slave/receiver detects an error in a frame, it automatically

requests the master/transmitter to resend the frame. This process is repeated until there is

no more error in the frame.

In order to prevent interferences of different signals and reflections on the bus it is nec-

essary to adapt the transmission line at the beginning and at the end with a termination

impedance.

The value of the termination impedance has to be equal to the value of thecharacteristic

impedanceZC of the cable which will be explained in more detail in section 3.3.1.ZC

is determined to 120Ω which means that a resistance of 120Ω is put at the extremities of

the line. The transceivers of the different devices may be connected between these two

resistances which is shown in figure 8.

Figure 8: Plan of a bus system with termination impedances

In a communication system of the MVB bus, up to 32 transceivers may be connected to

the line [1]. These transceivers consist of a line driver at the receiver side which converts

analog voltage smaller than -0.2V in a digital signal with a negative voltage level and ana-

log voltage greater than +0.2V in a digital signal with a positive voltage level, meaning

the driver does a conversion of signals in differential mode to signals in common mode.

In section 4.2 the demodulation of these digital Manchester signals is explained.

On the transmitter side the transceiver consists of a line driver which does the conver-

sion of signals in common mode to signals in differential mode. If there are more than 32

11

Page 23: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

transceivers the cable is not adapted anymore which implies reflections of the signals and

consequently interferences.

However, the input impedance of a transceiverZIT has the dimension of several kΩ

whereby the value of the termination impedance is 120Ω. If we look into the circuit from

one side we see the different devices in parallel to the termination impedance. Therefore,

the over-all impedance on a certain point of the cable looking in one direction is:

1

Z(l)=

1

ZC

+1

Z1IT

+1

Z2IT

+ ... +1

ZnIT

(1)

wheren is a number between 1 and 32, the maximum number of transceivers which may

be connected to the bus.

Due to the fact that the resistances are connected in parallel to the bus and their input im-

pedance is much bigger thanZC they can be neglected which is demonstrated in equation

1. Even if 32 transceivers are connected to the bus, the over-all impedance on a certain

point of the lineZ(l) is almost equal toZC .

3.3 Impedance Measurements

In order to determine the attenuation and phase characteristics of theRaychem 99M1121

cable we use the network analyzer HP4194A. This network analyzer is capable of mea-

suring impedances in the range of 100Hz to 40MHz and has ancharacteristic impedance

of 50Ω. For our applications a measurement up to 20MHz is sufficient. Considering that

thecharacteristic impedanceof the cable is equal to120Ω we need a balun transformer

in order to adapt the internal resistance of the network analyzer to the impedance of the

cable [20]. In order to obtain precise results for the gain and phase characteristics we mea-

sure the input impedance of the cable in dependence on the frequency. The step between

two measurement is equal to4kHz, consequently 5000 measurements are necessary to

measure a frequency band up to20MHz which is sufficient for our applications.

In the ideal case, the termination impedanceZR is equal to thecharacteristic impedance

ZC which is shown in equation 2. In this case thereflection coefficientis zero which means

that there are no reflections of the wave from the sending end to the load, meaning the

12

Page 24: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

whole power of this wave is absorbed by the termination impedance.

ZC =

√R′ + jωL′

G′ + jωC ′ (2)

where

R′ =dR

dx, L′ =

dL

dx, C ′ =

dC

dx, G′ =

dG

dx

are the longitudinal derivatives of resistance, inductance, capacitance and admittance

along the line. Each of these parameters depends on the frequency. For example,R′ and

the termination impedanceZR will change in dependence on the frequency due to the skin

effect as well asG′ due to frequency dependent dielectric losses [20].

Thus,ZC measured at a certain frequency will not necessarily be the same asZC mea-

sured at another frequency. For this reason the line is not adapted for every frequency

which implies reflections. Thereflection coefficientρ shown in equation 3 is then unequal

to zero:

ρ =ZR − ZC

ZR + ZC

(3)

In this case there is a wave from the sending end to the load and its reflection from the

load to the sending end. These two waves are overlapped which leads in some cases to

positive and in other cases to negative interferences.

The input impedance of the cable which is determined by the relationZ = UI

depends

consequently on the reflections and therefore on the frequency of the voltage and current

waves. The aim of our measurements is to determine thecharacteristic impedancesand

the propagation constantγ defined in equation 4 as a function of the frequency(ω =

2πf).

γ = α + jβ =√

(jωL′ + R′) · (jωC ′ + G′) (4)

whereα is designated as theattenuation constantandβ is designated as thephase con-

stant. In order to obtain accurate values for the input impedance and thecharacteristic

impedancewhich take into account their dependence on the frequency, we have to derive

some equations of these values which is explained in section 3.3.1. We measure the input

impedance of the cable with an opened end and then with a shortened end in the desired

13

Page 25: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

frequency band up from 100Hz to 20MHz. The two impedances lead us to values of the

characteristic impedanceand to values of thepropagation constantγ dependent on the

frequency [22].

Furthermore, we derive a relation between the input and output voltage and current in

dependence on thecharacteristic impedance, thepropagation constantand the input im-

pedance. This relation (equation 16) represents the transfer function of the cable and will

also be explained in more detail in the following section.

3.3.1 Determination of Transmission Line Parameters with Impedance Measure-

ments

A scheme of a cable with length∆x is represented in figure 9.

Figure 9: Nominal T section of a short length of transmission line

Using this figure we determine the following equation:

−E + I(R′ + jωL′)∆x

2+ (I + ∆I)

(R′ + jωL′)∆x

2+ E + ∆E = 0 (5)

Thus, we obtain:∆E

∆x= −I(R′ + jωL′)−∆I

jωL

2(6)

When∆x is made smaller and smaller, the ratio∆E/∆x corresponds to the derivative

14

Page 26: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

dE/dxand∆I is equal to zero.

dE

dx= −I(R′ + jωL′) (7)

For the node we obtain the following equation:

I − (∆I − I)− E∆x · (jωC ′ + G′) = 0 (8)

If we do the same approaches as above(∆x → 0) for equation 8 we obtain:

dI

dx= −E(G′ + jωC ′) (9)

Equation 7 and 9 are calledequations of telegraphy. In order to solve equation 7 it is

convenient to calculate the derivative of it and put equation 9 in this equation. Thus, we

obtain

d2E

dx2= −(jωL′ + R′) · dI

dx= (jωL′ + R′) · (jωC ′ + G′) · E = γ2 · E (10)

In a similar way we obtain the current in a differential equation:

d2I

dx2= −(jωC ′ + G′) · dE

dx= (jωL′ + R′) · (jωC ′ + G′) · I = γ2 · I (11)

The expression(jωL′ + R′) · (jωC ′ + G′) is denoted asγ2 as we have seen in equation 4.

The solution of the differential equations 11 and 10 has in general the following form:

E = Ae−γx + Beγx (12)

Now, we derive equation 12 and equate the result with the expression withdEdx

= −I(R′+

jωL′) of equation 7. Thus, we obtain

dE

dx= −I(jωL′ + R′) = −A · γ · e−γx + B · γ · eγx ⇒ I =

A · e−γx

ZC

− B · eγx

ZC

(13)

15

Page 27: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

In order to determine the constants A and B we have to solve the boundary value problem

of the transmission line. In terms of the conditions at the sending end, meaning thatx = 0,

we obtain the following expressions:

A + B = ES (14)A−B

ZC

= IS

Hence,

A =ES + ISZC

2B =

ES − ISZC

2(15)

When we put the expressions of A and B shown in equation 15 in equation 12 and 13

with the conditionES = ZS · IS at the sending end(x = 0) we obtain the following

equation which is the relation between the voltage or current at any point in the cable and

the voltage or current at the sending end of the cableES, IS2:

E

ES

= cosh(γx)− ZC

ZS

sinh(γx) (16)

I

IS

= cosh(γx)− ZS

ZC

sinh(γx) (17)

These equations are used to determine the voltage and current at a certain distance of

lengthx away from the sending end of the cable, meaning that these equations represent

a transfer function which is the relation of the output signal to the input signal.

In order to apply equations 16 we have to determine the relation between thecharacteris-

tic impedanceand the input impedance at the sending endZC

ZSand the values ofγ. To do

so it is necessary to solve the differential equation 10 respectively 11 in terms of condi-

tions at the load, meaning thatx = r andER = ZR · IR. Thus, we obtain the following

expressions:

ER = Ae−γr + Beγr (18)

2cosh(x) = ex+e−x

2 andsinh(x) = ex−e−x

2

16

Page 28: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

IR =A

ZC

e−γr − B

ZC

e+γr (19)

The solution for A and B is:

A =ER

2· (1 +

ZC

ZR

) · eγr (20)

B =ER

2· (1− ZC

ZR

) · e−γr

If we put the expressions for A and B in equation 12 and 13 and solve these equations we

obtain the following equation system:

E = ER cosh(γ(r − x)) + IRZC sinh(γ(r − x)) (21)

I = IR cosh(γ(r − x)) +ER

ZC

sinh(γ(r − x)) (22)

The network analyzer permits us to measure the input impedance of the cable as a function

of the frequency.

Due to the fact that the impedancesZR andZC also change slightly in dependence on

the frequency, we determine a general expression of the input impedanceZS of the cable

at the sending end as a function of the termination impedanceZR and thecharacteristic

impedanceZC .

In order to apply this we have to setx = 0 in equation 21 and 22 because we want to

calculate the input impedance at the sending end. Then we divide equation 21 by equation

22 and obtain3:

ZS = ZC ·ZR + ZC tanh(γr)

ZC + ZR tanh(γr)(23)

This is a general equation of the input impedance in dependence on the termination re-

sistance, thecharacteristic impedanceand thepropagation constantwhich is also valid

for the ideal case, when the line is adapted(ZR = ZC). In this case the fraction disap-

pears and the input impedance at the sending end is equal to thecharacteristic impedance

(ZS = ZC). But in order to obtain accurate values we apply the general case because

3tanh(x) = sinh(x)cosh(x)

17

Page 29: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

ZC andZR vary in frequency. Now we want to measure determineZC . To do so, we do

the measurement of the input impedances at the sending endx = 0 with two different

termination impedances at the load. In the first case the cable is shortened(ZR = 0) and

in the second case it is opened(ZR = ∞).

Considering the first case the voltage at the load of the cable is equal to zero because it is

shortened meaningER = 0. Thus, equations 21 and 22 become:

Eshortened = IRZC sinh(γr) (24)

Ishortened = IR cosh(γr) (25)

These two equations allow us to obtain a relation between the input impedance in the

shortened caseZshortened and thecharacteristic impedancewhen we divide equation 24

by equation 25.

Zshortened =Eshortened

Ishortened

= ZC tanh(γr) (26)

Considering the second case when the cable is opened the load is infinite and therefore

the current in the load equal to zero meaningIR = 0. Thus, equations 21 and 22 become:

Eopened = ER cosh(γr) (27)

Iopened =ER

ZC

sinh(γr) (28)

By dividing equation 27 by equation 28 we obtain the input impedance for the opened

circuit Zopen in dependence onZC4:

Zopened =Eopened

Iopened

=ZC

tanh(γr)= ZC coth(γr) (29)

In order to determine thecharacteristic impedanceZC in dependence on the two input im-

pedances(Zshortened, Zopened) which we measured we multiply equation 26 with equation

29 and obtain:

ZC =√

Zopened · Zshortened (30)

4coth(x) = 1tanh (x)

18

Page 30: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

This expression will be inserted in equation 23 in order to determine the input impedance

ZS at the sending end of the cable in the case when it is adapted with a certain ending

impedanceZR.

The only value which is missing to apply equation 23 isγ. This value will be calculated

by dividing equation 26 by equation 29:

Zshortened

Zopened

= tanh2(γr) (31)

Thus, forγ we obtain

γ =1

rarctanh

(√Zshortened

Zopened

)(32)

Now we have calculated the values forγ andZC in dependence on the measured input

impedanceZopened andZshortened. These values are put in equation 23 in order to calcu-

late the ratioZC

ZSwhich is used in equation 16. Finally we obtain the following transfer

function:E

Es

= cosh(γx)− ZC + ZR tanh(γr)

ZR + ZC tanh(γr)· sinh(γx) (33)

whereZR is the termination resistance of120Ω, r is equal to 30m the length of the cable

we measured,ZC =√

Zopened · Zshortened andγ = 1rarctanh

(√Zshortened

Zopened

)This equation gives us the gain and phase characteristics of any cable length x.

3.4 Cable Characteristics

Like described in the previous subsections, the gain and phase characteristics of the cable

has been measured in dependence on the frequency. We obtained the following curve for

the gain and phase characteristics in a frequency band up to20MHz

19

Page 31: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

Figure 10: Gain and phase characteristics of theRaychem 99M1121twisted pair cable

We observe that the gain is almost constant till 10 MHz. Furthermore, the phase of the

cable is linear over the whole frequency band. Hence, the group delay that is given in

equation 34 is constant, meaning every frequency of a signal is delayed by the same time.

τ(f) = − 1

dΘ(f)

df(34)

This only leads to delay of the received signal referred to the transmitted one but not to

ISI. The group delay is shown in the following figure.

Figure 11: Group delay of theRaychem 99M1121twisted pair cable

Therefore, only the gain of the cable has an effect on the shape of the signal. Due to

20

Page 32: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

these considerations the phase is neglected in the following work in order to reduce the

complexity of the simulation tool.

3.5 Implementation of the Cable Characteristics in MATLAB

Since we wish to establish a model where the cable length may be changed dynamically

by the user, we have to use equations 16 and 23 in order to determine the attenuation

characteristic of the cable of a certain cable length. The function which provides the phase

and gain of the cable is designated asCableCharacteristicsand its flow chart is shown

below:

Figure 12: Flow chart of the functionCableCharacteristics

In addition to that, I wrote a function where the functionCableCharacteristicsis included

in order to attenuate the spectrum of a signal in dependence on the length of the cable. Re-

member that MATLAB computes theDiscrete Fourier Transformation(DFT) of a signal.

Thus, the spectrum of a real time signal satisfies the symmetry conditionXN−k = X∗k ,

meaning the spectrum is point symmetric to half of the sample frequency. Hence, the

spectrum of the time signal from zero to half the sample Frequency has to be multiplied

by the gain from zero to half the sample frequency. The spectrum from half the sample

frequency to the sample frequency has to be multiplied as well by the gain from zero up to

half the sample frequency. This algorithm is included in the functionAttenuateSpectrum

and its structure is plotted below:

21

Page 33: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

3 Cable Model

Figure 13: Flow chart of the functionAttenuateSpectrum

22

Page 34: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

4 Transmission System

We have characterized the twisted pair cable which is used in transmission systems of

trains in chapter 3. In this chapter, I will explain the entire base band transmission system

which is shown in figure 14 with the encoding and decoding procedure, the modulation

and demodulation procedure and the corresponding bit error probability.

The transmission system which can be seen as aLinear Time Invariant(LTI) system

consists of an encoder which adds redundancy, in a controlled manner, to thek data bits

we want to transmit. This redundancy can be used at the receiver to overcome the effects

of noise which is encountered in the transmission of the signals through the channel,

meaning to detect or correct certain errors. However, thek data bits are mapped inton

code bits by the encoder. The modulator converts thesen code bits into digital baseband

signals(Manchester-Code). After that, the signals are transmitted over the channel and get

attenuated by the gain of the cable. Due to the fact that the group delay of the transfer

function of the cable is constant over all frequencies there is noIntersymbol Interference

(ISI) and the signals are only attenuated in amplitude. Noise corrupts these signals and

the demodulator has to recover the binary message. There are different methods to detect

the transmitted bits. In this section, I will describe a standard receiver which is used at the

IIT and a correlation demodulator.

Figure 14: Transmission System

The binarycode wordof n bits is decoded in order to find errors. In case of no errors

the frame is accepted and we obtain thek data bits. If there are any errors the frame is

23

Page 35: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

rejected and the receiver requests the transmitter to resend the frame.

4.1 Modulation of Manchester-Code

The transmission of digital signals like Manchester-Code corresponds to a transmission in

the baseband. Baseband channels are channels with a wire connection like coaxial-cables

or twisted-pair wires in which the digital information is directly transmitted by the base-

band pulse modulation. The TCN-Standard requires a shielded twisted pair wire, which

has been explained in more detail in chapter 3, in order to assure a reliable transmission.

Figure 15 presents the signalss1(t) as a logic one ands0(t) as a logic zero of the Manchester

code. A transition from a low tension to a high tension corresponds to a one and a transi-

tion from a high to low tension corresponds to a zero. The signal amplitude peak-to-peak

at the transmitter side is about 8V and the standard data rate is 1,5 Mbits/s.

Figure 15:s1(t) ands0(t) Manchester signals

In figure 15 we can verify that both signalss1(t) ands0(t) consist of two rectangular

pulses which have the width of half the bit timeTB. One with a positive sign, the other

one with a negative sign. The signal representation of the Manchester code shows equation

35 and 36, whererect( tT) is a rectangular pulse with the amplitude one, the width T and

symmetric to the y-axis.

s1(t) = −A · rect(

t

T/2− T

4

)+ A · rect

(t

T/2− 3T

4

)(35)

24

Page 36: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

s0(t) = A · rect(

t

T/2− T

4

)− A · rect

(t

T/2− 3T

4

)(36)

In order to obtain the spectrum of the Manchester code we have to determine the fourier

transformation of equation 35 and 36. The formula of the fourier transformation is shown

below:

F (f) =

∞∫−∞

f(t) · e−j2πftdt (37)

We substitutes1(t) for f(t) in equation 37 and obtain with the following correspondences

of the fourier transformationFf(t − t0) = F (f(t)) · e−j2πft0 and Frect( tT) =

T · sinc(πTf) after simplification the result5:

F (f) = −4Ajsin2(πf T

2)

πf(38)

The spectrum ofs0(t) has a different sign but the absolute value of it is the same as in

equation 38. We suppose using the TCN-standard data rateR = 1, 5Mbits/s. So the bit

period isTBP = 1/R = 0.67µs. Due to the fact that the rectangular pulse only covers

half of the bit time, the first zero of the Fourier Transformation is located at the frequency

R0.5

= 2R. So the required bandwidth of the first harmonic of the Manchester code is dou-

ble of its data rate. In comparison to aNon-Return-to-Zero(NRZ) code where each bit is

either a positive or a negative pulse and the required bandwidth is1/TBP the Manchester

code requires twice the bandwidth ofNRZ. Figure 16 represents the spectrum of the

Manchester signals1(t).

5sinc(πTf) = sin(πTf)(πTf)

25

Page 37: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

Figure 16: Spectrum of the Manchester code

The need of the high bandwidth is the major inconvenience of the Manchester-Code.

4.2 Demodulator and Detector of Manchester Code Signals

In the previous section, the Manchester signals in time and frequency domain were ex-

plained. These digital signals are converted in analog signals and are transmitted over the

channel in differential mode. At the receiver side they are converted from differential sig-

nals to signals in common mode by a line driver which I explained in section 3.2.

In this section, two receivers are presented in order to demodulate these digital Manchester

signals and to obtain the binary information.

The first receiver which is explained in section 4.2.1 has been used in the hardware avail-

able in the IIT. This receiver is based on the detection of a low or a high level of voltage

in the first or second half of a bit cell.

In order to use this receiver it is necessary to set up a reconstruction low pass filter to elim-

inate the high frequency noise components which do not belong to the signal. In section

4.2.2 a correlation demodulator is proposed which uses correlation techniques in order to

demodulate the digital Manchester signals. This receiver does not require a low pass filter

before demodulation because it is already integrated in the correlation demodulator.

26

Page 38: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

Both receiver have the same performance, meaning they achieve the sameBit-Error-Rate

(BER) with the sameSignal-to-Noise-Ratio(SNR). The correlation demodulator is less

sensitive to ISI and it may easily be implemented with integrator circuits.

4.2.1 Standard Receiver

The TCN-Standard demands that the receiver shall recognize a frame correctly even if the

next edge appears0.125µs too late or too early with respect to the expected edge position

[1]. Figure 17 shows the tolerances in which the receiver should detect the Manchester

signals.

Notice that the first bit of the received signal has to have a defined value of -4V in the

Figure 17: tolerances of the received signals

time range from 125ns till half bit time minus 125ns and a defined value of +4V in the

time range from half the bit time plus 125ns until the whole bit time minus 125ns. The

values between this two time intervals do not matter.

Due to the fact that the computer model should allow to modify the data rate of the

Manchester signals it is necessary to adapt the tolerances in dependence on the trans-

mission frequency.

Considering the TCN-Standard data rate of 1.5Mbit/s the time of one bit cell is 666.67ns.

Therefore 125ns correspond to 18.75% of the bit time and consequently 37.5% of half the

bit time.

The receiver decides on a one if all the samples between 18.75% and 31.25% of the bit

27

Page 39: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

time are on a negative voltage level and all the samples between 68.75% and 81,25% of

the bit time are on a positive voltage level.

This receiver is programmed in the functionDemodulation. It is indispensable to apply

a low pass reconstruction filter in the receiver before demodulation process in order to

eliminate the high frequency white noise components. The cut off frequency of this low

pass filter is the same as the cut off frequency of the anti aliasing filter in the transmitter.

4.2.2 Correlation Demodulator

The signals of the Manchester-Code in figure 15 can be treated as antipodal signals be-

cause the cross-correlation coefficientρ of the signalss1(t) ands0(t) is equal to -1 and

the signals1(t) = −s0(t). Hence, the two signals have the same energy.

The cross-correlation coefficient of two signals in a bit periodTB is calculated as follows

and can assume values in the range from -1 to 1:

ρ =

TB∫0

s1(t) · s0(t) dt (39)

where a cross-correlation coefficient of one indicates maximal similarity of the two sig-

nals and a cross-correlation coefficient of minus one indicates a maximal dissimilarity.

During the transmission the signals are corrupted by different noise sources which will be

explained in more detail in chapter 5.

In this section, I confine to the influence of white Gaussian noise. However, the received

signal before the correlation or matched filter demodulator is:

r(t) = si(t) + n(t) i = 0, 1 for 0 ≤ t ≤ Tb (40)

wheren presents the additive Gaussian noise which has a mean equal to zero and the

varianceσ2n = N0

2WHz

. This noise is explained in more detail in section 5.1.

The structure of the correlation demodulator which is used to detect the received bits is

shown in figure 18. It works in the following way:

First the received signalr is divided into two paths. The first path is multiplied by the

28

Page 40: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

Figure 18: Matched filter, Correlator

transmitted signals1(t) and the cross-correlation coefficient is calculated. Remember that

the calculation of the cross-correlation coefficient corresponds to an integration over a bit

periodTB of the product ofso(t) ands1(t) (see equation 39).

The second path is multiplied by the transmitted signals0(t) and the cross-correlation

coefficient is calculated and multiplied by -1.

After that, both paths are added together and the valuer is sampled with the bit periodTB

into the pathz, wherez is a normal distributed random variable withz(T ) = ai(T )+n(T )

with i = 0, 1.

ai(T ) is the amplitude of the signalssi and its value depends on the transmitted bit. It is

either 4 for a transmitted one or -4 for a transmitted zero supposing zero attenuation. Since

the attenuation of our cable is greater than zero the values ofai(T ) change according to

the attenuation.

Now the detector decides on a one ifz > γ and on a zero ifz < γ, whereγ is the threshold

between the signals1(t) and the signals0(t). In order to determineγ we observe the signal

space diagram for binary antipodal signals:

29

Page 41: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

Figure 19: Signal space diagram for Manchester-Code

The amplitude of the signals1 is located at a certain distance∆d to the right away from

the y-axis and the amplitude of the signals0 is located at the same distance to the left of

the y-axis. Now, we imagine that each signal amplitude is corrupted by white gaussian

noise with the density function

f(z) =1√2πσ

exp

−1

2

z2

σ2

(41)

If we take the median value of each amplitude±a1 into account we obtain the conditional

probability density function(PDF ):

f(z|si) =1√2πσ

exp

−1

2

(z ± ai

2σ2

)2

(42)

This equation shows thePDFs with the mean±ai, meaning that the standardPDF of

the white noise has been movedai to the left andai to the right. Thus, we obtain the two

curves below of the conditionalPDFs:

Figure 20: Conditional PDFs of two Manchester signals

30

Page 42: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

wheref(z|s0) is the conditional PDF with the condition thats0 is sent andf(z|s1) is the

conditional PDF with the condition thats1 is sent. We consider that the signalss1 ands0

are equally likely to be transmitted, meaning the probability on the transmitter side for

each signal being transmitted is equal to0.5. This probability is designated as thea priori

probability. In this case, the threshold of the two PDFs can be obtained by the following

equation:

γ0 =s0 + s1

2(43)

Sinces0 = −s1, γ is equal to zero for antipodal signals like Manchester code. Thus, the

correlation demodulator decides in favor of a one ifz(T ) is greater than zero and decides

in favor of a zero ifz(T ) is smaller than zero.

4.2.3 Bit Error Probability of the Standard Receiver and Correlation Demodulator

In section 4.2.2 and 4.2.1, the demodulation and detection of the antipodal Manchester

signals was described. In this section, I will explain how to calculate the probability of a

bit error in dependence on the SNR.

When a signal is transmitted and the detector decides on a zero or a one we designate these

decisions as hypothesisH0 andH1. We talk of a bit error, if the signals1 is transmitted but

the detector decides on a zero, or if the signals0 is transmitted and the detector decides

on a one. So the probability of a decision in favor ofs1 whens0 is sent is

P (H1|s0) =

∞∫γ0

f(z|s0)dz (44)

and the probability of a decision in favor ofs0 whens1 is transmitted is

P (H0|s1) =

γ0∫−∞

f(z|s1)dz (45)

In figure 20 the probability ofP (H1|s0) andP (H0|s1) are hatched in yellow and green.

To calculate the bit error probability, we have to determine the sum of these probabilities

and also take into account thea priori probabilitiesof 0.5 which I mentioned in section

31

Page 43: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

4.2.2. Thus, we obtain a bit error probability of

PBiterror =1

2P (H0|s1) +

1

2P (H1|s0) (46)

Due to symmetric reasonsP (H0|s1) is equal toP (H1|s0). Therefore, we obtain

PBiterror = P (H1|s0) =

∞∫γ0

f(z|s0)dz =1√2πσ

∞∫γ0

exp

−1

2

(z − a0

σ

)2

dz (47)

whereγ0 = 0. The theorem of Parsevalindicates that the energyεb of a bit is a2i [10].

Thus, we can express the signal amplitudeai as the square root of the energy:ai =√

εb.

We put this expression in equation 47, we replaceσ2 by N0

2and obtain:

PBiterror =1√πN0

∞∫0

exp

−(

z −√εb

N0

)2 dz (48)

In order to obtain thestandard normal distributionin equation 41, we substitute(

z−√εb√N0

)2

for x2

2and obtain

x =√

2

(z −√εb√

N0

)⇒ dx

dz=

√2

N0

⇔ dz =

√N0

2dx

We also have to replace the limits of the integral by

x1 =√

2

(0−√εb√

N0

)=

√2εb

N0

x2 =√

2

(∞−√εb√

N0

)= ∞

Then we obtain:

PBiterror =1√2π

∞∫√

2εb/N0

exp

−x2

2

dx = Φ(∞)−Φ

(√2εb

N0

)= 1−Φ

(√2εb

N0

)(49)

where εb

N0is the SNR of the signals at the receiver andεb = a2T is the average bit energy.

The functionΦ is called thecumulative density functionof thestandard normal distribu-

tion and is represented in figure 21.

32

Page 44: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

Figure 21:Cumulative density functionwith σ2 = 1 andµ = 0

This function is used to calculate the bit error probability. Now we calculate all values of

the bit error probability in dependence on theSNR and obtain the curve below:

Figure 22: Probability of a bit error in dependence on the SNR

The SNR in dB is calculated as follows:SNR/dB = 10 · log10(SNR)

33

Page 45: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

4.3 TCN-Frames Including CRC Bits

4.3.1 Introduction to the Structure of a TCN-Frame

The TCN-Protocol uses block codes in order to establish an error detection, i.e., redun-

dancy is added at the end of the data bits in order to detect bit errors which may be caused

by different noise sources or interferences during the transmission. In this introduction, I

will explain the structure of frames of the TCN-Protocol using the data rate of 1,5Mbit/s;

the linear block code which is used in order to detect incorrect frames is explained in

section 4.4.

The TCN-Standard distinguishes between master and slave frames where the master

frames always contain 16 data bit which are followed by eightparity check bit. Slave

frames may contain 16, 32, 64 or more data bits which are also terminated by eight parity

check bit at the end of the frame. If the message is longer than 64 bit, the eight bit check

sequence is put after each bit sequence of 64 bits [1].

Figure 23 shows the structure of master and slave frames. Each frame starts with a Start-

Figure 23: Frame structure

Delimiter which includes three Manchester-Code cells. These cells are separated by time

slots of 11,5Mbit

s

= 666.67ns. At the end of a frame after the check sequence, there is an

End-Delimiter, which allows the detection of the end of the frame6.

Due to the fact that the TCN bus uses the master-slave principle, each communication

between the equipment starts with a master frame sending commands. Therefore, at least

50 per cent of the bus payload consists of master frames which contain 16 data bits. For

this reason I confine in the following work and in the computer model to frames with 16

information bits and 8parity check bits, meaning the frame consists of 24 code bits.

6for more details of the Start and End-Delimiter please refer to [1]

34

Page 46: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

4.4 Binary Block Encoding

The following sections are based on the assumption that the errors that take place during

transmission are statistically independent. When using error correction it is not convenient

to apply the block code, which will be described in the following sections, with burst

errors7, because the error correction capability only guarantees the correction of one bit

error.

To overcome the effects of burst errors it is appropriate to use an interleaver that is applied

after the encoding and before the modulation. The interleaver algorithm makes sure that

the errors are statistically independent by distributing a frame over several channels. This

method is applied with OFDM data transmission and it will be explained in more detail

in section 6.2.1.

4.4.1 General Properties of Binary Block Codes

In this section, the properties of block codes used for error detection and correction of

the corrupted message, will be explained. In order to encode acode word, redundancy

is added to the original message to transformk data bits inton code bits(k < n) by

appendingn− k parity check bits.

A block code consists of a set of vectors with a fixed length, calledcode words. The length

of the code word is the number of elements in the vector and is designated asn. When

the elements of a code word only consists of the values one and zero, the code is called a

binary code. A binary code is applied in this work.

A block of k information bits is mapped into acode wordof lengthn. There are2n possi-

blecode wordsin a binary block code of lengthn. From this2n possiblecode wordsthere

are2k possibilities of different information bits and2n−k possibilities of different parity

bits.

Every binarycode wordcan be seen as a binary polynomial in theGalois Field 2(GF(2)).

TheGF(2) is a field with two elements 0 and 1 that has two arithmetic operations which

are defined on its elements. The arithmetic operations are the addition and the multipli-

cation, which satisfy the properties of the following addition and multiplication table:

7When m adjacent bits in a frame are disturbed we talk of a error burst of length n

35

Page 47: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

+ 0 1

0 0 1

1 1 0

· 0 1

0 0 0

1 0 1

The operations addition and multiplication of the elements in theGF (2) are based on

mod − 2 arithmetic. InGF (2) the addition is equal to the subtraction. To obtain the

division table we have to eliminate the first column of the multiplication table because the

division with zero is forbidden. Therefore only the second column of the multiplication

table defines the division inGF (2). The result of amod − 2 operation is always either a

one or a zero.

Although there are2n possiblecode words, only M = 2k code words withk < n are

selected to form a code, i.e., redundancy is added to the data bits. This code is called a

(n, k) block code and its dual code is a(n, n− k) code with2n−k code vectors. The dual

code may be used to construct the parity check matrixH which is explained in section

4.5.1.

The weight of acode wordis defined as the number of nonzero elements it contains. Here,

everycode wordhas his own weight. Therefore the code is called a linear block code.

The Hamming distancedij between two code wordsCi, Cj satisfy the condition0 ≤

dij ≤ n, whereby the smallestHamming distanceof the set ofM code wordsis called the

minimum distanceof the code and is designated asdmin. A minimumHamming distance

dmin of four is provided by the block code defined in the TCN-Standard. Thecode rate

of a code is defined as the relation between the code bits and the data bits:r = kn

= 23.

By multiplying thecode ratewith the data rate of a certain transmission system we obtain

the data rate with error detection/correction of this system after the encoding procedure.

After this general introduction the encoding ofcode wordsis explained in the following

section.

4.4.2 Generating Polynomial and Generator Matrix

Let us consider the row vectorXm = [xm1 xm2 ... xm3] as the vector of thek information

bits. This vector is encoded by using equation 50 and we obtain the row vectorCm =

36

Page 48: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

[cm1 cm2 ... cmn] which contains the information and parity bits.

Cm = Xm ·G (50)

G is called thegenerator matrixand it can be calculated by the givengenerator poly-

nomial in different ways. In this section, I describe an algorithm which computes the

generator matrixinto the following form:

G = [Ik | P] =

1 0 . . . 0 p1,1 p1,2 . . . p1,n−k

0 1 . . . 0 p2,1 p2,2 . . . p2,n−k

......

......

......

...

0 0 . . . 1 pk,1 pk,2 . . . pk,n−k

(51)

We observe that the generator matrixG consists of the identity matrixIk of dimensionk

and a matrix withk rows andn−k columns. This form of the matrixG is calledsystematic

and it is a preferred form because it constructscode wordswhere the firstk bits of each

code wordare identical to the information bits and the remainingn− k bits are the parity

check bits.

Thek row vectors ofG are linearly independent, meaning that they span a subspace ofk

dimensions. Therefore, the rank of the generator matrix isk, i.e., in the case of using only

frames which contain 16 information bitsk is equal to 16.

The generator matrix bits shall be computed according to thegenerating polynomialin

the following equation [1]:

g(x) = x7 + x6 + x5 + x2 + 1 (52)

Every generating polynomial has the degreen− k. In this case(n− k) = 7. Considering

a row vectorXm of k = 16 information bits, we can concluden = 23.

There are different possibilities to compute the check sequence of acode word. Equation

50 provides an encoding method of acode wordby using thegenerator matrixG. This

method and another method will be explained in more detail in section 4.4.3.

37

Page 49: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

In this section, I limit my explanations to a computation algorithm of thegenerator matrix

in the systematic form using thegenerating polynomialg(x) in equation 52.

The lth row of G corresponds to a polynomial of the formxn−l + Rl(x), l = 1, 2, ..., k,

whereRl(x) is the remainder of a polynomial division byg(x) in GF (2) and therefore a

polynomial of degree less thann− k. We dividexn−l by g(x) and obtain:

xn−l

g(x)= Ql(x) +

Rl(x)

g(x), l = 1, 2, ..., k (53)

which is equivalent to the form:

xn−l = Ql(x)g(x) + Rl(x)

whereQl(x) is the quotient andxn−l + Rl(x) is acode wordof the block sincexn−l +

Rl(x) = Ql(x)g(x) [18]. Remember that inGF (2) the addition is identical to the subtrac-

tion. Therefore, we obtain the desired polynomial of thelth row of G with the expression:

xn−l + Rl(x)

With this algorithm we determine the systematic form of thegenerator matrixG of our

(n, k) = (23, 7) linear block code which is shown in appendix I. Thegenerator matrixG

is needed later in section 4.4.3 to encode the information bits and in section 4.5 to develop

theparity check matrixH.

This parity check matrixapplied to the receivedcode wordmay be used to detect and to

correct transmission errors.

4.4.3 Encoding ofcode words

In this section, I describe two methods of encodingcode wordsand I will confine to 16

information bits in the row vectorXm, which corresponds to a master or slave frame with

16 bit payload.

In the first method we multiply thek information bits byxn−k and divide the result by

thegenerating polynomialg(x). We obtain a remainder ofn− k bits which are the parity

38

Page 50: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

check bits. Equation 54 shows the assignment.

ParityCheckBits(x) = remainder

[Xm(x) · xn−k

g(x)

](54)

This equation gives us the 7 parity check bits which have to be put after the 16 informa-

tion bits to obtain thecode word. In addition to that the TCN-standard requires to extend

thecode wordby appending one additional even parity check bit at the end of thecode

word. Therefore, the added check bit is a 0 if the originalcode wordhas an even number

of ones and a 1 if thecode wordhas an odd number of ones [1].

In comparison to the first method I explained above, the second method using equation

50 is more compact because it generates the wholecode wordat once by the vector by

matrix multiplicationCm = Xm · G.

If we multiply the vectorXm = [xm1 xm2 ... xmk] of k information bits(length k) with the

generator matrixG of the dimensionsk × n according equation 50 we obtain a vector of

the code wordof lengthn, where the firstk bits of eachcode wordare identical to the

information bits. The remainingn− k bits of eachcode wordare linear combinations of

thek information bits and they are called parity check bits [18]. Therefore the codeword

cm has the following form:Cm = [xm1 xm2 ... xmk| cm1 cm2 ... cm(n−k)].

As we can see above the length of thecode worddepends on the length of the data bit

vectorXm and thegenerating polynomial.

Like in the other method which is explained above, we have to enlarge the wholecode

word by appending one evenparity check bitat the end of thecode word. Thus, we obtain

acode wordof 16 information bits and 8 parity check bits.

4.5 Block Decoding and Error Detection

The data transmitted over the TCN bus is security relevant, meaning it contains infor-

mation about door opening, brakes, power electronics and so on. A wrong reception of a

frame may cause accidents. Therefore, the TCN-Standard only provides an error detection

and the receiver asks the transmitter to resend the frame in case of an error. The reception

39

Page 51: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

procedure is explained below.

When an equipment of the TCN bus receives a frame, it first isolates thecode wordof

this frame, meaning that the start delimiter and end delimiter are removed. Considering

a frame which consists of 16 data bits thecode wordhas a length of 24 bits. The eight

parity check bitsof the received frame are stored in a memory in order to compare them

later with the eightparity check bitswhich the receiver calculates of the received 16 data

bits. If the received eightparity check bitsmatch to the eightparity check bitswhich are

calculated by the receiver, the frame is accepted.

But in the case this two bit sequences do not match, the frame is rejected and the slave

asks for a new transmission of the message by sending a request [14]. This procedure is

designated asautomatic-repeat-request(ARQ).

Due to the fact that the proposed code is capable of correcting at least one bit error and

sometimes two bit error patterns, an algorithm to correct errors is proposed in section

4.5.2. This algorithm will be combined with the OFDM modulation scheme in order to

decrease theframe error rateof the transmitted data. But it is not useful to apply it to the

TCN frames because the probability that this method does not correct and consequently

not detect a transmission error is too high in noisy environments. In comparison to the data

transmitted by frames of the TCN-standard, the data transmitted using the OFDM coding

scheme is not security relevant considering it only contains audio and video signals.

4.5.1 Parity check matrix H

In order to detect or correct errors in the receivedcode wordswe have to determine the

parity check matrixH. This matrix corresponds to thegenerator matrixof the dual code

and consists ofn−k linearly independent code vectors. Anycode wordof the(n, k) code

is orthogonal to any code vector in the dual code(n, n − k). Hence, anycode wordCm

of the (n,k) code is orthogonal to every row of theparity check matrixH. Therefore, we

obtain the equation below:

Cm ·HT = 0 (55)

40

Page 52: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

where0 is a row vector withn− k elements which are equal to zero in case of no error in

the codeword. Since equation 55 is equal to zero for everycode wordof the (n, k) code

we can conclude that

G ·HT = 0

Thus,H has the following form inGF(2):

H = [PT|In−k] =

p1,1 p2,1 . . . pk,1 1 0 . . . 0

p1,2 p2,2 . . . pk,2 0 1 . . . 0...

......

......

......

...

p1,n−k p2,n−k . . . pk,n−k 0 0 . . . 1

(56)

Theparity check matrixof the(n, k) code hasn columns andn− k rows.

Since we have extended the linear block code in section 4.4.3 by appending an even parity

check bit, we have to extend theparity check matrixas well [18]. This matrixHextended

has the following form:

Hextended =

0

0

H...

0

1 1 1 . . . 1 1

(57)

whereH is theparity check matrixof the(n, k) code andHextended is the matrix of the

(n + 1, k) code.

The matrixHextended of the(24, 16) code is shown in appendix I.

4.5.2 Decoding and error correction

In section 4.5.1, we have seen how to determine theparity check matrixH by using the

generator matrixG. Now, we decode the receivedcode wordswhich may be incorrect in

order to find the original data bits using the matrixHextended. This matrix permits us to

correct different errors.

41

Page 53: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

We suppose thatCm is the transmittedcode wordwhich is disturbed in the transmission

channel and thecode wordY is received. Y can be expressed as

Y = Cm + e (58)

wheree is an arbitrary binary error vector of the length n. The weight of this error vector

corresponds to the number of errors in thecode word. Now we put the receivedcode word

Y in equation 55 and obtain

Y ·HTextended = (Cm + e) ·HT

extended (59)

= Cm ·HTextended︸ ︷︷ ︸+e ·HT

extended (60)

= 0 + e ·HTextended = S

The vectorS of the dimensionn+1−k = 8 which is calculated by the matrixHextended

is called thesyndrome of the error pattern. It follows that any component of the vectorS

is zero forcode wordswhich have an error vectore equal to zero and nonzero for allcode

wordswhich have an error patterne unequal to zero.

In a binary block coder = dmin− 1 errors may be detected and every error pattern which

consists of

t = b12(dmin − 1)c (61)

errors may be corrected.

With the valuedmin = 4 we obtain forr = 3 andt = 1.

Equation 59 shows thatS only depends on the error vector which is added to the code-

word. We have to keep in mind thatS is a characteristic of the error pattern and not of the

transmittedcode word.

Besides there are2n different error patterns and only2n+1−k = 256 syndromes. Thus,

different error pattern result in the samesyndrome. This means that it is not possible to

guarantee an error correction of the corrupted codeword when there is more than 1 error

42

Page 54: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

in acode wordwhich also shows equation 62 for the extended(n + 1, k) code8.

t∑i=0

(n + 1

i

)= 1 +

(n + 1

1

)+

(n + 1

2

)+ ... +

(n + 1

t

)≤ 2n+1−k (62)

If we calculate the binomial coefficients we obtain(

241

)= 24 and

(242

)= 276. Therefore,

the code is able to correct every error pattern with 1 bit error and only some with two,

three or four errors. This depends on the syndrome table.

In order to establish an error correction we have to multiply 256 different error patterns

of weight one, two, three and four with the parity check matrixH. The result of these

multiplications gives us a table with 256 rows, each row containing a differentsyndrome

of n + 1− k = 8 bit. This table is also designated as asyndrome table.

Notice that every row/syndrome in this table is assigned to an error pattern of length

n+1=24. In order to correct errors, the corrupted message is multiplied by theparity check

matrix H. The result of this multiplication gives us the syndromeS. Now, we search the

row in thesyndrome tablewhich corresponds to thissyndrome. Through the assignment

between thesyndrome tableand the error pattern table we obtain the corresponding error

pattern vector E which has to be added to the corrupted messageY = Cm + E. In case

the message was distorted by one bit error the error pattern vectorE corresponds to the

error vectore. Thus, thecode wordis corrected.

Ccorrected = Y + E = Cm + e + e = Cm (63)

Remember that withmod − 2 arithmetic an addition of two ones in is always zero. See

also section 4.4.

In some cases when the weight of an error pattern is greater than four which is the Ham-

ming distance of the block code [13], the incorrectcode wordmay be transformed in a

correct one by an error pattern. This kind of error cannot be detected and is designated as

anundetected error. Considering a bit error rate ofp the probability of m bit errors in a

8the binomial coefficient is defined as(nk

)= n!

(n−k)!·k!

43

Page 55: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

frame ofn = 24 bits may be calculated with the following equation:

P (m, n) =

(n

m

)pm(1− p)n−m (64)

If we plot the function number of bit errorsm in a frame of24 and64 bits versus the

probabilityP (m, 24) andP (m, 64) with different SNR we obtain figure 24.

Figure 24: Probability of bit errors

where the dashed line represents the probability of errors in a frame of64 bits and the

solid line represents the probability of errors in a frame of16 bits.

Notice that the probability of four and more bit errors with SNR of10 or 11 in a frame of

24 bits is smaller than10−16. In this case the probability of anundetected erroris negli-

gible.

In some cases of two or more errors which cannot be corrected by the code, the syndrome

of the corrupted codeword is unequal zero but the aligned error pattern does not corre-

spond to the error vector which disturbed the message. In these cases the correction of the

code worddoes not work and the receiver treats the received message as correct.

44

Page 56: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

The error pattern table which is provided by the functionsyndtableof the parity check

matrix H in MATLAB has the dimension(256 × 24) for a frame of24 bits. It provides

error pattern of weight one, two, three and four errors which is shown in table 4.5.2. In

this table we consider a SNR equal eight which corresponds to a bit error probability

of p = 1.9 · 10−4 for uncoded Manchester signals, see also figure 22. The value of the

SNR = 8dB is arbitrary and only shall be used for an example how to calculate the

probability that a erroneous frame is acknowledged as correct at the receiver.

Table 4.5.2:Analysis of the error correction with a SNR=8dB

Weight: Number of errors in a frame; weight of the error pattern

Probability: Probability of an error pattern, see equation 64

Possibilities: Number of different possibilities of error pattern

Errors corrected: Number of different error pattern which may be corrected

Probability(not correctable): Probability of an error pattern which is not correctable

Weight Probability Possibilities Errors corrected Probability(not correctable)

1 p1 = 4.5 · 10−3(

241

)= 24 24 P1 = 0

2 p2 = 9.9 · 10−6(

242

)= 276 126 P2 = p2 · 276−126

276= 5.38 · 10−6

3 p3 = 1.38 · 10−8(

243

)= 2024 104 P3 = p3 · 2024−104

2024= 1.3 · 10−8

4 p4 = 1.38 · 10−11(

244

)= 10626 1 P4 = p4 · 10626−1

10626= 1.38 · 10−11

In this table the probability of more than five errors is neglected. So, the probability that

acode wordor frame is not corrected but accepted as correct at the receiver is

P (accepted|error) =4∑

i=1

Pi = 5.39 · 10−6 (65)

In this example, the probabilityP (accepted|error) is five times too high because the

TCN-Standard requires that only one frame error appears in10+6 frames which corre-

sponds to frame error rate of10−6.

In general, it is not convenient to apply an error correction code in the TCN-Standard

because the explained code is not capable of correcting allcode wordswith two errors.

In strong noise environments, i.e. a low SNR, the probability of two bit errors in a frame

45

Page 57: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

is too high. In case the code does not correct these two bit errors, the received message

will not be seen as false. The receiver will acknowledge this message -which may contain

security data- as correct and execute its command. The process may lead to accidents,

therefore the risks of error correction for security relevant data can be greater than its

advantages.

However, the error correction code may rather be applied for OFDM coding, see also

section 6.2, because only video and audio signals are transmitted which are not as sensitive

to some bit errors as security data.

Remember that this error correction code does not correctburst errors. In order to correct

these kind of errors interleaving(see also section 6.2.1)has to be applied to distribute the

error burst over all the frames. Thus, we achieve a statistically independent distribution of

errors which allows the block code to correct several error bursts.

4.6 Implementation of Binary Block Codes in MATLAB

In order to apply the theory which has been explained in the previous sections, I wrote

several functions in MATLAB to encode, decode and correct frames.

The functionBlockcodecreates thegenerator matrix, the parity check matrix, the syn-

drome tableand theErrorpattern tableconcerning the methods and algorithm I explained

in sections 4.4.2 to 4.5.2.

The functionencodinguses thegenerator matrixcreated in the functionBlockcodeto en-

codek = 16 data bits inton = 23 code bits which are extended by a 24th even parity

check bit in order to obtain the complete frame of length of 24.

At the receiver side the functionDecodingis able to detect or to correct bit errors. The

flow chart of this function is shown below:

46

Page 58: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

4 Transmission System

Figure 25: Flow chart of functionDecoding

47

Page 59: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

5 Noise Sources

In chapter 3, the characteristics of theRaychem 99M1121twisted pair cable were de-

scribed. We obtained an equation in order to calculate the gain and phase of the cable in

dependence on the cable length. Due to the fact that the phase of this cable is linear over

the entire frequency band, the signals are not corrupted by ISI. Hence, only noise sources

may distort the shape of the signals.

In this chapter, I will describe different noise sources which may corrupt the signals in

the transmission channel like white and colored background noise and periodic impulsive

noise. We have to take into consideration that the transmission channel of a moving sys-

tem like a train is different from other communication channels because there are always

mechanical vibrations in the train. Furthermore, there are DC/DC converters in order to

transform high DC voltage to lower DC voltages. These converters may inject periodic

impulsive noise.

Since all electrical connections of the train lead to one mass which is connected to the

ground, it happens that this mass is unconnected for severalms due to mechanical vibra-

tions and physical distortions on the track. This causes noises in the electrical system. On

the other hand, it is possible that noise is injected through the mass into the system.

However, the main noise sources are due to different electrical and mechanical effects in

the train environment like the floating mass in a train, DC/DC and DC/AC-converters,

mechanical vibrations and coupling between electrical connections.

5.1 White and Colored Noise

Stochastic processes are used in order to describe white and colored noise. A random

process is characterized in the frequency domain by itspower spectral densityor psd

Sx(f) and in the time domain by its autocorrelation functionRx(τ). The fourier transfor-

mation of the autocorrelation function is thepower spectral densityand the inverse fourier

transformation of thepsd leads to the autocorrelation function.

In electronic devices, which are used in the implementation of communication systems,

thermal noise is generated. This noise is assumed as awhite random processn(t) which

48

Page 60: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

has a flat and constant power spectral densitySx(f) for all frequenciesf . If the stochas-

tic process is normal distributed we talk ofgaussian white noise. This kind of noise will

be described and later applied in the MATLAB model. Figure 27 shows thepsd and the

autocorrelation function of ideal white noise.

Figure 26: Power spectral density and autocorrelation function of white noise

Thepsd is defined asSx(f) = N0

29 ∀f and the unity of thepsd is W

Hz. If we calculate the

inverse fourier transformation we obtain the autocorrelation functionRx(τ) which is

Rx(τ) =

∞∫−∞

Sx(f)ej2πfτdf =N0

2

∞∫−∞

ej2πfτdf =N0

2δ(τ) (66)

As we can see in the figure above, the autocorrelation function is equal toN0

2atτ = 0 and

0 every where else. This means that adjacent signal values of the stochastic processn(t)

are always uncorrelated, so that the signal should variate with an infinite velocity. But this

is physically not possible. Another way to show this can also be derived from the power

of the noise signaln(t):

SinceSx(f) = N0

2= const for all frequencies and the power of the noise signal is

the integral over the whole frequency band ofSx(f) we obtain an infinite power which

obviously does not exist.

Rx(τ) =

∞∫−∞

Sx(f)df =

∞∫−∞

N0

2df = ∞

9quantum mechanical analysis of the thermal noise lead to the following equationSx(f) = hf

2(ehfkT −1)

,

where h denotes Planck’s constant and k is Boltzmann’s constant. T denotes the temperature in Kelvin. Thisspectrum achieves its maximum at f=0 which has the valuekT/2. In the literaturekT is designated asN0

[23]. Thus, the psd is equal toN02 .

49

Page 61: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

However, in modelling thermal noise which is generated in electronic devices it is as-

sumed that such noise is awhite random process.

In order to obtain colored noise, we have to get rid of the high frequencies by using a low

pass filter. At the output of this low pass filter we obtain the colored noise time signal

which is bandlimited white noise with a smaller variance.

Remember that, the higher the bandwidth of the system the greater the power and con-

sequently the influence of the white noise. We obtain the noise power by multiplying the

bandwidthB of a transmission system with the averagepower density spectrumN0

2. This

has to be taken into consideration by the user of the MATLAB model when changing the

transmission frequency of the Manchester code or the SNR of white noise.

Figure 27: Model for the generation of colored noise

The colored noise is obtained by using a digitalFinite Impulse Response(FIR) or Infinite

Impulse Response(IIR) filter of the form.

H(z) =B(z)

A(z)=

1 +m∑

i=1bi · z−i

1 +n∑

i=1ai · z−i

(67)

In this work, I used abutterworth(FIR) filter of order 10 to obtain the colored noise

time signal. The cut-off frequency of this filter was chosen to4MHz because the TCN-

Standard proposed the frequency band of bandlimited white noise up to4MHz. This

frequency has to be put in the MATLAB functionbutter() in dependence on the sample

frequencyfS, meaning the real cut off frequency has to be divided byfS

2. Considering a

sample frequency offS = 96MHz, the relative cut off frequencyfC is:

fC

fS

2

=4MHz

48MHz=

1

12= 0.083

50

Page 62: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

On the left side of figure 28 thepower spectral densityin dependence on the normal-

ized frequency (f/fS

2) is shown whereas on the right side the autocorrelation function is

plotted.

Figure 28:power spectral densityand autocorrelation function of colored noise

The x axis of the upper left window indicates the normalized frequency where 1 corre-

sponds to half the sample rate. In comparison to thepsd of the white noise, thepsd of

the colored noise is bandlimited. That means it drops down for frequency values greater

than 4MHz or 0.083. Furthermore, adjacent values of the time signal of a colored noise

are correlated which shows its autocorrelation function. The autocorrelation function of

the colored noise is unequal to zero for the whole time range.

Anyway, after filtering a white noise signal with thebutterworthlow pass filter we obtain

a colored noise signal. The differences can be observed in figure 29

51

Page 63: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

Figure 29: Time signals of white and colored noise

We observe that the high frequencies of the white noise signal are eliminated by the IIR

filter. In addition to that the amplitude respectively the variance of the colored noise is

decreased due to the filtering process. Notice that the variance of white gaussian noise is

equal to 1. For the simulation we obtain a variance of the white gaussian noise time signal

equal to1.044 and for the colored noise time signal we obtain a variance equal to0.092.

5.1.1 MATLAB Model of the White and Colored Noise

The model of white and colored noise can easily be created in MATLAB by applying the

random functionrandn(n,1), wheren is the length of the vector of random values between

-1 and 1.

This function provides random values which respect thestandard normal distributionof

white noise, meaning that the mean value of the output vector is equal to zero and the

variance is equal to one.

The function[b a]=butter(10,1/12)provides the filter coefficient of the denominator and

numerator of a butterworth low pass filter and the functiony=filter(b,a,x)convolutes the

52

Page 64: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

signalx with the low pass filter in order to obtain the colored noise. In the MATLAB

model, I designated the functions which add white and colored noise to a signal of length

n with Add_WhiteNoiseandAdd_ColoredNoise. Both functions create complex noises

which may be used to corrupt real base band signals as well as the complex QAM signals.

Since the demodulator of real base band signals only takes into consideration the real part

of the Manchester signal, the addition of complex noise has no impact on the receiver.

The structure of the functionAdd_ColoredNoiseis shown below:

Figure 30: Flow chart of the functionAdd_ColoredNoise

The amplitude of these noises is derived from the measured signal amplitude and the

entered SNR with the following equation:

SNR/dB = 20 · log10

(ASignal

ANoise

)=⇒ ANoise =

ASignal

10SNR20

(68)

Since the functionAdd_WhiteNoisehas the same structure as the functionAdd_ColoredNoise

but is less complex, i.e. the functionsbutter andfilter are not included, its flow chart is

not printed here.

5.2 Periodic Impulsive Noise

Another noise which is caused by the DC/AC-converter and DC/DC-converters in trains

can be classified asperiodic impulsive noise.

53

Page 65: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

In trains, there are several DC/DC and DC/AC converters in order to convert high DC

voltages of about27kV to lower voltages of220V AC and72V DC. The72V is used

to provide a DC power supply for several equipments like controls and devices of the

MVB/WTB. These converters work in a frequency range up to20kHz and thus may

cause peaks with this frequency as well as peaks with higher frequencies that correspond

to their harmonics.

However, in this model we suppose that the DC/DC converters cause periodic impulsive

noise due to their electrical properties. For the model we do the following approach:

Aimp_Noise =∞∑i=0

rect(t− i · TPeriod) · n(t) (69)

wheren(t) is gaussian white noise. The following figure shows a time signal of the peri-

odic impulse noise corresponding to equation 69.

Figure 31: time signal of a periodic noise process

54

Page 66: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

5 Noise Sources

5.2.1 Implementation of the Impulsive Noise in MATLAB

A function was written in this work which corrupts a signal of lengthn with periodic im-

pulse noise. This function is designated asAdd_PeriodicImpulsein the MATLAB model.

The frequency of the impulses may be changed in the command window by the user and

the impulse width in samples which is assigned in this function to the variableSamples-

ImpulseWidthcan be changed in the MATLAB code.

Figure 32: Flow chart of the functionAdd_PeriodicNoise

55

Page 67: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

6 Multicarrier Modulation and OFDM

New applications in trains, like security monitoring of certain areas or multimedia appli-

cations, lead to the need of high transmission data rates over the MVB bus.

Apart from the control data defined in the TCN-Standard and transmitted over a shielded

twisted pair cable which was characterized in chapter 3, engineers wish to transmit au-

dio and video data over the same cable. Thus, high data rates are required which may be

achieved by using multi carrier modulation (MC) that divide the available bandwidth in

different subcarrier where each subcarrier contains information data.

This chapter deals with the implementation of a multi carrier modulation technique in

order to achieve high data rates for video and audio data transmission.

For the above mentioned applications it is convenient to establish a full duplex transmis-

sion with an upstream and downstream channel each of them using the same amount of

bandwidth. This method is also known asFrequency Division Duplexing (FDD)whereas

one carrier frequency is used for the DownLink and a second carrier frequency for the

UpLink.

To do so it is necessary to divide the bandwidth of the cable in different section where the

bandwidth from0 to 3MHz is used by the TCN Manchester signals. Notice in figure 16

that the first harmonic of the Manchester-Code has its first zero at3MHz. In order to cut

all frequencies of the Manchester signals above3MHz a low pass filter with the cut off

frequencyfc = 3MHz is applied after the generation of the Manchester signals.

Figure 33: Partitioning of the cable bandwidth of the twisted pair cable

56

Page 68: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

The bandwidth above3MHz is now available for multi carrier transmission of video and

audio data. Thus, the upstream channel may be established in the frequency range from

4 − 6MHz and the downstream channel may be established in the frequency range be-

tween8− 10MHz. In the following section, several multi carrier modulation techniques

are discussed and the most convenient one is chosen for the implementation of the trans-

mission system.

6.1 FDM and DMT versus OFDM

Considering a single carrier system with an input data stream and a symbol time ofTSC .

In order to obtain a multi carrier system with the same data rate the input data stream is

divided intoN subcarrier each of them having a symbol timeN times greater thanTSC .

Thus,

TMC = N · TSC (70)

Due to this enlargement of the symbol time the bandwidth of each subcarrier is reduced

by factorN . If the bandwidth of each subcarrier is small enough each subcarrier repre-

sents approximately an ideal channel with constant gain and linear phase.

However, some subcarrier may be corrupted by strong noises which may disturb the trans-

mission. To overcome these distortions, error correction coding may be used to correct the

erroneous subcarrier. The method of a multi carrier system is also designated as parallel

data transmission.

In Frequency Division Multiplexing(FDM) the signal frequency band is divided intoN

non overlapping frequency subcarrier whereby each subcarrier is modulated with a sep-

arate symbol and theN subcarrier are frequency multiplexed. In this case it is necessary

to introduce a guard band between adjacent subcarrier in the frequency domain in order

to avoid spectral overlap of the subcarrier and to eliminate crosstalk between adjacent

channels. This crosstalk is also designated asInter Channel Interference(ICI). The guard

band which is applied in FDM as well as inDiscrete Multi Tone(DMT) techniques leads

to an inefficient use of the available bandwidth.

A simple example of FDM is the use of different frequencies for several radio stations.

57

Page 69: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

All stations transmit at the same time but they do not interfere because every station uses

a different carrier frequency. Their spectra are band limited and adjacent spectra do not

overlap due to a frequency guard band. At the receiver, each signal is individually received

by using a band pass filter to eliminate all the signals except the one we wish to receive.

The filtered signal is down converted and demodulated to recover the original transmitted

information.

DMT divides the available spectrum into N subcarrier with a bandwidth of 4kHz and in-

troduces between adjacent subcarrier a guard interval. DMT was applied in ADSL tech-

niques but is due to the frequency guard interval not convenient for powerful modern

communication systems.

To cope with the spectral inefficiency of DMT and FDM, another method was developed

which increases the spectral efficiency by overlapping adjacent subchannels and thus save

almost50% of the available bandwidth [25]. In order to reduce crosstalk or ICI the sig-

nals of the different subcarrier have to be orthogonal to each other. This topic will be

discussed in section 6.2.2. However, due to the orthogonality of the signals this modu-

lation technique allows an optimal use of the available bandwidth and is designated as

Orthogonal Frequency Division Multiplexing(OFDM). Figure 34 shows the bandwidth of

a conventional multicarrier technique in comparison to OFDM.

Figure 34: Comparison of bandwidth of an conventional MC system with an OFDM sys-tem

58

Page 70: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

The basic principle of OFDM is to split a data stream with a high data rate into a number

of lower rate streams which are transmitted in the same time over a channel. All subcarrier

within OFDM signals are time and frequency synchronized to each other which controls

the interference between subcarrier. Hence, OFDM allows to maximize the overall spec-

tral efficiency without introducing interferences of adjacent subcarrier. For these reasons,

only OFDM is used for the implementation in this work because it uses the bandwidth

more efficiently than FDM or DMT and consequently allows higher data rates.

Each subcarrier of an OFDM system may be modulated with digital modulation schemes

like Amplitude Shift Keying(ASK), Frequency Shift Keying(FSK), Phase Shift Keying

and so on. In this work, I confine toQuadrature Amplitude Modulation(QAM) which

will be explained in more detail in section 6.2.4.

Although the theoretical part of OFDM was developed in the 60s its practical implemen-

tation became a reality in the 1990’s due to the availability of DSP’s that made theFast

Fourier Transformationaffordable.

Today OFDM is applied in many communication systems like Hiperlan 2, DVB-T, WIFI

that is also known as IEEE 802.11 and so on. OFDM is convenient for wireless commu-

nication because the symbol time in comparison to a single carrier modulation system is

increased. For this reason ISI due to multi path propagation is decreased when the time of

the channel impulse response is smaller than the symbol time. However, multi path prop-

agation does not affect us in this work because the data is transmitted through a twisted

pair cable where only single path propagation takes place.

6.2 OFDM Transmitter

In this section, the different steps of an OFDM transmitter with encoding and interleav-

ing which is shown in figure 35 are explained. This transmitter has been implemented in

MATLAB in order to simulate the transmission of OFDM data.

In the first step, the binary data is encoded concerning thegenerating polynomialof equa-

tion 52 in order to obtaincode wordsor frames ofn = 24 bit. After that the frames are

scrambled by the interleaver to achieve that adjacent subcarrier do not contain bits of the

same frame. This will be explained in more detail in section 6.2.1.

59

Page 71: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

Figure 35: OFDM Transmitter

Then, the serial digital data is converted into a parallel data stream using a multiplexer

and the parallel data is mapped using QAM modulation into a mapping of subcarrier am-

plitude and phase that correspond to the in-phase and quadrature components of the QAM

signals. This subcarrier arrangement in the frequency domain will be explained in more

detail in subsection 6.2.3.

Anyway, the spectral representation of the data is transformed into the time domain by the

Inverse Discrete Fourier Transformation(IDFT). Considering a spectrum of N subcarrier,

the 2N IFFT has to be applied in order to obtain over-sampling and to satisfy theNyquist

criterium [25]. The IDFT converts subcarrier to time signals and their carrier frequencies

are spaced with a multiple of∆f from each other. This frequency spacing has to satisfy

the orthogonal condition which is explained in subsection 6.2.2 to prevent crosstalk, i.e.,

ICI between adjacent subcarrier.

In order to save computing time it is convenient to apply theInverse Fast Fourier Trans-

formation(IFFT) instead of the IDFT. This algorithm can only be applied to vector length

equal to2n but it only computesN log(N) complex multiplications while the IDFT/DFT

needsN2 calculation steps.

However, after the frequency to time conversion we obtain a complex OFDM signal where

the real part represents the in-phase and the imaginary part represents the quadrature com-

ponent of the summation signal of the different QAM subcarrier.

Equation 71 represents an OFDM signal in the time domain starting att = ts wheredi

are complex QAM symbols,NS is the number of subcarrier,T the symbol duration and

60

Page 72: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

fC the carrier frequency.

s(t) = Re

Ns2−1∑

i=−Ns2

di+Ns/2exp(j2π(fc −i + 0.5

T)(t− ts))

(71)

Now the guard band, a small percentage of the symbol time, which is explained in more

detail in section 6.2.5 is appended at the beginning of the symbol time and the signals

are mixed up to the required carrier frequencyfC by an radio frequency(RF) orIn-phase

Quadrature-phase(IQ) modulator. Further explanations of this modulator are to be found

in subsection 6.2.6.

6.2.1 Interleaving

In the proposed OFDM system the subcarrier of the upstream and downstream channel

are modulated with a QAM modulation scheme. Considering white noise with a constant

power density spectrumfor all frequencies, the noise power which is introduced in each

subcarrier is the same for all subcarrier. Due to the fact that the subcarrier with higher

carrier frequencies are attenuated stronger than those with smaller carrier frequencies, the

subcarrier with higher carrier frequencies have a lower SNR than those with smaller car-

rier frequencies. Consequently, the bit error probability for channels with higher carrier

frequency is larger.

The error correction capability of the(n = 24, k = 16) block code was analyzed and

evaluated in section 4.5.2. This block code accomplishes its best performance when the

errors occurring in each frame are statistically independent.

But in the aforementioned channel the statistical independent distributions of bit errors

is not guaranteed at all because subcarrier channels with higher carrier frequencies have

lower SNR than subcarrier channels with lower carrier frequencies. If a frame is trans-

mitted in adjacent subcarrier channels with low SNR, several bits of the frame might be

distorted. The error correction capability of the block code in general does not allow a

correction ofburst errors. Thus, the errors could not be corrected in these cases.

An effective method for dealing withburst errorschannels is to interleave the coded data

in such a way that the burst errors are transformed into statistical independent errors. At

61

Page 73: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

the transmitter, the coded bits are permuted in such a way that adjacent bits of a frame are

separated by several bits after interleaving. The reverse permutation has to be performed

at the receiver before decoding.

In this section, a block interleaver is proposed in order to interleave frames of lengthn.

This interleaver consists of a matrix ofn columns andm rows, wherem is the number of

frames we wish to transmit. The frames are written in this matrix row-wise, are read out

column-wise and transmitted over the channel. An interleaving array ofm TCN frames is

shown below, where each row corresponds to a TCN-code word.

n=24 columns︷ ︸︸ ︷f1 0 0 0 0 0 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0

f2 1 1 0 1 0 0 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 0

f3 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1...

......

......

......

......

......

......

......

......

......

......

......

......

fm 1 1 0 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 1 0 0 1

The greaterm the better the performance of the error correction code with interleaving

because all bits of one frame are separated after interleaving bym bits. At the receiver,

the deinterleaver stores the data in the same matrix format, but it is read out row-wise in

order to obtain the original frames.

6.2.2 Orthogonality in Time and Frequency Domain

Signals are orthogonal to each other if they are mutually independent. In this case, signals

may be perfectly transmitted over a common channel without causing interference.

Examples for modulation schemes which are inherently orthogonal areTime Division

Multiplexing (TDM) and FDM. In TDM unique time slots are assigned to each separate

information signal. During the time slots only the signal from a single source is transmit-

ted avoiding any interferences between the multiple information sources.

Most of the FDM systems are orthogonal in frequency domain because there is a empty

frequency guard band between each of the spectra of the different transmission signals.

In OFDM, the subcarrier are spaced as close as possible while the orthogonality among

62

Page 74: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

them is satisfied. Two functions are orthogonal to each other if they match the following

equation.TS∫0

e−j2πfmt · ej2πfnt =

const. ∀m = n

0 ∀m 6= n(72)

whereTS is the time of an OFDM symbol andfm,n the carrier frequency of them,nth

subcarrier. The valuesm andn are defined in the range:0 ≤ m, n ≤ N − 1, where

N is the number of subcarrier of the OFDM system. In order to satisfy the orthogonal

condition in equation 72 the frequencies of all subcarrier in the baseband are expressed as

a multiple of a basic frequency which respects the following equation:

fk = k ·∆f, 0 ≤ k ≤ N − 1 (73)

Since we have chosen the symbol time asTS, equation 72 is satisfied when

fm = m ·∆f, fn = n ·∆f where ∆f = 1TS

(74)

This means that all OFDM subcarrier are orthogonal if they all have a different integer

number of cycles within the symbol timeTS. The upper design of figure 36 shows four

individual OFDM subcarrier with one, two, three and four cycles per symbol time whereas

the lower design of this figure depicts the result for the summation of the four time signals.

63

Page 75: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

Figure 36: OFDM signal in the time domain(100 Samples)

In this figure, all subcarrier have the same phase and amplitude, but in practice when

QAM is used the amplitudes and phases may be modulated differently for each subcar-

rier. Furthermore, we observe that the maximum amplitude of the summation signal is

more than twice as big as the average amplitude of the summation signal. This is due to

positive interference of the subcarrier and leads to thePeak Power Problemwhich will be

described in more detail in section 6.4.

If there is a frequency offset, the number of cycles is not an integer anymore. Thus,

crosstalk, i.e., ICI between adjacent subcarrier occurs after the FFT in the receiver10,

meaning the FFT output for each subcarrier will contain interfering elements from other

subcarriers. Hence, the OFDM/QAM symbols in the signal space diagram are blurred.

The smaller the bandwidth of each subcarrier the greater the interference power of the

subcarrier. Due to the fact that the subcarrier in the middle of a OFDM spectrum has

subcarrier and thus interferer on both sides, the amount of ICI for these subcarrier is ap-

proximately twice as large as for the other subcarrier [25].

In the frequency domain, each subcarrier has asinc(2π∆ft) frequency response because

10the receiver applies a FFT algorithm in order to demodulate the OFDM signals; for more detail pleaserefer to section 6.3

64

Page 76: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

the shape of an OFDM time signal is a rectangular pulse of the durationTS = 1∆f

mul-

tiplied by asin(2πfct + φ) signal which contains the QAM information and the carrier

frequencyfc. Using the IDFT, the signal is modulated with a certain subcarrier frequency

in basebandn ·∆f . Due to the fact that the other subcarrier frequencies are integer multi-

ple of∆f , the subcarrier spacing in the frequency domain between adjacent subcarrier is

∆f = 1TS

. Therefore, the spectrum of an OFDM signal of equation 71 is a comb ofsinc

functions.

Figure 37: Spectrum of an OFDM signal

Figure 37 shows the spectra of four OFDM subcarrier which are placed with a frequency

spacing of∆f = 1MHz. The black dashed line shows the summation signal of the single

spectra.

Notice that, the spectra of the subcarrier are as close together as possible by maintaining

orthogonality.

65

Page 77: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

6.2.3 Subcarrier Modulation and Arrangement

In this work, an OFDM system with N=128 subcarrier is proposed. The reasons why I

have chosen this value for the implementation as well as the choice for other OFDM pa-

rameters will be explained in section 6.5.

Once each subcarrier has been assigned bits for transmission in shape of the 4/16QAM

symbols which consist of a complex vector with in-phase and quadrature-phase compo-

nents, the 128 subcarrier may be arranged over a vector ofNS = 2N = 256 points to

obtain twice over-sampling [25].

Notice that the IDFT/IFFT algorithm is used in order to convert the base band spectrum

in the time domain and consequently the frequency vectorXi of the spectrum is a vector

from zero to the sample frequency that is aligned to the sampleNS. The IDFT is repre-

sented in the following equation:

xk =1

N

N−1∑i=0

Xiej2π ki

N (75)

If we create a symmetric spectrum of QAM symbols which satisfies the conditionXNS−k =

X∗k we obtain a real time signal after the IFFT but only 64 subcarrier may be used. This

is because 64 subcarrier are allocated at the right of 0 in a vector of 128 samples between

0 and half the sample frequency. In order to respect the symmetric condition for real time

signals I mentioned above the complex conjugates of the 64 subcarrier have to be allocated

in the vector from half the sample frequency until the sample frequency. The subcarrier

are placed at the left of the sample frequency in order to satisfy the symmetric condition

and to center the spectrum. Hence, only 64 subcarrier may be used for the transmission.

66

Page 78: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

Figure 38: Spectrum of a real versus spectrum of a complex time signal

If we do not respect the symmetric condition and create a spectrum by placing 64 subcar-

rier at the right of zero and 64 independent subcarrier at the left of the sample frequency

we are able to place 128 independent subcarrier in the asymmetrical spectrum instead of

64 subcarrier for the symmetric spectrum [28]. Thus, we obtain double the bandwidth.

The differences of the two spectra are shown in figure 38. For the asymmetric spectrum

we obtain a complex baseband signal with in-phase and quadrature component after the

IFFT. This complex signal has to be mixed up to a certain carrier frequencyfc using an

IQ modulator which will be explained in more detail in section 6.2.6. After up converting

the complex time signal has become a real time signal.

6.2.4 QAM Signals

TheQuadrature Amplitude Modulationor QAM is a combination of the PSK and ASK,

meaning the amplitude and the phase is modulated on two different quadrature carriers

cos(2πfct) andsin(2πfct) with the carrier frequencyfc. In order to modulate the baseband

signal to a certain carrier frequency a IQ-modulator is used which is described in section

6.2.6. The modulated signals are expressed in the following equation [18]:

sm(t) = Re[(Amc + jAms)g(t)ej2πfct] m = 1, 2, ...,M

= Amcg(t) cos(2πfct)− Amsg(t) sin(2πfct) 0 ≤ t ≤ T

(76)

67

Page 79: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

whereAmc andAms contain the information, g(t) is the signal pulse and M gives us the

number of symbols. In this work, I confine toM = 4 andM = 16 QAM, meaning a

symbol consists of 2 bit in 4 QAM and of 4 bit in 16 QAM. Figure 39 shows the signal

space diagram of 4 and 16 QAM symbols.

Figure 39: Signal space diagram of 4 and 16 QAM signals

Each of the signal points is assigned to a binary symbol of 2 and 4 bit, respectively. In

order to obtain an optimal coding lockup-table the hamming distance between adjacent

symbols is set to one, meaning adjacent signal amplitudes differ only by one binary digit.

This is the preferred alignment because in the demodulation of the signal the most likely

error caused by noise may blur the signal and cause an erroneous selection of an adjacent

symbol. In this case, only a single bit error occurs in the symbol. This coding method is

designated asGray encodingand the signal space diagram completely encoded is shown

in appendix II.

In section 4.2.3, the bit error probability of the Manchester signals was calculated based

on the signal space diagram. We noticed that the bit error probability depends on the

distances between the signal points. Here, we observe that the distances between two

adjacent symbol points of the 16 QAM signal space diagram are smaller than those of the

4 QAM signal space diagram. It follows that the probability of a bit error is consequently

greater for 16 QAM signals. The bit error probability of QAM signals can be calculated

in a similar way as in section 4.2.3, whereas for M-QAM signals thea priori probability

68

Page 80: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

is equal to 1M

. Equation 77 represents the bit error probability of M-QAM signals [18]:

Pb = 2

(1− 1√

M

)Q

(√3

M − 1

εb

N0

)(77)

This equation permits us to plot the following curves11:

Figure 40: Bit error probability of QAM signals in dependence on the SNR

Figure 40 shows that the bit error probability of QAM signals is much higher than the

bit error probability of Manchester signals which is plotted in figure 22. But on the other

hand QAM modulation permits us to transmit several bits per symbol which increases the

data rate. In the computer model, the user may choose either 4 or 16 QAM in dependence

on the attenuation of the cable and the noise power.

Besides, the threshold decision value for 16 QAM between the signal points has to be

adjusted at the receiver. This value changes in dependence on the attenuation and conse-

quently in dependence on the length of the cable. In order to obtain the optimal value of

this decision bound and to minimize the BER, an adjustment frame has to be send before

data transmission. This message with a certain amplitude estimates the channel and cal-

culates a suitable value for the decision bound.11the Q-function is defined as: Q(x)=1-Φ(x)

69

Page 81: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

However, in practice this estimation is not necessary. Once a OFDM/QAM system has

been adjusted and implemented, the length and attenuation of the cable does not change

and therefore the channel is not time variant.

6.2.5 Guard Interval

After the IFFT converted the QAM symbols into the time domain, a guard interval is

inserted at the beginning of the signal in order to increase the symbol time. The duration

of this guard interval is typically a small percentage of the OFDM symbol time. This

guard interval does not contain information and will be removed in the receiver.

Figure 41: OFDM cyclic extension with a guard intervall

Like I mentioned in section 6.1, OFDM is used in many wireless communication systems

where multi path propagation takes place. The success of OFDM in these channels is

based on the relative long symbol duration of OFDM signals in comparison to single

carrier modulation. Due to enlarged symbol time ISI of successive symbols is eliminated

completely if the time of the guard interval is greater than the maximum time of the

channel impulse response. However, multi path propagation does not affect us in this

work because the information is transmitted over a twisted pair cable that only permits

single path propagation.

Another advantage of the guard interval is that it provides protection against time offset

errors in the receiver which may lead to distortions and interferences. This point is of

prime importance because in the MATLAB simulation of an OFDM system, time offset

occur due to the group delay of filters like anti aliasing, reconstruction and so on. In the

70

Page 82: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

simulation, the group delay has to be compensated by adding a certain number of zeros

at the end of the signal vector before filtering. After the filtering process, the number of

samples which were added at the end of the signal vector are removed at the beginning of

the signal vector in order to maintain the vector length.

Notice that there is no information in the firstn removed samples because the signal is

delayed byn samples due to the filter’s group delay.

Anyway, this compensation of zeros does not always lead to a perfect synchronization

and adaptation of the time because it is not possible to determine exactly the number of

samples the signal is delayed. Hence, it is convenient and necessary to append a guard

interval of e.g. five per cent of the symbol time in order to compensate the remaining time

offsets.

Due to the fact that the bandwidth of each subcarrier is reduced, the side lobes of the

overall OFDM spectrum are reduced as well.

6.2.6 IQ Modulator

The last step of the transmitter is the In-phase Quadrature (IQ) modulator which mixes

signals in baseband to a certain carrier frequencyfc. In section 6.2.4 the QAM signals

were described and evaluated. In order to modulate these signals to the radio frequencyfc

an IQ modulator which is designed in figure 42 has to be applied to the in-phase and the

quadrature-phase component of the QAM baseband signal.

Figure 42: IQ Modulator

71

Page 83: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

This IQ modulator separates the real and imaginary part of the complex baseband QAM

signals in order to obtain the in-phase and quadrature phase components and convert them

into analog signals by a digital to analog converter. After that, the signal are filtered by

an anti aliasing low pass filter to eliminate the high frequencies. The last step of the IQ

modulator is to multiply the analog in-phase vector bycos(2πfct) and the quadrature

vector bysin(2πfct) and to add up these two vectors. Thus, we obtain a real output signal

which corresponds with equation 76.

6.3 Receiver

The OFDM receiver performs the reverse operations of the OFDM transmitter in order to

detect the binary data. Figure 43 shows an OFDM receiver.

Figure 43: OFDM Receiver

First an IQ demodulator, which will be explained in more detail in section 6.3.1, mixes

the RF signal to baseband for processing.

Then the guard band is removed and the serial digital signal is converted to a parallel

signal in order to apply the FFT which is shown in the following equation:

Xk =N−1∑i=0

xie−j2π ki

N (78)

The FFT output gives us the QAM symbols with different amplitude and phase of the

subcarrier. These symbols will be demodulated into binary data by an QAM demapper.

After the demapping, the parallel data is converted into a serial data stream. This stream

is deinterleaved, meaning the algorithm which was applied in the transmitter is reversed

in order to obtain the bits in frame format. The frames may be applied to the decoding

72

Page 84: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

procedure I explained in section 4.5.2 in order to find bit errors or to correct them. In the

ideal case, the data output stream of the decoding procedure corresponds to the transmitted

binary data. The reverse process of the receiver has been explained in detail in the previous

sections, reason why only the IQ demodulator will be described in detail in the following

section.

6.3.1 IQ Demodulator

The IQ Demodulator recovers the complex baseband signals of the real pass band signal.

Like the IQ modulator it consists of an oscillator of the carrier frequencyfc which creates

sine and cosine signals in order to recover the in-phase and quadrature component of the

QAM modulated signal. The following figure shows the plan of an IQ demodulator:

Figure 44: IQ Demodulator

At the beginning the received pass band signal is divided into two paths. Notice that this

signal has the form of equation 76 whereAmcg(t) is expressed asX(t) andAmsg(t) is

expressed asY (t). Thus,s(t) = X(t) cos(2πfct) − Y (t) sin(2πfct). The first path is

multiplied by2 cos(2πfct)12:

s(t) · 2 cos(2πfct) = X(t) cos(2πfct) · 2 cos(2πfct)− Y (t) sin(2πfct) · 2 cos(2πfct)

12cos(x) · cos(y) = 12 (cos(x− y) + cos(x + y)), sin(x) · sin(y) = 1

2 (cos(x− y)− cos(x + y))andsin(x) · cos(y) = 1

2 (sin(x− y) + sin(x + y))

73

Page 85: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

= 2X(t) · 12

[cos(0)︸ ︷︷ ︸+ cos(4πfct)

]−2Y (t)1

2

[sin(0)︸ ︷︷ ︸+ sin(4πfct)

]= 1 = 0

= X(t) · [1 + cos(4πfct)] −Y (t) sin(4πfct)

(79)

This result is filtered by a reconstruction low pass in order to suppress the remaining

carrier frequencies. Thus, the filter output is consequentlyX(t) = Amcg(t).

In order to recover the quadrature component of the band pass signal the second path is

multiplied by−2 sin(2πfct):

s(t)·[−2 sin(2πfct)] = X(t) cos(2πfct)·[−2 sin(2πfct)]−Y (t) sin(2πfct)·[−2 sin(2πfct)]

= −2X(t) · 12

[sin(0)︸ ︷︷ ︸+ sin(4πfct)

]+2Y (t)1

2

[cos(0)︸ ︷︷ ︸− cos(4πfct)

]= 0 = 1

= −X(t) sin(4πfct) +Y (t) · [1− cos(4πfct)]

(80)

Like in the first path the result of the multiplication with−2 sin(2πfct) is filtered by a

low pass filter in order to eliminate the remaining carriers. The filter output is equal to

Y (t) = Amsg(t).

After this down converting of the band pass signals each path is converted into a digital

signal by anAnalog to Digital converter(ADC). The lower path[Y (t) = Amsg(t)] is

multiplied byj and added to the upper path[X(t) = Amcg(t)] in order to obtain a complex

base band signal which can be demodulated later.

6.4 The Peak-to-Average Power Problem

Like I mentioned in section 6.2.2 an OFDM signal consists of a number of independently

modulated subcarrier, which are overlapped in the time domain. Therefore, they may give

a large peak-to-average power ratio (PAP) when they are added up coherently. This means

whenN signals are summated with the same phase, which is not necessarily true in real-

ity, they produce a peak power which isN times the average power [25].

Such large signal peaks cause clipping of the signal peaks in a D/A converter when the

74

Page 86: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

analog signal is converted into a digital one. Another problem may occur at the level of

the power amplifier because they may drift in the saturation range which leads to distor-

tion of the multi carrier signal.

Therefore, the inconveniences of a large PAP ratio are an increased complexity of the

analog-to-digital and digital-to-analog converters as well as a reduced efficiency of the

RF power amplifier.

In order to decrease the PAP several techniques like peak windowing and peak cancel-

lation to decrease the signal peaks may be applied. Other techniques deal with powerful

error correction codes which exclude signals with a high (PAP).

However, these considerations are out of the scope of this work, for further explanations

please refer to [18],[25], [29].

6.5 Choice of OFDM Parameters

In an OFDM system there are different parameters up for consideration, such as the sym-

bol duration, number of subcarrier, modulation type for the subcarrier, guard interval and

subcarrier spacing. The choice of these parameters are influenced by the requirements of

the system. Some of the parameter are conflicting. For this reason we often have to deal

with compromises.

In order to choose adequate parameters for the OFDM systems a compromise of con-

flicting requirements has to be made. The amplitude and phase of each subcarrier should

remain constant over the symbol duration to maintain orthogonality between subcarrier

[28]. If the attenuation and phase characteristics within a symbol period are not constant,

the spectral shape of the subcarrier does not correspond to the correctsincshape which

consequently leads to ICI. Hence, it is convenient to choose a large symbol period, mean-

ing a short frequency band in order to obtain approximately an ideal channel for each

subcarrier.

Notice that a large symbol period leads to a large number of subcarrier in order to achieve

a high data rate. A large number of subcarrier with a smaller subcarrier spacing lead to

a larger implementation complexity and as well to more sensitivity to phase noise and

frequency offset. Furthermore, an increasing of the number of subcarrier leads to an in-

75

Page 87: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

creased PAP ratio because the subcarrier may interfere positively. For these reasons, it is

convenient to choose a not to high number of subcarrier.

However, after several tests and simulations, in this project a system with a symbol du-

ration ofTS = 53.3µs is proposed which corresponds to a carrier spacing off = 1TS

=

18.75kHz. This is a suitable result which takes the aforementioned requirements into con-

sideration. If we apply, as mentioned in section 6.2.5, the proposed guard time of five per

cent, in order to obtain robustness against time offsets, the symbol duration is extended

to:

T0 = TS + 0.05 · TS = 56µ ⇒ f =1

TS

= 17.857kHz (81)

The number of subcarrier is chosen asN = 128 which leads to the resulting bandwidth

of

B =1

T0

·N = 2.286MHz (82)

Notice that the first subcarrier is locatedB2

= 1.143MHz to the left and subcarrier 128

is locatedB2

= 1.143MHZ to the right of the carrierfc. If 4 QAM is applied a data

rate without coding(r=1) ofD(r = 1) = 2 · B · r = 4.571MHz is achieved, while

16 QAM provides a data rate of4 · B · r = 9.143MHz for the up and downstream

channel. However, it is convenient to use error correction coding with interleaving, which

I explained in section 4.5.2 and 6.2.1. This code has a code rater = 23. If we take this code

into consideration we have to multiply each data rate by the code rate in order to obtain

the absolute data rateD(r = 23) = r · B. The following table summarizes the discussed

results.

Table 6.5:Data rates of an OFDM channel in dependence on QAM and code rate

D(r = 1) D(r = 23)

4-QAM 4.571Mbit/s 3.047Mbit/s

16-QAM 9.143Mbit/s 6.095Mbit/s

Due to the fact that the Manchester signals cover the base band of the cable, the two

OFDM channels have to be transmitted in pass band, meaning the carrier frequencies

fc1 andfc2 have to be determined. The OFDM spectrum for upstream, also designated

76

Page 88: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

in the following work asOFDM1 is centered on the radio or carrier frequencyfc1 and

the OFDM spectrum for downstream, designated asOFDM 2 is centered on the carrier

frequencyfc2. This is calledFrequency Division Duplexing. Both spectra have the same

bandwidthB = 2.286MHz. Thus, both carrier frequencies should have a distance of

at least∆f = B = 2.286MHz to avoid overlapping. But this value is only theoretical

because applying this distance B between the two OFDM channels would require an ideal

filter to separate their spectra for demodulation. Thus, the two spectra have to be placed

far enough from each other in order to respect the transition bandwidth of digital filters.

This will be described in more detail in the following section.

6.6 Manchester-Code and OFDM in the same Transmission Line

In order to realize a transmission system of the MVB bus of the TCN-Standard where

OFDM/FDD is integrated, it is necessary to apply several filters to separate the different

spectra. The frames concerning several control functions are transmitted like usual in the

base band in Manchester signals whereas the video and audio data shall be send over

OFDM channels in higher frequency bands.

It is important to save bandwidth for the OFDM transmission because we wish to transmit

OFDM preferably at frequencies less than 10MHz in order to prevent high cable attenua-

tion of the signals. Thus, a low pass anti aliasing filter is applied after the creation of the

Manchester signals.

The spectrum of Manchester signals with the data rate of1.5Mbit/s has its first zero at

f = 3MHz, compare also figure 16 on page 26. Therefore, it is convenient to establish a

low pass filter with a cut off frequency equal to3MHz.

The remaining bandwidth from 3 to 10MHz may now be used for the OFDM transmis-

sion, meaning the upstream and downstream channel will cover a certain bandwidth. This

two channels should be separated by a wide frequency band to make it easy to recover

each channel.

In order to recoverOFDM1 which is transmitted at a radio frequency offc1 = 5MHz,

a high pass filter with a cut off frequencyfc = 3MHz is applied that eliminates the

Manchester signals. TheOFDM2 system which is transmitted at a radio frequency of

77

Page 89: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

fc2 = 9MHz remains consequently after the high pass filtering, but that is not a problem

because it will be eliminated automatically after down converting by the reconstruction

low pass. Notice that a low pass filter is integrated into the IQ receiver. This filter sup-

presses the carrier frequencies ofOFDM1as well as the entire signal ofOFDM2.

OFDM2will be recovered by using a high pass filter with a cut off frequency of6.8MHz.

Due to the fact that the spectrum of both OFDM channels with their carrier frequencies

fc1 andfc2 cover about2MHz bandwidth centered on each carrier frequency, there is a

transition bandwidth of about2MHz between the two spectra. Thus, I chose a cut off

frequency of6.8MHz for the high pass filter. The filter characteristics of the aforemen-

tioned filters are depicted in appendix III. The following figure shows a design of a OFDM

system integrated in the MVB:

Figure 45: OFDM included in a MVB bus system

Like I described above, each communication system(TCN, OFDM 1, OFDM 2) has to be

recovered by certain filters. In the MATLAB model, the functionsrecoverManchester, re-

coverOFDM1, recoverOFDM2have been written to filter the respective frequency band

which is needed for demodulation. Almost all filters which are used in the model are

Finite Impulse Response(FIR) filters. In comparison toInfinite Impulse Response(IIR)

filters they have the great advantage that they provide a linear phase. Hence, there is no

ISI when a signal is filtered by an FIR filter.

Unfortunately, these filters need a higher order than IIR filters to respect a certain attenu-

ation characteristic in the stop band. However, ISI leads to harsh distortions of the signals

78

Page 90: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

6 Multicarrier Modulation and OFDM

and consequently has to be avoided in any case. If not, equalizers have to be implemented

in order to cope with ISI. But this would lead to a higher implementation complexity

and consequently is not preferable. The characteristics of the filter which are used in the

MATLAB model are shown in appendix III.

6.7 Conclusions

In this chapter, the theory of OFDM was introduced and explained. Furthermore, a solu-

tion for integrating an OFDM system in the MVB bus was derived in the last sections. In

this section, the advantages and disadvantages of OFDM are summarized and a prospect

of the practical implementation is given.

The advantages of OFDM are:

• efficient use of the available bandwidth, due to a almost constant power spectral

density and steep flank for a high number of subcarrier

• if the guard interval is chosen larger than the delay spread, ISI is avoided in systems

with multi path propagation(wireless communications)

But OFDM has several inconveniences which should be mentioned as well:

• Due to the overlapping of several subcarrier OFDM signals have a large PAP ratio

which demands high requirements for the power amplifier

• an accurate time and frequency synchronization is essential for a reliable operation

Notice that is very important in reality that the radio frequency of the up converter in

the transmitter corresponds exactly to the radio frequency of the down converter in the

receiver. If this condition is not satisfied, a frequency offset occurs which destroys the

orthogonality of the OFDM signals and consequently leads to ICI. Hence, high quality IQ

modulator and demodulator should be used for the practical implementation.

However, the advantages predominate the disadvantages of OFDM. That is why it has

been so successful in many communication systems.

79

Page 91: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

7 Simulation Model

In the previous chapters, the theory of the TCN-standard, cable, block coding, Manchester

and OFDM modulation schemes were explained and evaluated. In this section, a computer

model of the transmission system in section 6.6 is proposed in order to simulate transmis-

sion of binary data over the twisted pair cable of section 3. Furthermore, different noise

sources which are explained in chapter 5 may be added to the signals in order to simulate

a realistic transmission channel.

The computer model allow us to simulate the transmission of binary data simultaneously

in three different frequency bands. That means it is capable to simulate the transmission

of a TCN-standard frame in base band and two broadband communication channels of

about2MHz bandwidth in the same time. All frames which are transmitted are encoded

with thegenerator matrixof section 4.4.2.

The binary data, the transmitted, and received Manchester signals in base band as well

as their spectra are shown in the main window. The OFDM signals are shown in extra

windows which are opened when the Modulation schemeOFDM is chosen in the popup

menuModulation.

The filters which are applied in this model for the OFDM pass band signals are optimized

to the carrier frequencies offc1 = 5MHz andfc2 = 9MHz. Thus, it is not convenient to

change these frequencies strongly in the program code. Other OFDM parameters such as

4/16QAM, guard time, number of subcarrier may be changed in the main window or in

the program code. Notice that the maximum number of subcarrier in this model is 128. If

this value is exceeded, aliasing appears which leads to ICI.

Since we have derived the maximal bandwidth of an OFDM spectrum in the proposed

system in section 6.5 to2.286MHz, the frequency spectrum of the upstream channel

is from about3, 9 − 6.1MHz and the down stream channel covers the spectrum from

7.9− 10.1MHz.

Different discrete, digital and analog signals of the OFDM system may be viewed and

verified in the simulation windows. In the following sections a description of the program

is provided to allow the reader to understand and to apply the simulation tool.

80

Page 92: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

7.1 Introduction to the MATLAB Model

During this work, a MATLAB model has been developed and implemented. The model

allows to test the transmission of Manchester signals in base band as well as the simulation

of two OFDM transmission systems in the pass band. The transmission of the baseband

signals is simulated in the functionupdate_allwhereas the transmission of the OFDM

signals is simulated in the functionOFDM_system. However, this will be explained in

more detail in section 7.1.1.

One of the objectives of this project is to develop a user friendly tool that allows the

user to change different transmission parameters in a interactive way. This objective was

achieved by using the functionguide in MATLAB to create windows with different in

and output objects. The impact of changes done by the user may be verified directly in the

main window.

Figure 46: Main window of the programCableModell.m

This user interface (CableModell.fig) is loaded when the fileCableModell.mis executed.

81

Page 93: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

On the right we can see different menus, text fields and buttons in order to variate different

parameters. On the left, the base band signals of the Manchester Code are depicted. The

following table explains the different parameters and windows of the main window.

Number Description

1 binary message we wish to transmit in the baseband

2 binary message from 1 modulated in digital Manchester signals

3 Spectrum of the transmitted signal, meaning theFFT of 2

4 Spectrum of the received signal; the spectrum of the transmitted signal is attenuated

by the gain of the cable and we obtain the spectrum of the received signal

5 Received signal, meaning theIFFT of 4

6 Digital received signal, the driver converts the analog signal 5 into a digital signal

7 the digital Manchester signal is demodulated and we obtain the binary message

8 move the spectrum onto the x-axis

9 zoom and un zoom the spectrum

10 add different noise sources; the SNR may be changed in the textfields

11 Frequency of the periodic impulse noise

12 the length of the cable may be changed

13 amplitude and data rate/frequency of the Manchester code may be changed

14 choice of receiver for the Manchester code; refer to section 4.2.1 and 4.2.2

15 in order to transmit the OFDM signalsOFDM has to be chosen.Manchesterand

Manchester with anti aliasing filteronly transmits the Manchester signals.

16 in these popup menus we can choose between 4,16 QAM forOFDM1,2

17 when the cable length is changed, the channel estimation has to be executed in order

to find an optimal decision bound for 16 QAM signals.

18 Error correction and interleaving may be activated. If error correction is not acti-

vated only error detection is applied.

19 takes into account the phase of the cable(only for testing purposes)

The principal windows, text fields and menus are mentioned in the table above. But it is

important to explain several features in more detail.

82

Page 94: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

If we increase the data rate we have to take into consideration that higher bandwidths lead

to a higher noise power of the white noise and hence to a lower SNR. The SNR has to

be decreased in 10 when the data rate in baseband is increased. This topic is explained in

more detail in section 5.1.

It should be noted that the TCN-Standard data rate is1.5Mbit/s. Therefore, it is only

convenient to change the data rate of the Manchester code in 13 when 15 is chosen to

Manchesterbecause for the other two options an anti aliasing filter is applied in order to

cut frequencies greater than3MHz. For data rates greater than1.5Mbit/s the low pass

filter will distort the Manchester signals. However, the OFDM system has been designed

by taking into account that the frequency from 0 to3MHz is occupied by the transmission

of Manchester signals. Therefore, the data rate of the Manchester code should be equal to

1.5MHz whenOFDM is chosen in the popup menu 15.

Testings of high data rates of Manchester signals should be executed with the first option

of the popup menu(15)Manchester code.

When the cable length is modified and OFDM with 16 QAM is applied it is inalienable

to estimate the channel(17) in order to obtain accurate values for the decision bounds at

the receiver. By activating this feature a random OFDM message with a certain amplitude

is sent over the cable. Due to the fact that the amplitude is known at the receiver, we are

able to calculate the attenuation in per cent of the transmitted signal. This per cent value

is taken to determine the decision bound at the receiver for further transmission of OFDM

signals.

This feature is just applied for the simulation tool and is not required in practice because

once a OFDM system is established in a train the cable length between transmitter and

receiver will logically not be changed anymore.

If we want to establish an error correction code for OFDM frames the check boxes in

18 have to be activated. Due to the fact that rather burst errors than single errors occur

it is convenient to apply error correction in combination with interleaving. For further

explanations of interleaving see also section 6.2.1.

83

Page 95: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

7.1.1 Development and Structure of the Main Program

The Computer model which has been developed during this work and is designated asCa-

bleModell.mrespectivelyCableModell.fighas been created by using the MATLAB func-

tion guide (Graphical User InterfaceDesignEnvironment). Theguidetool in MATLAB

allows the developer to place different objects, e.g., text fields, push buttons, check boxes,

popup menus, axes in a window in FIG-format. Each of these objects contain different

properties concerning layout and alignments to functions in the corresponding M-file.

Once a window has been created, it has to be saved and compiled with the same name

as the corresponding M-file in order to obtain a M-file which contains various function

links to the FIG-file. Furthermore, the propertyTag in theguide property editorof every

object has to be aligned to a functionTag_Callbackin the corresponding M-file in order

to relate each text field, window and menu in the FIG-file to a variable in the M-file. Once

these steps are done, the acquisition of values, that may be entered in the main window, is

executed every time a value is changed. This means the data can be processed by different

functions in order to simulate the transmission.

Figure 47: Flow chart of the main program

The program is divided in two parts: The first part contains only the functions of acquisi-

tion of different parameters concerning modulation, channel and so on. This means only

84

Page 96: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

the values of different parameters like amplitude, length of the cable, transmission fre-

quency, etc. are loaded in the main program.

In the second part of the program, these values are processed and applied in order to run

the simulation of the transmission channel. Once a value is changed in the user interface

after the program is executed for the first time, the main functionupdate_allis executed

again to calculate the impacts of the parameter change. Figure 47 shows the structure of

the main program where the input represents the change of a parameter. The structure of

the functionupdate_allis depicted in section 7.2.

7.1.2 Basic Considerations

In the computer modelCableModell.ma sample frequency of 96MHz is used in order to

obtain over-sampling and to simulate analog Manchester and OFDM signals.

Remember that the highest frequency in the system is about10.1MHZ, which is aligned

to the subcarrier that is located on the right edge of theOFDM2 system.After several

test I decided to choose a value for the sample frequency of about100MHz that permits

use to obtain a convenient simulation of analogue signals.96MHz was chosen because

of the standard receiver for Manchester signals that has been explained in section 4.2.1.

Considering that the standard receiver has to verify the voltage level of samples from

p1 = 18.75% to p2 = 31.25% of the bit time, these per cent values have to correspond

to an integer value of samples(meaning that if we multiply the number of samples in a

bit period withp1 respectivelyp2 we obtain an integer value as a result). After several

tests I decided to choose 64 samples for each bit which corresponds to a sample period

of TS = 666.67ns64

= 10.417 · 10−9 considering the TCN-Standard data rate of1.5Mbit/s.

Thus, we obtain the sample frequency as the reciprocal value of the sample period:

fS =1

TS

=1

10.417 · 10−9= 95.99.. · 10+6 ≈ 96MHz

This value seems adequate because it easily satisfies theNyquist Criteriumand allows the

standard receiver for the Manchester signals to verify the required condition I mentioned

above and which is proposed by the TCN-Standard [1].

85

Page 97: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

The computer model should be able to execute a simulation of Manchester base band

signals without the two OFDM systems, as well as a simulation of Manchester signals

together with the pass band signals, meaning the two OFDM systems. This aim was

achieved by implementing the menuModulationwhich was aligned to number 15 in sec-

tion 7.1. This popup menu allows the user to choose the modulation schemes. Thus, he

is able to run Manchester and OFDM signals transmission with the same simulation tool.

The main functionupdate_allof the programCableModell.mthat was mentioned in the

flow chart in figure 47 is explained in the following section.

7.2 Programming Structure of the Main Function update_all

The functionupdate_allcontains all simulation steps for the simulation of Manchester

signal transmission concerning the TCN-Standard. In this section, I describe this function

in combination with the simulation of the Manchester base band signals. The description

of the simulation of OFDM signal transmission is provided in section 7.3.

Every time a new value is entered in the main window e.g. change of noise sources, am-

plitude, choose 16 QAM instead of 4 QAM and so on, the main functionupdate_allis

executed. This function executes other functions in order to recalculate the whole sim-

ulation with the new input values. Several plot functions are integrated as well in this

function to show the output signals in the main window or in other OFDM windows.

86

Page 98: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 48: Flow chart of the functionupdate_all

Anyway, these plot functions are not included in the flow charts due to reasons of clear-

ness. The flow chart of the first part of the functionupdate_allis depicted in the figure

above, where the string of binary numbers, aligned to 1 in figure 46, is converted into a

binary number in order to apply the Manchester modulation(2). Afterwards, the transmit-

ted spectrum is calculated and plotted. If OFDM is not chosen by the user, the transmitted

spectrum of the Manchester signals is attenuated and we obtain the received spectrum

and signal, respectively. This signals is corrupted by different noise sources which is also

shown in figure 49.

In the other case, meaning OFDM is chosen by the user, the Manchester spectrum is

added in the functionOFDM_Systemto the two OFDM spectra in order to simulate the

transmission over one channel simultaneously.

87

Page 99: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 49: Flow chart of the functionupdate_all

The addition of the three spectra is attenuated and each of the three transmission systems

has to be recovered by a low or high pass filter concerning section 6.6. The function

OFDM_Systemthat will be explained in more detail in section 7.3 returns the recovered

Manchester signals which may be corrupted by several noise sources.

Finally, the analog Manchester signal is converted into a digital signal by the function

Analog2Digital and demodulated by the functionDemodulation. This function returns

the received binary message which corresponds in the ideal case to the transmitted bit

stream.

7.3 Transmission of OFDM signals

In the previous sections, the applications of the simulation tool as well as the structure

of the same for Manchester transmission were explained. The section, describes the sim-

ulation of OFDM signals which is programmed in the functionOFDM_System, when

the decision in the main programupdate_allin figure 48 is made toyes. In this case

88

Page 100: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

an OFDM sub window is opened with different push buttons in order to verify different

discrete, digital and analogue signals and their spectra.

Figure 50: Main Menu which is opened whenOFDM is chosen in the Modulation Menu

The first button of the menu closes the window whereas the second and third buttons open

submenus for OFDM transmitter. Further detail will be given in the following section.

In order to verify the time domain and spectrum of the Manchester signal added up to the

two OFDM signals the fourth button has to be pushed. Now this signal is attenuated by

the channel and finally the different signals have to be recovered by different filters. These

signals can be seen by pushing the following three buttons. Finally, the buttonsReceive

OFDM1,2opens a submenu which contains the different steps of an OFDM receiver.

The buttonclose allcloses all windows that were opened in this submenu.

7.3.1 OFDM Transmitter

Both of the push buttonsTransmit OFDM 1andTransmit OFDM 2represent two trans-

mitter concerning figure 35. TheEncoding, InterleavingandSerial to parallel conversion

89

Page 101: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

steps are computed in the functionOFDM_system. Starting with QAM mapping, each

step of figure 35 can be viewed in different sub windows. Due to the fact that the two

transmitters use the same functions, it is sufficient to explain the structure and simulation

of one OFDM transmitter. In the following figure, a sub menu opened by the push button

Transmit OFDM 1of the main menu is shown.

Figure 51: Sub menu to verify the signals at an OFDM Transmitter

The first push button opens a window of the 4/16QAM symbol constellation, similar to

figure 39 in section 6.2.4. These QAM symbols are arranged in a complex spectrum which

is explained in section 6.2.3 and theIFFT is calculated in order to obtain the discrete sub-

carrier with an in-phase and quadrature components. To compute these steps the function

Create_OFDMsignalswas written in MATLAB. Notice that the carriers are calculated by

multiplying theIFFT of the QAM spectrum by the length of theIFFT/FFT [26]. Given

the fact thatN = 128 subcarrier are used in this model the length of theIFFT/FFT is

equal toNS = 256 to obtain over sampling. This means that two sample points are given

in the base band time periodT which is chosen toT = 416.6ns. Hence, the sample fre-

quency in the OFDM transmitter is equal to2T

= 4.8MHz. Since we have128 subcarrier

we obtain a symbol time ofTS = 128 · T = 53.3µs before adding the guard interval.

However, the discrete time signal and its spectrum is shown by pushingCarrier baseband

and is plotted below:

90

Page 102: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 52: Discrete baseband time signal and its spectrum

The aim was to simulate analog signals which are transmitted over the channel. The first

step to do so is to convolute the complex discrete time signalcarriers with a rectangular

pulse to obtain a digital signal. The width of this pulse is equal to half the baseband time

periodT2

because there are two samples in each time periodT . Considering a sample rate

of 96MHz the rectangular pulse consists of 21 samples:

T21

96·106

= 19.996 ≈ 20

Since a sample at zero is included we built a vector from zero to20 · 1fs

= 208.3ns. Thus,

we obtain21 samples for the rectangular pulse.

After convoluting the discrete signal with the rectangular pulse we obtain a digital signal.

The signal created in the functionDA_Upconversionand its spectrum is shown in the

following figure.

91

Page 103: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 53: Digital time signal and its spectrum

We observe that the spectrum of the digital signal is periodic as required for a discrete

time signal. This signal is filtered by an anti aliasing low pass with a cut-off frequency

of 2.4MHz in order to eliminate the harmonics. Notice that the cut-off frequency of

2.4MHz corresponds to half the sample frequency in the transmitter. AnIIR butterworth

filter of order 13 is convenient for this application. Its gain and phase characteristics is

shown in appendix III. The phase of the filter is almost constant in the pass-band. Hence,

it does not cause ISI but a certain group delay of64fs

= 666.67ns. Since OFDM is very

sensitive to time offset we have to eliminate this group delay in order to obtain an optimal

synchronization. It has to be compensated by appending 64 zeros at the end of the signal

vector before filtering. These zeros have to be deleted in the output vector of the filter in

order to adapt it to the original length, meaning we ignore 64 samples at the beginning

of the vector and consider 64 at the end of the vector. Thus, we obtain an output vector

with the same length as the original time signal. Once a filter is applied to OFDM signals,

meaning a group delay is caused, it has to been compensated with the method afore in

order to eliminate time offsets.

After filtering and adapting the length we obtain the continuous time signal shown in

92

Page 104: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

figure 54. We observe that the signal has as well a bandwidth of2MHz in baseband.

Figure 54: Continuous time signal and its spectrum

This time signal in baseband has to be mixed up to the carrier frequencyfc by an IQ-

modulator which is explained in section 6.2.6. This means the real part or in-phase com-

ponent of the continuous time signal is multiplied bycos(2πfct) and the imaginary part

or quadrature component is multiplied bysin(2πfct) and added together. Now we obtain

a real time signal with the carrier frequencyfc wherefc = fc1 = 5MHz. This signal is

shown in figure 55

93

Page 105: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 55: Up-converted continuous time signal and its spectrum

The envelope of the up modulated time signal corresponds to the signal in baseband.

Furthermore, we observe that the spectrum of the baseband signal has been shifted to

the carrier frequencyfc1 = 5MHz. The same method is applied to the transmitter of

OFDM2 and we obtain a spectrum which has been shifted to the carrier frequencyfc2 =

9MHz. The windows of theOFDM2 system can be verified by executing the program

CableModell.

7.3.2 Channel and recover filter

Once the two OFDM signals with their carrier frequenciesfc1 andfc2 are generated, they

are summated to the Manchester signal and transmitted over the channel. This signal and

its spectrum is shown in the following figure. After transmission over the channel and

attenuation the signal is recovered by different filters concerning section 6.6 and figure

45 meaning, that each of the three transmission systems has to be isolated before being

demodulated. The filters that are applied for this issue areFIR filters which have a linear

phase characteristics. Thus, they do not disturb the signal but only cause a group delay

94

Page 106: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

which has to be compensated by appending zeros at the end of the time signals. However,

the summation of the three signals and its spectrum is shown in the following figure.

Figure 56: Time signal of Manchester,OFDM1, OFDM2and its spectrum

Each signal and its spectrum after this filtering process may be seen when the buttons

OFDM 1,2 after the high pass filter(fc=3MHz), OFDM 2 after the high pass filter(fc=6.8MHz)

respectivelyManchester signals after the low pass filter(fc=3MHz)are pushed.

95

Page 107: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

7.3.3 OFDM Receiver

After the recovering steps of the different signals, described in the previous section, the

OFDM signals have to be demodulated. The signals of the demodulation process may be

viewed in a submenu which is opened by clicking on the push buttonReceiver OFDM 1

or Receiver OFDM 2. This submenu is depicted in the following figure:

Figure 57: Submenu to verify the signals at the OFDM Receiver

Like in section 7.3.1 only the receiver for the OFDM1 system is explained, meaning the

receiver with the carrier frequencyfc1 = 5MHz due to reasons of briefness. The receiver

for the OFDM2 system is equivalent.

The first button opens a figure of the analogue time signal which has been filtered by the

recover high pass filter with a cut off frequency of3MHZ and afterwards has been down

converted by the IQ-demodulator.

96

Page 108: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 58: Received signal after down conversion

We observe that one spectrum is located in the base band while other spectra, meaning

the carriers of OFDM 1 and 2 are located in the pass band. Remember that the IQ de-

modulator, described in section 6.3.1, multiplies the incoming signal withcos(2pifct)

respectivelysin(2πfct) in order to obtain an in-phase and quadrature component of the

real time signal. Hence, each carrier is shifted5MHz to the left and5MHz to the right.

Thus, the spectrum of the down converted signal contains frequency bands of2.286MHz

in the baseband as well as at the radio frequencies4, 10, 14MHz. These carriers have

to be eliminated by an reconstruction filter. AnFIR filter of order 100 with the cut off

frequency of2MHZ is convenient for this application. This filter causes a group delay

of 49fS

= 510.4ns. Like in the transmitter the group delay has to be compensated, meaning

49 zeros are added at the end of the vector before filtering and are eliminated at the be-

ginning of the output vector after filtering. The phase and gain characteristics are shown

in appendix III.

However, after the filtering process we obtain the following time signal with the corre-

sponding spectrum. This figure is opened when the buttonReceived Signal after carrier

suppressionis pushed.

97

Page 109: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 59: Received signal after carrier suppression

In order to obtain a digital signal which can be processed by aDigital Signal Processor

(DSP) the analog signal has to be sampled by a sample frequency of4.8MHz. Notice that

this frequency is used as well in the transmitter in order to obtain twice over-sampling.

After sampling we obtain a time discrete signal with256 samples which is shown in the

following figure.

98

Page 110: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 60: Discrete signal after sampling

This signal can be processed in a digital signal processor and is demodulated by the using

theFFT algorithm. Then we obtain the QAM symbols in the symbol space diagram which

are aligned to certain symbols. A detector decodes the constellation of the symbols in

order to obtain the bit sequences of 2 respectively 4 bit per symbol. Remember that 4QAM

contains two bit per symbol and 16QAM contains 4 bit per symbol. Figure 61 shows the

QAM symbols of 4QAM.

We observe that the symbols are attenuated by the gain of the channel. The higher the

frequency of the subcarrier the stronger the signal is attenuated. Hence, we obtain the

symbol space diagram where the symbols are drifted to the origin.

99

Page 111: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Figure 61: Received QAM symbols

7.4 Programming structure of the OFDM system

The functionOFDM_systemsimulates the OFDM transmission of the two systems with

the carrier frequenciesfc1 = 5MHz andfc2 = 9MHz. This function is executed in

the functionupdate_allwhen OFDM is chosen in the popup menu in the main window.

Although there are two OFDM systems which are simulated, only the OFDM1 system is

explained in this section. The OFDM2 system is very similar and marked in the program

code in appendix IV.

At the beginning of the program code there is anif-condition in order to decide if the

channel estimation or the transmission of random data will be simulated. Notice that it is

only useful to apply the channel estimation when a transmission of 16QAM is simulated.

In this case, the decision limits between the symbols at the receiver have to be determined.

The default value of these limits arel1 = 0.99 and l2 = 0.77 corresponding to a cable

length of30m. Once the cable length is changed by the user the check boxChannel Esti-

mationshould be activated in order to find new decision limits for the 16-QAM detector.

The higher the attenuation the smaller the decision limits.

100

Page 112: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

Then the functions on the left side of figure 62 are executed, meaning random signals with

a fixed amplitude are generated and transmitted over the channel. Due to the fact that this

amplitude is known at the receiver, the attenuation of the channel can be calculated and

consequently the decision limits can be derived.

The first part of the flow chart of the functionOFDM_systemis shown in the following

figure.

Figure 62: Flow chart of the functionOFDM_system

If the decision is done in favor of data transmission(Channel Estimationis deactivated),

a random bit matrix is generated in the functionEncoding. In the functionInterleaving

this matrix is converted into a vector which is mapped to QAM symbols in the function

QAM_Mapping. Once the QAM symbols are created they are arranged in a spectrum and

modulated by theIFFT algorithm in the functionCreate_OFDMsignals. These discrete

signals are converted to analogue signals and finally mixed up to the carrier frequencyfc

in the functionDA_Upconversion.

After that, the spectra of the two OFDM systems and the spectrum of the Manchester

101

Page 113: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

signal are added up together in the functionAdditionSpectraand transmitted over the

channel. The following figure shows the second part of the flow chart of the function

OFDM_system. This flow chart represents the demodulation process of the OFDM re-

ceiver.

Figure 63: second part of the flow chart of the functionOFDM_system

If the checkboxChannel Estimationis activated, the OFDM signals are recovered from

the overlapped signal and the demodulation process is calculated in the functionsRe-

ceive_OFDMandSample_OFDMin order to obtain the received symbols. The amplitude

of these symbols is compared with the transmitted amplitude in order to estimate the at-

tenuation of the channel and to adapt the decision limits to the new cable length. This is

performed in the functionEvaluateChannel.

For usual data transmission, meaning the checkboxChannel Estimationis deactivated,

102

Page 114: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

7 Simulation Model

the system system OFDM1 has to be recovered by a high-pass filter which is integrated in

the functionRecover_OFDM1. Then the OFDM signal is down converted in the function

Receive_OFDMand possibly noises are added in order to simulate a realistic channel.

After that the analogue signal is sampled in the functionSample_OFDMand theFFT is

performed in order to obtain the QAM symbols. These symbols are aligned to binary num-

bers in the functionQAM_Demapping. At the end the binary bit sequence is deinterleived

and decoded in order to obtain the original data bit stream.

103

Page 115: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Conclusions and Prospects

8 Conclusions and Future Prospects

After a thorough examination of the theory of transmission lines, modulation schemes,

block encoding and noise sources it was possible to design a user friendly tool of a trans-

mission channel used in trains. This model has been developed in MATLAB in order to

simulate the transmission of base band Manchester signals based on the TCN-Standard.

In order to increase the data rate an OFDM system in fullduplex, that is using higher fre-

quency bands, has been implemented .

The channel of the simulation tool shall represent a typical cable used in trains. For this

reason theRaychem 99M1121shielded twisted-pair cable, used in several trains, was

measured and its characteristics have been implemented in the MATLAB model.

Considering that the cable provides a constant group delay, its phase was neglected in the

model in order to decrease its complexity. In practice, a synchronization for the OFDM

signals has to be implemented and may be achieved by transmitting pilot symbols. It

should be noticed that an accurate time and frequency synchronization is indispensable

for a reliable data transmission.

Furthermore, different noise sources with variable SNR have been implemented in order

to run the simulation under realistic conditions.

The model allows the user to change interactively various parameters of the channel,

such as cable length, noise sources, modulation scheme, signal amplitudes and so on. The

simulation steps with these new values are calculated directly and the impacts may be

seen in several control windows and in a TXT-file output which provides a summary of

the computed simulation.

This TXT-file contains the number of erroneous bits and frames, possibly different noise

sources and their SNR and various parameters concerning OFDM data transmission.

An enlargement of the data rate of the aforementioned channel, has been achieved by

using a OFDM/Frequency Division Duplexing(FDD) system with two frequency bands

of about2.2MHz. The upstream band is centered at the carrier frequency of 5MHz and

the downstream band is centered at the carrier frequency of 9MHz. Manchester signals

104

Page 116: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Conclusions and Prospects

are transmitted in baseband as it is required by the TCN-Standard. Depending on on the

modulation scheme of the OFDM signals, wether is 4 or 16 QAM, an overall data rate of

7.5Mbit/s or 13.5Mbit/s may be achieved.

Before starting the practical implementation of the proposed model, noises and their SNR

in a train shall be measured in order to adapt the variable parameters in the model to

real values. After that, the program code may be slightly changed in order to simulate

the transmission of several hundred thousand frames once with 4 once with 16QAM over

a long time period. To do so the plot functions in the program code should be put into

comments in order to increase the operation speed of the simulation. The execution of the

modified program provide us with the bit error and frame error rate.

After the simulation it can be decided wether we want to choose 4 or 16 QAM for the

practical implementation.

However, if the bit error rate of 16QAM is too high under realistic noise conditions,

4QAM may be used to provide a data rate of3Mbit/s which is enough to transmit

medium quality video data.

Another possibility to cope with 16 QAM in noisy environments is to improve the error

correction capability. Thus, the existing block code that has a code rate of 2/3 may be

replaced byConvolution Codesor Turbo Codeswith 2/3 or 1/2 code rates.

105

Page 117: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Economic Studies

9 Estudios Económicos

En este capítulo se pretende ofrecer un resumen de los gastos ocasionados en el transcurso

del proyecto.

Concepto Costes Directos Número Tiempo Totales

Ingeniero 1h=32.08 EUR 1 32 semanas a 40h41.062,40 EUR

Ordenador 100 EUR al mes 1 8 meses 800,00 EUR

Gastos de viaje 300EUR 2 - 600,00 EUR

Secretaria 1h=16EUR 1 80h 1.280,00 EUR

Licencia de MATLAB 1000EUR+90EUR al mes 1 8 meses 1.720,00 EUR

45.462,44 EUR

En las horas del concepto ingeniero están incluidos los costes indirectos como agua, elec-

tricidad, etc.

El tiempo de32 · 40h = 1280h para el concepto ingeniero se puede desglosar de la

siguiente manera.

Función por centaje Tiempo

Estudios teoricos 50% 640 h

Implementación y Tests 30% 384h

Redación del informe 20% 256h

100% 1280h

106

Page 118: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

References

References

[1] International Standard IEC 61375-1Electrical railway equipment-Train bus, Part 1:

Train Communication Network

[2] Hubert Kirrmann, Pierre A. Zuber,The IEC/IEEE TRAIN COMMUNICATION NET-

WORK

[3] Carlos Rodríguez-Morcillo García, Sadot Alexandres Fernandez, J. Daniel Munoz

Frías,Anális del estándar de comunicaciones TCN, Escuela Técnica Superior de

Ingeniería, Universidad Pontifica Comillas de Madrid

[4] Friedrich Jondral,Nachrichtensysteme, J.Schlembach Fachverlag, Feb 2001

[5] F. Jondral, A. WieslerGrundlagen der Wahrscheinlichkeitsrechnung und stochastis-

cher Prozesse für Ingenieure, B. G. Teubner Stuttgart Leipzig, 2000

[6] Uwe Kiencke, Ralf Eger, Heinz Kronnmüller,Messtechnik, Springer Verlag, 5. Au-

flage

[7] Uwe Kiencke, Holger Jäckel,Signale und Systeme, Oldenbourg Verlag München

Wien, 2. Auflage, 2002

[8] G. Merziger, G.Mühlbach, D. Wille, T. Wirth,FORMELN UND HILFEN ZUR

HÖHEREN MATHEMATIK, Binomi Verlag, 3.Auflage

[9] R. Kories, H. Schmidt-Walter,Taschenbuch der Elektrotechnik, Harri Deutsch Ver-

lag, 4., überarbeitete Auflage

[10] K. Kroschel, Statistische InformationstechnikSignal- und Mustererkennung,

Parameter- und Signalschätzung, 4. Auflage, Springer Verlag

[11] RHEE, MAN YOUNG,Error-correcting coding theory, McGraw-Hill, New York,

1989

107

Page 119: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

References

[12] Philip Koopman, Tridib Chakravarty,Cyclic Redundancy Code (CRC) Polynomial

Selection for Embedded Networks, ECE Department & ICES, Carnegie Mellon Uni-

versity Pittsburgh

[13] Funk, G. ,Performance comparision of standard frame transmission formats FT1.2

and FT2 specified by IEC TC57, ntzArchiv Bd. 10, 1988, pp. 217-221

[14] Philip Koopman, Tridib Chakravarty,Analysis of the Train Communication Network

Protocol Error Detection Capabilities, ECE Department & ICES, Carnegie Mellon

University Pittsburgh, February 25, 2001

[15] WILLIAM L. BRIGGS, VAN EMDEN HENSON, The DFT An Owner’s Manual

for the Discrete Fourier Transformation, siam, Philadelphia, 1995

[16] RICHARD A. HADDARD, THOMAS W. PARSON, DIGITAL SIGNAL

PROCESSING THEORY, APLLICATION AND HARDWARE, Computer Science

Press, New York, 1991

[17] Thomas R. Garcia, Purdue University,Communication Signal Analysis Using MAT-

LAB

[18] John G. Proakis,Digital Communications, McGraw-Hill, 4th. International Edition

[19] HWEI P. HSU,THEORY AND PROBLEMS OF ANALOG AND DIGITAL COM-

MUNICATIONS, McGRAW-HILL, 1993

[20] Richard LAO, Sumida America Technologies,The Twisted-Pair Telephone Line,

November 2002High Frequency Electronics

[21] Ronold W. P. King, Harry Rowe Mimno, Alexander H. Wing,TRANSMISSION

LINES ANTENNAS AND WAVE GUIDES, first edition, McGraw-Hill New York,

1945

[22] J. Ahola, T.Lindh and J. Partanen,Determination of Properties of Low Voltage Power

cables at Frequency Band 100kHz-30MHz, Departement of Electrical Engineering,

Lappeenranta University of Technology, Finland

108

Page 120: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

References

[23] John G. Proakis, Masoud Salehi, Gerhard Bauch,Contemporary Communication

Systems Using MATLAB and Simulink, second edition, Thomson Brooks/Cole

[24] An Analysis of the Broadband Noise Scenario in Powerline Networks, Manfred Zim-

mermann, Klaus Dostert, Institute of Industrial Information Systems, University of

Karlsruhe

[25] Richard van Nee, Ramjee Prasad,OFDM for wireless multimedia communications,

1st edition, Artech House, universal personal communications library, 2000

[26] Guillermo Acosta, Mary Ann Ingram,OFDM Simulation Using Matlab, Smart An-

tenna Research Laboratory, August, 2000

[27] Dusan Matiæ,OFDM as a possible modulation technique for multimedia applica-

tions in the range of mm waves, TUD-TVS, 30.10.98

[28] Adaptives Techniques for Multiuser OFDMEric Philip Lawrey, PhD thesis, James

Cook University, December 2001

[29] John A. C. Bingham,ADSL, VDSL, and Multicarrier Modulation, 2000 by John

Wiley & Sons

[30] Karl-Dirk Kammeyer,Nachrichtenübertragung, 3. neubearbeitete und ergänzte Au-

flage, B. G. Teubner, pp. 580-595

[31] Martin Meyer,KommunikationstechnikKonzepte der modernen Nachrichtenüber-

tragung, 2., verbesserte Auflage, VIEWEG, pp. 240-244

[32] Henrik Schober, Breitbandige OFDM Funkübertragung bei hohen Teil-

nehmergeschwindigkeiten, Institut für Nachrichtentechnik der Universität Karlsruhe

(TH), 2003

[33] Tomás Kratochvíl, David Køíz,UTILIZATION OF MATLAB FOR THE DIGITAL

MODULATION METHODS SIMULATION IN DVB AREA, Institute of Radio Elec-

tronics, Brno University of Technology Faculty of Electrical Engineering and Com-

munication

109

Page 121: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Part I

Generator and Parity Check Matrix

The generator matrix G of the(n, k) code is represented below withn = 23 andk = 16:

G=

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1

0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0

0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1

0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0

0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0

0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0

0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0

0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0

0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1

0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 1 1

0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 1 1

0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 1 1

0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0 1

0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 1 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 1

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 1

110

Page 122: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

On this page we see the parity check matrix H of the extended(n + 1, k) code:

H=

1 1 0 1 0 0 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0

1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0

1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0 0 0

0 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0 0

0 0 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0

0 1 0 0 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 0 0

1 0 1 0 0 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 0

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

111

Page 123: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Part II

Signal space diagrams withGray

encoding

Figure 64: Signal space diagram 4 QAM signals

112

Page 124: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Figure 65: Signal space diagram 16 QAM signals

113

Page 125: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Part III

Digital Filters

In this part, gain and phase characteristic of different digital filter are plotted. In the MAT-

LAB model the functionfir1 was used in order to calculate the filter coefficients of aFIR

filter with a linear phase characteristic. In addition to that the functionbutterwas used to

calculate the filter coefficients of abutterworth FIRfilter. This type of filter does not have

necessarily a linear phase, but its advantage is that it manages a steep slope of the gain

with a lower filter order than aFIR filter.

Anti aliasing filter of the OFDM Transmitter

Anti aliasing filter of order 13 with the cut off frequency of2.4MHz considering a sample

frequency of96MHz. This filter is constructed by using the MATLAB functionbutter.

Figure 66: Anti aliasing filter in the OFDM transmitter

114

Page 126: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Reconstruction low pass of the OFDM Receiver

ThisFIR filter of order 100 is integrated in the OFDM receiver and has a cut off frequency

of fc = 2MHz.

Figure 67: Reconstruction filter in the OFDM receiver

Recover filter for the Manchester signals

This filter is a digitalFIR low pass filter of order 100 with the cut off frequency of3MHz.

Figure 68: Recover filter to isolate the Manchester signals

115

Page 127: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Recover filter for the OFDM1 signals

This filter is a digitalFIRhigh pass filter of order 100 with the cut off frequency of3MHz.

Figure 69: Recover filter to isolate the Manchester signals

Recover filter for the OFDM2 signals

This filter is a digitalFIR high pass filter of order 100 with the cut off frequency of

6.8MHz.

Figure 70: Recover filter to isolate the Manchester signals

116

Page 128: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Part IV

Matlab CodeCableModell.m

function varargout = CableModell(varargin)%developed by Ulrich Hammes

global channel global OFDM

if nargin == 0 % LAUNCH GUI

fig = openfig(’CableModell.fig’,’new’); % opens the current figure CableModel.fig

% Generate a structure of handles to pass to callbacks, and store it.handles = guihandles(fig);guidata(fig, handles); % stores the structure

if nargout > 0% nargout(mfilename) if number of output arguments of function CableModell >0

varargout1 = fig; % varargout is a cell arrayend

gui_Singleton = 0;

%the check at the layout activates Attenuation and Noiseschannel.WhiteNoiseOn=get(handles.WhiteNoiseOn,’Value’);channel.ColoredNoiseOn=get(handles.ColoredNoiseOn,’Value’);channel.PeriodicImpulseOn=get(handles.PeriodicImpulseOn,’Value’);

%values of the cable length/concerns attenuationchannel.CableLength=str2num(get(handles.CableLength,’String’));

%values of the different noise sourceschannel.WhiteNoise=str2num(get(handles.WhiteNoise,’String’));channel.ColoredNoise=str2num(get(handles.ColoredNoise,’String’));channel.PeriodicImpulse=str2num(get(handles.PeriodicImpulse,’String’));channel.FrequencyImpulse=str2num(get(handles.FrequencyImpulse,’String’)) * 1e6;

%Datarate of the error detection=TransmissionFrequency, time to transmit one bitchannel.TransmissionFrequency=1e6 * str2num(get(handles.TransmissionFrequency,’String’));channel.BitTime=1/channel.TransmissionFrequency;

%determines the kind of the modulation(Manchester, OFDM..)channel.Modulation=get(handles.Modulation,’Value’);

%determines the kind of receiverchannel.Receiver=get(handles.Receiver,’Value’);

%message that we want to transmit(sequence of bits)

117

Page 129: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

channel.Message=get(handles.MessageSent,’String’);channel.NumberOfBits=length(channel.Message);

%amplitudes of the channel codingchannel.AmplitudeChannel=str2num(get(handles.Amplitude,’String’));

%values concerning the plot of the signalschannel.XMin=0;channel.XMax=channel.NumberOfBits * channel.BitTime; %to verify because x+1channel.ZoomT=1; channel.ZoomR=1;channel.YMin=-0.9 * channel.AmplitudeChannel;channel.YMax=0.9 * channel.AmplitudeChannel;channel.Phase=get(handles.Phase,’Value’);

%OFDM ParameterOFDM.Estimation_On=get(handles.Estimation_On,’Value’);OFDM.QAM_4_16_OFDM1=get(handles.QAM_4_16_OFDM1,’Value’);OFDM.QAM_4_16_OFDM2=get(handles.QAM_4_16_OFDM2,’Value’);OFDM.InterleavingOn_1=get(handles.InterleavingOn_1,’Value’);OFDM.InterleavingOn_2=get(handles.InterleavingOn_2,’Value’);OFDM.ErrorCorrectionOn_1=get(handles.ErrorCorrectionOn_1,’Value’);OFDM.ErrorCorrectionOn_2=get(handles.ErrorCorrectionOn_2,’Value’);OFDM.DecisionBound_1=0.98; OFDM.DecisionBound_2=0.75;

update_all(handles);

elseif ischar(varargin1) % INVOKE NAMED SUBFUNCTION OR CALLBACK

try% if an error occurs, it is captured int lasterr[varargout1:nargout] = feval(varargin:);% FEVAL switchyard/ nargout returns the number of output arguments% containing the optional output arguments from the function cablemodell% and varargin is a cell arry containing the optional% (input)arguments of the function cablemodell

catchdisp(lasterr);% if an error occurs between try and catch this line is executed

end

end

% ------------------------------------------------------%% Acquisition of the values%% ------------------------------------------------------

118

Page 130: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

% --- Executes on button press in WhiteNoiseOn ---function WhiteNoiseOn_Callback(hObject, eventdata, handles )

global channel;channel.WhiteNoiseOn=get(hObject,’Value’);update_all(handles);

% --- Executes on button press in ColoredNoiseOn ---function ColoredNoiseOn_Callback(hObject, eventdata, handles)

global channel;channel.ColoredNoiseOn=get(hObject,’Value’);update_all(handles);

% --- Executes on button press in PeriodicImpulse ---function PeriodicImpulseOn_Callback(hObject, eventdata, handles)

global channel;channel.PeriodicImpulseOn=get(hObject,’Value’);update_all(handles);

% --- gets the value of the white noise and activates the check boxfunction WhiteNoise_Callback(hObject, eventdata, handles)

global channel;channel.WhiteNoise=str2num(get(hObject,’String’));channel.WhiteNoiseOn=1;set(handles.WhiteNoiseOn,’Value’,1)update_all(handles);

% --- gets the SNR of the colored noise and activates the check boxfunction ColoredNoise_Callback(hObject, eventdata, handles)

global channel;channel.ColoredNoise=str2num(get(hObject,’String’));channel.ColoredNoiseOn=1;set(handles.ColoredNoiseOn,’Value’,1)update_all(handles);

% --- gets the SNR of the periodic noise and activates the check boxfunction PeriodicImpulse_Callback(hObject, eventdata, handles)

global channel;channel.PeriodicImpulse=str2num(get(hObject,’String’));channel.PeriodicImpulseOn=1;set(handles.PeriodicImpulseOn,’Value’,1)update_all(handles);

%gets the frequency of the periodic impulse noise

119

Page 131: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

function FrequencyImpulse_Callback(hObject, eventdata, handles)global channel;

channel.FrequencyImpulse=str2num(get(hObject,’String’)) * 1e6;channel.PeriodicImpulseOn=1;set(handles.PeriodicImpulseOn,’Value’,1)update_all(handles);

% --- gets the length of the cable ---function CableLength_Callback(hObject, eventdata, handles)

global channel;len=str2num(get(hObject,’String’));if (len<0)

set(handles,’String’,num2str(channel.CableLength));return;

elsechannel.CableLength=len;

endupdate_all(handles);

% --- Executes on selection change in Receiver ---function Receiver_Callback(hObject, eventdata, handles)

global channel;channel.Receiver=get(handles.Receiver,’Value’);update_all(handles);

% --- this function gets the amplitude of the signal ---function Amplitude_Callback(hObject, eventdata, handles)

global channel;channel.AmplitudeChannel=str2num(get(hObject,’String’));update_all(handles);

% --- this function gets the frequency of the Manchester Codefunction TransmissionFrequency_Callback(hObject, eventdata,handles)

global channel;channel.TransmissionFrequency=1e6 * str2num(get(hObject,’String’));channel.BitTime=1/channel.TransmissionFrequency;channel.XMax=channel.BitTime * channel.NumberOfBits;update_all(handles);

% --- Executes on selection change in Modulation ----function Modulation_Callback(hObject, eventdata, handles)

global channel;channel.Modulation=get(handles.Modulation,’Value’);update_all(handles);

% --- acquires the string of the binary messagefunction MessageSent_Callback(hObject, eventdata, handles)

global channel;

120

Page 132: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

message=get(hObject,’String’);for i=1:length(message)

if ((message(i)~=’1’) & (message(i)~=’0’))disp(’Error, only 1 and 0 are allowed’);set(hObject,’String’,channel.Message);return;

endendchannel.Message=message;channel.NumberOfBits=length(channel.Message);channel.Xmax=channel.NumberOfBits * channel.TransmissionFrequency;update_all(handles);

% --- Executes on button press in Phase.function Phase_Callback(hObject, eventdata, handles)

global channel;channel.Phase=get(hObject,’Value’);update_all(handles);

% --- estimates the gain of the channel; used for OFDM with 16QAMfunction Estimation_On_Callback(hObject, eventdata, handles)

global OFDM;OFDM.Estimation_On=get(handles.Estimation_On,’Value’);update_all(handles);

% --- choice between 4 and 16 QAM for the 2 OFDM systemsfunction QAM_4_16_OFDM1_Callback(hObject, eventdata, handles)

global OFDM;OFDM.QAM_4_16_OFDM1=get(handles.QAM_4_16_OFDM1,’Value’);update_all(handles);

% --- choice between 4 and 16 QAM for the 2 OFDM systemsfunction QAM_4_16_OFDM2_Callback(hObject, eventdata, handles)

global OFDM;OFDM.QAM_4_16_OFDM2=get(handles.QAM_4_16_OFDM2,’Value’);update_all(handles);

% --- activates error correction for OFDM 1function ErrorCorrectionOn_1_Callback(hObject, eventdata, handles)

global OFDM;OFDM.ErrorCorrectionOn_1=get(handles.ErrorCorrectionOn_1,’Value’);update_all(handles);

% --- activates error correction for OFDM 2function ErrorCorrectionOn_2_Callback(hObject, eventdata, handles)

global OFDM;OFDM.ErrorCorrectionOn_2=get(handles.ErrorCorrectionOn_2,’Value’);update_all(handles);

121

Page 133: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

% --- activates interleaving for OFDM 1function InterleavingOn_1_Callback(hObject, eventdata, handles)

global OFDM;OFDM.InterleavingOn_1=get(handles.InterleavingOn_1,’Value’);update_all(handles);

% --- activates interleaving for OFDM 2function InterleavingOn_2_Callback(hObject, eventdata, handles)

global OFDM;OFDM.InterleavingOn_2=get(handles.InterleavingOn_2,’Value’);update_all(handles);

% ------------------------------------------------------%% Functions to modify the values%% ------------------------------------------------------

% --- Zoom and unzoom for the transmitted spectrum ; Z z ---function ZoomT_Callback(hObject, eventdata, handles, zT)

global channel;x=get(handles.SpectrumT, ’XLim’);if (zT==-1) % unzoom

x(2)=x(2) * 2;channel.ZoomT=channel.ZoomT * 2;

endif (zT==1) % zoom

x(2)=x(2)/2;channel.ZoomT=channel.ZoomT/2;

endset(handles.SpectrumT,’XLim’,[x(1) x(2)]);

% --- Moves the transmitted spectrum ; -> <- ---function MoveT_Callback(hObject, eventdata, handles, MT)

global channel;x=get(handles.SpectrumT,’XLim’);switch MT

case -1x(1)=x(1)-channel.Samples/(0.001/channel.ZoomT);x(2)=x(2)-channel.Samples/(0.001/channel.ZoomT);

case 1x(1)=x(1)+channel.Samples/(0.001/channel.ZoomT);x(2)=x(2)+channel.Samples/(0.001/channel.ZoomT);

endset(handles.SpectrumT, ’XLim’, [x(1) x(2)]);

% --- Zoom and unzoom for the received spectrum ; Z z ---function ZoomR_Callback(hObject, eventdata, handles, zR)

global channel;x=get(handles.SpectrumR, ’XLim’);

122

Page 134: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

if (zR==-1) % unzoomx(2)=x(2) * 2;

channel.ZoomR=channel.ZoomR * 2;endif (zR==1) % zoom

x(2)=x(2)/2;channel.ZoomR=channel.ZoomR/2;

endset(handles.SpectrumR,’XLim’,[x(1) x(2)]);

% --- Moves the received spectrum ; -> <-function MoveR_Callback(hObject, eventdata, handles, MR)

global channel;x=get(handles.SpectrumR,’XLim’);switch MR

case -1x(1)=x(1)-channel.Samples/(0.001/channel.ZoomR);x(2)=x(2)-channel.Samples/(0.001/channel.ZoomR);

case 1x(1)=x(1)+channel.Samples/(0.001/channel.ZoomR);x(2)=x(2)+channel.Samples/(0.001/channel.ZoomR);

endset(handles.SpectrumR, ’XLim’, [x(1) x(2)])

% --- Main function update_all is executed every time a parameter% is changed in the main window

function [BitError]=update_all(handles)global channel;global OFDM;

%aligns different pathspath(path,strcat(pwd,’\channel’));path(path,strcat(pwd,’\Output and Plots’));path(path,strcat(pwd,’\Noises’));path(path,strcat(pwd,’\Encoding and Decoding’));path(path,strcat(pwd,’\OFDM Menus’));path(path,strcat(pwd,’\OFDM’));path(path,strcat(pwd,’\Manchester’));

%OFDM ParametersOFDM.Kmax_1=128; % number of subcarrier for OFDM 1OFDM.Kmax_2=128; % number of subcarrier for OFDM 2fc1=5e6; % carrier frequency OFDM 1fc2=9e6; % carrier frequency OFDM2Guardintervall=0.05; % guard band OFDM 1,2

%converts string 2 binary data[channel.BinMessage]=MessageString2Binary(channel);%manchester modulation

123

Page 135: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

[ModTime, ModAmplitude]=Modulation;

Plot_Signal(handles.Channel, ModTime, ModAmplitude, channel.XMin,channel.XMax,channel.YMin,channel.YMax,channel.BitTime,...-channel.AmplitudeChannel/2,channel.AmplitudeChannel/2,0);

[channel.FrequVector,channel.Spectrum,channel.AbsSpectrum,...channel.XReceived]=CalculateSpectrum(ModAmplitude);

Plot_SpectrumT(handles.SpectrumT,...channel.FrequVector(1:length(channel.FrequVector)/2),...channel.AbsSpectrum(1:length(channel.FrequVector)/2),...0,max(channel.FrequVector)/2, 0, max(channel.AbsSpectrum));

%decides if OFDM is transmitted in addition to the Manchester signalsif (channel.Modulation==3)

[ReceivedManchester]=OFDM_System(ModAmplitude, ModTime, fc1,fc2,Guardintervall,...handles.DecisionBound_1,handles.DecisionBound_2);

else[ReceiveSpectrum]=AttenuateSpectrum(channel.Spectrum,channel.FrequVector,...channel.CableLength);Plot_SpectrumR(handles.SpectrumR,...channel.FrequVector(1:length(channel.FrequVector)/2),...abs(ReceiveSpectrum(1:length(channel.FrequVector)/2)), 0,...max(channel.FrequVector)/2, 0, max(abs(ReceiveSpectrum)));

ReceivedManchester=ifft(ReceiveSpectrum, channel.Samples);

end

% adds the white noise to the Manchester signalsif(channel.WhiteNoiseOn)

[ReceivedManchester]=Add_WhiteNoise(ReceivedManchester);endif(channel.ColoredNoiseOn)

[ReceivedManchester]=Add_ColoredNoise(ReceivedManchester);endif(channel.PeriodicImpulseOn)

[ReceivedManchester]=Add_PeriodicNoise(ReceivedManchester);end

Plot_Signal(handles.ReceivedSignal , channel.XReceived,ReceivedManchester(1:length(channel.XReceived)), channel.XMin,...

channel.XMax, channel.YMin, channel.YMax, channel.BitTime,...-channel.AmplitudeChannel/2, channel.AmplitudeChannel/2,0);

[Driveroutput]=Analog2Digital(real(ReceivedManchester));

Plot_Signal(handles.Driver, channel.XReceived ,Driveroutput,channel.XMin, channel.XMax, channel.YMin, channel.YMax,...channel.BitTime, -channel.AmplitudeChannel/2,channel.AmplitudeChannel/2,0);

124

Page 136: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

[channel.ReceivedMessage]=Demodulation(Driveroutput,channel.Receiver);

channel.BitError=Plot_ReceivedMessage(handles.ReceivedMessage,...handles.ErrorMessage,channel.BinMessage,channel.ReceivedMessage);

... \ channelIn this folder the functionsAttenuateSpectrumandCableCharacteristicsas well as thefile Gamma6.matthat contains the measured cable characteristics are located.

% --- this function attenuates the spectrum of the received signal ---function [ReceivedSpectrum] = AttenuateSpectrum(Spectrum,FrequVector, CableLength)

global channel;

%path(path,strcat(pwd,’\folder’));[Fr Gain Phase]=CableCharacteristics(CableLength);

% eliminates Frequencies which appear twice: e.g f(1)=10MHz f(2)=10MHz% in order to apply the interpolation

j=1;for i=2:length(Fr)

if(Fr(i-1)~=Fr(i))NewFr(j)=Fr(i);NewG(j)=Gain(i);NewPh(j)=Phase(i);j=j+1;

endend

NumberofSamples=length(Spectrum);NewGain=interp1(NewFr,NewG,FrequVector(1:NumberofSamples/2));NewPhase=interp1(NewFr,NewPh,FrequVector(1:NumberofSamples/2));

%aligns values of NewGain/Phase in order to prevent NaNNewGain(1)=NewGain(3);NewGain(2)= NewGain(3);NewPhase(1)=NewPhase(2);NewPhase(2)=NewPhase(3);

%verifies and deletes NaN elementsfor i=1:length(NewGain)

if (any(NewGain(i))==0) %if any(NewGain) elseNewGain(i)=0;

endend

for i=1:length(NewPhase)if (any(NewPhase(i))==0) %if any(NewGain) else

NewPhase(i)=0;end

end

125

Page 137: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

ReceivedSpectrum=[];ReceivedSpectrum(NumberofSamples)=0;

if (channel.Phase==1)ReceivedSpectrum(1:NumberofSamples/2)=NewGain. * exp(-1i * NewPhase).... * Spectrum(1:NumberofSamples/2);

for i=1:NumberofSamples/2ReceivedSpectrum(NumberofSamples-i)=Spectrum(NumberofSamples-i)...

* NewGain(i) * exp(1i * NewPhase(i));end

elseReceivedSpectrum(1:NumberofSamples/2)=NewGain. * Spectrum(1:NumberofSamples/2);

for i=1:NumberofSamples/2ReceivedSpectrum(NumberofSamples-i)=Spectrum(NumberofSamples-i) * NewGain(i);

endend

function [Frequency,Gain,Phase]=CableCharacteristics(length)

% read cable dataStruct=load(’Gamma6.mat’);% parametersFrequency=Struct.Frecuencia; Gamma =Struct.Gamma_30; Zc=Struct.Zc_30;Zr =51; %OhmscableL=30; %meters

% Calculate impedance of the cableZc_Zs=(Zc+Zr. * tanh(Gamma. * cableL))./(Zr+Zc. * tanh(Gamma. * cableL));

% Calculate the attenuation and phase in dependence on the lengthCableCharacteristics=cosh(Gamma. * length)-Zc_Zs. * sinh(Gamma. * length);Gain=abs(CableCharacteristics); Phase=angle(CableCharacteristics);

126

Page 138: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

... \ Encoding and DecodingThis folder contains the functionsBlockcode, Decoding, DeInterleaving, Encoding, Inter-leaving.

function [G, H, Errorpattern, Syndrometable]=Blockcode();n=23; %number of code bitsk=16 ; %number of data bits

generator=[1 1 1 0 0 1 0 1]; %generating polynomial

% generator matrixX(n)=0;G(k,n)=0;for i=1:k

X(:)=0;X(i)=1;[q r]=deconv(X,generator);r1=mod(abs(r),2);G(i,:)=mod(X+r1,2);

end

%parity check matrix Hjj=1;for i=1:k

for j=k+1:nP(i,jj)=G(i,j);jj=jj+1;

endjj=1;

end

H=[P’ eye(7)];%extension of the parity check matrixnull=[0 0 0 0 0 0 0];H=[H null’; ones(1,24)];

% decoding matrixErrorpattern=syndtable(H);Syndrometable=mod(Errorpattern * H’,2);

%decodes the frame in order to detect or correct bit errorsfunction [CorrectedCodeword, detectederrors]=Decoding(ReceivedM,...

numberframes, G, H,Syndrometable, Errorvectors, ErrorCorrectionOn)%number of errores frames for error detection;

f=0;c=0;CorrectedCodeword=ReceivedM;

if(ErrorCorrectionOn==1)%calculation of the syndromefor i=1:numberframes

127

Page 139: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

S=mod(ReceivedM(i,:) * H’,2);for j=1:length(Errorvectors)

if (S==Syndrometable(j,:))break;

endend

CorrectedCodeword(i,:)=mod(ReceivedM(i,:)+Errorvectors(j,:),2);enddetectederrors=0;

elseif(ErrorCorrectionOn==0)for i=1:numberframes

control=mod(ReceivedM(i,1:16) * G,2);if(mod(sum(control),2)==1)

control=[control 1];else

control=[control 0];endif(control(17:24)==ReceivedM(i,17:24))

c=c+1;else

f=f+1;end

endCorrectedCodeword(i,:)=ReceivedM(i,:);detectederrors=f;

end

%deinterleaves the received bits in order to obtain the framesfunction [ReceivedMatrix]=DeInterleaving(InterleavingOn...

,numberframes, ReceivedVector)%DEinterleaving

j=1;if (InterleavingOn==1)

%converts vector to Matrixfor i=1:24

s(i,:)=ReceivedVector(j:j+(numberframes-1));j=j+numberframes;

end

%deinterleavingrc(numberframes,24)=0;

for i=1:numberframesReceivedMatrix(i,:)=s(:,i)’;

endelse

for i=1:numberframesReceivedMatrix(i,:)=ReceivedVector(j:j+23);j=j+24;

endend

128

Page 140: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

%encodes the data bits to frames with CRCfunction [NumberofFrames, DataMatrix,TransmittedBits]=Encoding(G,QAM416,Kmax)

if(QAM416==1)%4 QAM 2bits per symbolMax=Kmax* 2;NumberofFrames=floor(Max/24);%number of data bits; after encoding there are n * 24 code bitsM=NumberofFrames * 16;rand(’state’,0)a=1-1 * round(rand(M,1))’; %creates random datat bitsTransmittedBits=NumberofFrames * 24;

elseif(QAM416==2)%16 QAM 4 bits per symbolMax=Kmax* 4;NumberofFrames=floor(Max/24);%number of data bits; after encoding there are n * 24 code bitsM=NumberofFrames * 16;rand(’state’,0)a=1-1 * round(rand(M,1))’; %creates random datat bitsTransmittedBits=NumberofFrames * 24;

end%conversion of data vector into a matrix to encode and to interleave later

j=1;b(NumberofFrames,16)=0;

for i=1:NumberofFramesb(i,:)=a(j:j+15);j=j+16;

end

%Encoding of the datac=[];c(NumberofFrames,24)=0;for i=1:NumberofFrames

cc=mod(b(i,:) * G,2);if(mod(sum(cc),2)==1)

cc=[cc 1];else

cc=[cc 0];end

DataMatrix(i,:)=cc;end

129

Page 141: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

% interleaves the encoded frames in order to obtain an independent% distribution of the bits; this provides an error correction% capability of burst errors

function [EncodedVector]=Interleaving(InterleavingOn, numberframes, Data)j=1;

if (InterleavingOn==1)%Interleaving%24= Number of codebits in one frames(24,numberframes)=0;for i=1:24

s(i,:)=Data(:,i)’;end%MAtrix to vector;for i=1:24

ss(j:j+(numberframes-1))=s(i,:);j=j+numberframes;

endEncodedVector=ss;

else %Matrix to vector conversionfor i=1:numberframes

ss(j:j+23)=Data(i,:);j=j+24;

endEncodedVector=ss;

end

... \ ManchesterThis folder contains the functionsAnalog2Digital, CalculateSpectrum, Demodulation,Messagestring2binary, Modulationconcerning Manchester modulation and demodula-tion.

function [Driveroutput]=Analog2Digital(ReceivedAnalog)global channel;

if ((channel.Modulation==2) || (channel.Modulation==3))ReceivedAnalog=[ReceivedAnalog zeros(1,32)];Fcutoff=3e6/(channel.SampleRate/2);% cut off frequency in filter is between 0 and fs/2[b a]=butter(10,Fcutoff);ReceivedAnalog=filter(b,a,ReceivedAnalog);ReceivedAnalog=ReceivedAnalog(33:length(ReceivedAnalog));

end

Driveroutput(length(ReceivedAnalog))=0;Amplitude=channel.AmplitudeChannel/2;state=0;Driveroutput(1)=3;

for i=1:length(ReceivedAnalog)if (ReceivedAnalog(i)>=0.2)

Driveroutput(i)=Amplitude;state=1;

elseif (ReceivedAnalog(i)<-0.2)

130

Page 142: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Driveroutput(i)=-Amplitude;state=0;

endif ((state==1) && (ReceivedAnalog(i)>-0.2))

Driveroutput(i)=Amplitude;elseif((state==0) && (ReceivedAnalog(i)<=0.2))

Driveroutput(i)=-Amplitude;end

end

% --- this function determines the spectrum of the received Signal ---function [f, Spectrum, AbsSpectrum, CanalXR]=CalculateSpectrum( ModAmplitude)

global channel;Spectrum=fft(ModAmplitude,channel.Samples);AbsSpectrum=abs(Spectrum);f=1:channel.SampleRate/channel.Samples:channel.SampleRate;CanalXR=channel.SamplePeriod:channel.SamplePeriod:...

(channel.BitTime * channel.NumberOfBits); %time vector

%--- this function decodes the received signal to obtain the bit sequence ---function [ReceivedMessage]=Demodulation(DigitalSignal, Correlator)

global channel;

n=floor(channel.Samples/channel.NumberOfBits);n=64;

% two different receivers,if(Correlator==2)

Man(n)=0;A=channel.AmplitudeChannel;

for i=1:nif(i<=n/2)

Man(i)=A;else

Man(i)=-A;end

end

for i=1:channel.NumberOfBitsp1=corrcoef(DigitalSignal((i-1) * n+1:i * n), Man); %logic zerop2=corrcoef(DigitalSignal((i-1) * n+1:i * n),-Man); %logic onez=p1-p2;

if(z(1,2)>0)ReceivedMessage(i)=1;

elseReceivedMessage(i)=0;

endend

131

Page 143: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

else

limit1=floor(n/2)-ceil(n/2 * 0.375);limit2=floor(n/2)+ceil(n/2 * 0.375);

for i=1:channel.NumberOfBits%number of bits

if ((DigitalSignal(n * (i-1)+floor(n/4))<-0.2) &&...(DigitalSignal(n * (i-1)+floor(3 * n/4))>0.2))

for u=ceil(n/2 * 0.375):limit1

if ((DigitalSignal(n * (i-1)+u)<-0.2) &&...(DigitalSignal((n * i)-u)>0.2))

a=0;else

a=55;break;

endend

elseif ((DigitalSignal(n * (i-1)+floor(n/4))>0.2) &&...(DigitalSignal(n * (i-1)+floor(3 * n/4))<-0.2))

for u=ceil(n/2 * 0.375):limit1

if ((DigitalSignal(n * (i-1)+u)>0.2) &&...(DigitalSignal((n * i)-u)<-0.2))

a=1;else

a=44;break;

endend

elsea=44;

end

if(a==1)ReceivedMessage(i)=1;

elseif (a==0)ReceivedMessage(i)=0;

elseReceivedMessage(i)=’?’;

endend

end

% --- this function converts string data into binary data vectorfunction [BinMessage]=MessageString2Binary(channel)

for i=1:length(channel.Message)

132

Page 144: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

switch channel.Message(i)case ’0’

BinMessage(i)=0;case ’1’

BinMessage(i)=1;end

end

% --- this function modulates the signal with Manchesterfunction [ModTime, ModAmplitude]=Modulation()

global channel;

channel.XMax=channel.BitTime * channel.NumberOfBits;channel.YMin=-0.85 * channel.AmplitudeChannel;channel.YMax=0.85 * channel.AmplitudeChannel;

switch (channel.Modulation)case 1

n=64; %Samples per bitchannel.Samples=channel.NumberOfBits * n;channel.SamplePeriod=channel.BitTime/n;channel.SampleRate=1/channel.SamplePeriod; %Sample Ratefor i=1:channel.NumberOfBits

for j=1:nif (channel.Message(i)==’0’)

v=-0.5;else

v=0.5;endif(j<n/2)

ModAmplitude(n * (i-1)+j)=v * channel.AmplitudeChannel;else

ModAmplitude(n * (i-1)+j)=-v * channel.AmplitudeChannel;end

endend

case 2,3n=64; %Samples per bitchannel.Samples=channel.NumberOfBits * n;channel.SamplePeriod=channel.BitTime/n;channel.SampleRate=1/channel.SamplePeriod; %Sample Rate

for i=1:channel.NumberOfBitsfor j=1:n

if (channel.Message(i)==’0’)v=-0.5;

elsev=0.5;

endif(j<n/2)

ModAmplitude(n * (i-1)+j)=v * channel.AmplitudeChannel;else

133

Page 145: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

ModAmplitude(n * (i-1)+j)=-v * channel.AmplitudeChannel;end

endend

Fcutoff=3e6/(channel.SampleRate/2);[b a]=butter(10,Fcutoff);ModAmplitude=[ModAmplitude zeros(1,32)];ModAmplitude=filter(b,a,ModAmplitude);ModAmplitude=ModAmplitude(33:length(ModAmplitude));endModTime=channel.SamplePeriod:channel.SamplePeriod:...(channel.BitTime * channel.NumberOfBits); %time vector

... \ NoisesThis folder contains the functionsAdd_WhiteNoise, Add_ColoredNoiseandAdd_PeriodicNoise.

% --- this function adds the white noise ---function [received_wh_noise]=Add_WhiteNoise(Signal)

global channel;n=randn(1,length(Signal));n1=randn(1,length(Signal));meanvalue=mean(abs(Signal));AmplitudeWhiteNoise=meanvalue/(10^(channel.WhiteNoise/20));received_wh_noise=Signal+AmplitudeWhiteNoise * n +1j * AmplitudeWhiteNoise * n1;

function [received_co_noise]=Add_ColoredNoise(Signal)global channel;

x=randn(1,length(Signal)); % random sequence(white noise)x1=randn(1,length(Signal));[b,a]=butter(10,1/12); % "y = filter(b,a,x); % white noise is filtered by a low pass filtery1= filter(b,a,x1); % in order to obtain colored noisemeanvalue=mean(abs(Signal));AmplitudeColoredNoise=meanvalue/(10^(channel.ColoredNoise/20));received_co_noise=Signal + AmplitudeColoredNoise * y...

+1j * AmplitudeColoredNoise * y1;

function [received_im_noise]=Add_PeriodicNoise(Signal)global channel;

meanvalue=mean(abs(Signal));AmplitudePeriodicImpulse=meanvalue/(10^(channel.PeriodicImpulse/20));

SamplesImpulseWidth=6; %Samples of the impulse widthPeriodImpulse=1/channel.FrequencyImpulse; % periodSamplesPeriodImpulse=floor(PeriodImpulse/channel.SamplePeriod); % samples

134

Page 146: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

SignalVectorImpulseNoise=[];SignalVectorImpulseNoise(length(Signal))=0;

a=0;for i=1:length(Signal)

if(mod(i,SamplesPeriodImpulse)==0)a=i;

for j=a:a+SamplesImpulseWidthSignalVectorImpulseNoise(j)=AmplitudePeriodicImpulse;

endend

end

n=randn(1,length(SignalVectorImpulseNoise));SignalVectorImpulseNoise=SignalVectorImpulseNoise. * n;received_im_noise=Signal + SignalVectorImpulseNoise...

(1:length(Signal))+1j * SignalVectorImpulseNoise(1:length(Signal));

... \ OFDMThis folder contains all functions concerning OFDM.

function [Sum, FrequVector]=AdditionSpectra(OFDM1, OFDM2, Manchester);global channel;

if (length(OFDM1)>=length(OFDM2))L=length(OFDM1);

elseL=length(OFDM2);

endMan=fft(Manchester,L);O1=fft(OFDM1,L);O2=fft(OFDM2,L);Sum=Man+O1+O2;FrequVector=1:channel.SampleRate/length(Sum):channel.SampleRate;

function [Symbols]=Create_EstimationSymbols(Kmax)a0=1-1 * round(rand(Kmax,1));a1=1-1 * round(rand(Kmax,1));for i=1:length(a0)

if (a0(i)<=0.5)b(i)=3;

elseb(i)=-3;

endendfor i=1:length(a1)

if (a1(i)<=0.5)c(i)=3;

elsec(i)=-3;

end

135

Page 147: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

endSymbols=b+1j * c;

%creates a OFDM spectrum and carriersfunction [carriers]=Create_OFDMsignals(Kmax, Symbols)

%keep in mind that M=(Kmax+1) * 2 bzw. 4; 16qam qamFS=256; %IFFT/FFT lengthA=length(Symbols);

info=zeros(FS,1);info(1:(A/2)) = [ Symbols(1:(A/2)).’]; %Zero paddinginfo((FS-((A/2)-1)):FS) = [ Symbols(((A/2)+1):A).’];

%subcarrier generationcarriers=FS * ifft(info,FS);

%DA conversion and modulation to the carrier frequencyfunction [Ts,DigitalSig, AnalogSig,AnalogSig_Up, OFDM_timevector,...

OFDM_frequencyvector,Time_baseband,Frequency_baseband]=...DA_Upconversion(carriers, Faktor,fc)

%OFDM Parameterq=10;FFTlength=256;SampleF=96e6;T=40/SampleF;

Ts=FFTlength/2 * 40/SampleF;delta=Faktor * Ts;Ts=delta+Ts;

Time_baseband=0:T/2:Ts;Frequency_baseband=(2/T) * (1:FFTlength)/FFTlength;%upconverterL = length(carriers);discretesignal = [ carriers.’;zeros((2 * (1+Faktor) * q)-1,L)];p=0:1/SampleF:T/2;g=ones(length(p),1);%discrete to digital conversiondigitalsignal=conv(g,discretesignal(:)); %hier 18 zeros are already addeddelay=64;%compensation of the group delay and parallel to serial conversionDigitalSig=[digitalsignal; zeros(delay,1)].’;[b,aa] = butter(13,1/20); %delay=64AnalogSig = filter(b,aa,DigitalSig);

OFDM_timevector=1/SampleF:1/SampleF:Ts;t=OFDM_timevector; %zeitvektor mit der Abtastzeit 1/SampleFDigitalSig=DigitalSig(1:length(t));

AnalogSig=AnalogSig(delay+(1:length(t)));

136

Page 148: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

OFDM_frequencyvector=SampleF/length(t):SampleF/length(t):SampleF;

AnalogSig_Up=real((AnalogSig)). * cos(2 * pi * fc * t)+...imag((AnalogSig)). * sin(2 * pi * fc * t);

function [DecisionBound]=EvaluateChannel(ReceivedSymbols)%N=length(ReceivedSymbols);A=3+3j;AA=abs(A);D=mean(abs(ReceivedSymbols));%2 is the decision bound if there is no attenuation% (QAM constellation at the transmitter)DecisionBound=D/AA * 2;

function [Manchester]=OFDM_System(ModAmplitude, ModTime,...fc1,fc2,Guardintervall, DecisionBound_1,DecisionBound_2);

global OFDM;global channel;

%creates Matrix in order to encode and decode data[Gen, H, Errorpattern, Syndrometable]=Blockcode;

%**********************************************%******** Start modulation OFDM1 ***********%**********************************************if (OFDM.Estimation_On==1)

[SymbolEst_1]=Create_EstimationSymbols(OFDM.Kmax_1);[CarrierEst_1]=Create_OFDMsignals(OFDM.Kmax_1, SymbolEst_1);[Ts,DigitalSig_1, AnalogSig_1,OFDM.AnalogSigUp_1,...timevector_1, frequencyvector_1,Time_baseband_1,...Frequency_baseband_1]=DA_Upconversion(CarrierEst_1,Guardintervall,fc1);

else%creates random messages and encodes them in frames of 16 data and 8%parity check bits=> length of the entire frame is 24[OFDM.NumberofFrames_1, OFDM.DataMatrix_1, OFDM.TransmittedBits_1]...

=Encoding(Gen,OFDM.QAM_4_16_OFDM1,OFDM.Kmax_1);

%interleaves the DataMatrix in order to obtain a statistical%independent distribution of errors

[OFDM.EncodedVector_1]=Interleaving(OFDM.InterleavingOn_1,...OFDM.NumberofFrames_1, OFDM.DataMatrix_1);

%QAM Mapping of the frames[OFDM.Symbols_1]=QAM_Mapping(OFDM.QAM_4_16_OFDM1,OFDM.EncodedVector_1);%[OFDM.Symbols_1]=Create_EstimationSymbols(OFDM.Kmax_1);

[OFDM.carriers_1]=Create_OFDMsignals(OFDM.Kmax_1, OFDM.Symbols_1);[Ts,OFDM.DigitalSig_1,OFDM.AnalogSig_1,OFDM.AnalogSigUp_1,OFDM.timevector_1,...

OFDM.frequencyvector_1,OFDM.Time_baseband_1,OFDM.Frequency_baseband_1]...=DA_Upconversion(OFDM.carriers_1,Guardintervall,fc1);

137

Page 149: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

end%*********************************************%********** End modulation OFDM1 ***********%*********************************************

%**********************************************%******** Start modulation OFDM2 ***********%**********************************************

if (OFDM.Estimation_On==1)[SymbolEst_2]=Create_EstimationSymbols(OFDM.Kmax_2);[CarrierEst_2]=Create_OFDMsignals(OFDM.Kmax_2, SymbolEst_2);[Ts,DigitalSig_2, AnalogSig_2,OFDM.AnalogSigUp_2, timevector_2,...

frequencyvector_2,Time_baseband_2,Frequency_baseband_2]...=DA_Upconversion(CarrierEst_2,Guardintervall,fc2);

else%creates random messages and encodes them in frames of 16 data and 8%parity check bits=> length of the entire frame is 24[OFDM.NumberofFrames_2, OFDM.DataMatrix_2, OFDM.TransmittedBits_2]...

=Encoding(Gen,OFDM.QAM_4_16_OFDM2,OFDM.Kmax_2);

%interleaves the DataMatrix in order to obtain a statistical%independent distribution of errors[OFDM.EncodedVector_2]=Interleaving(OFDM.InterleavingOn_2,...

OFDM.NumberofFrames_2, OFDM.DataMatrix_2);

%QAM Mapping of the frames[OFDM.Symbols_2]=QAM_Mapping(OFDM.QAM_4_16_OFDM2,OFDM.EncodedVector_2);

[OFDM.carriers_2]=Create_OFDMsignals(OFDM.Kmax_2, OFDM.Symbols_2);

[Ts,OFDM.DigitalSig_2, OFDM.AnalogSig_2,OFDM.AnalogSigUp_2,...OFDM.timevector_2, OFDM.frequencyvector_2,OFDM.Time_baseband_2,...

OFDM.Frequency_baseband_2]=DA_Upconversion(OFDM.carriers_2,Guardintervall,fc2);end

%*********************************************%********** End modulation OFDM2 ***********%*********************************************

%Addition of the OFDM1, OFDM2 and Manchester spectras[OFDM.SumSpectrum OFDM.FrequVector]=AdditionSpectra...

(OFDM.AnalogSigUp_1, OFDM.AnalogSigUp_2, ModAmplitude);

%attenuation of the signals[OFDM.ReceivedSpectrum] = AttenuateSpectrum(OFDM.SumSpectrum,...

OFDM.FrequVector, channel.CableLength);

OFDM.u_modulated=ifft(OFDM.ReceivedSpectrum);

%********************************************

138

Page 150: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

%********** Start demodulation OFDM1 *******%*********************************************

if (OFDM.Estimation_On==1)[isolated_Estimate_1]=recoverOFDM1(OFDM.u_modulated);[Re_1,Re_fil_Estimate_1,dd,FS,q,A]=Receive_OFDM(isolated_Estimate_1...

,timevector_1,SymbolEst_1, Guardintervall,fc1);[Re_sa_1, ReceivedSymbols_Estimate_1]=Sample_OFDM(dd,FS,q,...

Re_fil_Estimate_1, Guardintervall,A);[OFDM.DecisionBound_1]=EvaluateChannel(ReceivedSymbols_Estimate_1);

else[OFDM.isolated_1]=recoverOFDM1(OFDM.u_modulated);

[OFDM.Re_1,OFDM.Re_fil_1,dd,FS,q,A]=Receive_OFDM(OFDM.isolated_1,...OFDM.timevector_1,OFDM.Symbols_1, Guardintervall,fc1);

if (channel.PeriodicImpulseOn==1)[OFDM.Re_fil_1]=Add_PeriodicNoise(OFDM.Re_fil_1);

end[OFDM.Re_sa_1, OFDM.ReceivedSymbols_1]=Sample_OFDM(dd,FS,q,...

OFDM.Re_fil_1, Guardintervall,A);

if (channel.WhiteNoiseOn==1)[OFDM.ReceivedSymbols_1]=Add_WhiteNoise(OFDM.ReceivedSymbols_1);

endif (channel.ColoredNoiseOn==1)

[OFDM.ReceivedSymbols_1]=Add_ColoredNoise(OFDM.ReceivedSymbols_1);end

%QAM Demapping of the received signals[OFDM.DataVector_1]=QAM_Demapping(OFDM.ReceivedSymbols_1,...

OFDM.QAM_4_16_OFDM1,OFDM.DecisionBound_1);%Receiver deinterleaving and decoding%deinterleaves the Vector and transforms it into a matrix[OFDM.ReceivedMatrix_1]=DeInterleaving(OFDM.InterleavingOn_1...

,OFDM.NumberofFrames_1, OFDM.DataVector_1);

%Errors of the ReceivedMatrix are detected or corrected[OFDM.CorrectedCodeword_1, DetectedErrors_1]=...

Decoding(OFDM.ReceivedMatrix_1,OFDM.NumberofFrames_1,Gen,H,...Syndrometable, Errorpattern, OFDM.ErrorCorrectionOn_1);

%compare data[false_1 correct_1]=Compare_Messages(OFDM.DataMatrix_1, OFDM.ReceivedMatrix_1,...

OFDM.CorrectedCodeword_1,OFDM.NumberofFrames_1,OFDM.ErrorCorrectionOn_1);end

%*********************************************%********** End demodulation OFDM1 *********%*********************************************

%********************************************%********** Start demodulation OFDM2 *******

139

Page 151: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

%*********************************************if (OFDM.Estimation_On==1)

[isolated_Estimate_2]=recoverOFDM2(OFDM.u_modulated);[Re_2,Re_fil_Estimate_2,dd,FS,q,A]=Receive_OFDM(isolated_Estimate_2,...

timevector_2,SymbolEst_2, Guardintervall,fc2);[Re_sa_2, ReceivedSymbols_Estimate_2]=Sample_OFDM(dd,FS,q,...

Re_fil_Estimate_2, Guardintervall,A);[OFDM.DecisionBound_2]=EvaluateChannel(ReceivedSymbols_Estimate_2);Plot_DecisionBound(DecisionBound_1,DecisionBound_2);

else[OFDM.isolated_2]=recoverOFDM2(OFDM.u_modulated);

[OFDM.Re_2,OFDM.Re_fil_2,dd,FS,q,A]=Receive_OFDM(OFDM.isolated_2,...OFDM.timevector_2,OFDM.Symbols_2, Guardintervall,fc2);

if (channel.PeriodicImpulseOn==1)[OFDM.Re_fil_2]=Add_PeriodicNoise(OFDM.Re_fil_2);

end

[OFDM.Re_sa_2, OFDM.ReceivedSymbols_2]=Sample_OFDM(dd,FS,q...,OFDM.Re_fil_2, Guardintervall,A);

if (channel.WhiteNoiseOn==1)[OFDM.ReceivedSymbols_2]=Add_WhiteNoise(OFDM.ReceivedSymbols_2);

endif (channel.ColoredNoiseOn==1)

[OFDM.ReceivedSymbols_2]=Add_ColoredNoise(OFDM.ReceivedSymbols_2);end

%QAM Demapping of the received signals[OFDM.DataVector_2]=QAM_Demapping(OFDM.ReceivedSymbols_2,...OFDM.QAM_4_16_OFDM2,OFDM.DecisionBound_2);

%Receiver deinterleaving and decoding%deinterleaves the Vector and transforms it into a matrix[OFDM.ReceivedMatrix_2]=DeInterleaving(OFDM.InterleavingOn_2...,OFDM.NumberofFrames_2, OFDM.DataVector_2);

%Errors of the ReceivedMatrix are detected or corrected[OFDM.CorrectedCodeword_2, DetectedErrors_2]=Decoding(OFDM.ReceivedMatrix_2...,OFDM.NumberofFrames_2,Gen,H,Syndrometable,Errorpattern,OFDM.ErrorCorrectionOn_2);[false_2,correct_2]=Compare_Messages(OFDM.DataMatrix_2,OFDM.ReceivedMatrix_2,...OFDM.CorrectedCodeword_2,OFDM.NumberofFrames_2,OFDM.ErrorCorrectionOn_2);

end%*********************************************%********** End demodulation OFDM2 *********%*********************************************

%Demodulation Manchester signals[OFDM.sMan]=recoverManchester(OFDM.u_modulated);Manchester=OFDM.sMan(1:channel.Samples);

OFDM_Menu(ModTime,ModAmplitude,OFDM.QAM_4_16_OFDM1,OFDM.QAM_4_16_OFDM2);

140

Page 152: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

Textfileoutput(fc1,fc2,Ts,false_1,correct_1,false_2,correct_2,...Guardintervall,DetectedErrors_1, DetectedErrors_2);

%demapps the QAM symbols into binary datafunction [DataVector]=QAM_Demapping(Symbols,QAM_4_16,threshold)

%4QAM Demappingif (QAM_4_16==1)

a=1;Datavector=[];Datavector(length(Symbols) * 2)=0;

for i=1:length(Symbols)if(real(Symbols(i))>0)

if(imag(Symbols(i))>0)DataVector(a)=0;DataVector(a+1)=0;a=a+2;

elseDataVector(a)=1;DataVector(a+1)=0;a=a+2;

endelse

if (imag(Symbols(i))>0)DataVector(a)=0;DataVector(a+1)=1;a=a+2;

elseDataVector(a)=1;DataVector(a+1)=1;a=a+2;

endend

end%16 QAM Demapping

elseif(QAM_4_16==2)

cd=[];cd(length(Symbols),4)=0;u=1;

for i=1:length(Symbols)% first quarter

if((imag(Symbols(i))>0) && (real(Symbols(i))>0))if(imag(Symbols(i))<threshold)

if(real(Symbols(i))>threshold)cd(u,:)=[1 1 1 0];

elsecd(u,:)=[1 1 1 1];

endelse

if(real(Symbols(i))>threshold)cd(u,:)=[1 0 1 0];

141

Page 153: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

elsecd(u,:)=[1 0 1 1];

endend

end% 2nd quarter

if((imag(Symbols(i))>0) &&(real(Symbols(i))<0))if(imag(Symbols(i))<threshold)

if(real(Symbols(i))>-threshold)cd(u,:)=[1 1 0 1];

elsecd(u,:)=[1 1 0 0];

endelse

if(real(Symbols(i))>-threshold)cd(u,:)=[1 0 0 1];

elsecd(u,:)=[1 0 0 0];

endend

end% third quarter

if((imag(Symbols(i))<0) &&(real(Symbols(i))<0))if(imag(Symbols(i))<-threshold)

if(real(Symbols(i))>-threshold)cd(u,:)=[0 0 0 1];

elsecd(u,:)=[0 0 0 0];

endelse

if(real(Symbols(i))>-threshold)cd(u,:)=[0 1 0 1];

elsecd(u,:)=[0 1 0 0];

endend

end%fourth quarterif((imag(Symbols(i))<0) &&(real(Symbols(i))>0))

if(imag(Symbols(i))<-threshold)if(real(Symbols(i))>threshold)

cd(u,:)=[0 0 1 0];else

cd(u,:)=[0 0 1 1];end

elseif(real(Symbols(i))>threshold)

cd(u,:)=[0 1 1 0];else

cd(u,:)=[0 1 1 1];end

endend

u=u+1;

142

Page 154: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

end

Datavector=[];Datavector(length(Symbols) * 4)=0;ud=1;

% to convert matrix in vector formfor i=1:length(Symbols)

DataVector(ud:ud+3)=cd(i,:);ud=ud+4;

endend

%converts binary data into QAM,16QAM symbolsfunction [Symbols]=QAM_Mapping(QAM_4_16,DataVector)

if (QAM_4_16==1)%4QAM

i=1;for j=1:length(DataVector)/2;

if ((DataVector(i)==0) && (DataVector(i+1)==0))Symbols(j)=1+1j;

endif ((DataVector(i)==0) && (DataVector(i+1)==1))

Symbols(j)=-1+1j;endif ((DataVector(i)==1) && (DataVector(i+1)==1))

Symbols(j)=-1-1j;endif ((DataVector(i)==1) && (DataVector(i+1)==0))

Symbols(j)=1-1j;endi=i+2;

endelseif(QAM_4_16==2)

%16 QAMi=1;

for j=1:length(DataVector)/4;%first quarterif ((DataVector(i)==1) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==1) && (DataVector(i+3)==1))Symbols(j)=1+1j;

endif ((DataVector(i)==1) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==1) && (DataVector(i+3)==0))Symbols(j)=3+1j;

endif ((DataVector(i)==1) && (DataVector(i+1)==0)...

&& (DataVector(i+2)==1) && (DataVector(i+3)==0))Symbols(j)=3+3j;

endif ((DataVector(i)==1) && (DataVector(i+1)==0)...

143

Page 155: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

&& (DataVector(i+2)==1) && (DataVector(i+3)==1))Symbols(j)=1+3j;

end%fourth quarterif ((DataVector(i)==0) && (DataVector(i+1)==0)...

&& (DataVector(i+2)==1) && (DataVector(i+3)==0))Symbols(j)=3-3j;

endif ((DataVector(i)==0) && (DataVector(i+1)==0)...

&& (DataVector(i+2)==1) && (DataVector(i+3)==1))Symbols(j)=1-3j;

endif ((DataVector(i)==0) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==1) && (DataVector(i+3)==1))Symbols(j)=1-1j;

endif ((DataVector(i)==0) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==1) && (DataVector(i+3)==0))Symbols(j)=3-1j;

end%third quarterif ((DataVector(i)==0) && (DataVector(i+1)==0)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==1))Symbols(j)=-1-3j;

endif ((DataVector(i)==0) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==1))Symbols(j)=-1-1j;

endif ((DataVector(i)==0) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==0))Symbols(j)=-3-1j;

endif ((DataVector(i)==0) && (DataVector(i+1)==0)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==0))Symbols(j)=-3-3j;

end%second quarterif ((DataVector(i)==1) && (DataVector(i+1)==0)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==1))Symbols(j)=-1+3j;

endif ((DataVector(i)==1) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==1))Symbols(j)=-1+1j;

endif ((DataVector(i)==1) && (DataVector(i+1)==1)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==0))Symbols(j)=-3+1j;

endif ((DataVector(i)==1) && (DataVector(i+1)==0)...

&& (DataVector(i+2)==0) && (DataVector(i+3)==0))Symbols(j)=-3+3j;

end

144

Page 156: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

i=i+4;end

% Symbols=Symbols/3;end

function [r_tilde,r_info,dd,FS,q,A]=Receive_OFDM(ofdmsignal,...OFDM_timevector,Symbols,Faktor,fc)

A=length(Symbols);q=10;FS=256;

dd=length(ofdmsignal);

%down converting DSB-demodulationr_tilde=2 * cos(2 * pi * fc * OFDM_timevector(1:dd)). * ofdmsignal...

+1j * 2* sin(2 * pi * fc * OFDM_timevector(1:dd)). * ofdmsignal; %(F)

%reconstruction filter, eliminates the carrier frequency[B,AA]= fir1(100,1/24);

%add delay in order to compensate the group delay of the filterdelay=49;r_tilde_extend=[r_tilde zeros(1,delay)];r_info=filter(B,AA,r_tilde_extend);%Baseband signal continuous-time (G)r_info=r_info(delay+1:length(r_info));

%recover the Manchester signalsfunction [sMan]=recoverManchester(s)

Fcutoff=1/16;[b a]=fir1(100,Fcutoff);sMan=[s zeros(1,53)];sMan=filter(b,a,sMan);sMan=sMan(54:length(sMan));

%Recovers the OFDM 1 signalsfunction [OFDM_isolated]=recoverOFDM1(sa)

s=[sa zeros(1,72)];[b a]=fir1(144,1/16,’high’);s=filter(b,a,s);OFDM_isolated=s(73:length(s));

%Recovers the OFDM 2 signalsfunction [OFDM_isolated]=recoverOFDM2(sa)

s=[sa zeros(1,72)];[bbb aaa]=fir1(144,1/7,’high’);s=filter(bbb,aaa,s);OFDM_isolated=s(73:length(s));

function [r_data, info_h]=Sample_OFDM(dd,FS,q,r_info, Faktor,A)%Samplingr_data=real(r_info(1:(2 * (1+Faktor) * q):dd))+1j * imag...

145

Page 157: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

(r_info(1 :(2 * (1+Faktor) * q):dd)); % (H) %Baseband signal, discretetime

%FFTinfo_2N=(1/FS). * fft(r_data,FS); % (I)info_h=[info_2N(1:A/2) info_2N((FS-((A/2)-1)):FS)];

... \ OFDM MenusThis folder contains all menu functions concerning OFDM for the user tool;OFDM_Menu,OFDM_Menu_Receive_1, OFDM_Menu_Receive_2, OFDM_Menu_Transmit_1, OFDM_Menu_Transmit_2.

%Menu to show different figuresfunction OFDM_Menu(ModTime,ModAmplitude,QAM_4_16,QAM_4_16_2);

global OFDM;global channel;

menu_result=0;%handles of figure 0..x are equal to zero

fig2=0;fig3=0;fig4=0;fig5=0;fig6=0;fig7=0;

while menu_result ~= 1menu_result = menu(’Menu of OFDM figures’, ...

’Exit’, ...’Transmit OFDM 1’,...’Transmit OFDM 2’, ...’Addition of Manchester and OFDM signals’, ...’OFDM 1,2 after the high pass filter(fc=3MHz)’, ...’OFDM 2 after the high pass filter(fc=6.8MHz)’, ...’Manchester signals after the low pass filter(fc=3MHz)’,...’Receive OFDM 1’,...’Receive OFDM 2’,...’close all’,...’Information’);

switch menu_resultcase 2

OFDM_Menu_Transmit_1(QAM_4_16,ModTime, ModAmplitude);case 3

OFDM_Menu_Transmit_2(QAM_4_16,ModTime, ModAmplitude);case 4

fig2=figure(2);subplot(211)overlapped=OFDM.AnalogSigUp_1(1:500)+OFDM.AnalogSigUp_2(1:500)...

+ModAmplitude(1:500);plot(OFDM.timevector_1(1:500),overlapped(1:500))title(’Addition of Manchester and OFDM time signals’)ylabel(’Amplitude in V’)% in order to adapt the spectrum we have to divide the spectrum

146

Page 158: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

% by their lengthif (length(OFDM.AnalogSigUp_1)>=length(OFDM.AnalogSigUp_2))

L=length(OFDM.AnalogSigUp_1);else

L=length(OFDM.AnalogSigUp_2);endSpec=fft(OFDM.AnalogSigUp_1,L)/(L/2) + fft(OFDM.AnalogSigUp_2)/(L/2)...

+ fft(ModAmplitude,L)/(length(ModAmplitude)/2);subplot(212)plot(OFDM.frequencyvector_1(1:1000),abs(Spec(1:1000)))title(’Spectrum of Manchester and OFDM signals’)xlabel(’Frequency in Hz’)ylabel(’Amplitude in V/Hz’)

case 5fig3=figure(3);subplot(211)plot(OFDM.timevector_1(1:300),OFDM.isolated_1(1:300))xlabel(’Time in s’)ylabel(’Amplitude in V’)title(’OFDM 1 and OFDM 2 after the reconstruction high pass filter(fc=3MHz)’)subplot(212)plot(OFDM.frequencyvector_1,abs(fft(OFDM.isolated_1))...

/(length(OFDM.isolated_1)/2))xlabel(’Frequency in Hz’)ylabel(’Amplitude in V/Hz’)

case 6fig4=figure(4);subplot(211)plot(OFDM.timevector_2(1:300),OFDM.isolated_2(1:300))xlabel(’Time in s’)ylabel(’Amplitude in V’)title(’OFDM 2 after the reconstruction high pass filter(fc=6.8MHz)’)subplot(212)plot(OFDM.frequencyvector_2,abs(fft(OFDM.isolated_2))...

/(length(OFDM.isolated_2)/2))xlabel(’Frequency in Hz’)ylabel(’Amplitude in V/Hz’)

case 7fig5=figure(5);subplot(211)plot(OFDM.timevector_1(1:1536),OFDM.sMan(1:1536))xlabel(’Time in s’)ylabel(’Amplitude in V’)title(’Manchester after the reconstruction low pass filter(fc=3MHz)’)for i=0:channel.NumberOfBits-1

line([i * channel.BitTime, i * channel.BitTime], [channel.YMin, channel.YMax]..., ’Color’,[0 0.75 0.75], ’LineStyle’,’-’);

%divides the graph into the different bit cellsend[ReSignal]=Analog2Digital(OFDM.sMan);[Receivedbit]=Demodulation(ReSignal, channel.Receiver);

147

Page 159: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

subplot(212)plot(OFDM.frequencyvector_1,abs(fft(OFDM.sMan))/(length(ModAmplitude)/2))xlabel(’Frequency in Hz’)ylabel(’Amplitude in V/Hz’)

case 8OFDM_Menu_Receive_1(QAM_4_16,ModTime, ModAmplitude);

case 9OFDM_Menu_Receive_2(QAM_4_16,ModTime, ModAmplitude);

case 10if (fig2~=0)

close(fig2);fig2=0;

endif (fig3~=0)

close(fig3);fig3=0;

endif (fig4~=0)

close(fig4);fig4=0;

endif (fig5~=0)

close(fig5);fig5=0;

endif (fig6~=0)

close(fig6);fig6=0;

endif (fig7~=0)

close(fig7);fig7=0;

endcase 11

a=1;msg=[’For Information see file Intro.txt: %d’,a];sprintf(’The value is: %d’,a);msg1=[a];msgbox (msg, ’TEST’);

endend

function OFDM_Menu_Receive_1(QAM_4_16_2,ModTime, ModAmplitude)global OFDM;

fig22=0;fig23=0;fig24=0;fig25=0;

menu_result=0;while menu_result ~= 1

148

Page 160: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

menu_result = menu(’Menu of the received OFDM1 signals’, ...’Exit’, ...’Received signal, down converted’,...’Received signal after carrier supression’, ...’Discrete signal’, ...’QAM Symbols’, ...’close all’);

switch menu_resultcase 2

fig22=figure(22);subplot(311)plot(OFDM.timevector_1(1:300),real(OFDM.Re_1(1:300)))title(’Inphase component of the received signal(after downconversion)’)xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_1(1:300),imag(OFDM.Re_1(1:300)))title(’Quadrature component of the received signal(after downconversion)’)xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_1,abs(fft(OFDM.Re_1))/(length(OFDM.Re_1)/2))title(’Spectrum of the downconverted signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 3fig23=figure(23);subplot(311)plot(OFDM.timevector_1(1:300),real(OFDM.Re_fil_1(1:300)))title(’Inphase component of the received signal(after reconstruction filter)’)xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_1(1:300),imag(OFDM.Re_fil_1(1:300)))

title(’Quadrature component of the received signal(after reconstuction filter)’)xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_1,abs(fft(OFDM.Re_fil_1))/(length(OFDM.Re_fil_1)/2))title(’Spectrum of the downconverted signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 4fig24=figure(24);subplot(311)stem(OFDM.timevector_2(1:30),real(OFDM.Re_sa_1(1:30)))title(’Digital signal Inphase component’)xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)stem(OFDM.Time_baseband_1(1:30),imag(OFDM.Re_sa_1(1:30)))title(’Digital signal quadrature component’)xlabel(’time’)

149

Page 161: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

ylabel(’Amplitude in V’)subplot(313)plot(OFDM.Frequency_baseband_1,abs(fft(OFDM.Re_sa_1))/(length(OFDM.Re_sa_1)/2))title(’Spectrum of digital signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 5fig25=figure(25);hold on;if (QAM_4_16_2==1)

plot(OFDM.ReceivedSymbols_1,’.k’);title(’Received 4 QAM Symbols, OFDM1’)axis([-1.5 1.5 -1.5 1.5])grid on;

elseif (QAM_4_16_2==2)plot(OFDM.ReceivedSymbols_1,’.k’);title(’Received 16 QAM Symbols, OFDM1’)axis([-4.5 4.5 -4.5 4.5])axis square ;axis equal;grid on;

endcase 6

if (fig22~=0)close(fig22);fig22=0;

endif (fig23~=0)

close(fig23);fig23=0;

endif (fig24~=0)

close(fig24);fig24=0;

endif (fig25~=0)

close(fig25);fig25=0;

end

end

end

function OFDM_Menu_Receive_2(QAM_4_16_2,ModTime, ModAmplitude)global OFDM;

fig18=0;fig19=0;fig20=0;fig21=0;

150

Page 162: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

menu_result=0;while menu_result ~= 1

menu_result = menu(’Menu of the received OFDM2 signals’, ...’Exit’, ...’Received signal, down converted’,...’Received signal after carrier supression’, ...’Discrete signal’, ...’QAM Symbols’, ...’close all’);

switch menu_result

case 2fig18=figure(18);subplot(311)plot(OFDM.timevector_2(1:300),real(OFDM.Re_2(1:300)))title(’Inphase component of the received signal(after downconversion)’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_2(1:300),imag(OFDM.Re_2(1:300)))title(’Quadrature component of the received signal(after downconversion)’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_2,abs(fft(OFDM.Re_2))/(length(OFDM.Re_2)/2))title(’Spectrum of the downconverted signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 3fig19=figure(19);subplot(311)plot(OFDM.timevector_2(1:300),real(OFDM.Re_fil_2(1:300)))title(’Inphase component of the received signal(after reconstruction filter)’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_2(1:300),imag(OFDM.Re_fil_2(1:300)))title(’Quadrature component of the received signal(after reconstuction filter)’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_2,abs(fft(OFDM.Re_fil_2))/(length(OFDM.Re_fil_2)/2))title(’Spectrum of the downconverted signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 4fig20=figure(20);subplot(311)stem(OFDM.timevector_2(1:30),real(OFDM.Re_sa_2(1:30)))title(’Digital signal Inphase component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)

151

Page 163: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

stem(OFDM.Time_baseband_2(1:30),imag(OFDM.Re_sa_2(1:30)))title(’Digital signal quadrature component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.Frequency_baseband_2,abs(fft(OFDM.Re_sa_2))/(length(OFDM.Re_sa_2)/2))title(’Spectrum of digital signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 5fig21=figure(21);hold on;if (QAM_4_16_2==1)

plot(OFDM.ReceivedSymbols_2,’.k’);title(’Received 4 QAM Symbols, OFDM2’)axis([-2.5 2.5 -2.5 2.5])grid on;

elseif (QAM_4_16_2==2)plot(OFDM.ReceivedSymbols_2,’.k’);title(’Received 16 QAM Symbols, OFDM2’)axis([-4.5 4.5 -4.5 4.5])axis square ;axis equal;grid on;

end

case 6if (fig18~=0)

close(fig18);fig18=0;

endif (fig19~=0)

close(fig19);fig19=0;

endif (fig20~=0)

close(fig20);fig20=0;

endif (fig21~=0)

close(fig21);fig21=0;

end

end

end

function OFDM_Menu_Transmit_1(QAM_4_16_2,ModTime, ModAmplitude)global OFDM;

fig8=0;

152

Page 164: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

fig9=0;fig10=0;fig11=0;fig12=0;

menu_result=0;while menu_result ~= 1

menu_result = menu(’Menu of OFDM1 signals’, ...’Exit’, ...’QAM Symbols’,...’Carriers baseband’, ...’Digital signals’, ...’Continous time signal after low pass filtering’, ...’Continous time signal up converted’,...’close all’);

switch menu_result

case 2fig8=figure(8);hold on;

if (QAM_4_16_2==1)plot(OFDM.Symbols_1,’.k’,’LineWidth’,2);title(’4 QAM Symbols, OFDM1’)axis([-2.5 2.5 -2.5 2.5])

elseif (QAM_4_16_2==2)plot(OFDM.Symbols_1,’.k’,’LineWidth’,2);title(’16 QAM Symbols, OFDM1’)axis([-4.5 4.5 -4.5 4.5])axis square ;axis equal;

endcase 3

fig9=figure(9);subplot(311)stem(OFDM.Time_baseband_1(1:30),real(OFDM.carriers_1(1:30)))title(’Carriers Inphase component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)stem(OFDM.Time_baseband_1(1:30),imag(OFDM.carriers_1(1:30)))title(’Carriers quadrature component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.Frequency_baseband_1,abs(fft(OFDM.carriers_1))...

/(length(OFDM.carriers_1)/2))title(’Spectrum of carriers’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 4fig10=figure(10);subplot(311)plot(OFDM.timevector_1(1:300),real(OFDM.DigitalSig_1(1:300)))

153

Page 165: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

title(’Digital signal Inphase component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_1(1:300),imag(OFDM.DigitalSig_1(1:300)))title(’Digital signal quadrature component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_1,abs(fft(OFDM.DigitalSig_1)...

/(length(OFDM.DigitalSig_1)/2)))title(’Spectrum of digital signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 5fig11=figure(11);subplot(311)plot(OFDM.timevector_1(1:300),real(OFDM.AnalogSig_1(1:300)))title(’continous signal Inphase component after low pass filter’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_1(1:300),imag(OFDM.AnalogSig_1(1:300)))title(’continuous signal quadrature component after low pass filter’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_1,abs(fft(OFDM.AnalogSig_1)...

/(length(OFDM.AnalogSig_1)/2)))title(’Spectrum of continuous signal after low pass filter’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 6fig12=figure(12);subplot(211)plot(OFDM.timevector_1(1:300),real(OFDM.AnalogSigUp_1(1:300)))title(’continuous signal upconverted’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(212)plot(OFDM.frequencyvector_1,abs(fft(OFDM.AnalogSigUp_1)...

/(length(OFDM.AnalogSigUp_1)/2)))title(’Spectrum of continous signal after upconverting’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 7if (fig8~=0)

close(fig8);fig8=0;

endif (fig9~=0)

close(fig9);fig9=0;

end

154

Page 166: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

if (fig10~=0)close(fig10);fig10=0;

endif (fig11~=0)

close(fig11);fig11=0;

endif (fig12~=0)

close(fig12);fig12=0;

endend

end

function OFDM_Menu_Transmit_2(QAM_4_16_2,ModTime, ModAmplitude)global OFDM;

fig13=0;fig14=0;fig15=0;fig16=0;fig17=0;

menu_result=0;while menu_result ~= 1

menu_result = menu(’Menu of OFDM2 signals’, ...’Exit’, ...’QAM Symbols’,...’Carriers baseband’, ...’Digital signals’, ...’Continous time signal after low pass filtering’, ...’Continous time signal up converted’,...’close all’);

switch menu_result

case 2fig13=figure(13);hold on;

if (QAM_4_16_2==1)plot(OFDM.Symbols_2,’.k’);title(’4 QAM Symbols, OFDM1’)axis([-2.5 2.5 -2.5 2.5])

elseif (QAM_4_16_2==2)plot(OFDM.Symbols_2,’.k’);title(’16 QAM Symbols, OFDM1’)axis([-4.5 4.5 -4.5 4.5])axis square ;axis equal;

endcase 3

155

Page 167: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

fig14=figure(14);subplot(311)stem(OFDM.Time_baseband_2(1:30),real(OFDM.carriers_2(1:30)))title(’Carriers Inphase component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)stem(OFDM.Time_baseband_2(1:30),imag(OFDM.carriers_2(1:30)))title(’Carriers quadrature component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.Frequency_baseband_2,abs(fft(OFDM.carriers_2)...

/(length(OFDM.carriers_2)/2)))title(’Spectrum of carriers’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 4fig15=figure(15);subplot(311)plot(OFDM.timevector_2(1:300),real(OFDM.DigitalSig_2(1:300)))title(’Digital signal Inphase component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_2(1:300),imag(OFDM.DigitalSig_2(1:300)))title(’Digital signal quadrature component’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_2,abs(fft(OFDM.DigitalSig_2)...

/(length(OFDM.DigitalSig_2)/2)))title(’Spectrum of digital signal’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 5fig16=figure(16);subplot(311)plot(OFDM.timevector_2(1:300),real(OFDM.AnalogSig_2(1:300)))title(’continous signal Inphase component after low pass filter’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(312)plot(OFDM.timevector_2(1:300),imag(OFDM.AnalogSig_2(1:300)))title(’continous signal quadrature component after low pass filter’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(313)plot(OFDM.frequencyvector_2,abs(fft(OFDM.AnalogSig_2)...

/(length(OFDM.AnalogSig_2)/2)))title(’Spectrum of continous signal after low pass filtering’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 6

156

Page 168: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

fig17=figure(17);subplot(211)plot(OFDM.timevector_2(1:300),real(OFDM.AnalogSigUp_2(1:300)))title(’continous signal upconverted’)%xlabel(’time’)ylabel(’Amplitude in V’)subplot(212)plot(OFDM.frequencyvector_2,abs(fft(OFDM.AnalogSigUp_2)...

/(length(OFDM.AnalogSigUp_2)/2)))title(’Spectrum of continous signal after upconverting’)ylabel(’Amplitude in V/Hz’)xlabel(’Frequency in Hz’)

case 7if (fig13~=0)

close(fig13);fig13=0;

endif (fig14~=0)

close(fig14);fig14=0;

endif (fig15~=0)

close(fig15);fig15=0;

endif (fig16~=0)

close(fig16);fig16=0;

endif (fig17~=0)

close(fig17);fig17=0;

endend

end

... \ Output and PlotsThis folder contains the functionsPlot_DecisionBound, Plot_ReceivedMessage, Plot_Signal,Plot_SpectrumR, Plot_SpectrumT, Textfileoutput.

function Plot_DecisionBound(textbox1, textbox2)global OFDM;DD1=round(OFDM.DecisionBound_1 * 100)/100;DD2=round(OFDM.DecisionBound_2 * 100)/100;D1=num2str(DD1)D2=num2str(DD2)set(textbox1,’String’,D1);set(textbox2,’String’,D2);

% --- this function

157

Page 169: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

function [NumberOfErrors] = Plot_ReceivedMessage...(textbox1,textbox2, Message, ReceivedMessage)

NumberOfErrors=0;

for i=1:length(Message)if (Message(i)==ReceivedMessage(i))

switch ReceivedMessage(i)case 0

WriteReceivedMessage(i)=’0’;WriteTransmissionError(i)=’ ’;

case 1WriteReceivedMessage(i)=’1’;WriteTransmissionError(i)=’ ’;

endelse

switch ReceivedMessage(i)case 0

WriteReceivedMessage(i)=’0’;WriteTransmissionError(i)=’E’;NumberOfErrors=NumberOfErrors+1;

case 1WriteReceivedMessage(i)=’1’;WriteTransmissionError(i)=’E’;NumberOfErrors=NumberOfErrors+1;

otherwiseWriteReceivedMessage(i)=’?’;WriteTransmissionError(i)=’E’;NumberOfErrors=NumberOfErrors+1;

endend

endset(textbox1,’String’,WriteReceivedMessage);set(textbox2,’String’,WriteTransmissionError);

% --- This function plots the coded signals ---function Plot_Signal(ax, x, y, XMin, XMax, YMin, YMax,...

BitTime, AmplitudeMin, AmplitudeMax, driver)axes(ax);

% opens the axes and returns its handleset(gcf,’CurrentAxes’,ax);

% gcf returns the handle to the current figurecla reset;% clears the old propertiesn=floor((XMax-XMin)/BitTime);% calculates the number of bits to plot /to verify if xmax=x+1 * ..

for i=0:n-1line([i * BitTime, i * BitTime], [YMin, YMax],...

’Color’,[0 0.75 0.75], ’LineStyle’,’-’);%divides the graph into the different bit cells

endhold on;

158

Page 170: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

if(driver)stem(x,y)

elseplot(x,y)

endhold off;set(ax,’XGrid’,’off’,’YGrid’,’on’);set(ax,’XTick’,[0:4 * BitTime:XMax]);set(ax,’XLim’,[XMin XMax]);set(ax,’YLim’,[YMin YMax]);

if (AmplitudeMin==0)set(ax,’YTick’,[0 AmplitudeMax]);

elseset(ax,’YTick’,[AmplitudeMin 0 AmplitudeMax]);

end

% --- this function plots the spectrum of the received signal ---function Plot_SpectrumR(ax, X, Y, XMin, XMax, YMin, YMax)

global channel;axes(ax);set(gcf,’CurrentAxes’,ax);YMax=YMax/(channel.Samples/2);cla reset;set(gca,’XGrid’,’off’);set(gca,’XScale’,’lin’);hold on;%if (YMax-YMin==0) YMax=1; endplot(X,Y/(channel.Samples/2));axis([0 channel.SampleRate/2 0 1000])set(ax,’XLim’,[XMin XMax * 0.1 * channel.ZoomR]);set(ax,’YLim’,[YMin YMax]);

% --- this function plots the spectrum of the transmitted signal ---function Plot_SpectrumT(ax, X, Y, XMin, XMax, YMin, YMax)

global channel;axes(ax);set(gcf,’CurrentAxes’,ax);YMax=YMax/(channel.Samples/2);cla reset;set(gca,’XGrid’,’off’);set(gca,’XScale’,’lin’);hold on;%if (YMax-YMin==0) YMax=1; endplot(X,Y/(channel.Samples/2));%axis([0 channel.SampleRate/2 0 1000])set(ax,’XLim’,[XMin XMax * 0.1 * channel.ZoomT]);set(ax,’YLim’,[YMin YMax]);

159

Page 171: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

function Textfileoutput(fc1,fc2,Ts,FalseFrames_1,CorrectFrames_1,...FalseFrames_2,CorrectFrames_2,Guardband, DetectedErrors_1,DetectedErrors_2)

global channel;global OFDM;

if(OFDM.QAM_4_16_OFDM1==1)QAM_1t=’4-QAM’;

elseQAM_1t=’16-QAM’;

end

if(OFDM.QAM_4_16_OFDM2==1)QAM_2t=’4-QAM’;

elseQAM_2t=’16-QAM’;

end

ff = fopen(’Output.txt’,’w’);

fprintf(ff,’\t \t \t \t \t\t \t \t \t \t OUTPUT DATA OFDM \n\n \n’);fprintf(ff,’\t \t \t \t \t \t \t \t OFDM 1 \t \t \t \t OFDM 2\n\n’);fprintf(ff,’Number of Carriers(K): %15i %22i \n\n’,[OFDM.Kmax_1 OFDM.Kmax_2]);fprintf(ff,’Modulation:\t \t \t %19s %22s \n\n’,QAM_1t, QAM_2t);fprintf(ff,’Symbol time in s:\t \t %16g %22g \n \n’,[Ts Ts]);fprintf(ff,’Carrier spacing in Hz: \t %14g %20g \n \n’,[1/Ts 1/Ts]);fprintf(ff,’Guard interval in per cent: \t %7g %22g \n \n’,[Guardband Guardband]);fprintf(ff,’RF Carrier Frequency in Hz: \t %7g %22g \n\n’,[fc1 fc2]);fprintf(ff,’Bandwidth=1/Ts * K: \t \t %19g %21g \n \n’,...

[1/Ts * OFDM.Kmax_1 1/Ts * OFDM.Kmax_2]);fprintf(ff,’Data Rate in Bit/s \n with 2/3 code rate: \t \t \t %7g %21g...

\n \n’,[2 * OFDM.QAM_4_16_OFDM1* 1/Ts * OFDM.Kmax_1* 2/3...2* OFDM.QAM_4_16_OFDM2* 1/Ts * OFDM.Kmax_2* 2/3]);

if (channel.WhiteNoiseOn==1)%fprintf(ff,’White Noise: \t %13s \t %20s \n \n’,WhiteNoi, WhiteNoi);fprintf(ff,’White Noise /SNR in [dB]: %24g \n \n’,[channel.WhiteNoise]);endif (channel.ColoredNoiseOn==1)%fprintf(ff,’Colored Noise: \t %13s \t %20s \n \n’,ColoredNoi, ColoredNoi);fprintf(ff,’Colored Noise /SNR in [dB]: %22g \n \n’,[channel.ColoredNoise]);endif (channel.PeriodicImpulseOn==1)%fprintf(ff,’White Noise: \t %13s \t %20s \n \n’,ImpulsiveNoi, ImpulsiveNoi);fprintf(ff,’Impulsive Noise /SNR in [dB]: %20g \n \n’,[channel.PeriodicImpulse]);endfprintf(ff,’Cable length in m: \t \t %25g \n \n’,[channel.CableLength]);

fprintf(ff,’Interleaving: %20i %22i \t \t \t \t \t\t 0=Interleaving off,...1=Interleaving on\n \n’,[OFDM.InterleavingOn_1 OFDM.InterleavingOn_2]);fprintf(ff,’ErrorCorrection: %20i %22i \t \t \t \t \t\t 0=Error correction off,...1=Error correction on \n\n’,[OFDM.ErrorCorrectionOn_1 OFDM.ErrorCorrectionOn_2]);if ((OFDM.ErrorCorrectionOn_1==0) || (OFDM.ErrorCorrectionOn_2==0))

fprintf(ff,’Error detection,\nNumber of detected errors: %10g %22g \n\n\n’,...

160

Page 172: Modelling a Transmission Channel based on the TCN  · PDF filesimulation tool in MATLAB. The aforementioned TCN-Standard should be respected in this model

Appendix

[DetectedErrors_1, DetectedErrors_2]);end

fprintf(ff,’Number of correct frames: %12i %22i \t \t \t \t \t\t...at the receiver side for OFDM 1 respectively OFDM2\n \n’,...

[CorrectFrames_1,CorrectFrames_2]);fprintf(ff,’Number of erroneous frames: %9i %22i \n \n’,...

[ FalseFrames_1,FalseFrames_2]);fprintf(ff,’Number of bit errors of \n the Manchester Code:\t...

\t %21g \t \t \t \t \t\t % baseband signal which is plotted...in the main window(Driver ouptput)\n\n’, channel.BitError);

status = fclose(ff);

161