联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2019-04-02 09:19

EEEN 60184

Internet and Communications

Networks

Laboratory Assignment:

Overview, Tasks 1, 2, 3 and 4

1.0 Introduction

The laboratory work is concerned with simulating various aspects of wireless sensor

networks. The basic simulations use the Zuniga and Krishnamachari link model, but higher

layers of the protocol stack are also considered.

There are 4 parts to the laboratory work:

Task 1: Modelling a network link in a pre-specified environment.

Task 2: Modelling the connectivity of a network and investigating factors that affect

topology.

Task 3: Calculating routes between nodes and the base station

Task 4: Discussing the implications of the results of Tasks 1-3 for

Transport Layer

communication.

1.1 Outcome

You will be expected to write a short report that presents and discusses your results. The

format of the report, along with the marking scheme will be specified in a subsequent

document. However, there will be a limit of 5 pages on the body of the report. This excludes

the front page, contents list, references and appendices.

The deadline for uploading the report to Blackboard will be 9.00 am on Monday 1st April

2019.

Further details will be given shortly.

1.2 Software

You will be provided with a number of MATLAB programs to use to obtain results. These will

require minor modifications to complete some of the tasks, but the amount of programming

needed is small. However, if you are confident programmer and have reasons for making

more extensive changes, then you are free to do so.

1.3 Laboratory Sessions

These will take place on Wednesday afternoons (20th and 27th March) from 14.00-15.00 in

the Barnes Wallis cluster and attendance is optional. The purpose of the sessions is to

enable you to ask questions about the assignment and the software that is provided. You

are expected to complete the assignment work during periods when there are no lectures or

tutorials.

3

2.0 Task 1

This part the assignment is concerned with utilising the analytical model of Zuniga and

Krishnamachari [1] (introduced in lecture 17) to predict the extent of the connected,

transitional and disconnected zones associated with transmissions by wireless sensor

nodes.

2.1 Background

As discussed in lecture 17, the well-known model of a fixed (circular) radius radio range with

a sharp cut-off between positions where a packet can and cannot be received, has been

found to be unrealistic. Experimental data indicates the existence of 3 distinct reception

regions surrounding a transmitter. The first, where packet reception rates (PRR) are high (>

90%) is known as the connected region. In the next zone the link is unreliable and packet

reception rates vary widely (between 90% and 10%); this is known as the transitional

region). Finally, there exists a region where packet reception is essentially negligible (less

than 10%) and this is known as the disconnected region.

The model of [1] is derived using two models and is a combination of empirical and

analytical approaches. The models are a channel model, based on the log normal law, which

defines the received signal power as a function of distance from the transmitter, and a radio

model that predicts PRR as a function of signal-to-noise-ratio (SNR) for a specific

combination of line coding and modulation schemes. This latter model is manipulated until

it can be written in terms of parameters that are known or can be measured/estimated for a

particular radio transceiver.

The log normal law (channel model) is:

r dB t dB dB

dB dB dB

P d P PL d

d

PL d PL d X

d

(1)

where Pr is the received signal power at distance d from the transmitter, Pt is the

transmitted power, PL is path loss, d0 is a reference distance at which path loss PL(d0) is

measured. In this assignment d0 is 1m. X is a zero-mean Gaussian random variable whose

variance is 2 which represents fading. is the path loss exponent. See equation (1) in [1].

The key elements of the radio model are:is the SNR at distance d from the transmitter, Pn is an estimate of noise, PRR is packet

reception ratio (as a fraction), BER is the bit error rate at a SNR of ? (in dBs) and f is the size

of a packet in bytes. See equation (2) in reference [1].

Now PRR is usually written as a function of Eb/N0 (energy received per bit/noise power

density). These are difficult parameters to estimate, and so the following familiar

relationship is used:

E R E B b b SNR

(3)

to write BER and PRR as functions of bandwidth B and data rate R, which are known or can

be estimated for a particular radio. The functions f and g depend on line coding and

modulation schemes. See Table V in [1].

2.2 What to do

A key element of the method is the plot shown in figure 1. This shows the curves from the

two models superimposed upon one another and which together enable the extent of the

three zones discussed above to be defined. The curves labelled ?,

and are derived from the log normal model and show the mean, and upper and

lower bounds of received signal strength at a receiver placed at a distance d from the

transmitter. The lines marked ?L+Pn and ?U+Pn represent received signal strength power

corresponding to PRRs of 0.1 and 0.9 respectively. The region defined by the intersections of

the curves from the two models defines the size of the transition region, as explained in [1].

The plot in figure 1 was obtained using a specific set of parameters in both the channels and

radio models namely:

%channel model constants

PATH_LOSS_EXPONENT = 4.0;

D0 = 1.0;

PATH_LOSS_D0 = 55.0; %in dBm

SHADOWING_VARIANCE = 4.0;

TX_POWER = 0; %in dBm


% Radio model constants

BANDWIDTH = 20000.0; % in Hz

DATA_RATE = 19200.0; % in bps

NOISE_FLOOR = -115.0; % in dBm

FRAME_LENGTH = 50; % in bytes

PREAMPLE_LENGTH = 2; % in bytes

5

and for specific line coding and modulation schemes (non-return-to-zero (NRZ) and noncoherent

frequency-shift keying (NCFSK)).

Figure 1 Transitional Region (adapted from [2])

Figure 1 The Transitional Region. Adapted from [1].

(i) Recreate Figure 1 based on the parameters specified for you in the spreadsheet

practical params 2019.xls in the Assignment folder (Assignment Details) on

Blackboard.

The spreadsheet practical params 2019.xls has a row for each member of

the class, with a separate separate set of the parameters PATH_LOSS_EXPONENT,

PATH_LOSS_D0, SHADOWING_VARIANCE, BANDWIDTH and DATA_RATE which relate

to a specific physical environment. See [3].

All the other parameters used in the calculations should be as defined above, and you

should assume the use of NRZ and NCFSK. You should also use equations (13) and (14)

in [1] to predict the radii of the start and end of the transitional region. Your version of

the plot of figure 1 and your predictions will be included in the report mentioned in

Section 1.

You will be expected to explain and discuss your results in the report on the

assignment. In particular, you will need to compare the results for YOUR environment

with the results in Figure 1, which relate to a different environment.

Useful MATLAB code that implements the important equations above can be found in

z_and_k_model.m also within the Assignment folder (Assignment

Details/Supporting MATLAB Code). Note that you will need to change the

constant values to those specified for you in the spreadsheet practical params

Transmitter-receiver distance (m) Received Powevr (dBm)

U+Pn

L+Pn

ds de

Transmitter-receiver distance (m) Received Powevr (dBm)

U+Pn

L+Pn

ds de

6

2019.xls. If you do not do this, you will receive a mark of 0 for this part of the

assignment.

(ii) Use the code mention in (i) above, with suitable modifications, to plot graphs showing

the variation of connected and transition zone widths (ds and de): Transmission power: in the range -10dBm to +10dBm

Data rate: in the range 10kbps-500kbps

Frame length: in the range 10 bytes to 100 bytes

The values of the other parameters needed to perform the calculations should be the

same as those specified for you in the spreadsheet Practical Params 2018.xls on

Blackboard.

You will be expected to explain and discuss your results in the report on the

assignment.

7

3.0 Task 2

This task builds on Task 1. The aim is to apply the analytical model of Zuniga and

Krishnamachari [1] (introduced in lecture 17) to predict the variation of connectivity of a

wireless sensor network with node transmission power.

A MATLAB program has been provided that generates a random1

set of 100 sensor

coordinates over an area of 100?100 metres. The program stores the coordinates in a .txt

file. MATLAB code to read the file and store the contents in x coordinate and y coordinate

arrays is also provided. The task is then to determine network topology on the basis of:

Different definitions of node connectivity

A single transmission power value used by all nodes

An approach where nodes can determine the transmission power for each link by

negotiation. In simulation terms, this reduces to determining the necessary

transmission power from the length of the link and other parameters.

3.1 Background

A key aspect of this part of the assignment is the question – what does it mean to say that 2

WSN nodes are connected? This question must be answered if the unrealistic binary

connectivity model2

is to be replaced by something more realistic.

Unfortunately, the answer to the above question is not clear because, if the Zuniga and

Krishnamachari model is adopted (and it is for this assignment), it is necessary to define the

extent (width) of the connected and transitional zones in terms of packet reception ratio

(PRR). However, this is arbitrary – what PRR defines the CZ – 99%, 95%, 90% .... ? Clearly, the

threshold is not a physical law but a human choice.

How is the choice be made? Perhaps it could depend on the reliability and power

consumption requirements of the application. How important is it that a packet is delivered

at the first attempt? For example, consider an application for monitoring the perimeter of a

military base to stop enemy incursions. Clearly is is important that the base-station receive

information about an incursion as quickly as possible.

On the other hand, some data from the glacial monitoring probes could be lost or delayed

without affecting the overall data acquisition aims of that project.


1 The distribution is not random. Can you work out from the code the rules used to create it?

Hint – they’re pretty simple!

2 This is the assumption that nodes within a fixed distance (‘radio range’) of a transmitter experience a 100%

PRR, whereas those whose separation with respect to the transmitter exceed the ‘range’ have a PRR of 0%.

8

3.2 What to do

Use the program sensor_field_generation.m3

to generate a file of sensor network

coordinates. It will also plot the distribution of points over the area – see the example in

Figure You can edit the file to change the name of the output file if you wish. The following

discussion assumes that this file is named coord.txt.

Figure 2 Example sensor node distribution plot

Use coord.txt as input to the program topology.m3

. This program uses the input

coordinates and the Zuniga and Krishnamachari model to establish the topology of the

network, based to the following 2 factors:

(i) The transmission power of each node. This is assumed to be the same for every node

in the network.

(ii) The threshold Packet Reception ratio (PRR) that determines whether a link is

assumed to exist or not. For example if a choice is made to define a link as existing if

PRR?80%, then this value needs to be used to initialise the program variable

You should use the software to:

Find the minimum transmission power for full-connectivity4

, assuming that all nodes

use the same transmission power.

Find the minimum transmission power for full-connectivity, assuming that the nodes

at either end of a link can determine the minimum transmission power to achieve a

specified PRR. This will require you to modify the program.

The above should be undertaken assuming that link connectivity is defined by:


3 This can be found in the Blackboard folder Assignment/Task 2

4

Full connectivity exists when there is a route (possibly multi-hop) between every pair of nodes in the

network.

9

A 90% PRR

A 50% PRR

If transmission power is too small for the target PRR then the network will not be fully

connected as shown in the example below:

Figure 3 Partially Connected Network (not the same distribution of nodes as Figure 2)

The final report will require an explanation and a discussion of the results obtained. You will

also be asked to comment on the feasibility of successfully achieving the above network

conditions using the Chipcon CC1101 transceiver, whose data sheet can be found in the

Assignments folder.

Warning

You are expected to create your own sensor network topologies as discussed above. If

reports from two or more class members use identical networks then a mark of 0 will be

awarded to all concerned for the laboratory-based part of the coursework.

10

4. Task 3

In this part of the assignment, you will make use of the MATLAB implementation of

Dijkstra’s algorithm to compute the minimum cost routes between the sink and every other

node in your own sensor network. The Dijkstra code is available from the MATLAB Central

web site [3]. It is also available from the unit’s Blackboard Assignment pages.

In this task, cost is defined by the ETX metric, and a brief introduction to this is given in the

next section. ETX is discussed in Lecture 23 on routing in Wireless Sensor Networks.

5.1 Background

ETX stands for the ‘Expected Number of Retransmissions’ across a link. Recall that many link

layer protocols will retransmit packets that have been sent but not acknowledged, and

retransmissions can be attempted multiple times.

ETX was created for networks whose nodes need to conserve power, such as Wireless

Sensor Networks. The developers of the ETX metric took the view that although

retransmission is helpful in ensuring reliable packet transfer, it is undesirable from the

perspective of power consumption, since each retransmission requires energy to be used,

and if a packet has to be retransmitted N times, then obviously N times the energy of

sending 1 packet must be expended.

The equation for ETX (given above) is:

(7)

What is its significance? The higher PRR, the higher the fraction of sent packets that are

received correctly, requiring no retransmission. So low PRR in either direction across a link,

leads to a higher ETX value. In other words, a high ETX value is associated with many

retransmissions and a low value is associated with few retransmissions.

The basic idea of ETX is to find routes that minimise the number of retransmissions. For a

route with H hops, the overall ETX metric is:

(8)

where the nodes of the route are labelled 1, 2...H. Hence, if ETX is regarded as a cost, then

Dijkstra’s algorithm can be used to find the route (or routes) with the minimum overall ETX

value.

5.2 What to do

The task is to compute the minimum cost (ETX) route between the source node of your

network, and every other node. For the sake of simplicity, it is assumed that the source

11

node is the first node in the text file specifying node coordinates. When the text file is read

into your code the coordinates of the source node are stored in x(1) and y(1). The

coordinates of ith node in the text file will be stored in x(i), y(i).

The program calculates the PRR for each link for a given transmission power.

To find minimum cost routes using Dijkstra’s algorithm, a cost matrix is required. Cost

matrices have been briefly encountered in Lecture 11. They are similar in form (a row per

node and a column per node) to adjacency matrices with the following difference:

? The entry i,j represents the cost of travelling from i to j if they are 1-hop

neighbours, otherwise entry i, j is ?.

In this assignment cost is the ETX value associated with each link, which must be calculated

from the PRR value.

5.2.1 Step 1

A set of MATLAB functions that implement Dijkstra’s algorithm is provided in

Assignments/Supporting Code/Dijkstra. It is necessary for you to edit topology.m to call

the Dijkstra function [4]. Before doing this, you should run the program TestDijkstra.m

using the graph below to provide test input. You will need to edit this program to specify the

cost values below in the appropriate positions in the cost matrix. This should be passed to

the Dijkstra function and you should then verify that the results are correct.

The Dijkstra function requires several input parameters and produces several outputs. Some

of these are defined below. Note that the values of arrays farthestPreviousHop,

farthestNextHop should be set as follows:

for i = 1:NUMBER_NODES

farthestPreviousHop(i) = i;

farthestNextHop(i) = i;

end;

since these parameters are of no interest in this assignment. In terms of outputs, path and

totalCost that are the only relevant parameters here.

12

% path: the list of nodes in the path from source to destination;

% totalCost: the total cost of the path;

% farthestNode: the farthest node to reach for each node after performing

% the routing;

% n: the number of nodes in the network;

% s: source node index;

% d: destination node index;

% parameters required by Dijkstra function, but of no significance to

% the assignment


[path, totalCost, farthestPreviousHop, farthestNextHop]

= dijkstra(noOfNodes, matrix, 1, 15, farthestPreviousHop, farthestNextHop);

5.2.2 Step 2

After successfully competing step 1, you should modify the topology.m program to call

the Dijkstra function. This should be done twice:

(i) With an ETX cost matrix assuming PRR = 0.9 for connectivity

(ii) With an ETX cost matrix assuming PRR = 0.5 for connectivity

Source/Destination Length Cost Route

Shortest path from 2 to 1 17 1.625432e+01 1 30 93 4 79 42

100 76 86 10 74 98

75 61 70 45 2

Shortest path from 3 to 1 15 1.426570e+01 1 30 93 4 79 42

100 76 86 10 74 59

62 9 3

Shortest path from 4 to 1 4 3.003464e+00 1 30 93 4

Shortest path from 5 to 1 9 8.058804e+00 1 30 93 4 79 42

100 83 5

Shortest path from 6 to 1 10 9.071470e+00 1 30 93 4 79 42

100 76 86 6

Shortest path from 7 to 1 14 1.337920e+01 1 30 93 4 79 42

100 76 86 55 81 34

37 7

…………………………………………………………………………………………………………………………………………

Quote all real number values to 3 decimal places (x.yyy). A table with the above structure

should be used to provide information about the minimum cost route between node 1 and

each of the other nodes on the system.

In the final report you will be required (amongst other things) to demonstrate that the

program generates the correct results by considering several routes.

13

4. Task 4

This last part of the assignment is based on the previous stages. Here the objective is to

assess the routes that have been found through your network in terms of their reliability at

the Transport Layer

Background

The role of the Transport Layer is to provide a reliable packet/segment delivery service,

based on an unreliable Network Later. Why is this necessary? Simply put, once a route has

been established and data is sent over the route, some packets may be lost. Why? Reasons

for Network Layer packet loss include:

Packets are lost at the link layer because the ARQ retry limit is exceeded. This may be

due to bit errors, link breakages etc.

Packets have been dropped by routers due to congestion. Some nodes receive too

much information and their buffers overflow.

The design of the protocol stack specifies that the Network Layer should provide addressing

and routing capabilities, but no ‘problem recovery’ facilities. These are provided by the

Transport Layer. Presumably, this is because, once a route exists, it is necessary to control

several different aspects – flow, error and congestion.

What to Do

(i) Using your results from part 1 of Task 2 (i.e. the minimum constant transmission

power across the whole network to ensure full connectivity), compute the probability

of successful transmission over each route in 1 try (pt1) using the simple statistical

model of lecture 25. Extend the table discussed in Section 5.2.2 with an extra column

that records pt1 for each route.

Find the route with the lowest pt1 value and determine how many retries would be

needed to ensure a probability of successful transmission over the route of 0.9. You

should assume that nodes on a route try a maximum of 3 times to transmit a packet

over a link i.e. the link layer retries up to 3 times. Comment on this result.

Hints:

(a) The following equation is needed:

Where pe probability of successful transmission over a route with H hops in 1

try. This equation applies to situations where the probabilities of successful

transmission over each of the individual links of the route (pTi) are different.

14

(b) Recall the equation for the sum to n terms of a geometric progression.

(ii) Assume that each node gathers data and transmits data on a periodic cycle. All nodes

send their data to the base station at the same time. Identify the nodes and links that

are most likely to suffer from congestion and explain why. Suggest action to improve

the situation.

5.Report Contents

The Basic Format should be:

Front page.

Contents List (new page).

A section for the results of each Task.

References.

Appendices.

The body of the report (the sections for each task) should be 5 pages maximum, although

the tables required in Tasks 3 and 4 should be included in Appendices.

5.1 Details of Task 1

Provide an introductory paragraph explaining the task.

The instructions identified 2 parts to this task. The outcomes for each part are described

below. Specifically, provide:

(i) The equivalent plot to Figure 1 for your environment specified in the spreadsheet

practical_params_2019.

A table of results comparing YOUR environment with the reference environment

shown in Figure 1 of this report for ds,de, and ?.

A brief discussion that explains the similarities and differences between the two sets

of results in terms of the models used in the Zunega and Krishnamachari model.

(ii) Present the 3 graphs specified in the instructions and explain the trends in the graphs

according to the Zunega and Krishnamachari model and your understanding of digital

communications. The graphs can be fairly small but the axes and legends need to be

readable. You will need to change MATLAB’s default plotting settings to do this. Some

of the programs that have been uploaded to Blackboard demonstrate how to do this.

5.2 Details of Task 2

Provide an introductory paragraph explaining the task.

15

The instructions identified 2 parts to this task. The outcomes for each part are described

below. Specifically, provide:

(i) A plot for full connectivity

A table with 1 entry specifying the global power value for full connectivity.

(ii) A version of the connectivity matrix (1 row per node, 1 column per node). Where 2

nodes are not connected, a zero should be inserted. Where 2 nodes are connected,

the minimum transmission power to achieve a PRR of 90% should be inserted. Provide

a brief explanation of these results and comment on the feasibility of implementing

your network using the Chipcon CC1101 transceiver, whose data sheet can be found in

the Assignments folder.

5.3 Details of Task 3

Provide an introductory paragraph explaining the task.

Take the results from Task 2, part (i) and compute the ETX values for connected links. Use

these values to construct a cost matrix for input to the Dijkstra function and compute the

minimum cost routes from node 1 (the sink) to all other nodes in the network. List these

routes in a table as discussed Section 5.2.2. This table should be placed in an Appendix.

Find the shortest and longest routes in terms of the numbers of nodes on the routes, and

also identify the route which is nearest to being half way between the longest and shortest

in length. If multiple routes have the same length chose one a random. Highlight each of

these routes on a separate plot (these should be in an Appendix) and provide a short

discussion to show that these results truly represent minimum cost routes between sources

and destinations.

5.4 Details of Task 4

Provide an introductory paragraph explaining the task.

Using your results from Task 2 (i) (i.e. the minimum constant transmission power across the

whole network to ensure full connectivity), compute the probability of successful

transmission over each route in 1 try (pt1) using the simple statistical model of lecture 25.

Extend the table discussed in Section 5.2.2 with an extra column that records pt1 for each

route. This table should be included in an Appendix.

Find the route with the lowest pt1 value and determine how many retries would be needed

to ensure a probability of successful transmission over the route of 0.9. Comment on this

result.

Assume that each node gathers data and transmits data on a periodic cycle. All nodes send

their data to the base station at the same time. Identify the nodes and links that are most

likely to suffer from congestion and explain why. Suggest action to improve the situation.

16

References

[1] Zuniga, M. and Krishnamachari, B. 2004. Analyzing the transitional region in low power

wireless links. In Proceedings of the IEEE 1st Annual Conference on Sensor and Ad Hoc

Communications and Networks (SECON). 517--526.

Link is available in Required Reading subfolder of Reading folder on Blackboard.

[2] Krishnamachari B, 2005, Networking Wireless Sensors, Cambridge University Press.

[3] Sohrabi, K., Manriquez, B. and G. Pottie 'Near Ground Wideband Channel

Measurement in 800-1000MHz', IEEE VTC Spring '99, Houston, TX May 16-20, 1999.

[4] MATLAB Central Dijkstra Shortest Path Routing version 1.0.0.0 (1.13 KB) by Xiaodong

Wang

Note: links to reference [1] and [3] can be found in the Required Reading Folder on the

Unit’s Blackboard pages. Reference [2] is available as an e-book from the University library

(go to http://www.library.manchester.ac.uk/search-resources/ and find the entry for the

book. There is a link to the e-book there).


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp