0% found this document useful (0 votes)
61 views

Communications System Simulation Using Simulink

The document describes how to simulate communication systems using Simulink. It explains basic analog and digital transmission schemes and how to build models for each using blocks like random signal generators, AWGN channels, and binary channels. It provides details on key blocks and parameters to understand noise effects on transmitted signals.

Uploaded by

Lạc Lạc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Communications System Simulation Using Simulink

The document describes how to simulate communication systems using Simulink. It explains basic analog and digital transmission schemes and how to build models for each using blocks like random signal generators, AWGN channels, and binary channels. It provides details on key blocks and parameters to understand noise effects on transmitted signals.

Uploaded by

Lạc Lạc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

TSTE91 System Design Communications System Simulation Using Simulink Sebastian Prot, Kent Palmkvist Electronic Systems, Dept.

EE, LiTH 020204

Contents
1 2 Abstract ........................................................................................................................1 Theory ..........................................................................................................................1 2.1 Basic analog channel...............................................................................................1 2.2 Basic digital channel ...............................................................................................1 2.3 Symbol Error Ratio ................................................................................................3 3 4 Simulink introduction ..................................................................................................3 Block descriptions.........................................................................................................5 4.1 Analog transmission system....................................................................................6 4.1.1 Transmission channel ...........................................................................................6 4.1.1.1 Random signal generator..............................................................................6 4.1.1.2 AWGN channel............................................................................................7 4.1.1.3 Error rate calculation ....................................................................................8 4.1.1.4 Goto & From blocks.....................................................................................9 4.1.1.5 Mux block..................................................................................................10 4.1.2 Measurement tools section..................................................................................10 4.1.2.1 Display.......................................................................................................11 4.1.2.2 Time scope.................................................................................................11 4.2 Digital transmission system ..................................................................................13 4.2.1 Transmission channel .........................................................................................13 4.2.1.1 Bernoulli random binary generator .............................................................13 4.2.1.2 Binary channel ...........................................................................................14 4.3 Other blocks ..........................................................................................................15 4.3.1 Block info ..........................................................................................................15 4.3.2 Block underlining, highlighting ..........................................................................15 5 The system basics .......................................................................................................16 5.1 The system setup parameters ...............................................................................17 5.1.1 Initial commands ................................................................................................17 5.2 The signals flow.....................................................................................................17 5.3 Transmission analyses ..........................................................................................19 5.3.1 Channel influence on transmission quality..........................................................19 5.3.2 Channel influence on transmitted signal..............................................................20

Part I. Basic transmission schemes


1 Abstract
The purpose of this manual is to introduce the Matlab\Simulink environment as well as present information about the basic Simulink Models - mostly from the Communication and DSP blocksets. It can also be viewed as a user guide showing the basics on how to build transmission system in the Matlab environment.

2 Theory
All electronic elements communicate between each other. Such communication can be divided 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 exist without distortions. In general, wherever electronics is used, the noise degrades transmission quality.

2.1 Basic analog channel


In 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 or both 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 can be 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 continues transmission simulation, since both continues and discrete time signals are influenced by the same limitations. Such limitation is e.g. signal resolution. There is no difference in applying continuous noise signal, and noise of limited sampling frequency, since the received signals are only analyzed ones every sample time. Thus, even if the noise changes rapidly twice or even hundred times during the time between the sampling moments, only one single state can be noticed and remembered for further processing (see fig.1).

2.2 Basic digital channel


In 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 signal distortion is incorrect identification of actual transmitted symbol. Thus, no matter how much the original value changes, the result can only be a logical 1 or 0.

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

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 the binary data with analog noise. This is equivalent to perform a modulo 2 summation that changes 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 binary transmission analysis.
Table 1. The binary channel effect.

Information Signal 1 0 1 0

Error signal 1 1 0 0

Result 0 1 1 0

2.3 Symbol Error Ratio


In 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). BER = ErrorBits TotalNumberOfTransmittedBits ErrorBits * 100% TotalNumberOfTransmittedBits (1).

BER[%] =

(2).

3 Simulink introduction
To start Simulink you have to run Matlab and execute <Simulink> command in Matlab command 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 the model window (see Fig.3). Before running the simulation you have to set the simulation parameters by selecting Parameters from Simulation menu in the Model window (fig.2).

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.

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 choose which 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.

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

4.1 Analog transmission system


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

Mean, Variance By 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 seed The Random Signal Generator generates normally distributed random numbers. The Seed is reset to the specified value each time the simulation starts. Sample time The 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 channel The 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 output signal. When the input signal is complex, this block generates complex Gaussian noise and produces a complex output signal. Mode There 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 from the following parameters: Es/No, the ratio of energy per symbol to noise energy The input signal power The symbol period

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 calculation The 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 dividing the total number of data elements that are not equal by the total number of received data samples. In case of the AWGN channel, there are no equal samples, since additive noise distorts each fragment of the transmitted signal. In order to simulate a real receiver with a soft decision system1, the Error Rate Calculation model, needs some insignificant modifications to allow the user to specify the maximal difference between transmitted and received signals that is not recognized as an error. 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 error was changed from 0 to the threshold variable (Fig.10). The parameter value is inherited from the main model mask. Also, to pass the threshold value from outside the model, the subsystem mask 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 is assumed to be the ideal value e.g. defined as a+b/2. When a hard decision is analyzed the range is replaced with a finite set of possible values.

Fig.10. Determining Symbols in the Error subsystem. The Threshold value is defined to be constant in the main system mask in the Initial commands section.

Fig.11. Error Rate Calculation mask (left - before, right - after). Due to the added Error checking threshold parameter, the Threshold value will be passed inside the subsystem. The data produced at the output of the Error Rate Calculation block is a vector whose entries correspond to: The error rate The number of error events The total number of input events 4.1.1.4 Goto & From blocks The Goto block passes its input to its corresponding From block. The input can be a realor complex-valued signal or a vector of any data type. From and Goto blocks allow you to pass 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 the From block can only receive a signal from one Goto block.

Fig.12. Goto & From block dialog boxes. Tag, Goto tag The 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 visibility The 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 the model hierarchy. A scoped tag name is enclosed in braces ({}). global means that the From and Goto blocks using the same tag can be anywhere in the model. 4.1.1.5 Mux block Multiplexes Number of inputs signals (fig.13).

Fig.13. Mux block mask.

4.1.2 Measurement tools section


The measurement tools section allows the student to analyze the channel influence on the transmitted signals and in general, on transmission quality.

4.1.2.1 Display The 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 scope the 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 appears when you open the standard Scope block by double clicking on its icon.

Fig.15. Standard Time Scope window. Auto-scale The Auto-scale toolbar button automatically scales both axes to display all the stored simulation data.

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-axis settings so they can be applied to the next simulation. Some more detailed information about the Time scope can be found in the Help displayed 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.

General Parameters The user can set the axes parameters, time range, tick labels, and can also choose the floating scope in the General tab. Number of axes Sets 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 scope A 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 generator This 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 zero When set to 0.5 the same average number of ones and zeros occur in a particular time range.

Seed Defines the generator initial state. Sample time Defines the time interval between transmitted binary symbols. 4.2.1.2 Binary channel Binary 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 is generated from the random integer signal with a Poisson distribution, converted to binary form 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 probability The error probability parameter is inherited from the main model mask, and is defined by the user before starting the simulation. Input vector length In this system the input signal is a scalar, thus this parameter should be set to 1. Seed Defines the initial state of the noise generator. Sample time Should 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.

4.3 Other blocks


4.3.1 Block info
To 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, highlighting


To 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 a frame 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 empty pseudo-region. In case of a Subsystem, it needs to be masked and then an empty disp() command needs 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. But fortunately the subsystems displaying sequence can be controlled by tricky models labeling.

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 controlling the displaying order.

5 The system basics


Before starting the simulation, you should analyze the system carefully and try to understand dependencies between particular blocks, parameters, etc. The following description explains the signals flow and tasks that are performed in different system stages.

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 models introducing basic analog and digital transmission. The analog channel requires the signal to noise ratio in decibels to be specified, while the digital channel only accepts an error probability ratio in the range from 0 to 1.

5.1.1 Initial commands


Both 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 value defining the maximal difference between received and transmitted signals that are not considered as an error.

5.2 The signals flow


Two basic sections can be distinguished in the included simulink systems: transmission channel including transmitter and receiver measurement tools

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

Fig.23. Digital system mask definition with initialization parameter setup.

Fig.24. Analog system mask definition with initialization parameter setup. Generated binary/analog signals are transmitted over a binary/AWGN channel, where both of them are distorted due to the channel noise (fig.25, fig.26).

Fig.25. Analog transmission channel.

Fig.26. Digital transmission channel. Next, both transmitted and received signals are compared in the Error Rate Calculation block. Obtained transmission statistics are presented using the display in the Measurement tools section.

5.3 Transmission analyses


The 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 quality


Received 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 digital channel is that parameter substituted with the error probability parameter. In digital transmission systems, the calculated bit error ratio is, more or less, equal to the channel error probability. On the other hand, in analog transmission system, the transmission characteristic can be obtained by sweeping the SNR parameter from, e.g., 0 to 20dB and writing down BER value presented in the display screen (fig.27).

1,E+00

SER

1,E-01

1,E-02 0 5 10 SNR [dB] 15 20

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

5.3.2 Channel influence on transmitted signal


The 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 error signal generated in the channel (fig.29).

Fig.28. Transmitted vs. received signal in the analog transmission system.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy