novel algorithms for design optimization of …

85
DSpace Institution DSpace Repository http://dspace.org Computer Science thesis 2020-03-20 NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF WIRELESS SENSOR NETWORKS DEFAR, ABENEZER http://hdl.handle.net/123456789/10749 Downloaded from DSpace Repository, DSpace Institution's institutional repository

Upload: others

Post on 14-Nov-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

DSpace Institution

DSpace Repository http://dspace.org

Computer Science thesis

2020-03-20

NOVEL ALGORITHMS FOR DESIGN

OPTIMIZATION OF WIRELESS

SENSOR NETWORKS

DEFAR, ABENEZER

http://hdl.handle.net/123456789/10749

Downloaded from DSpace Repository, DSpace Institution's institutional repository

Page 2: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

BAHIR DAR UNIVERSITY

BAHIR DAR INSTITUTE OF TECHNOLOGY

SCHOOL OF RESEARCH AND POSTGRADUATE STUDIES

FACULTY OF COMPUTING

NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF

WIRELESS SENSOR NETWORKS

ABENEZER DEFAR ANJORE

BAHIR DAR, ETHIOPIA

February 2018

Page 3: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF WIRELESS SENSOR

NETWORKS

ABENEZER DEFAR ANJORE

A thesis submitted to the school of Research and Graduate Studies of Bahir Dar

Institute of Technology, BDU in partial fulfillment of the requirements for the degree

of

Master of Science in Computer Science in the Faculty of computing

Advisor Name: Dr. Krishna Prasad

Bahir Dar, Ethiopia

February 2018

Page 4: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

i

DECLARATION

I, the undersigned, declare that the thesis comprises my own work. In compliance with

internationally accepted practices, I have acknowledged and refereed all materials used

in this work. I understand that non-adherence to the principles of academic honesty and

integrity, misrepresentation/ fabrication of any idea/data/fact/source will constitute

sufficient ground for disciplinary action by the University and can also evoke penal

action from the sources which have not been properly cited or acknowledged.

Name of the student Abenezer Defar Signature _____________

Date of submission: _____________

Place: Bahir Dar

This thesis has been submitted for examination with my approval as a university

advisor.

Advisor Name: Dr. Krishna Prasad

Advisor’s Signature: ______________________________

Page 5: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

ii

© 2018

ABENEZER DEFAR ANJORE

ALL RIGHTS RESERVED

Page 6: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

iii

Page 7: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

iv

ACKNOWLEDGEMENTS

First of all, I would like to thank GOD for making this possible. I like to express my sincere

thanks to my advisor Dr. Krishna Prasad for his continuous support and very useful

comments. He spent his precious time in commenting my work and showing me the right

directions which I found very important for my study.

My special thanks go to, Dr.-Ing waltenegus Dargie from University of Dresden for his

enthusiasm, scientific and personal guidance.

Finally, I would like to thank my family members, friends and colleagues for their support,

for the invaluable ideas and encouragement for accomplishing this study.

Abenezer Defar

Page 8: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

v

ABSTRACT

Sensor technologies have become very important today in gathering information about close

by environments and its use in wireless sensor networks (WSN) is getting widespread and

becoming popular every day. These networks are characterized by a number of sensor nodes

deployed in the field for the observation of some phenomena. The usage of WSN is ever

increasing in the diverse fields of Agriculture, Underground water resource management,

Traffic management, Crime surveillance, Dataveillance etc. Due to the limited battery

capacity in sensor nodes, energy efficiency is a major and challenging problem in such

power constrained networks. To extend the life time of wireless sensor networks as well as

conserving its power, some energy parameters have been under extensive research, which

play an important role in the reduction of power consumption. These parameters are as

energy required for operation, communication energy and battery capacity penalty. They

have a direct and indirect impact on the network’s lifetime. These parameters must be

chosen in such a way that the network use its energy resources efficiently. In This thesis we

have analyzed these parameters and developed algorithms for design optimization of

wireless sensor network through evolutionary paradigm and fuzzy control. the design

parameters optimized by the genetic algorithm include the status of sensor nodes (whether

they are active or inactive), network clustering with the choice of appropriate cluster heads

and finally the choice between two signal ranges for the simple sensor nodes. We showed

that optimal sensor network designs suggested by the genetic algorithms can optimize

battery consumption and increase network’s lifetime. The proposed algorithm

characteristics and the impact of the chosen parameters have been investigated and

illustrated in detail with various combinations. To achieve this goal, simulation algorithm

that help in analyzing the effects of the parameters on sensor network lifetime has been

designed and implemented in C++. Ultimately, results of extensive simulation studies are

presented, and conclusions are drawn which can be helpful in guiding the wireless sensor

network designer in optimally selecting the parameters proposed to improve the lifetime of

the wireless sensor network.

Keywords: WSN, Optimization, Genetic algorithm, Evolutionary algorithm, Design

optimization

Page 9: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

vi

TABLE OF CONTENTS

DECLARATION .............................................................................................................................. I

ACKNOWLEDGEMENTS ........................................................................................................... IV

ABSTRACT .................................................................................................................................... V

TABLE OF CONTENTS ............................................................................................................... VI

LIST OF ABBREVATIONS ...................................................................................................... VIII

LIST OF SYMBOLS ...................................................................................................................... IX

LIST OF FIGURES ........................................................................................................................ X

LIST OF TABLES ......................................................................................................................... XI

1. INTRODUCTION .................................................................................................................. 1

1.1. Background ................................................................................................................................... 3

1.2. Problem Statement ....................................................................................................................... 4

1.3. Objective of the study ................................................................................................................... 5

1.4. Scope of the study ......................................................................................................................... 5

1.5. Significance of the study ............................................................................................................... 6

1.6. Organization of the thesis ............................................................................................................. 6

2. LITERATURE REVIEW ....................................................................................................... 8

2.1. Wireless sensor node .................................................................................................................... 8

2.2. Wireless networking ................................................................................................................... 10

2.3. Clustering for data aggregation ................................................................................................... 15

2.4. Operating system ........................................................................................................................ 18

2.5. Applications of wireless sensor networks .................................................................................... 22

Page 10: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

vii

2.6. Issues and challenges in wireless sensor network design ............................................................ 24

2.7. Evolutionary algorithms .............................................................................................................. 25

2.8. Optimization in wireless sensor network .................................................................................... 28

2.9. Related works ............................................................................................................................. 30

3. METHODOLOGY ................................................................................................................ 31

3.1. WSN representation .................................................................................................................... 31

3.2. Fuzzy-genetic algorithm for energy optimization ........................................................................ 34

3.3. Fuzzy-Evolutionary algorithm ...................................................................................................... 38

3.4. Limiting sensor per Cluster .......................................................................................................... 38

3.5. Flow chart ................................................................................................................................... 39

3.6. Steps of the Algorithm ................................................................................................................ 41

4. RESULTS AND DISCUSSION ........................................................................................... 42

4.1. Simulation development using C++ ............................................................................................. 42

4.2. Simulation results ....................................................................................................................... 43

4.3. Results on limited vs unlimited sensors per cluster ..................................................................... 47

4.4. Results on Basic GA and proposed algorithm .............................................................................. 48

4.5. Results on fitness function parameters ....................................................................................... 50

4.6. Performance on battery-constrained WSNs ................................................................................ 52

5. CONCLUSIONS AND RECOMMENDATIONS ............................................................... 53

5.1. Conclusions ................................................................................................................................. 53

5.2. Recommendations ...................................................................................................................... 56

REFERENCES .............................................................................................................................. 57

APPENDIX ................................................................................................................................... 59

5.3. Appendix 1 C++ source code ........................................................................................................ 59

5.4. Snapshots of the simulation ........................................................................................................ 69

Page 11: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

viii

LIST OF ABBREVATIONS

CE Communication energy

OE Operational energy

BCP Battery capacity penalty

EAs Evolutionary Algorithms

WSNs Wireless Sensor Networks

LEACH Low Energy Adaptive Clustering Hierarchy

MAC Medium Access Control

HEED Hybrid energy efficient distributed clustering

IOT Internet of things

MEMS Micro Electro-Mechanical System

CH Cluster head

HSA Sensor in a high signal area

LSA Sensor in a low signal area

GA Genetic Algorithm

MOO Multi objective optimization

ABC Artificial Bee Colony

AIS Artificial Immune System

IEEE Institute of Electrical and Electronics Engineers

6LOWPAN IPv6 over Low-Power Wireless Personal Area Networks

CCA Clear channel assessment

LQI Link quality indication

SMAC Sensor Medium Access Control

CDMA Code division multiple access

TDMA Time division multiple access

TRAM Traffic adaptive MAC

PHY Physical

CTP Collection tree routing protocol

WLAN Wireless local area network

Page 12: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

ix

LIST OF SYMBOLS

Pm Mutation probability

Pc Crossover probability

f(x) Fitness function

fav Membership function

Standard deviation

µ Mean

Pm Mutation probability

Pc Crossover probability

Page 13: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

x

LIST OF FIGURES

Figure 2-1 General hardware architecture of a sensor node. ................................................ 8

Figure 2-2 Timeline for the sensor mote platforms ............................................................ 10

Figure 2-3 Network model with clustering ......................................................................... 16

Figure 2-4 One-point crossover .......................................................................................... 27

Figure 2-5 Two-point crossover ......................................................................................... 27

Figure 2-6 Uniform crossover ............................................................................................ 28

Figure 2-7 Optimization methods taxonomy ...................................................................... 29

Figure 3-1 Binary representation (on the right) and state of sensors in a randomly generated

WSN (on the left). .............................................................................................................. 32

Figure 3-2 Membership functions for fav .......................................................................... 37

Figure 3-3 Membership functions for standard deviation () ............................................ 37

Figure 3-4 pseudo code for limiting sensor per cluster ...................................................... 39

Figure 3-5 Basic genetic algorithm flow chart ................................................................... 39

Figure 3-6 Flow chart of the proposed algorithm ............................................................... 40

Figure 4-1 Quincy 2005 V1.3 C++ compiler ....................................................................... 42

Figure 4-2 Increase of fitness with generation ................................................................... 46

Figure 4-3 Decrease in number of cluster heads with generation ...................................... 46

Figure 4-4 operation mode of sensor vs generation ........................................................... 47

Figure 4-5 Average sensor per cluster with limited vs unlimited sensor per cluster .......... 48

Figure 4-6 fuzzy controlled vs fixed mutation ................................................................... 49

Figure 4-7 Impact of fitness function parameters on number of CHs ................................ 50

Figure 4-8 Impact of fitness function parameters on number of inactive sensors .............. 51

Figure 4-9 Percentages of sensors with battery capacities ................................................. 52

Page 14: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

xi

LIST OF TABLES

Table 4-1 The GA parameters settings ............................................................................... 42

Table 4-2 Fitness of chromosomes in 200th generation ..................................................... 44

Table 4-3 Sensor types in different generations and average number of active sensors per

cluster .................................................................................................................................. 45

Table 4-4 fuzzy mutation vs fixed value mutation ............................................................. 49

Table 4-5 impact of fitness function parameters with different combination .................... 50

Page 15: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

1

1. INTRODUCTION

A wireless sensor network (WSN) is a wireless network consisting of spatially distributed

autonomous devices using sensors to monitor physical or environmental conditions. Sensor

technology has made the development of small, low power, low-cost distributed devices,

which can make local processing and wireless communication, a reality. Such devices are

called sensor nodes. The sensors are deeply embedded devices that are integrated with a

physical environment and capable of acquiring signals, processing the signals,

communicating, context aware computing and performing simple computation tasks.

Sensors provide an easy solution to those applications that are based in the inhospitable and

low maintenance areas where conventional approaches prove to be impossible and very

costly for monitoring (Golsorkhtabar, 2010) . A wireless Sensor node can only equip with

limited data processing and limited power source (<0.5Ah, 1.2V)which is very low

(Akyildiz I. F., 2010) and communication capabilities are usually deployed in an ad-hoc

manner to in an area of interest to monitor events and gather data about the environment.

Examples include environmental monitoring which involves monitoring air soil and water,

condition-based maintenance, habitat monitoring, seismic detection, military surveillance,

structural health monitoring, inventory tracking, smart spaces etc.

Sensor nodes are typically disposable and expected to last until their energy drains.

Therefore, it is vital to manage energy wisely to extend the life time of the sensors for the

duration of a task. This often results in scenarios where a certain part of the network become

energy constrained and stop operating after some time. Sensor nodes failure may cause

connectivity loss and in some cases network partitioning, this can cause serious damage in

some environments that need critical monitoring. Most of the time sensor nodes are prone

to failure due to energy depletion, impact of deployment, extreme heat or fire, animal or

vehicular accidents, malicious activity and extended use.

Nowadays, wireless sensor networks and internet of things(IOT) have attracted a lot of

research attention in the recent years (Qu, 2010). It offers a rich area of research, in which

a variety of multi-disciplinary tools and concepts are employed.

Page 16: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

2

Due to technological and economic reasons, most available wireless sensor devices are

highly constrained in terms of computational, power, memory, and communication

capabilities because of that a lot of researches are trending to reduce the effect of those

constraints and enhance the usage of wireless sensor networks in various application

specific areas, to accomplish that extensive researches and experiments have been

conducted to developed different techniques and algorithms to increase the optimal usage

of the wireless sensors, those researches are reviewed on the related works section of this

document .

Over the past few years, researchers and scientists have shown great interest in developing

biologically inspired algorithms and techniques for solving various real-world problems.

Several techniques such as Genetic Algorithm (GA), Artificial Immune System (AIS), Ant

Colony Optimization (ACO), Artificial Bee Colony (ABC) algorithm, and Particle Swarm

Optimization(PSO) have been developed and successfully used for solving such problems.

Genetic algorithm is a well-known bioinspired technique, which is inspired by the principles

and processes of Darwinian theory of evolution and takes advantage of the characteristics

of the genetics such as survival of the fittest for solving problems.

Genetic algorithm basically abstracts the functions and structure of genetics into

computational systems. It considers the application of these systems for solving different

mathematical, information technology, and engineering problems. (Ramsha Rizwan, 2015).

In this study, we used wireless sensor network design, as optimization problem through

Genetic Algorithm (GA) technique and develop algorithms for design optimization of

wireless sensor network. Also, we examine the effects of Genetic algorithm parameters

including population size, mutation probability, selection and crossover methods on the

design. The generic program for design optimization of WSNs is included in the appendix

of this document, but also there are different variation of these programs used for this study.

Page 17: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

3

1.1. Background

Rapid advances in the areas of sensor design, information technologies, and wireless

networks have paved the way for the proliferation of wireless sensor networks. These

networks have the potential to interface the physical world with the virtual (computing)

world on an unprecedented scale and provide practical usefulness in developing a large

number of applications, including the protection of civil infrastructures, habitat monitoring,

precision agriculture, toxic gas detection, supply chain management, and health care

(Dargie, 2010).

A wireless sensor network typically consists of hundreds or thousands of sensor nodes

which are deployed manually or randomly over a target region. The sensor nodes sense the

local data and forward it to a remote base station (BS) called sink. (Akyildiz I. F., 2002).

However, the main limitation of WSN is that the sensor nodes are powered by small

batteries and recharging or replacing the batteries may not be always possible as the sensor

nodes are deployed in hostile environment for many applications. Therefore, energy

conservation for the WSNs is a challenging issue for prolonging network life time. (Jana,

2014). Many researches have been conducted to increase the life time of the wireless sensor

node some of them are designing energy efficient clustering algorithms (Ghiasi, 2002),

MAC layer protocols (Demirkol, 2006), routing techniques (Al-Karaki, 2004), optimization

algorithms (Ferentinos, 2007) most of the researchers found promising results in prolonging

the life time of sensor nodes by applying different methods and procedures. This study is

also motivated and got a baseline from the research conducted on different optimization

problems of wireless sensor network and the application of evolutionary algorithms for

optimization problems.

In many previously conducted studies evolutionary algorithms offer a good solution for

optimization problems in several problem domain areas like engineering, mathematics and

information and communication technology.

Page 18: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

4

1.2. Problem Statement

Nowadays the application of wireless sensor network increased in many areas such as

protection of civil infrastructures, habitat monitoring, precision agriculture, toxic gas

detection, supply chain management, and health care, etc. in fact, wireless sensor network

is also one of the most important elements in internet of things (IOT) paradigm. However,

wireless sensor nodes are prone to failure due to energy depletion, impact of deployment,

fire or extreme heat, animal or vehicular accidents, malicious activity, or by extended use.

Form the mentioned failure causes 81% of WSN node failures occur due to energy depletion

because wireless sensor node can only be equipped with a limited power source most of the

time (<0.5Ah, 1.2V) (Akyildiz I. F., 2010).

As sensor nodes carry limited energy, in general irreplaceable power sources, one of the

most important constraints for WSNs is the low power consumption requirement. Thus,

power conservation is of tremendous importance. Most of sensor nodes in WSN are

equipped with non-rechargeable batteries that have limited lifetime, therefore they must be

easily and rapidly deployed in large numbers and, once deployed, must form a suitable

network with a minimum of human intervention. These requirements must be met with a

minimum of power consumption because the problem that the sensors have very limited

battery life is aggravated by the fact that recharging is difficult and sometimes practically

impossible. therefore energy-efficient solutions are required for each aspect of wireless

sensor network to deliver the potential advantages of the WSN phenomenon because in both

existing and future, solutions for WSNs energy efficiency is the grand challenge.

Nodes in a wireless sensor network have non-uniform energy consumption rates. As a result,

early death among highly loaded nodes is a common phenomenon which makes it

impossible to use the full capacity of the network. Our claim is that significant reductions

in energy consumption can be achieved if wireless networks are designed specifically for

minimum energy. In order to maximize the total lifetime of a wireless network, there must

be energy efficient design optimization method. Previous researches show that the way

sensor networks are organized internally plays an important role in decreasing the energy

budget to perform certain functions, and therefore proper design of the sensor network

architecture is an important goal to be pursued.

Page 19: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

5

Hence, this research addresses the following research questions:

• Can the current approaches optimize WSNs design in term of energy?

• Does the change on genetic algorithm parameters have effect on the design

optimization?

• Which evolutionary algorithm is suitable for design optimization of wireless sensor

network.

• Is genetic algorithm effective in design optimization of WSNs.

1.3. Objective of the study

General objective:

✓ The general objective of this study is to develop algorithms for design optimization

of wireless sensor networks.

Specific objectives:

✓ To identify appropriate evolutionary algorithm for the problem

✓ To determine the effect of energy consuming constituents and their prevalent

parameters on energy consumption in WSNs.

✓ To propose algorithms for design optimization of wireless sensor networks

✓ To develop simulation models

✓ To study the performance of the algorithms with different parameters.

1.4. Scope of the study

This research assumes that wireless sensor network environment is simulated with static

nodes and cluster-based routing. It is not within the scope of this study to deploy and test

the wireless sensor network; And also, doesn’t include study on medium access control and

data aggregation of WSNs. Our research work target is to propose algorithm that bring

optimal design of wireless sensor network, which is energy efficient and responsive to

Page 20: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

6

network. The performance of the proposed method will be demonstrated and simulated

using C++.

1.5. Significance of the study

As the usage of wireless sensor network increases, elongating the life time of the wireless

sensor networks become the main agenda. Extensive researches in the area shows that there

is an urgent need of energy efficient design optimization mechanisms for the wireless sensor

networks. and, it is very important that network failures due to un-efficient WSNs designs

are detected in advance and appropriate measures are taken to sustain network operation.

also, this reduces maintenance rate and cost due to un-efficient WSNs design, also improves

safety and reliability by reducing the risk caused by unattended environment because of

sensor node failures or network disconnection specially on critical areas that need

continuous monitoring.

Additionally, the study output can be used as an input for other further studies on the

problem domain and the study can be taken as a prototype for the next researchers to add

knowledge and direction on design optimization, energy efficiency, clustering and fault

tolerance in wireless sensor networks.

1.6. Organization of the thesis

This research work is organized into the following five chapters:

Chapter one: This chapter includes the introduction of the study, a statement of the problem,

objective of the study, the significance of the study and the scope.

Chapter two: This chapter covers literature review, which gives a detailed overview of the

study area, various optimization techniques, review of related works and challenges of the

domain.

Chapter Three: This chapter discusses the design optimization algorithm with evolutionary

paradigm and fuzzy controller which is designed and developed in this research work.

Page 21: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

7

Chapter Four: This chapter deals with the simulation activity undertaken to implement the

algorithm described in chapter three; the simulation setup and the results of the extensive

simulations and discussion are discussed.

Chapter Five: This chapter provides conclusion and recommendation for the future research

direction for scholars interested in the area.

Page 22: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

8

2. LITERATURE REVIEW

In this Chapter, a brief overview of the field of wireless sensor networks and evolutionary

algorithms are provided. The different components of WSN and the approaches used to

design optimization of WSNs are reviewed and presented. Evaluation standards for the

performance of the algorithms which are used for the evaluation purpose are also presented

in this chapter.

2.1. Wireless sensor node

A wireless sensor node is generally composed of four basic components: a sensing unit, a

processing unit, a power unit and a transceiver unit. The general architecture and the major

components of a wireless sensor device (node) are illustrated in Figure 2.1 below. moreover,

additional components can also be integrated into the sensor node depending on the

application. These components as shown by the dashed boxes in Figure 2.1

Source (Akyildiz I. F., 2010)

Figure 2-1 General hardware architecture of a sensor node.

When choosing the hardware components for a wireless sensor node, obviously the

application’s requirements play a decisive factor with regard mostly to size, cost, and energy

consumption of the nodes communication and computation facilities as such are often

considered to be of acceptable quality.

Page 23: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

9

The hardware basis of WSNs is driven by advances in several technologies. First, the

advancement of system-on-chip technologies. Second, the availabilities of RF circuits for

short-distance communication. Thirdly, Micro-Electro-Mechanical System (MEMS)

technology is now available to integrate a rich set of sensors onto the same chip. The

different components are described as follows (Badjate, 2013).

Processing unit: The processing unit is the main controller of the wireless sensor node,

through which every other component is managed. The processing unit may consist of an

on-board memory or may be associated with a small storage unit integrated into the

embedded board. The processing unit manages the procedures that enable the sensor node

to perform sensing operations, run associated algorithms, and collaborate with the other

nodes through wireless communication.

Mobilizer: A mobilizer may sometimes be needed to move sensor nodes when it is

necessary to carry out the assigned tasks. Mobility support requires extensive energy

resources and should be provided efficiently. The mobilizer can also operate in close

interaction with the sensing unit and the processor to control the movements of the sensor

node.

Communication Device: is the hardware to enable the networking capability of the sensor

nodes. Some usual methods for communication between the sensor nodes are Radio

Frequencies (RF), optical communication, etc. RF is generally used because it provides a

long range of transmission and reception at high rate with acceptable error rates for the

required energy and it does not require a direct line of sight between two neighbors.

Sensor: is an electronic component that measures the physical quantity and converts to the

type that can be read by the user or other electronic devices, for example, a microprocessor.

Micro Electro-Mechanical System (MEMS) technology is now available to integrate a rich

set of sensors onto the same chip. They are interfaces to the physical world which sense the

environment parameter and convert them to a raw data (mostly voltage or current) for

further processing within the processor. Nowadays commercially available sensors include

magnetic, acoustic/ultrasound, and seismic sensors, thermal and electromagnetic sensors,

Page 24: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

10

optical transducer, chemical and biological transducer, accelerometer, and barometric

pressure detectors, etc. These sensors can be used in a broad range of applications.

Power Supply: For wireless sensor nodes, the power supply is a crucial system component.

There exists a large quantity of power supply options for a sensor node. The most common

option is the use of batteries; other options are scavenging energy from the environment

where the sensor node is exposed, the most popular example is solar cell. The integration of

the above technologies has made it possible to integrate sensing, computing,

communication, and power components in to tiny sensor nodes.

There are several sensor nodes available for use in wireless sensor network research and

development. Some examples of such wireless sensor nodes are Mica mote family, EYES

nodes, Iris, SHIMMER, cricket, BTnodes, and ScatterWeb.

Figure 2-2 Timeline for the sensor mote platforms. adapted from (Akyildiz I. F., 2010)

2.2. Wireless networking

Wireless sensor networks have features that are different from traditional wireless networks.

The main features of a WSN include its ability to cope with node failures, node's dynamic

mobility and network topology, frequent communication failures, the presence of

heterogeneous nodes, scalability to large scale deployment, ability to withstand harsh

environment conditions, and node's severe power constraints. This makes wireless sensor

network an active research area to design different models, algorithms and protocols. IEEE

802.15.4 is the main standard technology for WSNs which intends to offer the fundamental

Page 25: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

11

network lower layers and focuses on low-cost and low-speed ubiquitous communication

between devices. (Chandane, 2012). In the next sections, IEEE 802.15.4 standard which

covers the Physical and Medium Access Control (MAC) layer of Wireless Sensor Networks

and the issues of routing protocols for wireless sensor networks are reviewed.

2.2.1. physical protocols

The physical layer (PHY) defines the physical and electrical characteristics of the network,

for instance, specifying the receiver sensitivity and transmitting output power. The physical

layer also specifies the raw data rate characteristics, which can either be selected to offer a

larger coverage area or higher throughput. The basic task of this layer is thus data

transmission and reception at the physical/electrical level, which involves modulation and

spreading techniques that map bits of information in such a way they can travel through the

air. The PHY tasks can be summarized as follows:

1. Enable/disable the radio transceiver (since low duty cycle saves energy)

2. Compute Link Quality Indication for received packets

3. Energy detection within the current channel by means of signal strengths estimation

4. Listen to channels and declare availability or not.

Many of the WSN systems today are based on IEEE 802.15.4 protocols such as ZigBee and

IPv6 over Low-Power Wireless Personal Area Networks(6LoWPAN) due to their low cost

and power consumption and targeted at battery-powered devices in wireless control and

monitoring applications. IEEE 802.15.4 standard covers the Physical and Medium Access

Control (MAC) layer of Wireless Sensor Networks (Singhal, 2012).

The 802.15.4 physical layer specifies two different services: The PHY data service which

controls the transmission and reception of the PHY Protocol Data Units (PPDUs) and the

PHY management service performs Energy Detection in the channel and performs Clear

Channel Assessment (CCA) before sending the messages and provides Link Quality

Indication (LQI) for the received packets.

Page 26: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

12

2.2.2. Medium Access Layer Protocols for WSN

A Medium Access Control (MAC) protocol is the first protocol layer above the Physical

Layer (PHY). Its fundamental task is to control the access of several nodes to a shared

medium in such a way that certain application specific performance requirements are

satisfied. The IEEE 802.11 protocol was the first standard for wireless local area networks

(WLAN) (Standard, 1999). Even though many efforts have been made to use 802.11 for

WSNs, the high-power consumption and excessively high data rate of IEEE 802.11 protocol

are not suitable for WSNs. This fact has motivated several research efforts to design energy

efficient MAC protocols. (Demirkol, 2006) made a survey on the different MAC protocols

including Sensor-MAC (SMAC), WiseMAC, Spatial TDMA and CDMA, Traffic-Adaptive

MAC protocol (TRAMA), Node Activation Multiple Access (NAMA), etc. and presented

the advantages and limitations of each MAC protocol on their study.

The IEEE 802.15.4 MAC Standard provides information about type and association of

devices, channel access mechanism, packet delivery, frame structure, guaranteed packet

delivery, possible network topologies and security issues. In order to communicate with the

upper layers, it provides the MAC data service and the MAC management service. The

MAC data service enables transmission of MAC Protocol Data Units across the PHY data

service. The MAC sub layer features include beacon management, channel access, frame

validation, acknowledged frame delivery, association and disassociation. The MAC also

provides support for implementing defined security mechanisms like Data Encryption,

Frame Integrity and Sequential Freshness (Xiao, 2006).

2.2.3. Routing Layer Protocols for WSN

In this subsection, we will describe the design issues and challenges of routing protocols

and the basic operations of collection tree routing protocol(CTP), focusing on the details

that are relevant to the study.

In wireless sensor applications like habitat monitoring that require the deployment of large

number of nodes, to transfer the packet that is sensed by sensor nodes to the base station,

intermediate nodes are required to relay packets for the successful delivery of the packet to

Page 27: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

13

the base station. Otherwise the packets will be lost due to capacity and low transmission

range of the sensor nodes. Such an intermediate node has to decide to which neighbor to

forward the incoming packet which is not destined for it. Such decision is made by the

routing protocol which runs on every node in the network. There exist different routing

protocols for wired and ad-hoc networks. However, they are hardly applicable for wireless

sensor networks due to their high-power consumption. They are also designed to support

general routing request in wireless networks, without considering specific communication

pattern in WSN. Customization of these protocols for WSN and the developments of new

routing techniques are needed, even if it is very challenging due to the inherent

characteristics that distinguish these networks from other wireless networks like mobile ad-

hoc networks or cellular networks. Some of the routing challenges and design issues that

affect the routing process in WSNs are widely described in (Al-Karaki, 2004), some of the

issues are:

• Node Deployment: Node deployment in WSNs is application dependent and one of the

issues that affects the performance of the routing protocol. The deployment can be either

deterministic or randomized. In deterministic deployment, the sensors are manually placed,

and data is routed through pre-determined paths. However, in random node deployment, the

sensor nodes are scattered randomly creating an infrastructure in an ad-hoc manner. If the

resultant distribution of nodes is not uniform, optimal clustering becomes necessary to allow

connectivity and enable energy efficient network operation.

• Energy Consumption without Losing Accuracy: sensor nodes can use their limited

supply of energy for performing computations and transmitting information in a wireless

environment. Thus, energy conserving forms of communication and computation are very

essential. The malfunctioning of some sensor nodes in the network due to power failure can

cause significant topological changes and might require rerouting of packets and

reorganization of the network. Thus, the routing protocol designed for an application where

the sensor nodes get power supply from battery and left unchecked for long time, as the case

of our proposed work, should consider the limited energy supply of the sensor nodes.

Page 28: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

14

• Data Reporting Model: is the other issue mentioned in (Al-Karaki, 2004).Data sensing

and reporting in WSNs is dependent on the application and the time criticality of the data

reporting. Data reporting can be categorized as either time-driven (continuous), event-

driven, query-driven, or hybrid. The time-driven delivery model is suitable for applications

that require periodic data monitoring. As such, sensor nodes will periodically switch on their

sensors and transmitters, sense the environment and transmit the data of interest at constant

periodic time intervals. In event-driven and query-driven models, sensor nodes respond

immediately to sudden and extreme variations in the value of a sensed attribute due to the

occurrence of a certain event or a query is generated by the base station. A combination of

the previous models is also possible.

• Node/Link Heterogeneity: In many studies, all sensor nodes were assumed to be

homogeneous, i.e., having equal capacity in terms of computation, communication, and

power. But in fact, depending on the application a sensor node can have different role or

capability. Therefore, the existence of heterogeneous set of sensors raises many technical

issues related to data routing, and sensor data fusion.

• Fault Tolerance: Some sensor nodes may stop functioning or be blocked due to lack of

power, physical damage, or environmental interference. The failure of few sensor nodes

should not affect the overall task of the wireless sensor network. If many nodes fail, MAC

and routing protocols must accommodate formation of new links and routes to the data

collection base stations.

• Scalability: The number of sensor nodes deployed in the sensing area may be in the order

of hundreds or thousands, or more. Any routing arrangement must be able to work with this

enormous number of sensor nodes.

• Network Dynamics: Most of the network architectures assume that sensor nodes are

stationary. But in fact, mobility of either the base station or sensor nodes becomes necessary

sometimes in many applications. Routing messages from or to moving nodes is more

challenging since route stability becomes an important issue, in addition to energy,

bandwidth, etc.

Page 29: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

15

• Coverage: In wireless sensor networks, each sensor node in the network perceive a certain

area of the environment. A given sensor’s view of the environment is limited both in range

and in accuracy; it can only cover a limited physical area of the environment. Hence, area

coverage is also an important design parameter in WSNs.

• Data Aggregation: Since sensor nodes may generate significant redundant data, similar

packets from multiple nodes can be aggregated so that the number of transmissions is

reduced. Data aggregation is the combination of data from different sources according to a

certain aggregation function, example, duplicate suppression, minima, maxima and average.

This technique has been used to achieve energy efficiency and data transfer optimization in

several routing protocols. Detail description about data aggregation is given in section 2.3

2.3. Clustering for data aggregation

As sensor networks are projected to scale to huge numbers of nodes, protocol scalability

becomes an important design criterion. If the sensors are managed directly by the base

station, communication overhead, management delay, and management complexity become

limiting factors in network performance. Clustering has been proposed by researchers to

group several sensors, usually within a geographic neighborhood, to form a cluster that is

managed by a cluster head.

Clustering provides a framework for resource management. It can support many important

network features within a cluster, such as channel access for cluster members and power

control, as well as between clusters, such as routing and code separation to avoid inter-

cluster interference. Moreover, clustering distributes the management responsibility from

the base station to the cluster heads, and provides a convenient framework for data fusion,

local decision making, local control, and energy savings (Boukerche, 2005).

The following Figure 2.3 shows a network model with clustering and having three clusters

and each cluster have seven sensor that communicate with the cluster head in charge.

Page 30: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

16

Figure 2-3 Network model with clustering

Owing to a variety of advantages, clustering is becoming an active branch of routing

technology in WSNs. In the next sub sections, we present a fine-grained explanation on the

two most popular clustering routing protocols.

2.3.1. LEACH

Low Energy Adaptive Clustering Hierarchy(LEACH) protocol aims to minimize energy

consumption in WSNs through a cluster-based operation. The goal of LEACH is to

dynamically select sensor nodes as cluster heads and form clusters in the network. The

communications inside the clusters are directed to the cluster head, which performs

aggregation. Cluster heads then directly communicate with the sink to relay the collected

information from each cluster. LEACH also changes the cluster head role dynamically such

that the high-energy consumption in communicating with the sink is spread to all sensor

nodes in the network.

The operation of LEACH is controlled through rounds, which consist of several phases.

During each round, each cluster establishment stays the same, and the cluster heads are

selected at the start of each round. A round is separated into two phases, the setup phase and

steady state phase. During the setup phase, cluster heads are selected, clusters are formed,

Page 31: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

17

and the cluster communication schedule is determined. During the steady state phase, data

communication between the cluster members and the cluster head is performed. The

duration of the steady state phase is longer than the duration of the setup phase in order to

minimize the overhead.

The setup phase of LEACH consists of three phases: advertisement, cluster setup, and

schedule creation. LEACH aims to randomly select sensors as cluster heads during the

beginning of each round.

The cluster head selection is performed through the advertisement phase, where the sensor

nodes broadcast a cluster head advertisement message. Primarily, a sensor node chooses a

random number between 0 and 1. If this random number is less than a threshold T (n), the

sensor node becomes a cluster head. T (n) is calculated as

………………… Equ 2-1

where P is the desired percentage to become a cluster head, r is the current round, and G is

the set of nodes that have not been selected as a cluster head in the last 1/P rounds. The

selected cluster heads then advertise to their neighbors in the network that they are the new

cluster heads. For this operation, LEACH relies on a CSMA-based random access scheme

to avoid advertisement collisions from multiple cluster heads (Akyildiz I. F., 2010).

2.3.2. HEED

Hybrid energy efficient distributed clustering (HEED) approach for ad-hoc sensor networks

is an algorithm that assumes the sensor nodes are quasi-stationary 1and node location

unaware, the links are symmetric, and energy consumption is non-uniform for all nodes. It

periodically selects cluster heads according to the sensor residual energy and a node

closeness to its neighbors. Initially, HEED sets an initial percentage of cluster heads among

1 Quasi-stationary meaning standing still; not moving.

Page 32: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

18

all n nodes (Cprob) and its probability of becoming a cluster head, CHprob, before a node starts

executing HEED, is:

…………….…….. Equ 2-2

Where Eresidual is the estimated residual energy of the node, Emax is a reference maximum

energy, and Cprob is a small constant fraction used to bound the number of initial cluster

head announcements. CHprob is not allowed to fall below a small probability, Pmin, to ensure

constant time termination. During each iteration, a node arbitrates among the cluster head

announcements it has received to select the lowest cost cluster head. If it has not received

any announcements, it elects itself to become a cluster head with probability CHprob. If

successful, it sends an announcement indicating its “willingness” to become cluster head.

The node then doubles its probability CHprob, waits for a short iteration interval tc, and begins

the next iteration. A node stops this process one iteration after its CHprob reaches 1.

If a node elects to become a cluster head, it sends an announcement message cluster head

msg (Node ID, selection status, cost), where the selection status is set to tentative CH, if its

CHprob is less than 1, or final CH, if its CHprob has reached 1. A node considers itself

“covered” if it has heard from either a tentative CH or a final CH. If a node completes HEED

execution without selecting a cluster head that is final CH, it considers itself uncovered, and

announces itself to be a cluster head with state final CH. A tentative CH node can become

a regular node at a later iteration if it finds a lower cost cluster head. Note that a node can

elect to become a cluster head at consecutive clustering intervals if it has high residual

energy and low cost (Younis, 2004).

2.4. Operating system

In most cases an operating system is defined as the master program existing between the

computer hardware and the user, in this sub section we review most broadly used operating

systems for sensor nodes. Obviously, the main purpose of operating system(OS) is

coordination and management of various system resources, which may include hardware

Page 33: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

19

resources such as hard disk, memory, peripheral device management, or non-hardware

resources such as managing processor timeslots.

In most wireless sensor networks, sensors implement a basic operating system containing

the minimum functions essential to perform their tasks. This minimalist approach is of great

importance because of the extremely resource constrained nature of these sensing devices;

operating system code and application code must exist in devices having much less than one

megabyte (1 MB) of memory. There are several sensor-based operating systems in use

today; some of them are TinyOS, mate, Mantis OS, EYES OS, EMERALDS, and picOS.

In the following section, we review some of the mentioned operating systems.

TinyOS: is de-facto 2standard operating system for sensor nodes. It is written using the nesC

language (Chien, 2011) and provides an event driven operating system. The TinyOS

component library includes network protocols, distributed services, sensor drivers, and data

acquisition tools. This OS supports a wide range of hardware platforms and has been used

on numerous generations of sensors nodes. The design of TinyOS allows application

software to access hardware directly when required. it is a tiny micro-threaded OS that

attempts to address two issues: how to guarantee concurrent data flows among hardware

devices, and how to provide modularized components with little processing and storage

overhead. These issues are important since TinyOS is required to manage hardware

capabilities and resources effectively while supporting parallel operation in an efficient

manner. TinyOS uses an event-based model to support high levels of concurrent application

in a very small amount of memory. TinyOS achieves higher throughput. It can rapidly create

tasks associated with an event, with no blocking or polling. When CPU is idle, the process

is maintained in a sleep state to conserve energy.

TinyOS designs a hardware abstract component called the radio-frequency module (RFM)

for the radio transceiver, and a synthetic hardware component which is called radio byte,

that handles data into or out of the underlying RFM. An evaluation of TinyOS shows that it

attains the following performance improvements:

• It requires very little code and a small amount of data.

2 De-facto means in reality

Page 34: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

20

• Events are propagated quickly and the rate of posting a task and switching the

corresponding context is very high.

• It enjoys efficient modularity.

Mate: is designed to work on the top of TinyOS as one of its components. It is a byte-code

interpreter that aims to make TinyOS accessible to nonexpert programmers and to enable

quick and efficient programming of an entire sensor network. In Mate, a program code is

made up of capsules. Each capsule has 24 instructions, and the length of each instruction is

1 byte. The capsules contain type and version information, which makes code injection easy.

Mate capsules can deploy themselves into the network. Mate implements a beaconless

(BLESS) ad hoc routing protocol as well as the ability to implement new routing protocols.

A sensor node that receives a newer version of a capsule installs it. Through hop-by-hop

code injection, Mate can program the entire network. Capsules are classified into four

categories: message send, message receive, timer, and subroutine. An event can trigger Mate

to run. It can be used not only as a virtual machine platform for application development,

but also as a tool to manage and control the entire sensor network.

MagnetOS: is a distributed adaptive operating system designed specifically for application

adaptation and energy conservation. Other operation systems do not provide a network-wide

adaptation mechanism or policies for application to effectively utilize the underlying node

resources. The burden of creating adaptation mechanisms (if any) is on the application itself.

This approach is usually not energy efficient. The goals of MagnetOS are to adapt to the

underlying resource and its changes in a stable manner, to be efficient with respect to energy

conservation, to provide general abstraction for the applications, and to be scalable for large

networks.

MANTIS: is a multithread embedded operating system, which with its general single-board

hardware enables flexible and fast deployment of applications. With the key goal of ease

for programmers, MANTIS uses classical layered multithreaded structure and standard

programming language. The layered structure contains multithreading, preemptive

scheduling with time slicing, I/O synchronization via mutual exclusion, a network protocol

stack, and device drivers. The current MANTIS kernel realizes these functions in less than

500 bytes of RAM. MANTIS uses standard C to implement the kernel and API. In the

Page 35: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

21

current implementation of MANTIS, the RAM size allocated to each new thread is fixed.

The thread table stored in a global data structure has a capacity for of items, each of which

is 10 bytes and is used to store thread-related information. The thread scheduler in MANTIS

is priority based and round robin within each priority level. The scheduler is triggered only

by timer interrupts from hardware to perform context switching. In MANTIS, other

interrupts are handled by device drivers.

EYES OS: As indicated earlier, the operating system for WSNs should be very small in

terms of memory requirement and coding, should enjoy power awareness, and should be

capable of distribution and reconfiguration. EYES OS uses an event driven model and task

mechanism to realize these objectives. It works in a simple sequence as follows: perform a

computation, return a value, and enter the sleep mode. The task can be scheduled using a

FIFO, priority, or deadline-based approach (such as EDF), and is triggered by events in a

nonblocking manner. EYES OS defines an application programming interface (API) locally

and for the network components. The local information component provides functions such

as access to sensor node data, availability of resources and their status, and setting of

parameters or variables in sensor nodes. The network component provides functions to

transmit and receive data and to retrieve network information. In summary, EYES OS

realizes two groups of functions: those that can be executed at boot time to upload software

module, and those that can provide node localization information.

EMERALDS: is an extensible microkernel written in C++ for embedded, real-time

distributed systems with embedded applications running on slow processors (15 to 25 MHz)

and with limited memory (32 to 128 kB). It supports multithreaded processes and full

memory protection, which are scheduled using combined earliest deadline first (EDF) and

a rate-monotonic (RM) scheduler. The device drivers are implemented at the user level,

whereas interrupt handling takes place at the kernel level. EMERALDS use semaphores and

condition variables for synchronization with priority inheritance at the same time and

provides full semaphore semantics to reduce the amount of context switching. Inter-

processor communication (IPC) is realized based on message passing, mailboxes, and

shared memory, optimized especially for intranode, inter task communication. EMERALDS

Page 36: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

22

do not use a mailbox; it uses global variables to exchange information between tasks, to

avoid message sending. EMERALDS do not consider networking issues.

PicOS: One property of OS microcontrollers with limited RAM is to try to allocate as little

memory as possible to a process or thread. PicOS is written in C for a microcontroller with

limited on-chip RAM (e.g., 4 kB). In PicOS, all tasks share the same global stack and act as

coroutines with multiple entry points and implicit control transfer, which is different from

classical multitasking approaches. In PicOS, each task is like a finite state machine (FSM)

where the state transition is triggered by events.

The FSM approach is effective for reactive applications whose primary role is to respond to

events rather than to process data or crunch numbers. The CPU cycle is multiplexed among

multiple tasks, but the tasks can be preempted only at the FSM state boundary. It has few

resource requirements and supports multitasking, a flat structure for processes but perhaps

not good for real-time applications.

2.5. Applications of wireless sensor networks

Wireless sensor networks have gained considerable popularity due to their flexibility in

solving problems in different application domains and have the potential to change our lives

in many ways. These ever-increasing applications of WSNs can be mainly categorized into

five categories, military, environment, health, home and industrial. It is possible to expand

this classification with more categories such as space exploration, chemical processing and

disaster relief (Akyildiz I. F., 2002). For our case, we are going to discuss about the five

main categories.

Environmental Applications: Some environmental applications of sensor networks

include monitoring and tracking the movements of birds, small animals, and insects;

monitoring environmental conditions that affect crops and livestock; irrigation; macro

instruments for large-scale earth monitoring and planetary exploration; chemical/biological

detection; precision agriculture; biological, earth, and environmental monitoring in marine,

soil, and atmospheric contexts; forest fire detection; meteorological or geophysical research;

Page 37: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

23

flood detection; bio-complexity mapping of the environment; and pollution study (Akyildiz

I. F., 2010).

Military Applications: Wireless sensor networks can be an integral part of military

command, control, communications, computing, intelligence, surveillance, investigation

and targeting systems. The fast deployment, self-organization and fault tolerance

characteristics of sensor networks make them a very promising sensing technique for

military targeting systems. Since sensor networks are based on the dense deployment of

disposable and low-cost sensor nodes, demolition of some nodes by hostile activities does

not affect a military operation as much as the destruction of a traditional sensor, which

makes sensor networks a better approach for battlefields. Some of the military applications

of sensor networks are monitoring friendly forces, equipment and ammunition; battlefield

surveillance; reconnaissance of opposing forces and terrain; targeting; battle damage

assessment; and nuclear, biological and chemical (NBC) attack detection and

reconnaissance (Akyildiz I. F., 2002).

Health Applications: Some of the health applications of sensor networks are providing

interfaces for the disabled; integrated patient monitoring; diagnostics; drug administration

in hospitals; monitoring the movements and internal processes of insects or other small

animals; telemonitoring of human physiological data; and tracking and monitoring doctors

and patients inside a hospital (Akyildiz I. F., 2002).

Home Applications: As technology advances, smart sensor nodes and actuators can be

embedded in appliances such as vacuum cleaners, microwave ovens, refrigerators, and DVD

players as well as water monitoring systems. These sensor nodes that are embedded in

domestic devices can interact with each other and with the external network via the Internet

or satellite. They allow end-users to more easily manage home devices both locally and

remotely. Accordingly, WSNs enable the interconnection of several devices at residential

places with suitable control of various applications at home.

Industrial Applications: Networks of wired sensors have long been used in industrial

arenas such as industrial sensing and control applications, building automation, and access

control. However, the cost associated with the deployment of wired sensors limits the

Page 38: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

24

applicability of these systems. Therefore, WSNs became the promising alternative solution

for these systems as they offer significant cost savings and enable new functionalities. Some

of the commercial applications are monitoring material exhaustion, building virtual

keyboards, managing inventory, monitoring product quality, creating smart office spaces,

environmental control of office buildings, robot control and guidance in automatic

manufacturing environments (Matin, 2012) , (Dargie, 2010) and so many others.

2.6. Issues and challenges in wireless sensor network design

Wireless sensor networks differentiate themselves from traditional networks due to their

application-specific and energy constraints. Their structure and features depend on their

electronic, mechanical and communication limitations but also on application-specific

requirements. One of the major and probably most significant challenge in the design of

WSNs is their application-specific characteristic. A sensor network is set up to fulfil a

specific task and the data collected from the network may be of different types due to various

application scenarios. Respectively, different types of applications have their own specific

requirements. These requirements are turned into specific design properties of a WSN. In

other words, a WSN's architecture directly depends on the assigned application scenarios.

For the acceptable performance of a given task, the optimal WSN infrastructure should be

selected out of the hundreds of network solutions before the practical deployment. Similarly,

an issue that has been frequently emphasized in the research literature is the fact that energy

resources are significantly limited (Akyildiz I. F., 2002) and recharging or replacing the

battery of sensor nodes may be difficult or impossible. Hence, power efficiency often turns

out to be the major performance metric, directly influencing the network lifetime. Power

consumption according to the functioning of a sensor node can be divided into three

domains: sensing, communication, and data processing. There has been research interest in

hardware improvements to optimize the energy consumed by sensing and data processing.

Numerous studies on energy efficiency of WSNs have been discussed and several protocols

and algorithms that lead to optimal connectivity topologies for power conservation of

wireless sensor networks have been proposed in (Ghiasi, 2002) and (Zhou, 2003).

Page 39: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

25

According to (Sukhwinder, 2013) Major issues that affect the design and performance of a

wireless sensor network are energy, self-management, hardware and software issues,

operating system, MAC layer issues, quality of service, security, architecture, data

collection and transmission, deployment, limited memory and storage space, physical

attacks and security, fault tolerance, heterogeneity, real time operation, synchronization and

localization. Therefore, solutions for those problem domain issues are needed to solve the

problems and optimize the resource usage through different algorithms.

2.7. Evolutionary algorithms

Since the middle of the 20th century and the emergence of computers, the idea of mimicking

some of the nature’s mechanisms to create artificial intelligence (AI) has attracted many

researchers to computer science. Indeed, many fields of research have emerged following

these principles. Among them evolutionary algorithms (EAs) propose to use nature-inspired

evolving strategies for solving complex problems. More precisely, EAs are based on the

Darwinian theory of evolution (Khalil, 2011), which describes the capacity of biological

systems to modify their genetic material to adapt to a changing environment and ensure their

survival.

2.7.1. Basic components of evolutionary algorithm

Different components are specific to evolutionary algorithms(EAs) and shared between all

the existing variants. These include solution representation, selection strategy, and variation

operators. Such components must be carefully defined to efficiently apply EAs. The

following subsections review some detailed information on these components.

Representation: One of the first and fundamental steps when using an evolutionary

algorithm is to define the encoding of solutions to the problem. This is also linked to the

fact that genetic operators are dependent on the chosen encoding. In biological terms, the

encoding is defined as the genotype, while the phenotype defines the solution itself. Many

different representations have been proposed in the literatures, from simple linear ones as

binary encoding or permutation to complex nonlinear ones like trees.

Page 40: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

26

Fitness Function: In evolutionary computation, the fitness function f(x) represents the

objective of the problem. It is used to assign a value to an individual, that is, it measures the

quality of the genotype in the phenotype space. It permits sorting the solutions in the

population based on their performance, which is later used in the selection and replacement

processes. The fitness function is problem dependent, and its definition is crucial as it is

responsible for guiding the search to good solutions.

Selection: The selection operator is the first genetic operator involved in the EA process. It

stochastically chooses individuals to be included in the mating pool. As already mentioned,

it is a fitness-dependent strategy that drives the search to better solutions. Many different

selection operators exist. We here list a few prominent ones:

✓ Roulette wheel selection: Simplest selection scheme, also called stochastic

sampling with replacement. The chance of a chromosome 3 to get selected is

proportional to its fitness, that is, it is equal to its fitness divided by the total

population fitness. One disadvantage is that fittest individuals will be assigned a high

probability and thus might lead to premature convergence of the algorithm.

✓ Tournament selection: The tournament operator selects m individuals at random

and inserts the best individual among the m in the mating pool. The value of m is

usually comprised between 1 and 5, and the process has to be repeated N times for

a population of size N. A variant called soft tournament exists in which the winner

is accepted with some predefined probability.

✓ Rank selection: The rank selection operator assigns a rank to each individual in the

population depending on its fitness, ranging from 1 for the worst individual to N−1

for the best individual. The selection probability is then linearly assigned based on

the individuals’ rank value.

Crossover: The crossover operation, also named recombination, produces an offspring by

mixing the genetic material of two or more parent individuals with some probability pc

3 A chromosome is one such solution to the given problem.

Page 41: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

27

(typically between 0.6 and 1). The objective is to combine the genes of both parents in order

to produce better offspring. The most known crossover types are:

✓ One-point crossover: One-point crossover is also referred to as single point

crossover. One position is selected uniformly at random within the chromosome

length, and the genes of the two parents are exchanged at this point to create two

offspring.

Figure 2-4 One-point crossover

✓ Two-point crossover: Two-point crossover is one instantiation of n-point crossover

where n = 2. Two positions are selected uniformly at random to exchange the genetic

material of the parents and produce two offspring.

Figure 2-5 Two-point crossover

✓ Uniform crossover: Uniform crossover (Syswerda, 1989) does not assume any

specific crossing point(s), but instead each gene of the offspring is randomly chosen

from one of the parents. Both parents thus equally contribute to the offspring

Page 42: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

28

generation.

Figure 2-6 Uniform crossover

Mutation: The mutation operator is used to introduce some small changes in the individual

to prevent converging prematurely to local optima. It typically modifies each gene of the

individual with some constant low probability pm, usually between 0.001 and 0.01 (but it

can also be dependent on the solution vector size, for example, pm=1/chromosome length).

mutation can be defined as a change of a 1 into a 0 and vice versa, which is known as bit-

flip mutation.

Elitism: Elitism consists in copying the current best individual (or set of best individuals)

directly in the offspring population. It permits ensuring that the best fitness (or average,

depending on the level of elitism) can only improve from one generation to another.

However, it can also induce some premature convergence if diversity is lost too fast.

Stopping Criteria: Since EAs are iterative algorithms, the typical stopping criterion, also

referred to as termination condition, is a fixed number of iterations, that is, number of

generations or fitness evaluations. Another criterion can be to stop the EA after some

predefined amount of time. Finally, some more complex criteria might also be used, such

as stopping if the population diversity is below some threshold or if there is no improvement

of the best individual for some predefined number of iterations.

2.8. Optimization in wireless sensor network

Optimization plays a key role in wireless sensor networks. The optimization in WSNs can

be broadly categorized into two those are single and multi-objective optimization problem.

In single objective optimization, the main aim of the optimizer is to minimize or maximize

Page 43: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

29

one objective under various constraints. Whereas, in multi-objective optimization multiple

objectives are simultaneously optimized. This condition makes the multi-objective

optimization (MOO) a challenging task because the multiple objectives may or may not be

conflicting, but in most of the cases, the objectives conflict with each other Therefore, it is

very less probable to find a global optimal solution, contrary to the problems of the single

objective optimization (Iqbal, 2015).

Different approaches exist in optimization. As presented in Figure 2.7 those methods can

be classified into two main classes: exact and approximate. Exact methods ensure finding

the optimal solution to the problem, but they are nonpolynomial (NP) time algorithms for

NP-complete problems.

Figure 2-7 Optimization methods taxonomy (adapted from (Talbi, 2009)

Evolutionary Algorithms are iterative heuristics that evolve a set of candidate solutions,

represented as individuals that are grouped in a population.

Page 44: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

30

2.9. Related works

In last decades, Evolutionary algorithms and more specifically Genetic Algorithms (GA)

has been used in many engineering domains. GA is an efficient stochastic search algorithm

that simulates the adaptive evolution process of natural systems. It has been successfully

applied in deployment of sensor nodes for coverage (Jia, 2009) and optimization of

clustering in WSN (Kuila, 2013) and performance optimization. Recently, some researchers

have proposed corresponding strategies for optimizing routing by using GA in WSNs. In

order to maximize the network lifetime, (Al-Obaidy, 2008) applied GA to optimize the

communication distance of each sensor node to build an energy efficiency routing for each

sensor node. (Babaie, 2012) used GA to select routing in WSNs from the perspective of

power management and energy-efficient communication techniques for each sensor node.

Based on considering the energy model of WSNs, a variable-length chromosomes coding

besides selection, crossover and mutation operators in traditional GA is used to select an

appropriate routing from sensor node to the sink in few research works.

The successful application of genetic algorithms(GAs) in a wireless sensor network designs

led to the development of several other GA-based application-specific approaches in WSN

design, not only by using single objective fitness function but also by multi-objective

optimization to get Pareto optimality in the evaluation of fitness values (Jourdan, 2004).

Evolutionary approach is followed by few researchers for energy management and design

of WSN (Ferentinos, 2007). However, most of these approaches (including this work) do

not consider the requirements and constraints of application-specific WSNs as problem of

optimal design become much more complex. However, in most of these approaches, limited

network characteristics are considered. In this study a very important GA characteristic, the

mutation probability is dynamically decided by a fuzzy-controller which was not done by

the previous researchers.

Page 45: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

31

3. METHODOLOGY

In this Chapter, the implementation details, simulation experiment, and evaluation result of

the proposed design optimization algorithm is described. We implemented the wireless

sensor network design optimization algorithm and used different data management and

visualization tools for this study. The simulation experiment is performed using C++.

The methodology and formulation of GAs for some specific application incorporates three

basic steps: the problem representation, i.e. the encoding mechanism of the problem’s

phenotypes into genotypes that genetic algorithms(GAs) manipulate and evolve, the

formulation of the fitness function that gives to each individual (i.e. possible network

design) a measure of performance, and finally the choice of the genetic operators and the

selection mechanism used.

3.1. WSN representation

The variables that are included in the wireless sensor networks representation are those that

give all the mandatory information so that the performance of a specific network design can

be evaluated. These variables are the placement of the active sensors of the network, the

operation mode of each active sensor, that is, whether it is a cluster head or a ‘‘regular

sensor’’, and in the case of a ‘‘regular sensor’’, the range of its signal (high or low).

Each individual in a GA population specifies the structure and arrangement of sensors

encoded as a vector of genes. Figure 3.1 shows an example individual which represents a

grid of sensors with m rows and m columns. For a sensor placed at each of the m*m grid

positions, there are four possibilities represented by a two-bit encoding scheme: being an

inactive sensor (00), being an active sensor operating in a low-signal range (10), being an

Page 46: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

32

active sensor operating in a high-signal range (01) and being cluster head sensor (11).

Figure 3-1 Binary representation (on the right) and state of sensors in a randomly generated

WSN (on the left).

The parameters:

The Energy Required for Operation (ERO): is a consumption parameter, which refers to

the battery energy which is consumed by a sensor during a time of operation. It basically

depends on the operation mode of the sensor, that is, whether it operates as a cluster head

(CHE), or a sensor in a High signal area (HSA) or in a low signal area (LSA) or whether it

is inactive(INA). The corresponding relevance factors for the energy consumption of the

three active operating modes of the sensors are taken proportional to 10:2:1, for CHE, HSA

and LSA respectively and zero for inactive. The translates to that the energy consumption

of a sensor operating in CHE mode is 10 times more than that of a sensor operating in LSR

mode and 5 times more than that of a sensor operating in HSR mode. These relevant factors

were used to simplify the analysis and did not necessarily represent accurately the real

energy relations between the available operation modes of the sensors. Their exact values

depend on electromechanical characteristics of the sensors and were not further considered

in the analysis presented here. The ERO consumption parameter was then given by where,

Nche, Nhsa and Nlsa are the number of CHE, HSA and LSA sensors in the network,

respectively. Hence ERO can be calculated as

ERO = (10*Nche + 2*Nhsa+ Nlsa)/N …………………………... Equ 3-1

where N is the total number of nodes – number of inactive nodes.

Page 47: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

33

We consider that a WSN in which the node locations are fixed, nodes are battery operated

and equipped with omni-directional antennas. Every transmission by a node u can be

received by all nodes situated within its communication range. We also assume that ample

bandwidth is available to accommodate all transmission requests. The main factors that

influence the energy consumption include: the energy/bit consumed by the transmitter, the

energy dissipated in the transmit, and the energy/bit consumed by the receiver electronics.

Communication Energy(CE): which refers to the energy consumption due to

communication between sensors in regular operating modes and cluster heads. It mainly

depends on the distances between these sensors and their corresponding cluster head. In this

study average number of sensors for cluster (ANSC) is calculated as total number of nodes

in WSN divided by number of cluster heads. Assuming uniform spatial distribution it is

assumed ANSC multiplied by a suitable factor also gives the average distance between the

cluster head and the sensors in that cluster. Average number of sensors per cluster (AVSC)

is N/Nche. With this value for AVSC, CE is calculated as

CE= N×AVSC2 …………………………... Equ 3-2

Where Energy consumption for 1-bit communicated can be of the order of Nano Joules.

Battery life: is significant issue in WSNs in self-preservation of the network itself, that is,

the maximization of the life span of the sensor nodes. Each sensor consumes energy from

some battery source in order to perform its vital operations, like sensing and communication.

Cluster head will have more functions like data aggregation. Battery capacity of each sensor

of the network was considered in the design optimization process by the introduction of a

Battery Capacity Penalty (BCP) parameter. Since the operation mode of each sensor is

known, its battery capacity can be evaluated at each time. Thus, when the design

optimization algorithm is applied at a specific time the BC of sensor I, BCI is updated

according to the Penalty factor assigned to sensor I. The values it takes are given according

to the operation mode of sensor I. The values used here are proportional to the relevant

Battery Reduction Rate that depends on the operation mode of sensor I. During the

measuring cycle T-1 to the next cycle T, the battery capacity is reduced according to type

of sensor. This work assumes the percentage of the relevance factors for the energy

Page 48: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

34

consumption of the operating modes of the sensor as follows: 0.2 for CHE, 0.02 for HSA

0.01 for LSA operation modes and 0 for inactive sensors. Hence BCP is calculated as

BCP = 0.2×Nche + 0.02×Nhsa + 0.01×Nlsa …………………………... Equ 3-3

3.2. Fuzzy-genetic algorithm for energy optimization

Fuzzy logic is a form of many-valued logic in which the truth values of variables may be

any real number between 0 and 1. It is employed to handle the concept of partial truth, where

the truth value may range between completely true and completely false (Novák, 2012). The

design of the proposed fuzzy controlled genetic algorithm for design optimization of WSNs

is detailed here. Genetic algorithms are highly efficient stochastic search techniques based

on analogy in biology in which a group of candidate solutions evolves through Darwinian

principle of natural evolution.

3.2.1. Fuzzy-Genetic Algorithm

Here, the proposed Fuzzy-Evolutionary Algorithm (FEA) is described in detail. The FEA

includes all the basic features of a Basic Genetic Algorithm (BGA)The specific features that

are incorporated in FEA are chromosome (genetic string) coding and decoding, Elitism,

Tournament selection, two-point crossover and the mutation probability control using a

fuzzy rule base. All these features are discussed below in detail.

3.2.2. Chromosome Coding and Decoding:

The topology of WSN is assumed to be a square with K rows and K columns. Hence, it is

convenient to assume there are K2 sensors in the proposed FEA. It is also convenient and

logical to denote 4 types of sensors CHA, HSA, LSA and INA with 11, 10, 01 and 00

respectively. That also means each sensor is represented by 2 bits. Hence each WSN in this

scenario can be represented by 2* K2 bits. So, the chromosome or genetic string is chosen

to consist of 2* K2 bits. Starting from the first bit each pair of bits represent one sensor and

as per the combination as discussed before they represent one of the four types of sensors.

Obviously, one chromosome or individual represents one network.

Page 49: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

35

3.2.3. Initial Population:

Initial population of size 20 is used and the length of each chromosome is explained in the

previous section. After running the simulation with different numbers of population

(Chromosomes), it is found the suitable number is 20 and there is some scope for future

study for more rational approach on deciding the number of chromosomes. The initial

population is generated randomly by choosing 1 or 0 for each bit randomly. The simulation

makes sure that there will not be too many cluster heads when compared to the total number

of sensor nodes.

3.2.4. Fitness Function

Since the fitness function is the only guiding factor that influences the search mechanism,

it should be carefully chosen to meet the objectives. Fitness of chromosome is defined as

the degree of correctness of an expected solution. The fitness function used for our

Evolutionary algorithm is based on a performance measure of a given chromosome. In this

study we use a similar performance measure that corresponds to the optimal realization of

the objectives.

On this study the fitness function is calculated from Equations (3-1,3-2,3-3)

Fit(i)=1/(OE+CE*0.0001+BCP) …………………………... Equ 3-4

Where, OE is operational energy, CE is communication energy, BCP is battery capacity

penalty and fit(i) is fitness of chromosome i.

3.2.5. Reproduction and Crossover:

In this proposed FEA, the genetic operators, reproduction and crossover, are implemented

exactly in the same way as those in basic genetic algorithm(BGA). The selection mechanism

is based on the Tournament selection. In Tournament selection, initially a pair of

chromosomes were chosen randomly. Out of these two the better fit one is selected. Later

another two chromosomes were chosen randomly and again better fit one out of these two

is selected. Now these two-selected chromosomes will participate in crossover.

Page 50: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

36

Two-point crossover is used with a crossover probability Pc. In two-point crossover two

different points which are below the length of the chromosome are randomly selected and

the bits between these two points among the previously selected chromosomes are swapped

to produce new pair of chromosomes. Repeating this process few times will bring in

significant diversity in the population.

3.2.6. Fuzzy-Adaptive Mutation and Elitism

Premature convergence that leads to same individuals in the entire population after some

generations can be prevented using mutation operator. Mutation diversifies the search by

bringing new information. The mutation probability pm should be sufficiently small and is

critical. In this work, a fuzzy system-based approach has been used to control the mutation

probability at each generation. If the pm is too small then the premature convergence may

not be avoided and if it is too high, the process becomes random search. Hence the mutation

probability must be optimal.

The diversity of population can generally be measured by an assessment of the standard

deviation () and the convergence trend of the GA can be evaluated by observing the

incremental change in the average fitness ( avf ) of the population from fitness distribution

of the population as shown in the Figure 3.2.

The standard deviation to measure the diversity of population is calculated as:

…………………………... Equ 3-5

Where Xi are the individual x values and µ is the mean

The central values of fuzzy singletons used in the output space of the fuzzy system in FGA

are chosen to be 0.11, 0.12, 0.13, 0.14 and 0.15, respectively, for the different fuzzy sets

Figure 3.3 i.e., VS (very small), S (small), M (medium), L (large) and VL (very large).

Page 51: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

37

Figure 3-2 Membership functions for fav

Figure 3-3 Membership functions for standard deviation ()

The above designs of fuzzy rule base and membership functions are based on intuition. With

evolution, some rules become dominant depending upon evolutionary statistics. Thus, it is

beneficial to use an optimal set of rules and membership functions. Since this information

is not available a priori, several evolutionary approaches have been suggested. The basic

approach is to evolve the definitions of the rules and membership functions through GA.

Elitism: Use of elitism operator is an elegant way of preserving the good solutions of early

generations by ensuring the survival of the fittest individuals (strings) in each generation.

This is easily achieved by passing the fittest string of the current generation into the next

Page 52: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

38

generation. A tentative solution is called non-dominated and Pareto optimal, if it cannot be

replaced with another solution which improves an objective without worsening another one.

3.3. Fuzzy-Evolutionary algorithm

FEA starts with randomly generating chromosomes (population) of specified number and

specified length. As mentioned earlier, this study has taken the population of 20. Each sensor

is coded by 2 bits with combinations 11, 10, 01 and 00 denoting CHE, HSA, LSA and INA

respectively as discussed before. In the first generation the fitness of each chromosome is

calculated which in turn related the number of cluster heads and other HAS, LSA and INA

sensors and this process is repeated for all subsequent generations. From current generation

to next generation the population must go through Selection, Crossover and fuzzy-

controlled mutation. Elitist approach makes sure that the best individual from current

generation will be passed on to next generation. Through the genetic operators it is observed

that as the population goes through number of generations, the average fitness and the fitness

of the best individual generally keep increasing. After a specified number of generations,

the best WSN is observed and this also gives clues for best design.

3.4. Limiting sensor per Cluster

After finally getting the optimal design, we considered limiting the number of sensors per

cluster, to implement the clustering with limiting number of sensor per cluster we calculate

the distance of each cluster to all the cluster heads using Euclidean distance. i.e. The

Euclidean distance between points p and q is the length of the line segment connecting them

(pq). In Cartesian coordinates, if p = (p1, p2,..., pn) and q = (q1, q2,..., qn) are two points in

Euclidean n-space, then the distance (d) from p to q, or from q to p is given by the

Pythagorean formula:

…………….. Equ 3-6

Page 53: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

39

After calculating the Euclidean distance to the cluster heads each sensor in the network will

be clustered with the nearest one. If one cluster having more number of sensors than limited,

then the algorithm creates additional cluster head to handle the extra sensors.

3.5. Flow chart

The figures below show the flow chart of the basic and the proposed genetic algorithms.

3.5.1. Basic genetic algorithm flow chart

yes

No

Initialize Population

Evaluate fitness

Selection

Output result

Crossover

Start

Stop condotion

Mutation

Figure 3-5 Basic genetic algorithm flow chart

Input optimal WSN design

Calculate sensors Euclidean distance to CH

Cluster sensors to the nearest CH

If no of sensor per cluster > limited

Check inserting position in the network

Insert new cluster head

Else return optimal design

Figure 3-4 pseudo code for limiting sensor per cluster

Page 54: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

40

3.5.2. Proposed algorithm flow chart

yes

NO

Initialize Parameters, Gen . No=0.

Generate initial population randomly

Determine fitness for all population members

Evaluate population statistics

Selection of Parents(Tournament)

Crossover (Two point)

Mutation(fuzzy controlled)

Update Population

Gen . No = Gen . No + 1

Is Gen. No = Max. Gen. No?

Stop

Start

Figure 3-6 Flow chart of the proposed algorithm

Page 55: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

41

3.6. Steps of the Algorithm

In this section, the major steps of the proposed algorithm are detailed to elaborate the flow

chart shown in figure 3.6.

Step 1: A initial population of 20 chromosomes is generated randomly. The length of the

chromosome is 2*M*M, where the WSN is assumed to be a square matrix with M number

of columns and M number of Rows.

Step 2: Each chromosome represents one WSN with each consecutive pair of bits

representing one sensor and the combination decides the type of sensor. The fitness of each

chromosome is calculated as per the fitness function.

Step 3: In the process of reproduction, a new generation is created from old population, they

have better fitness value than the previous generation. But the population size remains

unchanged. Then supervised mutation is applied on chromosomes with mutation probability

pm. All the genetic operators: selection, crossover, mutation and Elitism are applied to

improve the fitness of population from generation to generation.

Step 4: Step 3 is repeated for 100 to 300 generations and with different sizes of WSN to

study the design characteristics and also the performance of the algorithm.

Page 56: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

42

4. RESULTS AND DISCUSSION

4.1. Simulation development using C++

A Simulation used to test the working and complexity of the proposed algorithm for design

optimization of wireless sensor networks is implemented with C++ as it is flexible to study

the system behavior in detail even though it is tedious. Figure 4.1 below shows Quincy 2005

V1.3 compiler, that is used to implement the simulations in this study.

Figure 4-1 Quincy 2005 V1.3 C++ compiler

The genetic algorithm parameters settings that are used in the simulation are listed below in

table 4-1

Table 4-1 The GA parameters settings

Parameter Value

Number of sensor nodes 100

Population size 20

Selection type Tournament selection

Cross-over rate 0.7

Crossover type Two-point

Mutation rate Fuzzy controlled

Generation size 200

Page 57: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

43

4.2. Simulation results

In this section, we describe and discuss performance evaluation metrics which the results

obtained from running the design optimization algorithm on different Wireless sensor

network designs. The results show that the fitness function, number of cluster heads and

average sensor per cluster on different generations. In order to understand the performance

of wireless sensor network design optimization algorithm Table 4.3 and also Figure 4.2 and

Figure 4.3 shown in below describe a plot of change throughout generations for fitness

function, number of cluster heads and average sensor per cluster.

The details are presented below. The fitness function as discussed previously for guiding

the FEA is chosen for the optimal results. The program is flexible enough to simulate for

any size WSN. Just by changing the max value to any desired size of the matrix, the program

adjusts itself and ready for simulation. The population size is fixed (20) in the program but

as a further study, can be modified for optimum population with more testing for optimality.

This study went on for different numbers of generations ranging from 100 to 300. This

simulation study is also repeated with different numbers of populations before selecting

population size 20. This study also considered WSN matrices of different sizes and results

are noted.

In a typical simulation with WSN of size 10 rows and 10 columns, in the First generation

the maximum fitness obtained = 0.144844 and the corresponding best arrangement of WSN

is given below:

01 01 00 01 11 10 10 00 00 01

10 11 00 01 01 01 01 01 11 01

01 10 00 10 00 10 00 01 00 10

00 01 01 10 01 00 01 01 00 01

11 10 10 00 10 11 10 01 10 01

10 11 01 01 01 10 00 10 00 11

10 01 01 10 10 11 00 10 11 01

00 10 01 11 00 01 00 01 01 11

10 01 00 00 11 01 01 10 10 11

01 01 10 00 11 10 00 00 00 01

Page 58: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

44

Note that there are 14 cluster heads and 24 inactive sensors out of 100 sensors in this WSN.

In the 100th generation the maximum fitness obtained = 0.259262 and the corresponding

best WSN arrangement is given below:

10 00 01 00 01 00 10 01 01 01

01 10 01 00 10 00 01 11 00 10

00 01 01 00 01 00 10 00 01 01

10 01 10 00 00 01 10 01 11 01

01 10 00 01 00 00 01 00 00 10

01 10 01 01 01 10 01 01 00 11

01 10 11 01 01 10 10 00 00 01

10 01 00 01 11 01 00 00 10 01

01 01 10 01 10 10 00 01 10 10

10 01 10 10 10 01 00 01 10 01

Note that there are only 5 cluster heads and 24 inactive sensors out of 100 sensors in this

WSN (after 100 generations). The maximum fitness has increased significantly. The fitness

of all the 20 surviving chromosomes (WSN) in the 200th generation is given in Table 4-2

below.

Fitness of chromosome:0 0.32485

Fitness of chromosome:1 0.32485

Fitness of chromosome:2 0.32485

Fitness of chromosome:3 0.32485

Fitness of chromosome:4 0.32485

Fitness of chromosome:5 `0.32485

Fitness of chromosome:6 0.32485

Fitness of chromosome:7 0.32485

Fitness of chromosome:8 0.32485

Fitness of chromosome:9 0.32485

Fitness of chromosome:10 0.32485

Fitness of chromosome:11 0.319659

Fitness of chromosome:12 0.319659

Fitness of chromosome:13 0.319659

Fitness of chromosome:14 0.309913

Fitness of chromosome:15 0.315292

Fitness of chromosome:16 0.319659

Fitness of chromosome:17 0.32485

Fitness of chromosome:18 0.319659

Fitness of chromosome:19 0.319659

Table 4-2 Fitness of chromosomes in 200th generation

Page 59: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

45

Note that, as shown in table 4-2 above, the 200th generation the maximum fitness went up

to 0.32485 and it is observed the simulation is converging at this maximum fitness.

Table 4-3 Sensor types in different generations and average number of active sensors per

cluster

Gen.No Nche Nhsa Nlsa Total

Active

Average sensors

per Cluster head

Maximum

Fitness

1 20 19 34 73 3.52 0.132827

10 14 27 30 71 5.01 0.174941

20 12 29 31 72 6.00 0.176259

30 10 28 29 67 6.70 0.178137

40 9 27 29 65 7.22 0.180504

50 8 29 30 67 8.37 0.181342

60 8 30 29 67 8.37 0.181425

70 8 28 28 64 8.00 0.182259

80 7 29 29 65 9.30 0.183106

90 6 28 29 63 10.50 0.184824

100 5 28 28 61 12.20 0.185696

200 4 28 28 60 15.00 0.196897

The following results are obtained from the proposed evolutionary algorithm for design

optimization of wireless sensor networks as a general, in other words the results are obtained

by including all the parameters used for the design optimization of WSNs fitness function.

those parameters include operational energy(OE), communication energy (CE) and battery

capacity penalty(BCP).

The graph in Figure 4.2 shows the increase of fitness from generation 1 to 200, initially the

best fitness value in the first generation was 0.1328 after 100th generation become 0.1856

and after 200th generation it become 0.1968, this shows that due to elitism operator the best

fitness never decreases as the best individual from previous generation is passed on to the

current generation.

Page 60: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

46

Figure 4-2 Increase of fitness with generation

The graph in Figure 4.3 below, shows the trend of decreasing number of cluster heads with

increasing generation. This trend is validated as initially too many cluster heads were

present as the bits were randomly generated and to optimize the energy consumption these

excess cluster heads were avoided.

Figure 4-3 Decrease in number of cluster heads with generation

0.12

0.13

0.14

0.15

0.16

0.17

0.18

0.19

0.2

0 20 40 60 80 100 120 140 160 180 200

Fitn

ess

Generation

Increase in fitness with generation

0

2

4

6

8

10

12

14

16

18

20

22

0 20 40 60 80 100 120 140 160 180 200

Clu

ster

hea

ds

Generation

Decrease in number of cluster heads

Page 61: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

47

A scatter chart in figure 4.4 describes the operation mode of sensors the number of sensors

in high signal area(Nhsa) and number of sensors in low signal area(Nlsa) in different

generation.

4.3. Results on limited vs unlimited sensors per cluster

The other significant point in this study is we implemented the simulation model in two

scenario the one is limiting number of sensor per cluster and the other one is unlimiting the

number of sensors per cluster. To describe the two scenarios briefly on the first unlimited

access scenario, after the design optimization algorithm yield the optimal WSN design the

number of sensors that belong to a respected cluster head can be unbalanced in other words

some cluster heads may have more number of sensor nodes under them.

The second scenario is limited access, after the design optimization algorithm yield the

optimal WSN design the number of sensors that belong to a respected cluster head can be

unbalanced therefore, in this case beyond the design optimization the algorithm also limits

the number of sensors per cluster not to go beyond limit. The details are described in section

3.4 above and the pseudo code for limiting sensor per cluster is also illustrated in figure 3.4.

Figure 4-4 operation mode of sensor vs generation

0

5

10

15

20

25

30

35

0 10 20 30 40 50 60 70 80 90 100

Nu

mb

er

of

sen

sor

Generation

operation mode of sensor

Nhsa Nlsa

Page 62: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

48

The following scatter chart in figure 4.5 shows the average number of sensors per cluster

in the two scenarios (limiting and unlimiting) number of sensor per cluster throughout

different generations, it shows that the average number of sensor per cluster increase in both

cases, because of the number of cluster heads decrease by the optimization algorithm but in

case of the first scenario (unlimiting sensor per cluster) some cluster heads have more

number of sensors under them. In case of limiting the number of sensor per cluster, the

results show that average sensor per cluster does not exceed more than the limit because

excess sensors are handled by the proposed clustering algorithm that is proposed in section

3.4 on this document.

Figure 4-5 Average sensor per cluster with limited vs unlimited sensor per cluster

4.4. Results on Basic GA and proposed algorithm

The other study conducted in this thesis is comparative study of the proposed algorithm with

basic genetic algorithm(BGA) in other words the effect of genetic algorithm parameter

mutation, with probability of mutation with fuzzy controller and probability of mutation

with fixed value, for this simulation we used 0.3 as mutation probability for fixed value

mutation because as discussed in section 3.1.6 (The mutation probability pm should be

sufficiently optimal). and for fuzzy controlled mutation the mutation probability range that

02468

10121416182022

0 20 40 60 80 100 120 140 160 180 200

sen

sors

per

Clu

ster

Generation

Average Sensor per cluster

limited sensor per cluster Unlimited sensor per cluster

Page 63: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

49

is described in the methodology section is used. The results found from the simulation is as

shown below in table 4-4 and figure 4.6

Table 4-4 fuzzy mutation vs fixed value mutation

Generation Number of CH in fuzzy

mutation (proposed

algorithm)

Number of CH in

fixed

mutation=0.3(BGA)

1 20 20

10 14 19

20 12 19

30 10 18

40 9 16

50 8 15

60 8 13

70 8 12

80 7 10

90 6 9

100 5 8

200 5 7

From the above table 4-4 We can see that decreasing of cluster heads throughout

generations is slow when mutation probability is fixed at 0.3 than the fuzzy controlled

mutation. Additionally, the scatter graph in figure 4.6 clearly show diagrammatically.

Therefore, we can conclude that the proposed algorithm is much faster than the basic

genetic algorithm in convergence to maximum fitness with less number of generation.

Figure 4-6 fuzzy controlled vs fixed mutation

0

5

10

15

20

25

0 20 40 60 80 100 120 140 160 180 200

NU

mb

er

of

clu

ste

r h

ead

s

Generation

fuzzy controlled vs fixed value mutation

Fuzzy controlled mutation mutation probability fixed to 0.3

Page 64: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

50

4.5. Results on fitness function parameters

In this section we studied the three fitness function parameters operational energy(OE),

communication energy (CE) and Battery capacity penalty and their impact on the wireless

sensor design optimization process. The results of the simulation are shown in table 4-5 and

figure 4.7 and 4.8 below.

Table 4-5 impact of fitness function parameters with different combination

Genera

tion

Number of in Active sensors Number of cluster heads

CE+

BCP

OE+

BCP

OE+

CE

OE+CE

+BCP

CE+

BCP

OE+

BCP

OE+

CE

OE+CE

+BCP

1 19 27 24 22 22 24 19 20

10 11 19 23 16 20 19 17 14

20 9 12 21 15 19 12 16 12

30 7 10 21 13 19 10 15 10

40 7 8 20 13 19 10 13 9

50 5 8 18 12 17 8 13 8

60 4 6 17 10 16 8 12 8

70 2 5 16 9 16 6 10 8

80 2 2 16 9 15 5 9 7

90 2 1 15 8 15 5 7 6

100 1 1 15 7 14 5 6 5

200 1 1 15 7 14 4 6 5

Figure 4-7 Impact of fitness function parameters on number of CHs

0

5

10

15

20

25

30

1 10 20 30 40 50 60 70 80 90 100 200

Nu

mb

er

clu

ste

r h

ead

s

Generation

Impact of fitness function parameters on number of CHs

CE+BCP OE+BCP OE+CE OE+CE+BCP

Page 65: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

51

Figure 4-8 Impact of fitness function parameters on number of inactive sensors

From the above table 4-5 and figure 4.7 and 4.8 we can see the results that, calculating the

fitness function using only communication energy(CE) and battery capacity penalty(BCP)

by removing operational energy(OE) parameter results more number of inactive sensors

and the number of cluster heads are also very less.

Secondly, we run the algorithm with calculating the fitness function using only operational

energy(OE) and battery capacity penalty(BCP) removing communication energy(CE)

parameter results less number of inactive sensors also number of cluster heads are less.

Next, we run the algorithm by calculating the fitness function using only operational

energy(OE) and communication energy(CE) parameters by removing battery capacity

penalty(BCP) parameter, this results less number of inactive sensors, but more number of

cluster heads in every generation.

Lastly, we run the algorithm by calculating the fitness function using all the three

parameters operational energy(OE), communication energy(CE) and battery capacity

penalty(BCP) together. The result shows that aggregating the parameters in fitness function

results better, it yields less number of inactive sensors and less number of cluster heads

compared with OE+CE and slightly more number of cluster heads compared with the

OE+BCP and CE+BCP.

0

5

10

15

20

25

30

1 10 20 30 40 50 60 70 80 90 100 200Nu

mb

er

of

inac

tive

se

nso

rs

Generation

Impact of fitness function parameters on number of inactive sensors

CE+BCP OE+BCP OE+CE OE+CE+BCP

Page 66: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

52

4.6. Performance on battery-constrained WSNs

The algorithm was applied on specific initial WSN designs with sensor nodes of various

battery capacities, to show the quality of decisions that the algorithm makes on the operation

modes of the sensors for the next measuring cycle. Here, we focus on the analysis of the

effect of the adaptation factor concerning energy conservation of the dynamically applied

algorithm. The variability of this effect is determined by the weighting factor of the BCP

parameter in the fitness function of the GA which from now on we call Energy-Conservation

Factor (ECF).

Figure 4-9 Percentages of sensors with battery capacities below 50%, 40%, 30% and 20%

of full battery capacity at the end of each measuring cycle, for three different ECF values.

Figure 4-9 shows the effect of ECF to the available energy of the sensors of the WSN during

the period of the dynamic application of the algorithm. It presents the percentage of sensors

that have battery capacity below certain levels at the end of each measuring cycle, with the

three ECF value. these graphs also show that the ECF parameter seems to play an important

role in the life span of the network too.

Page 67: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

53

5. CONCLUSIONS AND RECOMMENDATIONS

5.1. Conclusions

Recent advancements in micro-electro-mechanical systems (MEMS) technology, wireless

communication digital electronics have enabled the development of low-cost, low-power,

multifunctional sensor nodes that are small and communicate in short distance. These tiny

sensor nodes, which consist of sensing, data processing, and communicating components,

leverage the idea of sensor networks based on collaborative effort of many nodes.

The wireless sensor node, being a microelectronic device, can only be equipped with a

limited power source (<0.5 Ah, 1.2 V). In some application scenarios, replenishment of

power resources might be impossible. The lifetime of a sensor node shows a strong

dependence on battery lifetime. In a multi-hop sensor network, each node plays the dual

role of data originator and data router. The malfunctioning of few nodes can cause

significant topological changes and might require rerouting of packets and reorganization

of the entire network. Hence, power conservation and power management take on additional

importance. It is for these reasons that researchers are currently focusing on the design of

power-aware protocols and algorithms for sensor networks. In other mobile and ad hoc

networks, power consumption has been an important design factor, but not the primary

consideration, simply because power resources can be replaced by the user. The emphasis

is more on Quality of Service provisioning than the power efficiency. In sensor networks

though, power efficiency is an important performance metric, directly influencing the

network lifetime. Application specific protocols can be designed by appropriately trading

off other performance metrics such as utility, delay and throughput with power efficiency.

Building self-organizing sensor networks has some challenges. All are related to map the

overall system requirements down to individual device capabilities, requirements and

actions the underlying principle for building self-organizing sensor networks that can

overcome the challenges is to provide the fundamental mechanisms upon which other

networking and system services may be spontaneously specified and reconfigured.

Page 68: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

54

The way sensor networks are organized internally may play a role in decreasing the energy

budget to perform certain functionalities, and therefore proper design optimization is an

important goal to be pursued. To maximize the lifetime of the network, we need to optimize

the design by reducing the energy dissipation parameters. There are several parameters

mainly related to the network lifetime. These are operational energy that is used by the

sensors for sensing the environment and data processing, communication energy that is used

for communication between sensors and their respected cluster heads and between cluster

heads and the sink node, Battery capacity. These parameters are thought to have certain

tradeoffs in terms of the lifetime and therefore the relations between these parameters should

be thoroughly investigated in this thesis.

The thesis first presents a design optimization algorithm through genetic algorithm and

fuzzy controller for wireless sensor networks that can address the strict requirements of

wireless sensor networks. The design characteristics optimized by the genetic algorithm

system include the status of sensor nodes (whether they are active or inactive), network

clustering with the choice of appropriate cluster heads and finally the choice between two

signal ranges for the simple sensor nodes. We showed that optimal sensor network designs

constructed by the proposed WSN design optimization algorithm.

To validate our design optimization algorithm, we have realized the following scenario: A

design of the wireless sensor network was simulated. Simulating design optimization of

WSN with the desired control parameters, that are operational energy, communication

energy and battery capacity penalty. Therefore, to realize the scenario as a simulation, we

have made some assumptions that were defined in Problem Definition Section.

The simulation briefly mentioned above was implemented in C++. our goal is to understand

the energy efficiency constraints between the sensor network parameters affecting the

lifetime.

Verification of the simulation was recurrently tested with different WSN designs inputs with

different combinations of fitness function parameters. The simulations were performed over

Page 69: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

55

a wide range of input parameter combinations as a result, we got different unique plots and

we examined the crucial plots as illustrated in Simulation Study Section.

In brief, three parameters were considered in this study. Two of them, operational energy

and communication energy, have directly affects a wireless sensor network’s design

optimization. In other words, change in these parameters causes the design optimization

algorithm of the wireless sensor network to converge to optimal design or not to find optimal

design. In contrast, the other parameter, battery capacity penalty has tradeoffs in terms of

the wireless sensor network’s design.

As a main contribution to the sensor networks, this study presents a guide to a designer.

First of all, it is better for the designer to examine the whole report in order to get a feeling

about the parameters of the sensor networks. After that, he/she ought to observe the results

of the parameters selected combinations by using the analyses tools. While our specific

approach is an important first step, much further research is needed in developing a detailed

and accurate understanding of the interplay between the parameters considered in this study.

We envision that the simulation implemented for this study will play an instrumental role

in the design and implementation of new application specific sensor networks.

The upcoming technology advances will most likely be applied to decreasing the power

consumption of the device. In turn, this will enable a reduction of physical size of the energy

storage required for any given application. All application scenarios can benefit from

reduced power consumption, which is translated into longer network lifetime. Nowadays

sensors are a “behind-the-scenes” technology that has an impact on every aspect of our lives.

All factory and machine command and control systems will have switched over to relying

on wireless sensing and control points. The millions of miles of cumbersome wiring we hear

about in building control and automation systems will be replaced by an invisible wireless

mesh. The devices themselves will become as commonplace as today’s light switches and

thermostats. They will be tiny, cheap, commodity pieces of silicon that interact with the

physical world.

Page 70: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

56

5.2. Recommendations

Design optimization of wireless sensor networks is now an active area of research

considering the importance of wireless sensor networks in today’s internet of things(IOT)

environment and efficient use of them in different application specific areas. The developed

design optimization algorithm used to optimize the design of WSN considering different

energy related parameters.

Hence, we have the following recommendation for future research work.

✓ Improving the fitness function by including additional parameters that are related to

connectivity, coverage and application specific parameters.

✓ Study on additional objectives and make multi objective optimization to find pareto

optimal solution for design optimization

✓ Study on WSN energy harvesting.

✓ Complexity measurement is important metrics in optimization algorithm, it

important measure complexity of the design optimization algorithm on another

metrics which is not included in our study.

✓ Additionally, work with different types of evolutionary algorithms can be

implemented and evaluated in the future.

Page 71: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

57

REFERENCES Akyildiz, I. F. (2002). Wireless sensor networks: a survey. computer networks, 38(4), 393-422.

Akyildiz, I. F. (2010). Wireless sensor networks (Vol. 4). UK: John Wiley & Sons.

Al-Karaki, J. N. (2004). Routing Techniques in Wireless Sensor Networks: A survey. IEEE wireless

communications, 6-28.

Al-Obaidy, M. A. (2008). Optimizing the communication distance of an ad hoc wireless sensor

networks by genetic algorithms. Artificial Intelligence Review, 29(3), 183-194.

Babaie, S. &. (2012). A New Method for Improving Life Time in Wireless Sensor Network by Using

Genetic Algorithm. Instrumentation, Measurement, Circuits and Systems, 177-184.

Badjate, G. a. (2013). Asynchronous Circuit Design for Wireless Sensor Nodes: A Survey. National

Conference on Innovative Paradigms in Engineering & Technology, 14-18.

Boukerche, A. (. (2005). Handbook of algorithms for wireless networking and mobile computing.

CRC Press.

Chandane, M. M. (2012). Performance analysis of IEEE 802.15. 4. International Journal of

Computer Applications (0975–8887), 23-29.

Chien, T. V. (2011). A comparative study on operating system for wireless sensor networks. In

Advanced Computer Science and Information System (ICACSIS), 2011 International

Conference, 73-78.

Dargie, W. &. (2010). Fundamentals of wireless sensor networks: theory and practice. John Wiley

& Sons.

Demirkol, I. E. (2006). MAC Protocol for Wireless Sensor: A survey. IEEE Communications

Magazine, 114-121.

Ferentinos, K. a. (2007). Adaptive design optimization of wireless sensor networks using genetic

algorithms. Computer Networks, 51(4), 1031-1051.

Ghiasi, S. S. (2002). Optimal energy aware clustering in sensor networks. Sensors, 2(7), 258-269.

Golsorkhtabar, M. N. (2010). The novel energy adaptive protocol for heterogeneous wireless

sensor networks. In Computer Science and Information Technology (ICCSIT), 2010 3rd

IEEE International Conference on (Vol. 2), 178-182.

Iqbal, M. N. (2015). Wireless Sensor Network Optimization: Multi-Objective Paradigm. Sensors,

15(7), 17572-17620.

Jana, M. A. (2014). A distributed algorithm for energy efficient and fault tolerant routing in

wireless sensor networks. Springer, 251-267.

Page 72: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

58

Jia, J. C. (2009). Energy efficient coverage control in wireless sensor networks based on multi-

objective genetic algorithm. Computers & Mathematics with Applications, 57(11), 1756-

1766.

Jourdan, D. B. (2004). Layout optimization for a wireless sensor network using a multi-objective

genetic algorithm. In Vehicular technology conference, 5, 2466-2470.

Khalil, E. A. (2011). Energy-aware evolutionary routing protocol for dynamic clustering of wireless

sensor networks. Swarm and Evolutionary computation, 1(4), 195-203.

Kuila, P. G. (2013). A novel evolutionary approach for load balanced clustering problem for

wireless sensor networks. Swarm and Evolutionary Computation, 12, 48-56.

Matin, M. A. (2012). Overview of Wireless Sensor Network. INTECH Open Access Publisher.

Novák, V. P. (2012). Mathematical principles of fuzzy logic (Vol. 517). Springer Science & Business

Media.

Pratyay Kuila, S. (2013). A novelevolutionaryapproachforloadbalancedclusteringproblem for

wirelesssensornetworks. Swarm and Evolutionary Computation , 48-56.

Qu, Y. F. (2010). Modeling the Critical Transmitting Range for Connectivity in Wireless Sensor

Networks. Multimedia Information Networking and Security (MINES) (pp. 101-105). IEEE.

Singhal, S. G. (2012). An investigation of wireless sensor network: a distributed approach in smart

environment. In Advanced Computing & Communication Technologies (ACCT), 2012

Second International Conference, 522-529.

Standard, A. 8. (1999). Wireless LAN Medium Access control (MAC) and physical layer (PHY)

specifications.

Sukhwinder, S. R. (2013). Issues and Challenges in Wireless Sensor Networks. International

Conference on Machine Intelligence Research and Advancement, 58-62.

Syswerda, G. (1989). Uniform crossover in genetic algorithms. Proceedings of the Third

International Conference on Genetic Algorithms, (pp. 2-9). San Francisco.

Talbi, E. G. (2009). Metaheuristics: from design to implementation. John Wiley & Sons.

Xiao, Y. C. (2006). MAC security and security overhead analysis in the IEEE 802.15. 4 wireless

sensor networks. EURASIP Journal on Wireless Communications and Networking, 2006(1),

093830.

Younis, O. &. (2004). HEED: a hybrid, energy-efficient, distributed clustering approach for ad hoc

sensor networks. IEEE Transactions on mobile computing, 3(4), 366-379.

Page 73: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

59

Zhou, C. &. (2003). Localized topology generation mechanisms for wireless sensor networks.

GLOBECOM'03. IEEE Vol 3, 1269-1273.

APPENDIX

5.3. Appendix 1 C++ source code

#include <stdio.h>

#include <conio.h>

#include <stdlib.h>

#include <iostream.h>

#include <math.h>

#define max 10

double MP(double, double);

double sigma, dfav;

// Main function

int main()

{

int i, j, r, r1, gen, a, b, ss, kk, k1 = 2 * max, i1, j1, chss[50][2], k2 = max * max;

int p, q, p1, s, xfit1, yfit1, min1, min2, bestmat[max][2*max], cluster[50];

int ar, arr, flag, m11, m22, n11, n22, m1, m2, n1, n2, min, minss[200], s1, ii, t2, temp, mrr,

nrr, count1, count01, q1, q2;

float xfit, yfit, x, y, tfit = 0, fav, fava[200], total, totalfit, dfav, dfav1[200], mutpr, max_fit,

dist[max*max][max*4];

float cum_fit[20], nor_fit[20], frn, mr, nr, minf;

const int k = max * max * 2;

cout << k << endl;

getch();

int pop[20][k], pop1[20][k], bestind[k];

float fit[20], n[20], OE, CE, nch[20], nhs[20], nls[20], naa[20], avgc, BCP, PF, BC;

srand( (unsigned)time( NULL ) );

// Generating population (initial WSN design) randomly

for (i = 0;i < 20;i++) {

for (j = 0;j < k;j++) {

pop[i][j] = rand() % 2;

}

Page 74: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

60

}

for (i = 0;i < 20;i++) {

for (j = 0;j < k;j = j + 2) {

if (pop[i][j] == 1) {

if (pop[i][j+1] == 1) {

r1 = rand() % 100;

if (r1 > 90) {

pop[i][j+1] = 0;

}

}

}

}

}

for (i = 0;i < 20;i++) {

for (j = 0;j < k;j++) {

cout << pop[i][j];

}

cout << endl;

}

for (ss = 0;ss < 200;ss++) {

cout << "currently in gen no: " << ss << endl;

for (i = 0;i < 20;i++) {

nch[i] = 0;

nhs[i] = 0;

nls[i] = 0;

naa[i] = 0;//getch();

//cout<<"nch="<<nch[i]<<"nhs="<<nhs[i]<<"nls="<<nls[i]<<"naa="<<naa[i]<<endl;

for (j = 0;j < k;j = j + 2) {

a = pop[i][j];

b = pop[i][j+1];

if (a == 1 && b == 1)nch[i]++;

else if (a == 1 && b == 0)nhs[i]++;

else if (a == 0 && b == 1)nls[i]++;

else if (a == 0 && b == 0)naa[i]++;

}

if (nch[i] == 0) {

nch[i]++;

pop[i][0] = 1;

pop[i][1] = 1;

}

if (nhs[i] == 0)nhs[i]++;

if (nls[i] == 0)nls[i]++;

Page 75: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

61

// Calculate fitness function

n[i] = nch[i] + nhs[i] + nls[i];

OE = 6 * (nch[i] / n[i]) + 2 * (nhs[i] / n[i]) + 1 * (nls[i] / n[i]) + 1 * (naa[i]

/ n[i]);

avgc = n[i] / nch[i];

CE = n[i] * pow(avgc, 2);

BCP = 0.2 * nch[i] + 0.02 * nhs[i] + 0.01 * (nls[i] + naa[i]);

fit[i] = 1 / (OE + CE * 0.0001 + BCP);

}

totalfit = fit[0];

max_fit = fit[0];

s = 0;

for (i = 1;i < 20;i++) {

totalfit = totalfit + fit[i];

}

for (i = 1;i < 20;i++) {

if (fit[i] > max_fit) {

max_fit = fit[i];

s = i;

}

}

// Display maximum fitness so far in generation

for (t2 = 0;t2 < k;t2++)bestind[t2] = pop[s][t2];

cout << "so far maximum fiteness=" << max_fit << endl;

// Fuzzification starts here

fav = totalfit / 20;

fava[ss] = fav;

if (ss == 0) {

fava[ss] = fav ;

dfav = 0.05;

} else {

fava[ss] = fav;

dfav = fava[ss] - fava[ss-1];

dfav1[ss] = dfav;

};

//cout<<"Generation Number = "<<ss<<endl;

//cout<<"Deviation in Average fitness of population = "<<dfav<<endl;

sigma = 0;

for (i = 0;i < 20;i++) {

sigma = sigma + sqrt(pow((fit[i] - fav), 2));

}

Page 76: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

62

sigma = sigma / 20;

// cout<<"sigma= "<< sigma<<endl;

mutpr = MP(sigma, dfav);

// mutpr=0.3;

cout << "mutprobability= " << mutpr << endl;

cout << "Going for Tournament selection" << endl;

kk = -1;

do {

m11 = rand() % 20;

m22 = rand() % 20;

if (fit[m11] < fit[m22]) {

m1 = m22;

} else {

m1 = m11;

};

n11 = rand() % 20;

n22 = rand() % 20;

if (fit[n11] < fit[n22]) {

n1 = n22;

} else {

n1 = n11;

};

// cout<<"m11 and n11 are "<<m11<<n11<<endl;getch();

//ii=rand()%100;

//if(ii<95){

// cout<<"k="<<k<<endl;

m11 = rand() % k;

n11 = rand() % k;

//cout<<"m11 and n11 are "<<m11<<n11<<endl;getch();

if (m11 < n11) {

m2 = m11;

n2 = n11;

} else {

m2 = n11;

n2 = m11;

};

for (t2 = m2;t2 <= n2;t2++) {

temp = pop[m1][t2];

pop[m1][t2] = pop[n1][t2];

pop[n1][t2] = temp;

}

x = rand() % 100;

mr = x / 100.0;

//cout<<"mr="<<mr<<endl;getch();

Page 77: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

63

if (mr < mutpr) {

mrr = rand() % k;

if (pop[m1][mrr] == 0)pop[m1][mrr] = 1;

else pop[m1][mrr] = 0;

}

y = rand() % 100;

nr = y / 100;

// cout<<"nr="<<nr<<endl;getch();

if (nr < mutpr) {

nrr = rand() % k;

if (pop[n1][nrr] == 0)pop[n1][nrr] = 1;

else pop1[n1][nrr] = 0;

}

kk = kk + 1;

for (j = 0;j < k;j++) {

pop1[kk][j] = pop[m1][j];

}

kk = kk + 1;

for (j = 0;j < k;j++) {

pop1[kk][j] = pop[n1][j];

}

} while (kk < 18);

cout << "New population generated" << endl;

for (i = 0;i < 20;i++) {

for (j = 0;j < k;j++) {

pop[i][j] = pop1[i][j];

}

;

};

// Elitist GA

m11 = rand() % 20;

for (t2 = 0;t2 < k;t2++)pop[m11][t2] = bestind[t2];

cout << "currently out of gen no: " << ss << endl;

if (ss == 0 || (ss + 1) % 10 == 0) {

cout << "so far best arrangement of WSN is" << endl;

t2 = 2 * max;

for (j = 0;j < k;j++) {

cout << bestind[j];

if ((j + 1) % 2 == 0)cout << " ";

if ((j + 1) % t2 == 0)cout << endl << endl;

}

}

cout << "End of the Generation " << ss << endl;// getch();

Page 78: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

64

if (ss == 199) {

for (t2 = 0;t2 < 20;t2++) {

cout << "Fiteness of chromosome:" << t2 << " = " << fit[t2] <<

endl;

}

}

}

cout << "200 generations completed" << endl;

getch();

// display number of cluster heads and their index after 200 generation t2 = 0;

for (j = 0;j < k;j++) {

i1 = j / k1;

j1 = j % k1;

bestmat[i1][j1] = bestind[j];

}

cout << "I am hre" << endl;

getch();

for (i1 = 0;i1 < max;i1++) {

for (j1 = 0;j1 < k1;j1 = j1 + 1) {

cout << bestmat[i1][j1];

}

cout << endl;

}

getch();

for (i1 = 0;i1 < max;i1++) {

for (j1 = 0;j1 < k1;j1 = j1 + 2) {

if (bestmat[i1][j1] == 1 && bestmat[i1][j1+1] == 1) {

chss[t2][0] = i1;

chss[t2][1] = j1;

++t2;

}

}

}

cout << t2 << endl;

getch();

for (i1 = 0;i1 < t2;i1++) {

cout << chss[i1][0];

cout << chss[i1][1] << endl;

}

for (i1 = 0;i1 < max;i1++) {

Page 79: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

65

for (j1 = 0;j1 < k1;j1 = j1 + 2) {

if ((bestmat[i1][j1] == 1 && bestmat[i1][j1+1] == 1) ||

(bestmat[i1][j1] == 0 && bestmat[i1][j1+1] == 0)) {

for (j = 0;j < t2;j++) {

dist[i1*max+(j1/2)][j] = 0.0;

}

;

dist[i1*max+(j1/2)][t2] = -1.0;

} else {

for (j = 0;j < t2;j++) {

dist[i1*max+(j1/2)][j] = sqrt(pow((i1 - chss[j][0]), 2) +

pow((j1 - chss[j][1]), 2));

}

}

}

}

for (i = 0;i < k2;i++) {

minf = dist[i][0];

kk = 0;

for (j = 1;j < t2;j++) {

if (dist[i][j] < minf) {

minf = dist[i][j];

kk = j;

}

}

dist[i][t2] = float(kk);

if (minf == 0)dist[i][t2] = -1;

}

for (j = 0;j < t2;j++) {

cluster[j] = 0;

}

for (i = 0;i < k2;i++) {

i1 = dist[i][t2];

if (i1 != -1)cluster[i1]++;

}

for (j = 0;j < t2;j++) {

cout << "cluster[" << j << "]=" << cluster[j] << endl;

}

for (j = 0;j < t2;j++) {

getch();

Page 80: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

66

// Checking the position for inserting new cluster head

if (cluster[j] > 2*max) {

getch();

i1 = chss[j][0];

j1 = chss[j][1];

cout << "i1j1" << i1 << j1 << endl;

getch();

if (j1 > 1) {

p = i1;

q = j1 - 2;

} else {

p = i1;

q = j1 + 2;

};

if (i1 > 0) {

p1 = i1 - 1;

q1 = j1;

} else {

p1 = i1 + 1;

q1 = j1;

};

getch();

} else if (cluster[j] > max) {

i1 = chss[j][0];

j1 = chss[j][1];

if (j1 > 1) {

p = i1;

q = j1 - 2;

} else {

p = i1;

q = j1 + 2;

}

;

p1 = i1;

q1 = j1;

bestmat[p][q] = 1;

bestmat[p][q+1] = 1;

bestmat[p1][q1] = 1;

bestmat[p1][q1+1] = 1;

}

}

for (i1 = 0;i1 < max;i1++) {

for (j1 = 0;j1 < k1;j1 = j1 + 1) {

Page 81: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

67

cout << bestmat[i1][j1];

}

cout << endl;

}

getch();

}

// Fuzzy controlled Mutation probability function

double MP(double sig, double dfa )

{

double si_val[5] = {0.03, 0.06, 0.09, 0.12, 0.15}, memsig[5], memdf[5], matt[5][5];

double dfrange[5]={-0.05,-0.025,0,0.025,0.05},mu[5],sum1,

sum2;//sigma=0.08,dfav=0.03,

int eqn[8][2] = { -40, -1, 40, 2, -40, 0, 40, 1, -40, 1, 40, 0, -40, 2, 40, -1}, ind, j, num;

double max1 = 0, max2 = 0, max3 = 0, max4 = 0, max5 = 0, cv[5] = {0.15, 0.14, 0.13, 0.12,

0.11};

//while(sigma>si_val[i]){ posi[i]=0;i++}

for (ind = 0;ind < 5;ind++) {

memsig[ind] = sig / si_val[ind];

if (memsig[ind] > 1)memsig[ind] = 1;

}

for (ind = 0;ind < 5;ind++)memdf[ind] = 0;

ind = 0;

while (dfa > dfrange[ind] && ind < 5)ind++;

if (ind == 0)memdf[0] = 1;

else if (ind > 4)memdf[4] = 1;

else {

j = 2 * ind - 2;;

memdf[ind-1] = eqn[j][0] * dfa + eqn[j][1];

j = 2 * ind - 1;

memdf[ind] = eqn[j][0] * dfa + eqn[j][1];

};

// Limiting sensor per cluster

for (ind = 0;ind < 5;ind++) {

for (j = 0;j < 5;j++) {

if (memdf[ind] < memsig[j])matt[ind][j] = memdf[ind];

else matt[ind][j] = memsig[j];

}

}

for (ind = 0;ind < 5;ind++) {

Page 82: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

68

for (j = 0;j < 5;j++) {

num = (ind + 1) * (j + 1);

if (num < 3) {

if (matt[ind][j] >= max1) {

max1 = matt[ind][j];

mu[0] = max1;

}

} else if (num < 5) {

if (matt[ind][j] >= max2) {

max2 = matt[ind][j];

mu[1] = max2;

}

} else if (num < 12) {

if (matt[ind][j] >= max3) {

max3 = matt[ind][j];

mu[2] = max3;

}

} else if (num < 20) {

if (matt[ind][j] >= max4) {

max4 = matt[ind][j];

mu[3] = max4;

}

} else {

if (matt[ind][j] >= max5) {

max5 = matt[ind][j];

mu[4] = max5;

}

}

}

}

sum1 = 0;

sum2 = 0;

for (ind = 0;ind < 5;ind++) {

sum1 += mu[ind] * cv[ind];

sum2 += mu[ind];

}

if (sum2 > 0) {

// cout<<"Mutation probability= "<< sum1/sum2<<endl;getch();

return sum1 / sum2;

} else return 0.5;

}

Page 83: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

69

5.4. Snapshots of the simulation

Page 84: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

70

Page 85: NOVEL ALGORITHMS FOR DESIGN OPTIMIZATION OF …

71