+ All Categories
Home > Documents > TSTE91 System Design Communications System Simulation...

TSTE91 System Design Communications System Simulation...

Date post: 14-Mar-2018
Category:
Upload: doantruc
View: 215 times
Download: 1 times
Share this document with a friend
22
1 TSTE91 System Design Communications System Simulation Using Simulink Sebastian Prot, Kent Palmkvist Electronic Systems, Dept. EE, LiTH 020204
Transcript
Page 1: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

1

TSTE91 System Design

Communications System Simulation Using Simulink

Sebastian Prot, Kent PalmkvistElectronic Systems, Dept. EE, LiTH

020204

Page 2: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Contents1 Abstract ........................................................................................................................1

2 Theory ..........................................................................................................................1

2.1 Basic analog channel...............................................................................................1

2.2 Basic digital channel ...............................................................................................1

2.3 Symbol Error Ratio ................................................................................................3

3 Simulink introduction ..................................................................................................3

4 Block descriptions.........................................................................................................5

4.1 Analog transmission system....................................................................................64.1.1 Transmission channel ...........................................................................................6

4.1.1.1 Random signal generator..............................................................................64.1.1.2 AWGN channel............................................................................................74.1.1.3 Error rate calculation ....................................................................................84.1.1.4 Goto & From blocks.....................................................................................94.1.1.5 Mux block..................................................................................................10

4.1.2 Measurement tools section..................................................................................104.1.2.1 Display.......................................................................................................114.1.2.2 Time scope.................................................................................................11

4.2 Digital transmission system ..................................................................................134.2.1 Transmission channel .........................................................................................13

4.2.1.1 Bernoulli random binary generator .............................................................134.2.1.2 Binary channel ...........................................................................................14

4.3 Other blocks ..........................................................................................................154.3.1 Block info ..........................................................................................................154.3.2 Block underlining, highlighting ..........................................................................15

5 The system basics .......................................................................................................16

5.1 The system setup parameters ...............................................................................175.1.1 Initial commands ................................................................................................17

5.2 The signals flow.....................................................................................................17

5.3 Transmission analyses ..........................................................................................195.3.1 Channel influence on transmission quality..........................................................195.3.2 Channel influence on transmitted signal..............................................................20

Page 3: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

1

Part I. Basic transmission schemes

1 Abstract

The purpose of this manual is to introduce the Matlab\Simulink environment as well aspresent information about the basic Simulink Models - mostly from the Communication andDSP blocksets. It can also be viewed as a user guide showing the basics on how to buildtransmission system in the Matlab environment.

2 Theory

All electronic elements communicate between each other. Such communication can bedivided into two main types:

• analog• digital

Different transmission schemes can be applied in different stages of every system,depending on the electronic architecture. Additionally, there are no systems that can existwithout distortions. In general, wherever electronics is used, the noise degrades transmissionquality.

2.1 Basic analog channelIn analog circuits, in general, most of the distortions can be simulated as additive noise

that degrades transmitted information by changing the amplitude of the original signal.Simulink includes several channels that spreads transmitted signals in time, distorts real orboth real and complex component of transmitted signals, introduce Rayleigh fading -frequency domain distortions, etc.

But, in the most simplified case, AWGN – Additive White Gaussian Noise channel canbe used for fast and rough research of the noise influence on analog signals being transmitted.

The AWGN channel is actually a discrete channel, but can be used for analog continuestransmission simulation, since both continues and discrete time signals are influenced by thesame limitations. Such limitation is e.g. signal resolution. There is no difference in applyingcontinuous noise signal, and noise of limited sampling frequency, since the received signalsare only analyzed ones every sample time. Thus, even if the noise changes rapidly twice oreven hundred times during the time between the sampling moments, only one single state canbe noticed and remembered for further processing (see fig.1).

2.2 Basic digital channelIn the case of digital communication, an analog channel can also be applied, but since

digital signals can only take on two values, the only effect that can be caused by the signaldistortion is incorrect identification of actual transmitted symbol. Thus, no matter how muchthe original value changes, the result can only be a logical 1 or 0.

Page 4: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

2

Fig.0. Continues vs. discrete time transmission scheme.

Page 5: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

3

The conclusion can then be drawn that it is enough to perform logical sum modulo2(XOR) between the binary data and a binary error signal (Table 1) instead of summing thebinary data with analog noise. This is equivalent to perform a modulo 2 summation thatchanges transmitted information to the opposite value whenever the error signal is equal to 1.

Simulink includes a binary error channel, which is the best choice for binarytransmission analysis.

Table 1. The binary channel effect.

Information Signal Error signal Result1 1 00 1 11 0 10 0 0

2.3 Symbol Error RatioIn the literature Bit Error Ratio BER or Symbol Error Ratio SER is calculated according

to expression (1). However, it can also be given in percents (2).

ttedBitsrOfTransmiTotalNumbe

ErrorBitsBER = (1).

%100*[%]ttedBitsrOfTransmiTotalNumbe

ErrorBitsBER = (2).

3 Simulink introduction

To start Simulink you have to run Matlab and execute <Simulink> command in Matlabcommand window(Fig.1) or click simulink icon on the Toolbar.

Fig.1. Starting Simulink from the Matlab command window

A Simulink window appears. You can use a particular block by dragging it into themodel window (see Fig.3).

Before running the simulation you have to set the simulation parameters by selectingParameters from Simulation menu in the Model window (fig.2).

Page 6: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Fig.2 Accessing the parameter dialog box.

The parameter dialog box consists of three pages (fig.4):• Solver• Workspace I/O• Diagnostics

The Solver page allows you to:• set the simulation start and stop parameters• choose solver algorithm and specify its parameters• select output options

Fig.3. Dragging a block into the model window.

Fig.4. Simulation Parameters Window.

Page 7: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

The Workspace I/O page allows you to:• direct simulation output to workspace variables• get input and initial states from the workspace

The Diagnostics tab allows you to:• select desired action for many types of events or conditions that can be encountered

during simulation

All tabs are clearly described in the Simulink help text (click the HELP button, fig.4).

4 Block descriptions

The system introduces two, basic transmission schemes and allows the user to choosewhich one to analyze:

• Transmission over an AWGN channel (fig.5),• Transmission over a binary channel (fig.6.).

Fig.5. The system introducing transmission over AWGN channel.

Page 8: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Fig.6. The system introducing transmission over binary channel.

4.1 Analog transmission systemThis section will describe the blocks in the analog transmission model, and the settings

needed by the these blocks.The models will use masking of subsystems, tags, and other more advanced properties of

Simulink. If you have problems understanding these, please see the Simulink user guide.

4.1.1 Transmission channel

4.1.1.1 Random signal generator

Fig.7. Random Signal Generator mask.

Page 9: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Mean, VarianceBy default, the produced sequence has a mean value of 0 and a variance of 1, although

you can vary these parameters by changing particular values in the input data fields.

Initial seedThe Random Signal Generator generates normally distributed random numbers. The Seed

is reset to the specified value each time the simulation starts.

Sample timeThe sample time defines the time interval between samples. This parameter is set to 1 in

the main model mask definition in section Initial commands.

4.1.1.2 AWGN channelThe AWGN Channel block can be used with either real or complex valued input signals.

When the input signal is real, this block adds real Gaussian noise and produces a real outputsignal. When the input signal is complex, this block generates complex Gaussian noise andproduces a complex output signal.

ModeThere are three modes defined in the model mask, which can be used during simulation

(fig.8):• Signal to noise ratio• Variance from mask• Variance from port

Fig.8. AWGN channel mask

In this manual Signal to noise ratio is to be specified. Thus, variance is calculated fromthe following parameters:

• Es/No, the ratio of energy per symbol to noise energy• The input signal power• The symbol period

Page 10: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Other modes are not important in this system, thus their description will be omitted.

ES/N0 (dB)SNR parameter is to be specified in decibels (1):

10log10(ES/N0) (1)

4.1.1.3 Error rate calculationThe Error Rate Calculation block compares the transmitted signal with its distorted,

received version. By default, the model from the library calculates the error rate by dividingthe total number of data elements that are not equal by the total number of received datasamples.

In case of the AWGN channel, there are no equal samples, since additive noise distortseach fragment of the transmitted signal.

In order to simulate a real receiver with a soft decision system1, the Error RateCalculation model, needs some insignificant modifications to allow the user to specify themaximal difference between transmitted and received signals that is not recognized as anerror.

To perform such system modification do the following:• first it is necessary to select the Error Rate Calculation block,• then choose BREAK LIBRARY LINK form EDIT menu.

Under the mask several models appears (Fig.9).The modification was applied in the Determine Symbols in Error block. The specified

maximal difference between the transmitted and received data that does not generate an errorwas changed from 0 to the threshold variable (Fig.10). The parameter value is inherited fromthe main model mask. Also, to pass the threshold value from outside the model, the subsystemmask needs to be insignificantly modified (Fig.11).

Fig.9. Error Calculation Subsystem

1 Each sample is compared with the range [a:b], if it is included in this region the received sample isassumed to be the ideal value e.g. defined as a+b/2. When a hard decision is analyzed the range isreplaced with a finite set of possible values.

Page 11: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Fig.10. Determining Symbols in the Error subsystem.

The Threshold value is defined to be constant in the main system mask in the Initialcommands section.

Fig.11. Error Rate Calculation mask (left - before, right - after).

Due to the added Error checking threshold parameter, the Threshold value will bepassed inside the subsystem.

The data produced at the output of the Error Rate Calculation block is a vector whoseentries correspond to:

• The error rate• The number of error events• The total number of input events

4.1.1.4 Goto & From blocksThe Goto block passes its input to its corresponding From block. The input can be a real-

or complex-valued signal or a vector of any data type. From and Goto blocks allow you topass a signal from one block to another without actually connecting them.

The Goto block can pass its input signal to more than one From block, although theFrom block can only receive a signal from one Goto block.

Page 12: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Fig.12. Goto & From block dialog boxes.

Tag, Goto tagThe two blocks: Goto and From, can be considered as physically connected if their Tag

and Goto tag names, specified in the parameter entry field (Fig.12), are the same.

Tag visibilityThe Tag visibility parameter determines how the location of the From blocks that access

the signal is limited:• local, the default, means that the From and Goto blocks using the tag must be in the

same subsystem. A local tag name is enclosed in square brackets ([]).• scoped means that the From and Goto blocks using the same tag must be in the

same subsystem or in any subsystem below the Goto Tag Visibility block in themodel hierarchy. A scoped tag name is enclosed in braces ({}).

• global means that the From and Goto blocks using the same tag can be anywhere inthe model.

4.1.1.5 Mux blockMultiplexes “Number of inputs” signals (fig.13).

Fig.13. Mux block mask.

4.1.2 Measurement tools sectionThe measurement tools section allows the student to analyze the channel influence on

the transmitted signals and in general, on transmission quality.

Page 13: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

4.1.2.1 DisplayThe display presents the value of its input. If the input is a vector, vector length values

are displayed (fig.14).

Fig.14. Display setup mask.

4.1.2.2 Time scopethe scope block displays its input plotted against the simulation time. The number of

inputs is equal to the number of separate plots with a common time range.Block inherits the sample time from the incoming signal, but decimation can be changed

in the block properties dialog box, increasing the time interval between plotted samples.

The scope provides a set of toolbar buttons that enable the user to:• zoom in / zoom out on the displayed data• display all the data inputs to the Scope• preserve axes settings from one simulation to the next• limit displayed data, and save data to the workspace

The toolbar buttons are labeled in the figure 4. It shows the Scope window as it appearswhen you open the standard Scope block by double clicking on its icon.

Fig.15. Standard Time Scope window.

Auto-scaleThe Auto-scale toolbar button automatically scales both axes to display all the stored

simulation data.

Page 14: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Properties

Properties allow the user to:• change axes limits• set the number of axes• set time range,tick labels• set sampling parameters• set saving options

Save Axes settings

The Save axes settings toolbar button enables the user to store the current x- and y-axissettings so they can be applied to the next simulation.

Some more detailed information about the Time scope can be found in the Helpdisplayed by clicking the Help button on the Properties dialog box.

4.1.2.2.1 Time scope properties

Fig.16. Time scope properties dialog box.

Page 15: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

General ParametersThe user can set the axes parameters, time range, tick labels, and can also choose the

floating scope in the General tab.

Number of axesSets the number of separate plots. If floating scope is selected, only one plot can be

displayed, regardless of the value of the number of axes parameter.

Floating scopeA floating Scope selection allows the user to display the signals carried on one or more

lines without an actual connection to the measurement tool.To use the floating scope during simulation and display the signals carried in a single

line, select the line.Hold down the Shift key while clicking on another line to select multiple lines. Note that

all the signals will be presented in a single plot.A model can contain more than one floating Scope, although generally, it is not useful to

have more than one floating Scope in a window because they will display the same signals.If you plan to use a floating scope during simulation, you should disable buffer reuse.

See “Disable optimized I/O storage” in Matlab/Help for more information.

4.2 Digital transmission system

4.2.1 Transmission channel

4.2.1.1 Bernoulli random binary generatorThis blocks generates a binary signal with a Bernoulli distribution. The model requires

three main parameters to be set (fig.17):• Probability of zeros• Seed• Sample time

Fig. 17. Binary generator setup mask.

Probability of zeroWhen set to 0.5 the same average number of ones and zeros occur in a particular time

range.

Page 16: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

SeedDefines the generator initial state.

Sample timeDefines the time interval between transmitted binary symbols.

4.2.1.2 Binary channelBinary signals transmitted over the channel are to be distorted by the logically additive

binary error signal, generated in the channel subsystem. The noise signal in the channel isgenerated from the random integer signal with a Poisson distribution, converted to binaryform by saturation.

The user is required to set the basic model parameters, depicted in figure 18.The top output of the model outputs transmitted, distorted signal, while the second

output port outputs the error signal.

Fig.18. Binary channel setup mask.

Error probabilityThe error probability parameter is inherited from the main model mask, and is defined

by the user before starting the simulation.

Input vector lengthIn this system the input signal is a scalar, thus this parameter should be set to 1.

SeedDefines the initial state of the noise generator.

Sample timeShould be equal to the time interval between binary symbols in the input signal, in order

to correctly simulate the channels influence on the transmitted signal.

Page 17: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

4.3 Other blocks

4.3.1 Block infoTo include comments in the region of the system, the user can double click on the

background or place a Model info block.The problem with a label placed straight on the system background is that it will be

invisible when moved over other blocks., It is better to use the Model info block to place a description on top of existing models

(fig.19).

Fig.19. Model info definition dialog box.

The block allows the user to type in the information text and perform text alignment.Additionally, the block frame can be removed.

To change font properties select the model and choose FONT from FORMAT menu.

4.3.2 Block underlining, highlightingTo indicate some special region of the system or indicate that some blocks form a

special, independent group, the user can highlight that region/blocks by putting them over aframe or colored region limited by a frame.

Two basic models can be applied for such a purpose:• Model info• Subsystem

In the Model info case, the text field should be left empty in order to produce an emptypseudo-region.

In case of a Subsystem, it needs to be masked and then an empty disp(‘’) commandneeds to be typed in the DRAWING COMMANDS section of the mask definition dialog box(fig.20).

Matlab does not allow the user to directly specify the models order of displaying. Butfortunately the subsystems displaying sequence can be controlled by tricky models labeling.

Page 18: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Fig.20. Two subsystems with mask defined to remove the plotted icon.

The displaying is performed in accordance with the alphabetic order. E.g. model named“a” is displayed on the top of the model named “b”, etc (fig.21).

Fig.21. Subsystems labeling as a method of controllingthe displaying order.

5 The system basics

Before starting the simulation, you should analyze the system carefully and try tounderstand dependencies between particular blocks, parameters, etc.

The following description explains the signals flow and tasks that are performed indifferent system stages.

Page 19: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

5.1 The system setup parameters

Fig.22. The systems setup dialog boxes.

The main mask (fig.22), allows user to set basic parameters of the two modelsintroducing basic analog and digital transmission. The analog channel requires the signal tonoise ratio in decibels to be specified, while the digital channel only accepts an errorprobability ratio in the range from 0 to 1.

5.1.1 Initial commandsBoth subsystems need some parameters to be set during the initialization process (fig.23

and fig.24).In both systems is the sample time duration between samples in the signal to be

transmitted2 t_samp, and additionally, in the case of analog transmission, is a threshold valuedefining the maximal difference between received and transmitted signals that are notconsidered as an error.

5.2 The signals flowTwo basic sections can be distinguished in the included simulink systems:

• transmission channel including transmitter and receiver• measurement tools

2 In digital systems is it equivalent to the time duration between the bits to be transmitted.

Page 20: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Fig.23. Digital system mask definition with initializationparameter setup.

Fig.24. Analog system mask definition with initializationparameter setup.

Generated binary/analog signals are transmitted over a binary/AWGN channel, whereboth of them are distorted due to the channel noise (fig.25, fig.26).

Page 21: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

Fig.25. Analog transmission channel.

Fig.26. Digital transmission channel.

Next, both transmitted and received signals are compared in the Error Rate Calculationblock. Obtained transmission statistics are presented using the display in the Measurementtools section.

5.3 Transmission analysesThe Measurement Tools section, mentioned above, allows the student to:

• compare two basic transmission schemes: digital and analog (discrete equivalent)• analyze the transmission channel influence on transmission quality• analyze the transmission channel influence on transmitted signal• familiarize with the basic measurement tools

5.3.1 Channel influence on transmission qualityReceived digital, or sampled analog signals, are influences by the transmission channel.

The SNR parameter defines the level of distortions in the analog system, and in the digitalchannel is that parameter substituted with the error probability parameter.

In digital transmission systems, the calculated bit error ratio is, more or less, equal to thechannel error probability.

On the other hand, in analog transmission system, the transmission characteristic can beobtained by sweeping the SNR parameter from, e.g., 0 to 20dB and writing down BER valuepresented in the display screen (fig.27).

Page 22: TSTE91 System Design Communications System Simulation ...read.pudn.com/downloads166/doc/comm/758627... · TSTE91 System Design Communications System Simulation Using Simulink ...

1,E-02

1,E-01

1,E+00

0 5 10 15 20SNR [dB]

SE

R

Fig.27. Symbol error ratio verses SNR parameter; analog signaltransmitted over AWGN channel.

5.3.2 Channel influence on transmitted signalThe received (distorted) and transmitted signal can be observed in a single plot in both

systems (fig.28, fig.29). In the digital transmission system the user can also observe the errorsignal generated in the channel (fig.29).

Fig.28. Transmitted vs. received signal in theanalog transmission system.

Fig.29. Transmitted vs. received signal in the digital transmission system. Channel errorsignal is summed modulo 2 with the information signal.


Recommended