Report Taruna

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 58

1

CHAPTER 1 INTRODUCTION

1.1 INTRODUCTION TO WSN

A wireless sensor network (WSN) consists of spatially distributed autonomous sensors. The
more modern networks are bi-directional, enabling also to control the activity of the sensors.
The development of wireless sensor networks was motivated by military applications such as
battlefield surveillance; today such networks are used in many industrial and consumer
application, such as industrial process monitoring and control, machine health monitoring,
environment and habitat monitoring, healthcare applications, home automation, and traffic
control. The WSN[22] is built of "nodes" – from a few to several hundreds or even
thousands, where each node is connected to one (or sometimes several) sensors. Each such
sensor network node has typically several parts: a radio transceiver with an internal antenna
or connection to an external antenna, a microcontroller, an electronic circuit for interfacing
with the sensors and an energy source, usually a battery or an embedded form of energy
harvesting.

A sensor node might vary in size from that of a shoebox down to the size of a grain of dust,
although functioning "motes" of genuine microscopic dimensions have yet to be created. The
cost of sensor nodes is similarly variable, ranging from hundreds of dollars to a few pennies,
depending on the complexity of the individual sensor nodes. Size and cost constraints on
sensor nodes result in corresponding constraints on resources such as energy, memory,
computational speed and communications bandwidth. The topology of the WSNs can vary
from a simple star network to an advanced multi-hop wireless mesh network. The
propagation technique between the hops of the network can be routing or flooding. In
computer science and telecommunications, wireless sensor networks are an active research
area with numerous workshops and conferences arranged each year.
2

Fig. 1.1: Wireless


sensor network

1.2 WSN AS
CLUSTERED SENSOR NETWORK
We consider WSN as clustered sensor networks because clustering allows for scalability of
MAC and routing. Cluster heads also serve as fusion points for aggregation of data, so that
the amount of data that is actually transmitted to the base station is reduced.

Fig. 1.2: WSN as


clustered sensor
network

1.2.1 Clustered sensor networks can be classified into two broad types:-

Homogeneous sensor networks


In homogeneous networks all the sensor nodes are identical in terms of battery energy and
hardware complexity. With purely static clustering (cluster heads once elected, serve for the
entire lifetime of the network) in a homogeneous network, it is evident that the cluster head
nodes will be over-loaded with the long range transmissions to the remote base station, and
3

the extra processing necessary for data aggregation and protocol co-ordination. As a result
the cluster head nodes expire before other nodes. However it is desirable to ensure that all the
nodes run out of their battery at about the same time, so that very little residual energy is
wasted when the system expires. One way to ensure this is to rotate the role of a cluster head
randomly and periodically over all the nodes as proposed in LEACH. However the downside
of using a homogeneous network and role rotation is that all the nodes should be capable of
acting as cluster heads, and therefore should possess the necessary hardware capabilities.[22]

Fig. 1.3: Homogenous


sensor network

Heterogeneous
sensor networks
On the other hand, in a
heterogeneous sensor network, two or more different types of nodes with different battery
energy and functionality are used. The motivation being that the more complex hardware and
the extra battery energy can be embedded in few cluster head nodes, thereby reducing the
hardware cost of the rest of the network. However fixing the cluster head nodes means that
role rotation is no longer possible. When the sensor nodes use single hopping to reach the
cluster head, the nodes that are farthest from the cluster heads always spend more energy
than the nodes that are closer to the cluster heads. On the other hand when nodes use multi-
hopping to reach the cluster head, the nodes that are closest to the cluster head have the
highest energy burden due to relaying. Consequently there always exists a non-uniform
4

energy drainage pattern in the network. Thus there are two desirable characteristics of a
sensor network, viz. lower hardware cost, and uniform energy drainage. While heterogeneous
networks achieve the former, the homogeneous networks achieve the latter. However both
features cannot be incorporated in the same network.

1.2.2 Clustered sensor networks could also be classified as single hop and multi-hop.

In a single hop network, the sensor nodes communicate directly with the cluster head using a
single hop transmission. The nodes are assumed to have power control features so as to
adjust their transmit power. In a multi-hop network nodes use multi-hopping to reach the
cluster head. In both cases, the cluster heads use single hopping to reach the base station,
since we assume a remote base station.
Single Hop Homogeneous Network: LEACH
Following are some of the salient features of a single hop homogeneous sensor network.
 Since all the nodes are identical, the main design objective is to guarantee a certain
network lifetime (in terms of number of data gathering cycles), and at the same time
ensure that all the nodes expire at about the same time so that there is very little residual
energy left behind when the network expires. Hence LEACH uses random and periodic
rotation of the cluster heads for load balancing. Role rotation also ensures that a node
which is located near the periphery of a cluster is nearer to the cluster head at some other
time.
 Since each node has to be capable of acting as a cluster head, it is necessary for each
node to have the hardware capable of performing long range transmissions to the remote
base station, complex data computations (if required), and co-ordination of MAC and
routing within a cluster.
Since all the nodes are capable of acting as a cluster head, the failure of a few nodes does not
seriously affect the working of the scheme. Thus the system is robust to node failures. [22]
Single Hop Heterogeneous Networks: Two Types of Nodes
Heterogeneous sensor networks use two or more types of nodes with different functionalities.
For example, two types of nodes; type 0 nodes which act as pure sensor nodes, and type 1
nodes which act as the cluster head nodes. Some of the salient features of such networks are:
 Since the cluster head nodes are predetermined and the sensor nodes use single hop
communication to reach the cluster head nodes, the sensor nodes near the periphery of the
cluster have the highest energy expenditure among all the sensor nodes. It is this worst
case energy expenditure that has to take into account in battery energy dimensioning.
5

Thus there is a waste of energy due to the residual battery energy of the sensor nodes that
are near the cluster heads.
 Since only the cluster head nodes bear the responsibility of transmitting to the distant
base station, the rest of the nodes can be designed with simple hardware that enables
short range communication. Thus the hardware complexity is limited to only a few nodes.
 A cluster head node serves as the fusion point, as well as the command center of its
cluster. As a result when a cluster head node fails, all the sensor nodes in that cluster have
to be re-assigned to other neighboring clusters. In the extreme case, it is possible that all
the cluster head nodes might fail, thereby bringing down the entire network. Thus the
system is less robust to node failure as compared to a homogeneous sensor network.

1.3 CHARCTERSTICKS OF WSN

The main characteristics of a WSN include:

 Power consumption constrains for nodes using batteries or energy harvesting


 Ability to cope with node failures
 Mobility of nodes
 Dynamic network topology
 Communication failures
 Heterogeneity of nodes
 Scalability to large scale of deployment
 Ability to withstand harsh environmental conditions
 Ease of use
 Unattended operation.

Sensor nodes can be imagined as small computers, extremely basic in terms of their
interfaces and their components. They usually consist of a processing unit with limited
computational power and limited memory, sensors or MEMS (including specific
conditioning circuitry), a communication device (usually radio transceivers or alternatively
6

optical), and a power source usually in the form of a battery. Other possible inclusions are
energy harvesting modules, secondary ASICs, and possibly secondary communication
devices (e.g. RS-232 or USB).[22]
The base stations are one or more distinguished components of the WSN with much more
computational, energy and communication resources. They act as a gateway between sensor
nodes and the end user as they typically forward data from the WSN on to a server. Other
special components in routing based networks are routers, designed to compute, calculate and
distribute the routing tables. Many techniques are used to connect to the outside world
including mobile phone networks, satellite phones, radio modems, high power WiFi links etc.

1.4 APPLICATIONS OF WSN

Area monitoring
Area monitoring is a common application of WSNs. In area monitoring, the WSN is
deployed over a region where some phenomenon is to be monitored. A military example is
the use of sensors to detect enemy intrusion; a civilian example is the geo-fencing of gas or
oil pipelines. When the sensors detect the event being monitored (heat, pressure), the event is
reported to one of the base stations, which then takes appropriate action (e.g., send a message
on the internet or to a satellite). Similarly, wireless sensor networks can use a range of
sensors to detect the presence of vehicles ranging from motorcycles to train cars.[9]
7

Fig. 1.4: Applications of WSN

Air pollution monitoring


Wireless sensor networks have been deployed in several cities[21] (Stockholm, London or
Brisbane) to monitor the concentration of dangerous gases for citizens. The sensor nodes can
control important parameters like CO, CO2, NO2 or CH4, which are generated by vehicles
and industry, and have a severe impact on the human health. This way, the public institutions
have a good tool to design plans to reduce pollution, improve the air quality and ensure the
compliance with current legislation.
Forest fires detection
A network of Sensor Nodes can be installed in a forest to control when a fire has started. The
nodes will be equipped with sensors to control temperature, humidity and gases which are
produced by fire in the trees or vegetation. The early detection is crucial for a successful
action of the firefighters; thanks to Wireless Sensor Networks, the fire brigade will be able to
know when a fire is started and how it is spreading.
Greenhouse monitoring
Wireless sensor networks are also used to control the temperature and humidity levels inside
commercial greenhouses. When the temperature and humidity drops below specific levels,
the greenhouse manager must be notified via e-mail or cell phone text message, or host
systems can trigger misting systems, open vents, turn on fans, or control a wide variety of
system responses.
Landslide detection
A landslide detection system makes use of a wireless sensor network to detect the slight
movements of soil and changes in various parameters that may occur before or during a
landslide. And through the data gathered it may be possible to know the occurrence of
landslides long before it actually happens.
Machine health monitoring
Wireless sensor networks have been developed for machinery condition-based maintenance
(CBM) as they offer significant cost savings and enable new functionalities. In wired
systems, the installation of enough sensors is often limited by the cost of wiring. Previously
inaccessible locations, rotating machinery, hazardous or restricted areas, and mobile assets
can now be reached with wireless sensors.
Water/wastewater monitoring
8

There are many opportunities for using wireless sensor networks within the water/wastewater
industries. Facilities not wired for power or data transmission can be monitored using
industrial wireless I/O devices and sensors powered using solar panels or battery packs.
Landfill ground well level monitoring and pump counter
Wireless sensor networks can be used to measure and monitor the water levels within all
ground wells in the landfill site and monitor leach ate accumulation and removal. A wireless
device and submersible pressure transmitter monitors the leach ate level. The sensor
information is wirelessly transmitted to a central data logging system to store the level data,
perform calculations, or notify personnel when a service vehicle is needed at a specific well.
Agriculture
Using wireless sensor networks within the agricultural industry is increasingly common;
using a wireless network frees the farmer from the maintenance of wiring in a difficult
environment. Gravity feed water systems can be monitored using pressure transmitters to
monitor water tank levels, pumps can be controlled using wireless I/O devices, and water use
can be measured and wirelessly transmitted back to a central control center for billing.
Irrigation automation enables more efficient water use and reduces waste.
Fleet monitoring
It is possible to put a node on-board of each vehicle of a fleet. The node gathers its position
via the GPS module, and reports its coordinates so that the location is tracked in real-time.
The nodes can be connected to temperature sensors to avoid any disruption of the cold chain,
helping to ensure the safety of food, pharmaceutical and chemical shipments. In situations
where there is not reliable GPS coverage, like inside buildings, garages and tunnels, using
information from GSM cells is an alternative for to GPS localization.

1.5 PLATFORMS

1.5.1 Standards and specifications

Several standards are currently either ratified or under development for wireless sensor
networks[31]. There are a number of standardization bodies in the field of WSNs. The IEEE
focuses on the physical and MAC layers; the Internet Engineering Task Force works on
9

layers 3 and above. In addition to these, bodies such as the International Society of
Automation provide vertical solutions, covering all protocol layer. Finally, there are also
several non-standard, proprietary mechanisms and specifications.
Standards are used far less in WSNs than in other computing systems. However predominant
standards commonly used in WSN communications include:

 WirelessHART
 ISA100
 IEEE 1451
 ZigBee / 802.15.4
 IEEE 802.11

1.5.2 Hardware

The main challenge in a WSN is to produce low cost and tiny sensor nodes. There are an
increasing number of small companies producing WSN hardware and the commercial
situation can be compared to home computing in the 1970s. Many of the nodes are still in the
research and development stage, particularly their software. Also inherent to sensor network
adoption is the use very low power method for data acquisition.[5],[6]
10

Fig. 1.5: Hardware component of sensor node

1.5.3 Software

Energy is the scarcest resource of WSN nodes, and it determines the lifetime of WSNs.
WSNs are meant to be deployed in large numbers in various environments, including remote
and hostile regions, with ad-hoc communications as key. For this reason, algorithms and
protocols need to address the following issues:

 Lifetime maximization
 Robustness and fault tolerance
 Self-configuration

Some of the important topics in WSN software research are:

 Operating systems
 Security
 Mobility
 Usability – human interface for deployment and management, debugging and end-user
control
 Middleware – the design of middle-level primitives between high level software and the
systems[5],[6]

1.5.4 Operating systems

Operating systems for wireless sensor network nodes are typically less complex than general-
purpose operating systems. They more strongly resemble embedded systems, for two
reasons. First, wireless sensor networks are typically deployed with a particular application in
mind, rather than as a general platform. Second, a need for low costs and low power leads
11

most wireless sensor nodes to have low-power microcontrollers ensuring that mechanisms
such as virtual memory either unnecessary or too expensive to implement.[1]
It is therefore possible to use embedded operating systems such as eCos or uC/OS for sensor
networks. However, such operating systems are often designed with real-time properties.
TinyOS is perhaps the first operating system specifically designed for wireless sensor
networks. TinyOS is based on an event-driven programming model instead of multithreading.
TinyOS programs are composed into event handlers and tasks with run to completion-
semantics. When an external event occurs, such as an incoming data packet or a sensor
reading, TinyOS signals the appropriate event handler to handle the event. Event handlers
can post tasks that are scheduled by the TinyOS kernel some time later.[4]
LiteOS is a newly developed OS for wireless sensor networks, which provides UNIX like
abstraction and support for C programming language. Contiki is an OS which uses a simpler
programming style in C while providing advances such as 6LoWPAN and proto-threads.
The algorithmic approach to modeling, simulating and analyzing WSNs differentiates itself
from the protocol approach by the fact that the idealized mathematical models used are more
general and easier to analyze. However, they are sometimes less realistic than the models
used for protocol design, since an algorithmic approach often neglects timing issues, protocol
overhead, the routing initiation phase and sometimes distributed implementation of the
algorithms.

1.6 SIMULATIONS OF WSN

In general, there are two ways to develop simulations of WSNs. Either use a custom platform
to develop the simulation. And the second option is to develop one's own simulation:
Simulators
There are network simulator platforms specifically designed to model and simulate Wireless
Sensor Networks, like TOSSIM, which is a part of TinyOS and COOJA which is a part of
Contiki. Traditional network simulators like ns-2 have also been used. Ns-3, which is an
upgrade over Ns-2 is expected to be released shortly, also features WSN libraries. However
in reply to a question at his keynote address in Spring Simulation Multiconference 2010,
Orlando, FL, George Riley from the NS team mentioned that even NS-3 simulator does not
have any capabilities to model and simulate complex environments.[1],[4]
12

As such, at present Agent-based Modeling and Simulation is the only paradigm which allows
the simulation of even complex behavior in the environments of Wireless sensors (such as
flocking).
Network Simulators like QualNet, OPNET Modeler, NetSim and NS2 can be used to
simulate Wireless Sensor Network. Other simulators, like IDEA1 – based on SystemC – have
hardware-level librairies that permits system-level simulations by taking low-level
constraints into account.
Based on Matlab, the Prowler (Probabilistic Wireless Network Simulator) toolbox is
available.
Agent-based simulation of WSN
Agent-based simulation of wireless sensor and ad-hoc networks is a relatively newer
paradigm. ABM was originally based on social simulation. A recent article on agent-based
simulation published in the IEEE Communications magazine gives examples and tutorials on
how to develop custom agent-based simulation models for wireless sensors, mobile robots
and P2P networks in a short period of time (few hours). A formal agent-based simulation
framework using formal specification using Z notation demonstrating the use of agent-based
modeling to represent simulation of complex behavior in the environment of sensors is given
in.

1.7 WSN SECURITY

1.7.1 Requirements of WSN security


 Data Confidentiality– omission of data leaks to neighboring networks.
 Data Authentication– verification of sender/receiver.
 Data Integrity – non altered transmission of data.
 Data Freshness– ensuring data is recent while allowing for delay estimation.
WSNs are becoming a cost effective, practical way to go about deploying sensor networks.
Large range of applications from civilian to military purposes pose different challenges as
compared to traditional networks. Hence different mechanisms must be brought about.[7]
1.7.2 Attacks on WSN

 Spoofed, altered and replayed routing information


 Selective Forwarding
 Sinkhole attacks
 Traffic Analysis Attacks: Take over the base station/nodes closest to base station.
13

 The Sybil attack: Defined as a “malicious device illegitimately taking on multiple


identities.”Originally used against peer to peer networks but may also be used to disrupt
routing algorithms, data aggregation etc.[16],[17]
1.7.3 Challenges/ Obstacles

• The existing infrastructure is already resource-starved.


–Communication bandwidth
–Power
–Computational power[11]
• A typical sensor has a 16 bit 8 Mhz CPU with 10K RAM, 48K Program Memory
and 1M flash storage.
• Preventing insider attacks.
• Sinkhole attacks and wormholes – no known countermeasures to apply after the protocol
is designed.
• Building multi-hop routing topology - Nodes within one or two hops of the base station
are attractive to intruders.
•Unreliable Communication :
– Unreliable Transfer: Packet-based routing of the sensor network is connectionless
hence unreliable.
– Conflicts: Even if the channel is reliable, the communication may still be unreliable
due to broadcast nature of WSN.
– Latency: Multi-hop routing, network congestion and node processing can lead to
greater latency in the network.
• Unattended Operation:
– Exposure to Physical Attacks.
– Managed Remotely: Hard to detect physical tampering.
– No Central Management Point: Ideally a WSN should have any central
management point. However, if the network is designed incorrectly it may lead to
greater congestion.
14

CHAPTER-2 MATLAB

This chapter is an introduction to Matlab (version 6.5) for people without much
programming, mathematical or Unix background. Matlab is an easy software package to use
even without much knowledge. That is what makes it so convenient. In this tutorial, some
basic and very useful functions are described. These should get you started. Having
understood a few basics, it will be pretty easy to expand your knowledge using Help, the
internet and manuals.

2.1 WHAT IS MATLAB?

Matlab is a software program that allows you to do data manipulation and visualization,
calculations, math and programming. It can be used to do very simple as well as very
sophisticated tasks. .
15

Fig. 2.1: Matlab Icon

2.1.1 Starting/quitting
To start Matlab, click on the ‘Start’ button on the left bottom of the screen, and then click on
‘All Programs’, then ‘Math and Stats’, then ‘Matlab’. A window will pop up that will consist
of three smaller windows. On the right there will be a big window entitled ‘Command
Window’. On the left there will be two windows, one entitled ‘Workspace’ and another one
‘Command History’.

Fig. 2.2: Three windows of Matlab

In addition, on the top there is a usual bar with ‘File’, ‘Edit’, etc. headings. You can use these
as you would in any other software (Word for example). Click on ‘File’ and look at the
available commands there. Do the same for all the other headings. Note that the last heading
is ‘Help’ (very useful!). Therefore, if you are stuck you know where to look.
16

To use Matlab, you will mostly be typing in the ‘Command window’. Click on the Command
window. Its outline will become dark grey (that’s how you know that you can type into that
window). A cursor will start blinking on a line right after ‘>>’ (this is called a prompt).
Let’s start using Matlab by quitting it. In the Command window type quit (the letters should
appear after the prompt) and hit enter. Matlab will close. Now you have used Matlab!
2.1.2 Help!
Start Matlab again. Let’s explore the Help bar. Look at the third option under the Help
heading ‘Using the Desktop’. Click on it. A Help window will come up with a list of topics
describing the Desktop. Click on ‘What Desktop Is’. On the bottom of the page that will
come up you will find explanations of the buttons, windows and options available on the
desktop. Scroll to the bottom. You will see text ‘Drag the separator bar to resize window’.
Let’s try that.
Switch to the Matlab window. (To do this, look at the taskbar on the bottom of the screen and
find an icon with a little orange and green hill on it that says ‘MATLAB’. Click on it.)
Move your mouse to the space between the ‘Command window’ on the right and the
windows on the left. The mouse should take a shape of an arrow with two points. Press the
left mouse button down and move the mouse left and right. This should move the boundary
between the windows.
If you have questions about the desktop in the future, you can go to Help/Using the Desktop
for the answers. However, the most useful help option under the Help heading for you now is
the second option called ‘MATLAB Help’. Click on it. This will take you to the main page of
Matlab help. The categories are on the left, the main text is on the right.
You can always go to this page if you have a question. Two very useful features on this page
are ‘Index’ and ‘Search’. These are bars on top of the left window that contains the
categories. In the ‘Index’ you can search for available functions in Matlab. In fact, the Index
is like an index at the back of a Matlab manual book.
For example, click on the Index bar. In the window under ‘Search index for:’ type logarithm.
The text on the window below will jump to the entry under ‘logarithm’. It has several
subheadings. Double click on the subheading ‘natural’ in that window. On the right you will
get the description of the log function in Matlab, with syntax and example.
17

The Index bar is very useful to look up the syntax of a function or to see if a particular
Matlab function exists. Another useful Help feature is the Search bar (located to the right of
the Index bar). That allows you to search Matlab documentation more thoroughly.
Therefore, if you cannot find something in the Index, you might want to try using Search.
Close the Help window, and get back to the main Matlab window.

2.2 MATLAB AS A SUPER-CALCULATOR

Click on the Command window. Type 2+3 at the prompt and then hit enter. The following
will come up below the prompt:
ans =
5
As you can see, you can use Matlab as a basic calculator (although that’s not the most
efficient use for it).
Notice that there is a new entry in the top left window entitled ‘Workspace’. There is now an
entry ans there of size 1x1. ans is a variable. This means that it’s a string of text that has a
value (number) assigned to it. To see this, type ans at the prompt and then hit enter. As you
can see Matlab again returns ans = 5, i.e. it remembers that ans holds a value of 5.
ans is a special name for a variable in Matlab. It is assigned the value of the answer to the
expression that you type at the prompt.
18

You can create your own variables. For example, type in x=10. Now Matlab has another
entry in the ‘Workspace’ window called x. Now if you type x, Matlab will know that its value
is 10. For example, type x+5. Matlab will give you the correct answer 15.

Fig.2.3 Matlab as a super calculator

Matlab has all the math functions that a calculator may have and many more. For example,
you can find x2. Here, we need to learn a bit of notation. To raise x to the power of 2 in
Matlab you type x.^2. You will get, predictably, 100 since you assigned a value of 10 to x.
Among the most familiar functions, Matlab has sin, cos, exp, log functions. For example, to
find e2, you type exp(2). You should get 7.3891. As you can see, to use a function, you put
the argument of the function in the parentheses after the function name (without a space
between them).

2.3 MATLAB AS A MATHEMATICAL TOOL


19

So far we have used common mathematical functions. However, Matlab allows you to define
(and evaluate) your own functions as well. For example, lets define a function f(x)=x2+1. To
do this, simply type in f=x.^2+1. Since x has a value of 10, the answer is 101. You can now
change the value of x. For example, type x=5 and enter, then type f=x.^2+1 again. You
should now get 26.

Fig.2.4 Matlab as a mathematical tool

However, you don’t want to type the expression for f(x) every time you want to change the
value of x. You might want to define a function f(x) for a range of values of x. To do this in
Matlab we need to make x be a range of values. For example, suppose we want to make x to
go from 1 to 10. To do this in Matlab, you type x=1:10. You will get
x=
1 2 3 4 5 6 7 8 9 10
as a result. Now, x is a list of values from 1 to 10. If we now type f=x.^2+1, we will get 10
values of f for each value of x. In other words, we have defined f as a function of x.
20

Right now the difference between two consecutive values of x is 1. To change this , we put
the step between two consecutive values between the maximum and minimum values, i.e.
type x=1:0.5:10. You will get
x=
Columns 1 through 8
1.0000 1.5000 2.0000 2.5000 3.0000 3.5000
4.0000 4.5000
Columns 9 through 16
5.0000 5.5000 6.0000 6.5000 7.0000 7.5000
8.0000 8.5000
Columns 17 through 19
9.0000 9.5000 10.0000
Now x still ranges from 1 to 10, but now it takes on 19 values with a step of 0.5. Since we
redefined x, we now need to redefine f(x) as well. This means that we must again type
f=x.^2+1. f(x) now has 19 values as well.
2.3.1 Plotting basics
One thing we want to do to with functions is plot them. Matlab is a very good tool for that.
For example, to plot f as a function of x, type plot(x,f). A new window will come up with a
plot of f(x) as a function of x. Matlab has many features for plotting.
21

Fig.2.5 Plotting basic graph


We will now learn a few of them. First of all we want to define our axes. This is very simple
to do.
To define the x-axis, type xlabel(‘x’) in the Command window. Now switch to the window
with the figure. You will see a label on the x-axis. Let’s do the same for the yaxis.
Predictably, to do this you need to type ylabel(‘f(x)’). Now, if we want to put a title on our
graph the command it title(‘Function f’). As you can see, a lot of the commands are quite
intuitive.

2.4 MATLAB AS A TOOL FOR DATA ANALYSIS

What about looking at data in Matlab? Usually, data comes in tables. For example, you could
have some observation as a function of time, such as the average temperature as a function of
a month. This data will have two columns, one for the month and another for the value of a
temperature. Or you could have several replicates on an experiment where the average
weight of some organisms was observed in environments with different food levels. This data
can be recorded as a table with the number of rows equal to the number of replicate
experiments and the number of columns equal to the food levels tested.
A mathematical term for a table is a matrix. (From now on you can understand the term
matrix as table.) Matlab deals with matrices very well. Let’s create a matrix of ones in
Matlab. To do this, we need to know how many rows and columns we want in a matrix.
Suppose we want to create a matrix of ones with 2 rows and 3 columns. To do this, type
ones(2,3). The Matlab will return
ans =
111
111
Suppose we want to store this matrix in a variable. To do this, type M=ones(2,3). Now, M
will appear in the Workspace window (notice that its size, 2 by 3, is also stated). The size of a
matrix is often referred to as its dimensions. For example, M is ‘a matrix of dimensions 2 by
3’ or simply ‘a 2 by 3 matrix’.
22

Whenever you want to change a variable or remove a variable, you can use command clear.
If you type clear M, this will remove M from the Workspace. Try it. Anytime that you have
made a mistake defining a variable or a function, or when you reuse the same variable name,
it is a very good practice to use the clear command. If you want to get rid of all the variables
in your Workspace, you can simply type clear.
You can also construct your own matrix by typing it in. For example, if you type
M=[2,5;9,7; 4,3],
you will get a 3 by 2 matrix:
25
7
97
43
As you can see, to define a matrix in Matlab, you surround the entries by square brackets.
Commas separate column entries and semicolons separate row entries. To look at the whole
first row of the matrix M, you type M(1,:). Here, the colon means ‘show me all the entries in
the row(s) indicated’. To look at the whole second column, you type
M(:,2).
If you want to see only the second and third rows of M, you type
M(2:3,:).
Let’s work on an example. Suppose you have observations of average temperature as a
function of month. Let’s generate the data to represent that. As we do this, we will learn
several more useful function of Matlab. First, we need to generate a column of months.
We already generated a row of numbers from 1 to 10 in the previous section. Now, we need
to make a column. Notice that a row is just a matrix of dimensions 1 by n (where n is the
length of the row). Similarly, a column is a matrix of dimensions n by 1. These are called
vectors. Since we know how to make a row, let’s start with that. Type
month=1:12.
You will see
month =
1 2 3 4 5 6 7 8 9 10
11 12
23

To make this row into a column, we will transpose it. To transpose a matrix means to flip the
values in the matrix so that the first row becomes the first column, the second row becomes
the second column etc. Therefore, if you transpose a row, you will get a column. To do this
type month=month’. The apostrophe tells Matlab to transpose month. You will get
month =
1
2
3
4
5
6
8
7
8
9
10
11
12
This is what we wanted. Now, we need to generate values of average temperature for each
month. For educational purposes, we will do this naively by picking random numbers
between 0 and 80. Matlab provides a convenient function rand to generate random numbers
between 0 and 1. Try it by typing rand at the prompt several times. You will get a different
number from 0 to 1 every time. To generate random values between 0 and 80, we can
multiply a random number between 0 and 1 by 80. To do this
type 80*rand.
Now, we need to generate 12 of these numbers. There are several ways of doing this, we will
learn two of them. (In fact, there are several ways of doing almost everything in Matlab. As
long as you can do it any one way, it will suffice for most work that you will be doing in the
course.)
24

We need to generate 12 random numbers between 0 and 80. We know how to generate one of
them (the command is 80*rand). Now, we need to string them together. To do this, we will
use a new variable called temp (for temperature). temp should be a column.
A column is a matrix of dimensions n by 1. Therefore, the first entry in the variable temp will
be located in the first row and first (and only) column. To express this in Matlab
type temp(1,1)=80*rand.
The second entry in the column will be located in the 2nd row and 1st column, therefore
type temp(2,1)=80*rand.
You will get the answer giving two random values stored in temp. However it is tedious to
write all the twelve values by hand. (If you think that twelve values is not that many, imagine
having to do it 100 times.) Therefore, we will use a bit of programming, so that we can be
lazy.

2.5 A BIT OF PROGRAMMING FOR LOOPS

Suppose we want to do something several times. You can do this by using a very convenient
structure called a loop. A loop loops (hence the name) through some commands several
times. Getting back to our example, we want to perform a command
temp(i, 1)=80*rand twelve times, where i is a number between 1 and 12.
To do this in Matlab you can type:
for i=1:12,
temp(i,1)=80*rand;
end
25

Now type temp. You will get a row of 12 random numbers between 0 and 80.

Fig.2.6 Matlab as a tool for data analysis

Now, what has just happened? You made a for loop. A for loop performs an operation several
times. As you can see, it starts with the word for and ends with the word end.
Let’s translate the line of code to English: for i=1:12 means let i be 1, then 2, then 3, etc. until
i=12 and perform the command temp(i,1)=80*rand; for each value of i.
Note that there is a comma after 12 to signify that what follows is the command you want to
perform. End a command with a semicolon. Then you need to let the for loop know when to
end, and you do this by typing end.

2.6 ERRORS
26

Getting the commas and the parentheses right in Matlab is very important. Matlab (like any
other software) is stupid, and if you make even a small syntax error, it will give you an error.
Let’s try that.
Retype the previous line but omit the semicolon:
for i=1:12, temp(i,1)=80*rand end
You will get an error in red:
??? for i=1:12, temp(i,1)=80*rand end
|
Error: Missing operator, comma, or semicolon.

Fig.2.7 Errors

Matlab is complaining about your syntax. In fact, whenever you get an error, you should first
check your syntax.
Getting back to our example, we now have a column of temperatures. We are ready to create
our artificial data set by putting the month column and the temperature column 10 together
27

by typing data=[month,temp]. The outcome will be a neat table of month and temperature.
This is the kind of dataset you might be working with.

2.7 SAVING WORKSPACE AND PLOTS

Now that you’ve done all this work, you might want to save it. To save all the variables that
you have created, you need to save your Workspace. To do this, type save workspace_name
(you can pick the name). After you close Matlab, you can open that file and it will contain all
the variables that you have created. You can also save selected variables. For example to save
variable data1 only, type save data_name data1.
This will create another data_name.mat file that will contain only variable data1. You might
also want to save your plots. There are two ways of saving Matlab plots. One of them saves
them in the Matlab format .fig. This allows you to open the figure later in Matlab and make
modifications to it (change axes, add text, etc.). To save a figure like that, simply click on the
File heading on the toolbar on top of the figure window and click Save.
You can also save files in other graphical formats. To do this, go to the File heading on the
toolbar of the figure window and click Export. This allows you to export your file in several
formats (most familiar would probably be .jpg). This is useful for saving your completed
plots for reports.

2.8 SAVING COMMANDS: WRITING .M FILES

You just saved your data and your figure. What about all the commands that you typed in?
You may want to save the commands if you want to perform this analysis on several data
sets. The commands that you have typed in so far are listed in the bottom left window
‘Command History’. Moreover, Matlab will remember these if you restart it, but only on this
computer. However, if you change computers, or if the computer crashes, etc., you may loose
the list of the commands that you have typed and may have to type and remember them over
again. Matlab offers an easy way to have a more permanent record of the commands. You can
type your commands into a file and save them, and then execute them within Matlab.
Let’s try that. In the main Matlab window, on the top toolbar click on File/New/M-file.
28

This will open a new window with Matlab’s own text editor. Let’s make a file that would
load our data file, plot it and calculate the average temperature for the whole year.
To calculate the average temperature for the year, we will use Matlab function mean() that
(predictably) calculates the mean of the list of numbers that you put in the parentheses. To
calculate the average temperature for the year, you would type mean(data1(:,2)).
Now, type the commands into the file that you typed at the prompt:
load data1.txt
data1
plot(data1(:,1), data1(:,2), ‘o’)
hold on
plot(data1(:,1), data1(:,2))
hold off
year_avg=mean(data1(:,2))
Save the file under name prog1 into the same directory where the file data1.txt is located
(since one of the commands in prog1.m will load data1.txt). The file will be saved with
extension .m. This is the format that Matlab uses for files that contain commands.
There is another important step. This is to put comments into our file (a comment is a text
that is written for the benefit of the person reading the file only, and Matlab simply ignores
it). Comments are very important! Imagine that you make a file like this for the class, and
then you want to use it three months later when you are writing up your last project. It is
quite likely that you will not remember when, for what reason and how you wrote this file. It
is also likely that you will not remember what data1 represented.
Therefore, you need comments. To make a comment in Matlab, you put % in front of the
text. Your commented file may look something like this.
load data1.txt % loads and plots the data, finds average yearly temperature
data1 % view data
plot(data1(:,1), data2(:,2), ‘o’) % plot data
hold on
plot(data1(:,1), data2(:,2))
hold off
year_avg=mean(data1(:,2)) % find average yearly temperature
29

It might seem an overkill for you right now to put that many comments into such a small file.
However, when you start working with more complicated files, it might be very useful to be
very diligent about writing comments.
Now, let’s clear the Workspace by typing clear. Also, close all the figure windows you have
opened. For you to be able to run the commands in the file prog1.m, the file has to be in the
Matlab’s current directory. If you saved prog1.m into another directory, change to that
directory. Now, in the main Matlab window type prog1 (without .m at the end) at the prompt.
If everything is well, you will either get the data and the value for the year_avg printed, and
you will get a figure window with the proper plot in it.
Another possibility is that Matlab will give you some errors to sort out. Read the errors. If
they make sense, fix your file. If they don’t make sense, look at the file and make sure
everything is correct. Then type prog1 again. Do this until it works.

2.9 SUMMARY OF COMMANDS AND FUNCTIONS

% - put before comments in the .m files


‘ – transposes a matrix
clear – clear the variables in the Workspace
dims – gives the dimensions of a matrix
figure – makes a new figure window
for … end – for loop, used to perform commands several times in a row
help (function_name) – shows Matlab help in the Command window as overview or about
the function_name if it is included
hold on/off – keeps/does not keep the current plot when the next one is plotted
load – load a file
ls – show the list of the files in the Matlab’s current directory
mean(data) – calculate the mean of data
plot(x_vector, y_vector) – make a plot (has more options, see help for details)
quit – quit Matlab
rand – produces a random number between 0 and 1
30

randn – produces a random number from a distribution with a mean of 0 and a standard
deviation and variance of 1
save (variable_name) – save Workspace or a variable if the variable_name is included
31

CHAPTER-3 Literature Survey

In Year 2010, Maumita Bandyopadhyay performed a work,” Zone Based Ant Colony
Routing In Mobile Ad-hoc Network”. Here In this paper Author have used Zone based
ANT colony using Clustering which assures to find shortest route using the DIR principle (In
this principle, the source or intermediate node transmits message to several neighbors and the
node whose direction is closest to the direction of destination gets selected as the next hop
forwarding node.) together with minimum overhead for route discovery and mobility
management. Unlike other Zone based approach, in clustering it is not required to consider
zone related information of each node while finding shortest path. Here, it is being proposed
a new routing algorithm for mobile ad hoc network by combining the concept of Ant Colony
approach and Zone based routing approach using clustering to get shortest path with small
number of control messages to minimize the overhead.
Ahmed A. A. Zakzouk performed a work,” An Ant Colony Optimization Approach for
Solving Shortest Path Problem with Fuzzy Constraints”. This paper presents an Ant
Colony Optimization Approach (ACO) to solve the shortest path problem, especially with
fuzzy constraints. The proposed algorithm consists of five sequential steps. The first step is to
determine the number of possible paths from the source to the target. The second step
calculates the probability of each path of possible paths. The third step calculates the
expected number of ants through each path of possible paths then calculates in the fourth step
the new trail of each weight component for each path of possible paths, which leads to the
final step to calculate the average trail of each path .
In Year 2010, Afshin Ghanizadeh performed a work,” A Fuzzy-Particle Swarm
Optimization Based Algorithm for Solving Shortest Path Problem”. In this paper, an
efficient particle swarm optimization (PSO) algorithm based on fuzzy logic for solving the
single source shortest path problem (SPP) is proposed. A particle encoding/decoding scheme
has been devised for particle-representation of the SPP parameters, which is free of the
previously randomized path construction methods in computational problems like the SPP
.The search capability of PSO is diversified by hybridizing the PSO with fuzzy logic.
32

In Year 2010, Michael Rinehart performed a work,” A Graph Reduction for Bounding the
Value of Side Information in Shortest Path Optimization”. Author consider a
generalization of this framework whereby the agent has access to a limited amount of side
information about the edge weights ahead of choosing a path. Specifically, Author define a
notion of information and information capacity, provide bounds on the agent’s performance
relative to the amount of side information it receives, and offer algorithms for optimizing
information within a capacity constraint.
In Year 2010, Michael Rinehart performed a work,” The Value of Sequential Information
in Shortest Path Optimization”. Author consider a generalization of this framework
whereby the agent has access to a limited amount of side information about the edge weights
as it traverses the graph. Specifically, Author define a notion of side information and
capacity, and Author provide bounds on the agent’s performance relative to the total amount
of side information it receives.
In Year 2010, Yanfang Deng performed a work,” Dynamic Shortest Path in Stochastic
Traffic Networks Based on Fluid Neural Network and Particle Swarm Optimization”.
The shortest path algorithm is critical for dynamic traffic assignment and for the realization
of route guidance in intelligent transportation systems (ITS). In this paper, a hybrid Particle
Swarm Optimization (PSO) algorithm combined fluid neural network (FNN) to search for the
shortest path in stochastic traffic networks is introduced. The algorithm overcomes the
weight coefficient symmetry restrictions of the traditional FNN and disadvantage of easily
getting into a local optimum for PSO algorithm.
In Year 2011, Michael Rinehart performed a work,” The Value of Side Information in
Shortest Path Optimization”. Author consider a generalization of this framework whereby
the agent has access to a limited amount of side information about the edge weights ahead of
choosing a path. Author define a measure for information quantity, provide bounds on the
agent’s performance relative to the amount of side information it receives, and present
algorithms for optimizing side information. The results are based on a new graph
characterization tied to shortest path optimization.
In Year 2010, Marina Yusoff performed a work,” A Discrete Particle Swarm Optimization
with Random Selection Solution for the Shortest Path Problem”. This article proposes a
discrete particle swarm optimization (DPSO) for solution of the shortest path problem (SPP).
33

The proposed DPSO adopts a new solution mapping which incorporates a graph
decomposition and random selection of priority value. The purpose of this mapping is to
reduce the searching space of the particles, leading to a better solution. Detailed descriptions
of the new solution and the DPSO algorithm are elaborated. Computational experiments
involve an SPP dataset from previous research and road network from Malaysia.
In Year 2010, Zhang Huidang performed a work,” The Particle Swarm Optimization with
decaying ICMIC for Shortest Path Computation in Computer Networks”. This paper
proposes an improved particle swarm optimization utilizing Iterative Chaotic Map with
Infinite Collapses (ICMIC) perturbations (ICMICPSO) for shortest path computation in
computer networks. The chaotic perturbation generated by the ICMIC is incorporated into the
particle’s velocity updating rule to make the particles have a larger potential space to fly.
With the coefficient of chaotic perturbation decaying, the dynamics of ICMICPSO algorithm
is a chaotic dynamics first and then a steepest descent dynamics.
In Year 2011, Je´ roˆme Berclaz performed a work,” Multiple Object Tracking Using K-
Shortest Paths Optimization”. In this paper, Author show that reformulating that step as a
constrained flow optimization results in a convex problem. Author take advantage of its
particular structure to solve it using the k-shortest paths algorithm, which is very fast. This
new approach is far simpler formally and algorithmically than existing techniques and lets us
demonstrate excellent performance in two very different contexts.
In Year 2011, Kavitha Bhaskaran performed a work,” Dynamic Anycast Routing and
Wavelength Assignment in WDM Networks Using Ant Colony Optimization (ACO)”. In
this paper, Author propose an ACO-based algorithm to solve the dynamic anycast routing and
wavelength assignment (RWA) problem in wavelength-routed optical networks. Using
extensive simulations, Author show that ACO-based anycast RWA significantly reduces
blocking probability compared to the fixed shortest-path first
(SPF) and other load-balancing and dynamic algorithms.
In Year 2011, H.Kusetogullari performed a work,” K- Shortest Path Network Problem
Solution with a Hybrid Genetic Algorithm: Particle Swarm Optimization Algorithm”.
This paper presents a hybrid evolutionary algorithm (HGAPSO) to maximize utilization and
improve the Quality of Service (QoS) in expanding networks. Two meta-heuristic
optimization algorithms, namely a Genetic Algorithm (GA) and Particle Swarm Optimization
34

(PSO) are combined to find the feasible solution within a search space of telecommunication
networks. By employing a local search based priority encoding method, each individual in
the GA and each particle in PSO is represented as a potential solution for the routing
problem.
In Year 2011, Mingcong Deng performed a work,” Optimal Path Planning for Material
and Products Transfer in Steel Works Using ACO”. In this paper, a method to plan
schedule for railway train in steel works is proposed. First, a node-arc model of railway
systems in steel works is given. Then derived is an optimal path for materials transportation
problem. The path goes through specified places in the works in a given order in the shortest
steps. In this paper, an algorithm based on Ant Colony Optimization(ACO) is proposed to
solve the problem and the ACO method is modified to apply the scheduling problems.
35

CHAPTER-4 RESEARCH METHODOLOGY

4.1 PROBLEM DEFINITION

In a sensor network the nodes are present with limited energy and with each transmission
they loss some energy. Because of this it is required to minimize the rerouting to save the
energy loss. Our work is defined in same area. We proposed an algorithm to get the reliability
in case of broken link problem. The broken link can be hole or the dead sensor that cannot
transfer data to the next node. In this work we have proposed a swarm optimized approach to
reconstruct the network and generate a net path in case of broken link problem. In this work
the swarm work is divided in two phases first to detect the broken link over the network and
then reconstruct the network by generating new optimal path.

4.2 SOURCES OF DATA

The proposed work is defined to detect the broken link problem in a wireless sensor network.
The detection approach is performed using the swarm based approach. As in case of WSN a
sensor node can lose its energy and can be dead over the period. The proposed system will
detect such nodes and reconstruct the network dynamically using Swarm based approach. A
Wireless Sensor Network is a dynamic network with large no. of nodes. As the traffic
increases over the network such type of network suffers from the problems like congestion
and packet loss. Over the period these sensors loss the energy and can be dead. If the network
is wireless in such case there are more chances of inclusion of some external node in the
network. In such case there are more chances of Intrusion or packet loss over the network.
The packet loss is acceptable up to some threshold value but as there is more packet loss we
need some solution for this. The same solution is presented in this proposed work. The
complete solution is defined in terms of two stages. In first stage we have to find the node
that is responsible for packet loss over the network. Another stage is the development of
algorithm or approach that will eliminate the node dynamically and get the reliable data
transmission over the network.
36

As we are working on broken link problem in a peer to peer network. Because of this we
have to first establish a sensor network and need to define the basic properties of the
network. We can define these properties just by studying some existing network or some case
study of sensor network.

Fig. 4.1: Network Establishment

We had taken 15 nodes. The above figure shows their X and Y axis values assigned to them.
All of these nodes have some energy values which also shown in the figure. Based on these
parameter values, dead node detection will be done.
37

4.3 OBJECTIVES

The proposed research work is about to achieve the following research objectives

 Study and analyze existing shortest path techniques in WSN


 Define a WSN network along with specific energy based parameters.
 Detection of Broken link or Hole over the network using swarm analysis
 Generate a new optimal path and reconstruct the network
 Implementation of proposed algorithm in Matlab Environment.
 Analysis of Results

4.4 RESEARCH DESIGN

In a wireless network a transmission can have number of possible paths. It also contains a
reliable and fastest path is generally the shortest path .But this approach has some problems
based on security and reliability.
Some are as follows:
 Use of wireless links in shortest path susceptible to link attacks
 Relatively poor protection as in Battlefields.
 Passive eavesdropping
 Attacks from compromised attacks.

The proposed work is divided in three phases :-


1. Establish the network with protocol and route specification
2. Detect the block node using swarm approach
3. Define some other path to transfer data from other node , if there is no such node
introduce a new node dynamically, that can replace this node
38

Start

Identify the Dead node


using swarm

Include it in critical node


list

Search the another


efficient node and
compare the performance

Represent this as new


solution route

Stop

Fig. 4.2: Overall Flowchart

Now the proposed system will be represented as an approach or the framework as shown in
figure to resolve the above said problem.

4.5 TOOL USED-MATLAB

1) MATLAB Editor is used for writing the code to implement our algorithm.
2) The result will be shown in the command window of MATLAB.
39

MATLAB is a high-level language and interactive environment that enables you to perform
computationally intensive tasks faster than with traditional programming languages such as
C, C++, and Fortran. [Matlab Toolbox]

1. Introduction and Key Features


2. Developing Algorithms and Applications
3. Analyzing and Accessing Data
4. Visualizing Data
5. Performing Numeric Computation
6. Publishing Results and Deploying Applications

MATLAB is a high-level technical computing language and interactive environment for


algorithm development, data visualization, data analysis, and numeric computation. Using
the MATLAB product, you can solve technical computing problems faster than with
traditional programming languages, such as C, C++, and Fortran.

You can use MATLAB in a wide range of applications, including signal and image
processing, communications, control design, test and measurement, financial modeling and
analysis, and computational biology. Add-on toolboxes (collections of special-purpose
MATLAB functions, available separately) extend the MATLAB environment to solve
particular classes of problems in these application areas.

MATLAB provides a number of features for documenting and sharing your work. You can
integrate your MATLAB code with other languages and applications, and distribute your
MATLAB algorithms and applications.
KEY FEATURES
1. High-level language for technical computing
2. Development environment for managing code, files, and data
3. Interactive tools for iterative exploration, design, and problem solving
4. Mathematical functions for linear algebra, statistics, Fourier analysis, filtering,
optimization, and numerical integration
5. 2-D and 3-D graphics functions for visualizing data
6. Tools for building custom graphical user interfaces
7. Functions for integrating MATLAB based algorithms with external applications
and languages, such as C, C++, Fortran, Java, COM, and Microsoft Excel
4.6 PSO ALGORITHM
40

A basic variant of the PSO algorithm[23] works by having a population (called a swarm) of
candidate solutions (called particles). These particles are moved around in the search-space
according to a few simple formulae. The movements of the particles are guided by their own
best known position in the search-space as well as the entire swarm's best known position.
When improved positions are being discovered these will then come to guide the movements
of the swarm. The process is repeated and by doing so it is hoped, but not guaranteed, that a
satisfactory solution will eventually be discovered.

Formally, let f: ℝn → ℝ be the cost function which must be minimized. The function takes a
candidate solution as argument in the form of a vector of real numbers and produces a real
number as output which indicates the objective function value of the given candidate
solution. The gradient of f is not known. The goal is to find a solution a for which f(a) ≤ f(b)
for all b in the search-space, which would mean a is the global minimum. Maximization can
be performed by considering the function h = -f instead.

Let S be the number of particles in the swarm, each having a position xi ∈ ℝn in the search-
space and a velocity vi ∈ ℝn. Let pi be the best known position of particle i and let g be the
best known position of the entire swarm. A basic PSO algorithm is then:

 For each particle i = 1, ..., S do:


o Initialize the particle's position with a uniformly distributed random vector:
xi ~ U(blo, bup), where blo and bup are the lower and upper boundaries of the
search-space.
o Initialize the particle's best known position to its initial position: pi ← xi
o If (f(pi) < f(g)) update the swarm's best known position: g ← pi
o Initialize the particle's velocity: vi ~ U(-|bup-blo|, |bup-blo|)
 Until a termination criterion is met (e.g. number of iterations performed, or a solution
with adequate objective function value is found), repeat:
o For each particle i = 1, ..., S do:
 For each dimension d = 1, ..., n do:
 Pick random numbers: rp, rg ~ U(0,1)
41

 Update the particle's velocity: vi,d ← ω vi,d + φp rp (pi,d-xi,d) + φg


rg (gd-xi,d)
 Update the particle's position: xi ← xi + vi
 If (f(xi) < f(pi)) do:
 Update the particle's best known position: pi ← xi
 If (f(pi) < f(g)) update the swarm's best known position: g ← pi
 Now g holds the best found solution.

The parameters ω, φp, and φg are selected by the practitioner and control the behavior and
efficacy of the PSO method.
42

CHAPTER-5 RESULT AND IMPLEMENTATION

When the main.m file is executed, first of all the above graph will come out as output.
43

When main.m file is executed, above processing is appeared in command window of Matlab.
It shows the establishment of network having 15 nodes. We can also change the number of
nodes.
44

After establishment of network having 15 nodes, above processing appeared in the command
window. It shows the requests and replies of the nodes.
45

This shows the network established having fifteen nodes showing here with black dots. These
are generated randomly.
46

This shows the network having live nodes shown as black dots and dead nodes as red nodes.
Also dead nodes are shown as green cloud callout.
47

This shows the status of the nodes. There are fifteen zeros showing all nodes are live. It is
when there is no dead node detection.

After dead node detection the status of dead node changes to 1. In above node 7 and 13 are
dead nodes.
48

Bar Graphs shows the different kind of communication over the network such as
1. Number of Input Request
2. Number of Ouput Request
3. Number of Forwarding Request
4. Number of Crosslayer or Inter Cluster Request for Input
5. Number of CrossLayer Request for Ouput
6. Number of CrossLayer Request for Forwarding
7. Number of Reply out
8. Number of Reply in
9. Number of Reply Forward
As the communication performed over the network, these all parameters are stored and
presented in the form of bar graph.
49

This shows the communication path between all the fifteen nodes in the network when there
is no dead node detection. All the fifteen nodes are shown separately with arrow heads and
node numbering for ease of understanding. In it large distance is covered to traverse all the
nodes.
50

This shows the optimum safe swarm optimized path. In it the dead nodes are discarded.
Clearly shown node7 and node 13 which are dead nodes are not present in this figure.
51

This shows for network with dead and live both nodes. As shown in it, distance covered is
large. Because no optimization is performed, due to it there will be only wastage of time and
energy.
52

This shows for the network with dead node detection and after discarding these dead nodes.
It clearly shows that the distance covered is much less than the previous figure. Optimization
is performed here. The cost factor used for optimization is distance covered.
53

CHAPTER-6 CONCLUSION AND SCOPE FOR THE FUTURE

6.1 CONCLUSION

This implementation work is done in Matlab. In the implementation work the optimization is
in terms of route identification. The identified route will not include any bad node and the
process of identifying these bad nodes is minimized. The swarm also finds the effective
alternate path. It means the optimization is done in terms of path length. In this work, we had
generated values of X and Y axis for nodes randomly. Also the energy given to each node is
randomly generated with each new running task of the work. Here we had taken the fifteen
number of nodes for our work and hundred number of iterations. Then energy parameters are
assigned to each node individually. As iterations or we can say communication performed,
energy assigned to nodes got loss and in the end energy given to some nodes got zero. These
nodes are considered as the dead nodes. Then these are detected and discarded. Then
optimization algorithm is applied and we got the final optimized path without dead nodes. In
this work we can also change the no. of nodes taken and no. of iterations performed. In the
earlier work either the bad node detection is performed or the optimization of path cost is
performed. In this work we have optimize both the processes collectively. Here it will return
an optimized path along with the exclusion of bad nodes.
54

6.2 SCOPE FOR THE FUTURE

For the future work, we can change the optimization factor and then perform this
optimization again so that with the distance covered in communication path, also the time
taken for the optimized path also become optimum.
The work may be extended for the problem where transmission loss co-efficient are not
given. In that case the loss co-efficient can be calculated by solving the load flow problem.
GA convergence characteristics better than PSO and in some cases the PSO gives better
result than GA method. So, both the methods can be combined to find a better solution. In
PSO method selection of parameters are important. So, the parameters may be optimized by
using the ANN method. Any other method can be applied with PSO to improve the
performance of the PSO method.
This work may be extended for new optimization techniques, like Bacterial Foraging (BFO)
and Artificial Immune Systems (AIS). This may be used to compare and find out the
better optimization technique.
55

REFERENCES

[1] A. Boukerche, H. A. B. Oliveira, E. F. Nakamura, and A. A. F. Loureiro, “Localization


systems for wireless sensor networks,” IEEE Wireless Commun. Mag., vol. 14, no. 6, pp.
6–12, (December 2007).
[2] Ahmed A. A. Zakzouk,” An Ant Colony Optimization Approach for Solving Shortest Path
Problem with Fuzzy Constraints”.
[3] Afshin Ghanizadeh,” A Fuzzy-Particle Swarm Optimization Based Algorithm for Solving
Shortest Path Problem”, IEEE 978-1-4244-6349-7/10, (2010)

[4] A. Chandrakasan, R. Amirtharajah, S. Cho, J. Goodman,G. Konduri, J. Kulik, W.


Rabiner, A. Wang, “Design considerations for distributed micro-sensor systems”,
Proceedings of the IEEE 1999 Custom Integrated CircuitsConference, San Diego, CA,
pp. 279–286 (1999).
[5] A. Cerpa, J.Wong, L. Kuang, M. Potkonjak, and D. Estrin, “Statistical Model of Lossy
Links in Wireless Sensor Networks”, IPSN, (April 2005).

[6] A. Porret, T. Melly, C.C. Enz, E.A. Vittoz, “A low-powerlow-voltage transceiver


architecture suitable for wireless distributed sensors network”,IEEE International
Symposium on Circuits and Systems’00, Geneva, Vol. 1, pp. 56–59 (2000).
[7] A. Perrig, R. Szewczyk, V. Wen, D. Culler, J.D. Tygar,SPINS: “security protocols for
sensor networks”, Proceedings of ACM MobiCom’01, Rome, Italy, pp. 189–199 (2001).
[8] Brandstatter, B. and Baumgartner, U., "Particle swarm optimization-mass-spring system
analogon," IEEE Transactions on Magnetics, vol. 38, no. 2, pp. 997-1000, (Mar.2002).

[9] C. Shen, C. Srisathapornphat, C. Jaikaeo, “Sensor information networking architecture


and applications “, IEEE Personal Com munications, pp. 52–59 (2001).
[10] Cedeno, W. and Agrafiotis, D. K., "Using particle swarms for the development of
QSAR models based on K-nearest neighbor and kernel regression," Journal of
Computer-Aided Molecular Design, vol. 17, no. 2-4, pp. 255-263, (Feb.2003).
56

[11] D. Estrin, R. Govindan, J. Heidemann, S. Kumar,” Nextcentury challenges: scalable


coordination in sensor networks”,ACM MobiCom’99, Washingtion, USA, ,pp. 263–270
(1999)
[12] E. Altman, T. Basar, T. Jimenez, and N. Shimkin, “Competitive routing in networks
with polynomial costs,” IEEE Trans. Automat. Control, vol. 47, no. 1, pp. 92-96 ( 2002).
[13] El-Gallad, El-Hawary, Sallam, and Kalas, “A Particle swarm optimizer for
constrained economic dispatch with prohibited operating zones”, Canadian Conference
on Electrical and Computer Engineering, 2002, pp. 78-81(2002).
[14] H.Kusetogullari,” K- Shortest Path Network Problem Solution with a Hybrid Genetic
Algorithm: Particle Swarm Optimization Algorithm”, IEEE ICTON 2011 978-1-4577-
0882-4/11,(2011)
[15] Hu, X. and Eberhart, R. C., “Multiobjective optimization using dynamic
neighborhood particle swarm optimization”,. Proceedings of the IEEE Congress on
Evolutionary Computation (CEC 2002), Honolulu, Hawaii USA. pp. 1677-1681, (2002)

[16] J. Elson, D. Estrin, Random,” ephemeral transaction identifiers in dynamic sensor


networks”, Proceedings 21st International Conference on Distributed Computing
Systems, Mesa, AZ, pp. 459–468 (April 2001) .
[17] J.Guo, Z.yong Lei, “A Kind of Wormhole Attack Defense Strategy of WSN Based on
Neighbor Nodes Verification”, IEEE Transactions on wireless communications Print
ISBN:978-1-61284-486-211, pp. 564 – 568,( May 2011) .
[18] João Pedro,” Distributed Routing Path Optimization for OBS Networks based on Ant
Colony Optimization”, IEEE "GLOBECOM" 2009 978-1-4244-4148-8/09,(2009)
[19] Je´ roˆme Berclaz,” Multiple Object Tracking Using K-Shortest Paths Optimization”,
IEEE Transactions On Pattern Analysis And Machine Intelligence 0162-8828/11, (2011)
[20] Kavitha Bhaskaran,” Dynamic Anycast Routing and Wavelength Assignment in WDM
Networks Using Ant Colony Optimization (ACO)”, IEEE ICC 2011 978-1-61284-233-
2/11, (2011)
[21] Kennedy, J. “The particle swarm: Social adaptation of knowledge”, Proceedings of
the 1997 International Conference on Evolutionary Computation, IEEE Service Center,
Piscataway, NJ. Pp.303-308(1997).
57

[22] TARUNA, Dr.Pankaj Gupta, Vishal pahal, “Wireless Sensor Network-A Review”,
National Conference on Advences in Computing, Communication Network & Electrical
Systems(NCACCNES-2012), ID_192.1-192.6, (March 27,28-2012)
[23] TARUNA, Dr.Pankaj Gupta “A Study Of Particle Swarm Optimization”, Proceedings
of the International Conference on Emerging Trends in Engineering and Management,
Satpriya group of Institutions, ISBN: 978-981-07-2631-7, Pp. 28-33, (June 2012)

[24] L. Rizzo, “Effective erasure codes for reliable computer communication protocols,”
ACM Computer Communication Review, vol. 27, no. 2, pp.24–36, (1997).
[25] Marina Yusoff,” A Discrete Particle Swarm Optimization with Random Selection
Solution for the Shortest Path Problem”, IEEE 978-1-4244-7896-5/10, (2010 )
[26] Maumita Bandyopadhyay,” Zone Based Ant Colony Routing In Mobile Ad-hoc
Network”, IEEE 978-1-4244-5489-1/10, (2010)
[27] Michael Rinehart,” A Graph Reduction for Bounding the Value of Side Information
in Shortest Path Optimization”, 2010 American Control Conference Marriott Waterfront,
Baltimore, AACC 978-1-4244-7427-1/10, (2010)
[28] Michael Rinehart,” The Value of Sequential Information in Shortest Path Optimization”,
2010 American Control Conference Marriott Waterfront, Baltimore, AACC 978-1-4244-
7427-1/10, (2010)
[29] Michael Rinehart,” The Value of Side Information in Shortest Path Optimization”,
IEEE transactions on automatic control 0018-9286, (2011)
[30] Mingcong Deng,” Optimal Path Planning for Material and Products Transfer in Steel
Works Using ACO”, Proceedings of the 2011 International Conference on Advanced
Mechatronic Systems 978-0-9555293-7 -5/11, (2011)
[31] Mostaghim, S. and Teich, J. r. “Strategies for finding local guides in multi-objective
particle swarm optimization (MOPSO)”, Proceedings of the IEEE Swarm Intelligence
Symposium 2003 (SIS 2003), Indianapolis, Indiana, USA. pp. 26-33, (2003).

[32] P. Bauer, M. Sichitiu, R. Istepanian, K. Premaratne, The mobile patient: “wireless


distributed sensor networks forpatient monitoring and care”, Proceedings 2000 IEEE
58

EMBS International Conference on Information Technology Applications in


Biomedicine, pp. 17–21 (2000) .
[33] S. Cho, A. Chandrakasan, “Energy-efficient protocols for low duty cycle wireless
microsensor”, Proceedings of the 33rd Annual Hawaii International Conference on
System Sciences, Maui, HI Vol. 2 , pp. 10 (2000).
[34] S. Meguerdichian, F. Koushanfar, G. Qu, M. Potkonjak, “Exposure in wireless ad-hoc
sensor networks “, Proceedings of ACM MobiCom’01, Rome, Italy, pp. 139–150 (2001).
[35] S. Vardhan, M. Wilczynski, G. Pottie, W.J. Kaiser, “Wireless integrated network
sensors (WINS): distributed in situ sensing for mission and flight systems”, IEEE
Aerospace Conference, Vol. 7,pp. 459–463 (2000).
[36] T. P. Hong and G. N. Shiu, “Allocating multiple base stations under general power
consumption by the particle swarm optimization,” in Proceedings of the IEEE Swarm
Intelligence Symposium (SIS), pp. 23–28,(2007).
[37] X. Wang, S. Wang, and J. J. Ma, “An improved co-evolutionary particle swarm
optimization for wireless sensor networks with dynamic deployment,” Sensors, vol. 7, pp.
354–370, (2007).
[38] Yanfang Deng,” Dynamic Shortest Path in Stochastic Traffic Networks Based on Fluid
Neural Network and Particle Swarm Optimization”, IEEE Sixth International
Conference on Natural Computation (ICNC 2010) 978-1-4244-5961-2/10, (2010)
[39] Zhang, X., Yu, L., Zheng, Y., Shen, Y., Zhou, G., Chen, L., Xi, L., Yuan, T., Zhang, J.,
and Yang, B., "Two-stage adaptive PMD compensation in a 10 Gbit/s optical
communication system using particle swarm optimization algorithm," Optics
Communications, vol. 231, no. 1-6, pp. 233-242, (Jan.2004).
[40] Zhang Huidang,” The Particle Swarm Optimization with decaying ICMIC for Shortest
Path Computation in Computer Networks”, IEEE International Conference on
Computational Intelligence and Security 978-0-7695-4297-3/10, (2010)
[41] Zheng, Y., Ma, L., Zhang, L., and Qian, J. “Empirical study of particle swarm
optimizer with an increasing inertia weight”, Proceedings of IEEE Congress on
Evolutionary Computation 2003 (CEC 2003), Canbella, Australia. pp. 221-226, (2003).

You might also like