Mac 1
Mac 1
of Huddersfield Repository
Long, Hua
Research routing and MAC based on LEACH and SMAC for energy efficiency and QoS in
wireless sensor network
Original Citation
Long, Hua (2013) Research routing and MAC based on LEACH and SMAC for energy efficiency
and QoS in wireless sensor network. Doctoral thesis, University of Huddersfield.
This version is available at http://eprints.hud.ac.uk/23739/
The University Repository is a digital collection of the research output of the
University, available on Open Access. Copyright and Moral Rights for the items
on this site are retained by the individual author and/or other copyright owners.
Users may access full items free of charge; copies of full text items generally
can be reproduced, displayed or performed and given to third parties in any
format or medium for personal research or study, educational or notforprofit
purposes without prior permission or charge, provided:
• The authors, title and full bibliographic details is credited in any copy;
• A hyperlink and/or URL is included for the original metadata page; and
• The content is not changed in any way.
For more information, including our policy and submission procedure, please
contact the Repository Team at: [email protected].
http://eprints.hud.ac.uk/
Research Routing and MAC based on LEACH and S-MAC for
Hua Long
October 2013
1
ABSTRACT
The wireless sensor is a micro-embedded device with weak data processing capability and
small storage space. These nodes need to complete complex jobs, including data monitoring,
acquisition and conversion, and data processing. Energy efficiency should be considered as one of
the important aspects of the Wireless Sensor Network (WSN) throughout architecture and protocol
design. At the same time, supporting Quality of Service (QoS) in WSNs is a research field, because
the time-sensitive and important information is expected for the transmitting to to the sink node
immediately. The thesis is supported by the projects entitled “The information and control system
for preventing forest fires”, and “The Erhai information management system”, funded by the
Chinese Government. Energy consumption and QoS are two main objectives of the projects. The
thesis discusses the two aspects in route and Media Access Control (MAC).
For energy efficiency, the research is based on Low Energy Adaptive Clustering Hierarchy
(LEACH) protocol. LEACH is a benchmark clustering routing protocol which imposes upon cluster
heads to complete a lot of aggregation and relay of messages to the base-station. However, there are
limitations in LEACH. LEACH does not suit a wide area in clustering strategy and multi-hop
routing. Moreover, routing protocols only focus on one factor, combining the clustering
strategy and multi-hop routing mechanism were not considered in routing protocol for performance
of network.
QoS is supported by the MAC and routing protocol. Sensor MAC(S-MAC) makes the use of
the periodically monitoring / sleeping mechanism, as well as collision and crosstalk avoidance
mechanism. The mechanism reduces energy costs. Meanwhile, it supports good scalability and
avoids the collision. However, the protocols do not take the differentiated services. For supporting
QoS,A new route protocol needs to be designed and realized on embed platforms, which has WIFI
mode and a Linux operation system to apply on the actual system.
This research project was conducted as following the steps: A new protocol called RBLEACH
is proposed to solve cluster on a widely scale based on LEACH. The area is divided into a few
areas, where LEACH is improved to alter the selecting function in each area. RBLEACH creates
routes selected by using a new algorithm to optimize the performance of the network. A new
clustering method that has been developed to use several factors is PS-ACO-LEACH. The factors
include the residual energy of the cluster head and Euclidean distances between cluster members
and a cluster head. It can optimally solve fitness function and maintain a load balance in between
the cluster head nodes, a cluster head and the base station. Based on the “Ant Colony” algorithm
and transition of probability, a new routing protocol was created by “Pheromone” to find the
optimal path of cluster heads to the base station. This protocol can reduce energy consumption of
cluster heads and unbalanced energy consumption. Simulations prove that the improved protocol
can enhance the performance of the network, including lifetime and energy conservation.
Additionally, Multi Index Adaptive Routing Algorithm (MIA-QR) was designed based on network
delay, packet loss rate and signal strength for QoS. The protocol is achieved by VC on an
embedded Linux system. The MIA-QR is tested and verified by experiment and the protocol is to
support QoS. Finally, an improved protocol (SMAC -SD) for wireless sensor networks is proposed,
2
in order to solve the problem of S-MAC protocol that consider either service differentiation or
ensure quality of service. According to service differentiation, SMAC-SD adopts an access
mechanism based on different priorities including the adjustment of priority mechanisms of channel
access probability, channel multi-request mechanisms and the configuring of waiting queues with
different priorities and RTS backoff for different service, which makes the important service
receive high channel access probability, ensuring the transmission quality of the important service.
The simulation results show that the improved protocol is able to gain amount of important service
and shortens the delay at the same time. Meanwhile, it improves the performance of the network
effectively
Key words: WSN, RBLEACH, PS-ACO-LEACH, MIA-QRP, SMAC-SD
3
ACKNOWLEDGEMENTS
I would like to express my most sincere appreciation and thanks to those who have helped me.
First of all, I would like to extend my heartfelt thanks to my supervisors, Professor Joan Lu
and Professor Qiang Xu. Professor Joan Lu and Professor Qiang Xu have been a tremendous
mentor for me. They are humble and approachable. Their minds are full of knowledge and
academic rigor. I would like to thank them for encouraging my research in the process of topic
selection and ideas of writing. In addition, their innovative mind and unique perspectives have
profoundly inspired me in terms of my research and career.
A special thanks to my family. I am extremely grateful to my parents and my husband who
have given me endless support.
The thesis is supported by the projects entitled “The information and control system for
preventing forest fires”, and “The erhai information management system”, which come from the
Chinese Government. Special thanks for the Fund Committee of YUNNAN Science and
Technology Agency, Which is belong Chinese Government.
I thank for the Members of our group, especially Yubin Shao, Qin zhi Du, they give good
suggest for experment simulations.
Finally, I would like to thank all the teachers who have given their kind assistance. Thank you
all for your time, advice and hard work.
4
CONTENTS
2.5.1 LCA....................................................................................................... 29
2.5.2 RCC....................................................................................................... 29
research .................................................................................................................. 44
2.10.1 Design requirements for ADHOC network QoS routing protocol ..... 60
Analysis.................................................................................................................. 60
5.7.3 Drive function and main data structure of network device ................. 128
5.8.4 Design of the key module and Process flow ....................................... 137
7.7.3 Experiment results of simulation and comparison of relative work ... 163
7.3.2 Support setting of nodes to data package for forwarding ................... 173
9
Chapter 1 Introduction
background for data processing [1]. WSN has great potential for many applications in
scenarios, such as military target tracking and surveillance [2,3], natural disaster relief
A typical WSN includes sensor nodes, sink nodes, infrastructure network and
sensor network management nodes. The nodes have resource constraints. The resource
bandwidth and limited processing and storage in each node. Nodes transmit the data
monitored to a sink node through other nodes in a multi-hop way. The design of
simplicity should conform to the principles of WSN protocol. The design of the WSN
protocol should be a minimum use of power and extend the life cycle. Meanwhile,
Quality of Service (QoS) in WSNs is an on-going research field, due to the services
scalability. There are numerous routings that have been developed for WSN data
include:
10
Low Energy Adaptive Clustering Hierarchy(LEACH)[10], Power-Efficient
The three protocols represent typical WSN clustering routing algorithms of three
chain-based protocol. This proposal builds all sensor nodes to form a chain according
to Greedy algorithm that the sum of edges must be minimum in wireless sensor
networks. In PEGASIS, each node communicates only with a close neighbor and takes
turns transmitting to the base station, thus reducing the amount of energy spent per
round. TREEPSI is tree-based protocol in which WSNs select a root node in all the
sensor nodes, the length of path form end leaf node to root/chain node in TREEPSI is
the shortest. The data will not send for a longer path. Therefore, TREEPSI can reduce
power consumption in data transmission less than the others. LEACH routing protocol
is the first hierarchical routing protocol based on data aggregation. The initial idea is to
allocate the energy load of the whole network to each sensor node on average through
equal probability, random and cyclical selection of cluster heads, thus achieving the
purpose of reducing network energy cost and extending the life cycle of the network.
The advantage of LEACH is that each node has the equal probability to be a cluster
head, which makes the energy dissipation of each node be relatively balanced.
However, it requires nodes to have high communication ability and it has low
expansibility. It is not appropriate for widely-scale networks [13, 14, 15, 16].
multi-hop routing mechanism. The former is responsible for the topology optimization
of a network. The latter will be responsible for choosing the best path to transmit the
data, which it senses in the network, to the base station by multi-hop routing mode.
However, How to use the LEACH for widely area, Whether it is possible to combine
clustering and routing to improve network performance? At the same time, if the
swarm intelligence is introduced into the WSN, is there an advantage? This issues need
11
more research.
bandwidth delay, jitter, available bandwidth and packet loss. It is required to design
[21], Time MAC (T-MAC)[22] and S-MAC[23] are proposed to decrease the energy
costs and to support good scalability and avoid collision. S-MAC makes use of the
mechanism. However, the protocols do not include the differentiated services. Because
WSNs are very different from traditional networks, supporting Quality of Service (QoS)
protocol SMAC-SD is proposed. The new protocol added the principle of distinction
traffic, the mechanism of priority channel access based on traffic, and the mechanism
The route is also influenced by QoS. How to choose a route based on QoS
parameter is a research issue. The literatures [24,25,26,27] put forward these solutions.
Over all, Energy efficiency and QoS will be studied in the thesis.
The thesis is supported by the projects entitled “The information and control
system for preventing forest fires”, and “The Erhai information management system”,
which come from The Chinese Government. The projects have two main objectives for
monitoring sensors: energy consumption and QoS. The thesis contains the two issues
12
1.1.1 Energy Efficiency
1. How to use LEACH for a wide area? Due to the fact that the cluster
head selection is randomly distributed, it will lead to a lack of uniformity in the energy
distribution of sensor nodes in that the nodes, which are far away from the base
strategy is simple. Equally, the cluster could be slightly neglected for route
3. LEACH routing protocol was put forward based on one parameter in WSN,
such as hop counts or residual energy. Essentially, the route can be influenced by many
factors, such as distance, energy and others. What if it could select multi-parameters as
ways. In our project, information includes video, image and monitoring data. QoS is
accepted as a measure of the service quality that the network offers to the applications.
The purpose of MAC protocol is to focus on the underlying network, which provides
2. QoS is needed to support the routing protocol. How can we design and embed
scale. The widely scale divided into small scale and LEACH is improved to alter
selecting function in each area. RBLEACH creates routes select by using a new
2. A new clustering method has been developed which uses several factors is
PS-ACO-LEACH, the factors include the residual energy of cluster head, Euclidean
distances between cluster members and a cluster head. Fitness function is optimally
solved between cluster head nodes, a cluster head and the base station. It also maintain
a load balance.
routing protocol was created by “Pheromone” to find the optimal path of cluster heads
to the base station. This protocol can avoid energy consumption of cluster heads and
4. The Multi Index Adaptive Routing Algorithm (MIA-QR) was designed based
on network delay, packet loss rate and signal strength. Protocol data formats are
system.
and configure waiting queues with different priorities. The protocol can make
important service get high channel access probability and ensure the transmission
and ACO, considering the combination between clustering and routing, and a complete
put forward and the protocol is designed and implemented. In Chapter 6, improved
analyze of protocols are discussed for improved protocols. Chapter 8 is the summary of
15
Chapter 2 Background
WSN [21] nodes consist of managed nodes, aggregation and sensor nodes. A
large number of sensor nodes are distributed in the monitoring region, and are
responsible for the perception and acquisition of specific target temperature, humidity,
density, light intensity, pressure and other physical characteristics, and then transmit
these data to the aggregation node through a single-hop or multi-hop manner. The user
releases monitoring tasks and data query through the management of node WSN
Task management
node
users
responsible for the perception of the external information, and are responsible for
calculating the data processing module for processing data. A wireless communication
module of sensor node is responsible for sending and receiving information.The energy
module provides energy, and each of the wireless sensor nodes can be used as a
16
network node terminal. The sensor nodes can also be used as a router for data
2. Aggregation nodes: WSN system has to contain one or more node base stations
(BS), also known as the aggregation node. The Aggregation node [29] is mainly
responsible for transmitting data from sensor nodes for processing (such as
compression, fusion), and then transfers it from the external network to the user. The
data can be directly transmitted to the BS, or the BS in a multi-hop manner by the
nodes. So it can be seen that the base station node is a transmission station for WSN
and external network (users) to communicate with each other and that it can support
two or more different protocol conversions between different protocols. The node base
station typically has more computing power than ordinary sensors, more storage space
and more energy reserves, and thus supports the general interaction of the entire WSN
3. Management node: Users manage and configure the wireless sensor node
through the management nodes [30], publishing tasks, collecting data and inquiry data.
On the contrary, the wireless sensor node will perceive and collect data passing to the
convergence node in a single-hop or multi-hop manner, transmit the data from the
hierarchical structure. In the planar structure [31], all nodes have the equal status with
no difference in grades and levels. The network is divided into different levels with the
selected node as the cluster head node and a cluster head perform as the
17
Sensor Module The wireless communication
Processor
module
Processor Receiver and
Sensor AC/DA Network MAC
Storage transmitter
Power
The sensor nodes consist of four components: the sensor module, the processor
module, wireless communication module and power supply module. Shown in Figure
2.2[32].
The converted information and data are collected and monitored by the sensor
Receiving and transmitting data from the own node to other nodes are undone by
divided into five layers: respectively; application layer, transmission layer, network
layer, data link layer and physical layer. The horizontal management plane can be
divided into the energy management plane, mobility management plane and task
management plane. The following is the description of each of the specific functions.
m
WSN protocol stack is shown in Figure 2.3[34]: e
g
a
n
a
t
n M
t e k
n
e m y s
m e t a
e g
a i
l T
g
a y n i
n g a
M b
o
Application Lay a r M
M e
n
E
Transmission control layer
Network Lay
Physical Lay
18
The physical layer addresses the needs of a robust modulation, transmission and
receiving techniques.
Data link layer provides data framing, frame monitoring, media access and error
control.
The network layer takes care of routing the data supplied by the transport layer.
The transport layer helps to maintain the flow of data if the wireless sensor
Depending on the sensing tasks, different types of application software can be set
The power management plane manages how a sensor node uses its power and
manages its power consumption among the three operations (sensing, computation, and
wireless communications). The mobility management plane detects and registers the
management plane (i.e., cooperative efforts of sensor nodes) balances and schedules
1. Limitation of Power
Power limit sensor nodes are usually tiny with a low price, carrying limited
energy[35][36]. There is no device transmitting external light, heat and tidal energy
into electricity. Besides, it’s impractical to change sensor nodes manually for the
carried by sensors, its priority is to make full use of the energy and extend the life
cycle of WSN. Due to the consumption of a vast majority of energy by the sensor in
the wireless communication module design of WSN routing protocols, energy saving
19
2. Limitation of Communication ability
It can be seen that there exists a positive correlation between the energy
consumption of communicating nodes with the distance. The longer the distance is, the
greater the energy consumption will be with a sharp increase. Therefore, under the
distance of the single-hop communication, meanwhile, to design WSN routing one also
capability and small storage space. These nodes finish complex work, including the
data monitoring, acquisition and conversion, the data processing [37]. For instance, one
would need to address how to take full advantage of the node itself, the computing
power and storage space and how to use the idea of working together to optimize
computing and storage node challenged in the process of WSN routing design.
To sum up, the following problems need to be solved emphatically in WSN: (1)
energy saving: due to a great number of nodes and wide distribution in the wireless
sensor network, a battery supply is a widely used method. But the energy is limited and
it is difficult to change and recharge the power for the battery supply. In order to make
maximum use of the network and guarantee the working time, the energy should be
invalidation would happen in network working due to a limited amount of node energy.
The new nodes need to be added to enlarge the lifetime of the network. Thus, the
network scalability to adapt to this topological change; (3) network efficiency: the
20
2.3 Overview of research issues
In the case of WSNs, the following aspects must also be considered [38]: network
it is possible to improve the efficiency of the MAC protocol for time synchronization,
data fusion and targeting many aspects of the foundation, the sensor node can also save
energy to extend the life cycle of the entire network. Under the premise of
guaranteeing coverage to meet the communication link, the methods for forming
network topology in order to ensure efficient data forwarding is the focus of current
research.
2. Network contract
WSN has a dynamically changing topology; the nodes in the network are
frequence division multiple access and Coding division multiple access. Another
3. Information security
As a task-based data-centric network, WSN not only collects data, but also needs
to address, integrate and transmit data. Reliable and secure transmission and efficient
data fusion on WSN is of paramount concern [42]. Information security should be paid
4. Time synchronization
Time synchronization is a new hot spot in the study of WSN technology. Many
21
wireless sensor network applications require the sensor nodes to maintain clock
time synchronization mechanisms [43], it is required to take into account the stability,
convergence, energy perception and scalability and other factors simultaneously. But
5. Positioning technology
The location information is very important for the wireless sensors and the single
collection of data [44], the majority of the data must be included for the location
information in order to make it sense. Determining the data collection node location or
a time position is one of the most basic functions of WSN. Deployed in the monitoring
region of the wireless sensor nodes it must be able to get its own position, and
6. Data fusion
Due to the limited scope of the perception of a WSN, the data collected usually
does not have a high degree of accuracy and redundancy. In order to improve the data
accuracy and reduce the amount of data transmitted to save energy, it is needed to send
and transmit data with WSN, use their computing power and storage capacity and
7. Data management
data query management and database management [46] in WSN, WSN observers can
achieve a logical view of the data stored in the network and network separation without
acquisition, process control [47], wireless communications and energy supply module
with data processing algorithms input and data transfer protocol, application-specific
support.
multi-application, the question of how to efficiently use the wireless sensor nodes
operating systems.
9. Application-layer technology
and coordination between multi-tasking. Study of the application layer is only half
end-to-end. Some new QoS parameters are desired for the measurement of the delivery
of the sensor data in an efficient and effective way. In WSN, The protocol need QoS
routing, and QoS Medium Access Control (MAC)to support QoS, includes QoS model,
The thesis is supported by the projects, which are provided financial aid by the
Chinese Government “The information and control system for preventing forest fires ”,
“Erhai information system” and etc.. The projects have two main problems for
23
monitoring sensors: energy consumption, and QoS. The thesis will research the two
In conclusion, the thesis will focus on reduce energy consumption and ensure QoS.
ways [51]. For one, sensor nodes do not have Internet protocol (IP) addresses, so
IP-based routing protocols cannot be used in a WSN. The design of network protocols
nodes and propagate sensor data to the base station. The protocol should meet network
be prolonged. Lastly, the protocol should address issues of efficiency, fault tolerance,
1. Energy priority. The Energy of a WSN node is limited, and prolonged survival
of the entire network is an important goal, the energy consumption of nodes and
modes in order to save energy, nodes with limited memory resources and computing
resources, cannot store large amounts of routing information. Because of local node
monitoring data is focused on the data forwarding path, which is importance. The
24
monitoring data have redundancy. Data-centric route finishes aggregation of data for
communication patterns are different, and there is no routing mechanism suitable for
the needs of each specific application with specific routing mechanisms and design a
1. Energy efficiency. WSN routing protocol not only needs to select the energy
chooses balanced energy consumption for the entire network and requires simple and
resulting in different network sizes; if a node fails, a new node is added, node mobility,
it will make the network topology change dynamically, requiring scalable routing
the exhaustion of energy or environmental factors which may cause failure of sensor
nodes, the surrounding environment also can affect the quality of wireless
communication links.
bandwidth.
order to enable higher data efficiency issues from networking support and QoS
considerations.
25
2.4.2 Routing Category
structure [60]. In flat-based routing, all nodes are typically assigned equal roles or
the network. In location-based routing, sensor nodes' positions are exploited to route
parameters can be controlled in order to adapt to the current network conditions and
As figure2.4 shows, the network is divided into a group of clusters, each cluster
selected a node as a cluster head, the job of each cluster head is to transmit information
to the base station after it finishes aggregation of the data, and removes redundant
information. Figure 2.4 shows the structure relationship between the various parts of
Figure 2.4 Structural relationships between nodes, cluster heads and base stations in
WSN
26
After the network is clustered, cluster members are flexible, variable levels of
2. Clustering limits the scope of interaction within the cluster, avoids excessive
exchange of information between the sensor nodes, and reduce the information stream
maintenance overhead;
4. The sensors only need to focus on the connection between the cluster heads; the
further enhance network operation, extend battery life and individual nodes throughout
6.The cluster head can schedule activities within a cluster, the nodes can wake up
based on a low-power sleep mode to reduce the energy consumption rate, allowing the
sensor nodes to run in web mode and determining the send and receive timing to avoid
7.The cluster head in a cluster can collect data, reducing the number [67] of the
relay packets.
and design goals. The following are the structural parameters and the impact on
network clustering.
1. Network dynamics: The nodes’ moving and the energy’s limitation cause
2. Network data processing: As the node may generate a lot of redundant data,
similar data on multiple node aggregation packets reduces the amount of information
27
sent [10]; one must assign a cluster head for each cluster to achieve data forwarding.
3. Node Deployment: sensor nodes have the same energy, computing and
communication capabilities when the nodes are randomly distributed; they are called
isomorphic sensor network. Cluster heads communicate without sensors; the cluster
head may not have the ability to reach the base station. The connectivity of a cluster
goals are distinguished.Route hops in order to satisfy the delay-sensitive date, and the
A node starts working until its energy is depleted, combining clustering routing
and adaptive clustering so as to maximize the lifetime of the network and streamline
2. Load balancing
Balance of node load to extend the lifetime of a network is the goal of clustering
[72]. Load balancing is especially useful in energy constrained sensor network because
the relative energy level of the nodes does affect the network lifetime more than their
absolute energy level. When all sensors have equal initial energy and equal chances to
become sources, network could maximize its lifetime if all sensor sensors dissipate
energy at the same rate, since no loss of connectivity would result from node failure.
3. Fault tolerance
To avoid losing information, the cluster head should be fault tolerant [73].
Intuitive re-clustering is the role of the cluster nodes cluster head, rotation is also a
tolerant approach and also has the advantage of balancing the load.
2.5.1 LCA
Mustapha Khiati, Djamel Djenouri proposed Linked cluster algorithm (LCA) [74].
The algorithm is to build a network topology that can effectively solve the problem of
the movement of nodes. Every node broadcasts its ID and monitors the transmission of
the other nodes. In the next round, the nodes broadcast the monitored the set of
neighbors, and let every node know its 1-hop and 2-hop neighbors. Node x is defined
as the cluster head if it has the highest ID amongst the neighbors, or if it does not have
the highest in the near 1-hop neighbor but there is at least one node y in the neighbors
making node x become the highest ID node in the 1-hop neighbor of node y. When
nodes move, the cluster head can form a backbone for the network by means clustering,
which allows the cluster members to connect. LCA algorithm is prepared to maximize
2.5.2 RCC
protocol is designed for a mobile WSN network, RCC is the clustering based on
random competition. RCC algorithm focuses on the stability of the cluster and follows
the rule of “first claim, first win”. After receiving the message of the first node
broadcast, the neighboring nodes will join in the cluster as a member and give up the
right of being a cluster head. In order to maintain the cluster, every cluster head will
regularly broadcast the message of cluster head. The delay between message receiving
and sending which may cause conflicts can force the neighboring nodes to broadcast
the message simultaneously due to the fact that other nodes cannot sense the ongoing
29
message. To avoid this problem, RCC makes judgments by using a random timer and
node ID’s. Every node in the network will reset their time value randomly before
broadcasting the message of cluster head. During a random time, a node will simply
cancel its self-sent cluster head message if it receives the broadcasted message of
cluster head from another node. Since the random timer cannot completely solve this
problem, the nodes with a lower ID will become the cluster head if the conflict is
upheld. Although frequent movements of the nodes directly affect the stability, RCC is
more stable than a traditional clustering mechanism. A cluster head in the self-adaptive
clustering mechanism gives up its own position when sensing a node with a lower ID;
but a cluster head in the RCC gives up its own position only when a cluster head
B K
B K
J
A
C E
F
D
G
2.5.3 EEHC
30
algorithm (EEHC) [76] is the distributive clustering algorithm with the objective of
maximizing the network survival time. The cluster heads collect the data picked up by
the sensors in the clusters, and send the collected report to a focal point. In the stage of
initialization (also called the single-stage clustering), every node claims itself as the
cluster head with frequency p to the neighbor node in its communication range. These
cluster heads claim themselves as the “volunteer” cluster heads. All cluster heads that
are in the k-hop range of cluster heads receive the claims by direct communication or
repost. Any cluster head will become the nearest cluster member if it is not the cluster
head and receives the claims. The forced cluster head is neither the cluster head nor the
node that belongs to the clusters. If the claim cannot get a node with the set time t, time
t can be calculated by the duration when a message to the k-hop’s node is received. If
the claims are not in the any k-hop of the volunteer cluster head, this node is defined as
the forced cluster head. In the second stage, the process is developed to allow the
multi-level clustering, which is to build the h level cluster layers ,as shown in Figure
2.5. The process of recursive clustering repeats and forms an echoed level. The
algorithm ensures the n-hop connection between cluster head and focal points. If the
highest level is set as the h level, the sensor node will send the collected data to the
higher level cluster head. The data at level-1 can be transferred and aggregated to
level-2; the rest may be deduced by analogy. At the highest level of a clustering
structure, the cluster head will send the data to the focal points.
2.5.4 HEED
(HEED) [77]. The protocol can be selected from the deployment of sensor nodes. The
selection of cluster head. This algorithm cannot select the cluster head node randomly,
because only the nodes with residual energy can become the cluster head node. There
between two nodes. Second, the energy cost is not balanced for all nodes. Third, the
connectivity between the cluster heads can be maintained by adjusting the selection
At HEED, every node can certainly shine upon the cluster, and communicate with
the cluster head directly. The algorithm can be classified into three stages:
C prob
Initialization phases: Firstly, set the initial proportion of all nodes in the
cluster head. This ratio is used to limit the initial cluster heads for other sensors
declared. Each sensor in accordance with the formula (2-1) as a cluster head
CH prob
determines the probability
Eresidual is residual energy of the current node Emax is the maximum energy when
CH prob
the battery is fully charged. is not allowed to fall below a certain threshold
Repeat phase: In this phase, each sensor node goes through several iterations until
the cluster head with minimum transmission power transmission is found, if not the
cluster head is not heard, the cluster head node is allowed to send a message to its
CH prob
neighbors notifying of changes. Finally, each sensor , is multiplied and it goes
on into the next iteration. When it reaches 1, the stage is stopped. Therefore, the sensor
nodes can advertise to their neighbors; there are two types of cluster head states:
CH prob < 1
Temporary Status: If , the sensor node becomes a temporary cluster
head. If a lower power node cluster head is found, it can switch to the next iteration of
CH prob
Final state: If is 1, the node becomes permanently cluster head.
Final phase: In this phase, each sensor node according to their status as a final
32
decision, with the selection of the least expense of a cluster head or declared itself as
2.5.5 DWEHC
Hierarchical Clustering (DWEHC) [78], as shown in Figure 2.6. Every node calculates
its’ self-weight after locating the neighbor nodes. The weight is the function of the
nodes energy and the proximity of the neighbors. In the neighborhood, the node with
V8
V9
V6
V3
V7
V2
V0
H
CLUSTER
V1
RANGE
V4
V5
this stage, since the nodes directly connect with the cluster head, they are defined as
first-class members. In order to get the cluster head with the minimal energy, the nodes
will keep adjusting the relations between members. The nodes will check the minimum
power of non-cluster heads, and will judge them self to be a first level member or a
second level member with a 2-hop to be the cluster head if the distance between the
node to the neighbors is known. If the nodes can determine topology inside the cluster
with the most effective energy use, the processing will stop. In order to limit the
number of levels, every cluster is distributed in a range that each member node should
give.
33
2.5.6 EEUC
Uneven Clustering EEUC [79]. The algorithm classifies the routing organization into
two parts: intra-cluster communication and communication between the cluster heads
and focal points. The intra-cluster communication uses single-hop, which is easy to
achieve, while the communication between the cluster heads and focal points uses
of cluster members that are closed to the focal points. Thus, the cluster head can save
energy used when reposting the data in order to balance the energy cost of cluster
heads. Moreover, not only is it important to consider the position of the candidate
nodes to the focal points, but also the residual energy of candidate nodes when the
cluster head selects the next hop nodes of its routing. The experiment results show that
this routing algorithm can effectively solve the problems of non-uniform cluster head
energy cost under multi-hop communication. This algorithm can also modify the
energy cost of every node in the network and effectively prolong the lifetime of the
network.
2.5.7 LEACH
low-cost protocol and clustering algorithm with the self-adaption. The cluster head
nodes collect the data of sensor nodes from the clusters, and then the data is processed
and sent to the focal points, which is the cluster head with a layered structure. It is very
easy to select the information transmission path and save routing information without
can be mainly divided into two stages: building of the clusters and table processing.
34
The total time of these two stages is called a round. In order to decrease the cost of the
protocol, the duration of the stable processing stage is longer than the building of
clusters. However, very few nodes in LEACH usually die prematurely because of too
much energy in the network. The sequence of the death is from the distant to the close.
Thus, the communication of the region far away from the base station will be
unresponsive early in the round and the functional region of the whole network
This algorithm is one of the most popular clustering algorithms. In this thesis
improvements to the LEACH algorithm are proposed and its detailed processing steps
To sum up, the comparison of various algorithms is as shown in Table 2.1[80, 81,
82].
35
Table 2-1 Comparison of various algorithms
Converg- Cluster
Clustering Node Location Energy Failure Balanced Cluster
ence overlap
approaches mobility awareness efficient recovery clustering stability
time ping
ry required
ry good
BS required
The network model uses the typical settings of the topology control in WSN,
which is the same with LEACH. N nodes are randomly distributed in the region with
the determined directions. The communication abilities of these isomorphic nodes are
weak. The calculation abilities are relatively weak, and their energy is limited. These
nodes will not move after being settled down, and they can automatically connect to
each other to build the network without the manual help. There is only one base station
in the whole network. The network which is built by the connections of nodes has the
1) The energy consumption of the nodes in the network is different in every round
36
2) It is no need to know the detailed position of the nodes in the network and it is
only needed to know the relative distance with the other nodes.
4) All sensor nodes in the network perceive the environment with a constant rate.
5) The life cycle of the network is the duration from the operation of network to
To sum up, it is clear that the design of the algorithm should uniformly distribute
the energy cost of the network system into all nodes. The design also needs to
guarantee scalability of the whole network and guarantee that the nodes can deal with
the relative operations in different positions. Moreover, the design should reduce the
channel model and a free space model. In the environment of the network, the node
energy cost of message sending with the constant distance threshold d is in proportion
to the distance between the node sending and receiving. The node energy cost of a
message sending can be calculated based on formula (2-2) and (2-3) by first order
Transmitting Power
circuit amplifier
E Rx _ elect ( k , d )
Kbit data
Receiving
circuit
kE elect
The energy cost produced in the data transmission of the receiving nodes is as
37
shown in formula (2-2) [10,83]
E Rx (k , d ) = Eelec k …… …(2-3)
Where k is the length of the data frame in the protocol, d is distance between the
two nodes, Eelec is the power consumption of sending and receiving, determined by the
circuit itself, and ε amp is the sending energy cost of an amplifier in the protocol, the
model is adopted. Conversely, when the transmission distance is equal or greater than
the value, the power amplifier ε amp of multi-path attenuation model is adopted.
d0
If the transmission distance is less than threshold , the power amplifier Eelec is
the power consumption of sending and receiving, decided by the circuit itself.
ε fs
d0 =
ε mp (2-4)
1. About “round”
The concept of the “round” has been introduced in LEACH [10]. The working
process of the whole sensor network is divided into several rounds with two stages in
each round: cluster creation stage and stable data communication stage. The cluster
creation stage is mainly to send the control message without sending the actual sensor
data. All nodes organize the clustering by broadcasting what is called the “short
message”, one node in every cluster is set as the cluster head. After cluster formation,
the cluster head is responsible for creating a TDMA program in the nodes. In the stage
38
of clustering, all nodes broadcast the “short message” for communication by CSMA
protocol. In the stage of stable data communication, the nodes send the data collected
continuously by every frame to the cluster head nodes based on the TDMA program.
Then the cluster head focuses the important data and sends them to the aggregation
In the creation stage, the sensor nodes create a random number from 0 to 1. If this
number is lower than the threshold T ( n ) , the node will be the cluster head. T ( n ) can
p
1 − p[r mod( 1 )] n∈G
T ( n) = p
0 other
(2-5)
Where,
p is the percentage of the expected number of the cluster head in all
nodes, which is the possibility of the nodes to be selected as cluster heads, r is the
number of rounds. G is the set of all nodes not selected as the cluster head in the
recent 1 / p rounds. In every round, T (n) is set as 0 if the nodes have been selected
as the cluster head so that there is no node selected as the cluster head. For those sensor
nodes not selected as the cluster head, they will be selected with the probability of
T (n) . The threshold T (n) of the residual nodes that will be selected as the cluster
39
heads increases as more and more nodes are selected to be the cluster head. However,
the random number percentage of the probabilities that the nodes creation is lower than
the value of the T (n) will increase. Thus the percentage of the nodes to be selected as
the cluster head will increase. As there is only one node not selected as the cluster head,
The cluster head is randomly created in the region of the whole network in
LEACH protocol, including the position and number of cluster head. This kind of
random creation will lead to excessive cluster heads. In every round of LEACH
protocol, the number of the selected cluster heads follows the binomial distribution.
Assume that the percentage of the cluster head is p = k / N , the number of the selected
N
P { X= k=
} p k (1 − p )
N −k
(2-6)
k
LEACH protocol randomly produces the cluster head in the whole region. This
random distribution makes the size and scope of each cluster different, as shown in
Figure 2.8. According to the analysis in Figure 2.9, it is known that this difference is
caused by clustering distribution and will cause the prerequisites of LEACH protocol
40
100
90
80
70
60
50
40
30
20
10
0 20 40 60 80 100
Head of cluster Nodes Base Station
follows: the first condition is the beginning of cluster formation. The energy of all
nodes is the same at this moment. The second condition is cluster formation. The
energy consumed is generally similar. In the first life cycle of the network, the first
prerequisite is easily satisfied when the cluster head is selected in the first round.
However, the second prerequisite cannot be satisfied if the range of the clustering is
not constant. The network model is assumed as in section 2.61, that all the sensors
perceive the surroundings. Therefore, the data is sent to the users. The nodes transmit
the data at a constant rate, thus the clustering range affects the workload of the cluster
head. As mentioned above, the nodes energy that is consumed by the range of cluster
and the cluster position produced and distributed randomly by LEACH protocol has an
41
the contained nodes and the cluster head in terms of distance. Hence, the
communication functions between the nodes have large differences. In the following
round, the algorithm protocol will select a node that consumes more energy than the
previous round as the cluster head, which will conversely accelerate the death of the
nodes.
LEACH has been improved for various applications. Zuo Chen,Kai Chen
proposed LEACH-MF, the protocol adopts the methods of multi-layer clustering and
LEACH, some nodes are facilitated by solar power and these nodes act as CHs which
mainly depend upon their solar status in LEACH. Farooq, M.O, Dogar, A.B. proposed
LEACH cluster-heads a long distance from Base station transmit data to next
Xinhua, Wang Sheng proposed LEACH-C [88] .To LEACH-C, at the initialization of
every round, each node has to report its residual energy, resulting in copious energy
consumption. Sunkara Vinodh Kumar and Ajit Pal proposed Assisted LEACH
(A-LEACH) [89]; the protocol achieves lessened and uniform distribution of dissipated
energy by separating the tasks of Routing and Data Aggregation. Mustapha Khiati,
which adds new common static and dynamic broadcast periods to support and
accelerate broadcasting. This reduces broadcast latency and ensures scalability. JIANG
42
Yang,SUN Liu-lin[91]and others proposed a model to calculate the number of cluster
head according to energy consumption. Hu Junping, Jin Yuhui, Dou Liang proposed
LEACH-F [92], it makes some changes to the basis of LEACH. The formation of
clusters is same as LEACH-C. The base station uses simulated annealing algorithms to
generate clusters. Meanwhile, base stations generate a cluster head list for each cluster
to indicate the order of selection of nodes for cluster heads in turn. Once a cluster is
formed, its structure will no longer change. Compared to LEACH and LEACH-C, the
cycle and the cost for establishing clusters is reduced. However, LEACH-F is not
appropriate for real network applications, because it cannot process the addition,
failure and motion of nodes dynamically and it increases signal interference among
chosen clusters. The similarity of clusters can be completed according to the process of
adaptive learning. Jing Chen, Hong Shen proposed HYENAS. It avoids the
recombination of clusters and saves the cost for clustering in each cycle.
To conclude, LEACH protocol allows every node to have the chance to be the
cluster head in the whole work cycle because of the expectations, making the load
uniform, to some extent. However, the distribution and the number of cluster heads
have some randomness and there are still some cluster heads that die prematurely,
which cause a decrease in the life of the network. In order to prevent this phenomenon
from happening, the nodes with high ability should be selected as cluster head as much
as possible, and the energy used by the selected cluster head should be reduced as
much as possible.
43
2.7.2 Reasons to select LEACH protocol as the improved object in the
research
designed for WSN according to the layer routing. After LEACH protocol, many
LEACH protocol. A lot of simulation experiments prove that this algorithm has a
better stability and longer life cycle compared with the general plane routing
LEACH routing protocol has many characteristics in solving the problems of node
life cycles in WSN. For example, it reduces the number of the node transmissions and
the aggregation messages. The cluster head nodes are responsible for focusing the
message sent from different nodes in the cluster, and send the collected message to the
base station. The conflicts between or in the clusters are reduced by the MAC layer
head nodes to guarantee balanced use of energy in a WSN. However, there are still
nodes in the space within specified settings. In some cases, the cluster head nodes
selected by the algorithm may concentrate in some narrow region, making some of the
member nodes unable to join any cluster, or cause them to consume too much energy
in the process of data communication, thus resulting in the premature death of those
nodes, and even making it impossible to communicate with the cluster head nodes.
2. Asymmetrical distances between the cluster heads and the base station cause a
single-hop algorithm. The cluster nodes directly communicate with the base station
after aggregating the data message sent from the other nodes in the cluster. In a small
44
network scope, most communications which applied free space models between the
cluster head and base station can be ensured, which can eliminate the energy
However, once the covered regions in the network become larger, the differences of
the energy cost between the nodes will become larger if the cluster head nodes select
single-hop communication again. This can cause a situation to occur in which the
nodes far from the base station die earlier than the nodes near the base station, which
shown in Figure 2.10, as the region scope of the whole network becomes larger, the
nodes loads become uneven. The life cycle of the nodes near the base station are
obviously longer, but the nodes far from the base station die prematurely because of
the excessive energy cost caused by the communication between the nodes and the
base station.
Dead nodes
Active nodes
Cluster head
However, if the base station is on the edge of the sensor nodes and the sensor
nodes are in a wide range. The question which needs to be researched is “How to
45
improve LEACH to be more suitable for current networks
intelligent individual without a centralized control case, by the simple act of a single
individual, making the entire group exhibit some intelligent behavior, so as to solve
some specific problems. Mark Millonas proposed to build a SI system which would
changes in response to the behavior exhibited by the diversity within the group;
4. Stability principle: not every change in the environment would lead to changes
changes in population worth paying opportunities, groups must be able to change their
behavior patterns;
problems in which there is not centralized control and does not provide a global model.
group of random solutions, through an iterative search it finds the optimal solution.
(2) In this situation there is only one piece of food in the area.
(3) All the birds do not know where the food is.
(4) All the birds know their current location and how far away from the food
they are.
The basic PSO algorithm, each optimization problem is a bird in the search space,
called "particle." All particles have an optimized adaptation value (Fitness Value)
function to determine, each particle has a flying speed and can determine their
direction and distance. The particles follow the optimal particle current search in the
solution space. Reynolds study found that birds flying only use a limited number of
neighbors to track it, but the end result is the whole flock seems under control by a
center, that complex global behavior is caused by the interaction of simple rules.
The population (Swarm) is constituted by the number of particles and the particles are
known as population size or scale (Swarm Size). Each particle has a position vector
and velocity vector, their number represents the number of problem solution space. If it
is assumed that the search space is a problem in dimensional space, the position vector
and the particle velocity vector as shown in Equation (2-7), (2-8), the position where
the component represents dimensional position, vector represents the velocity vector
solutions), each particle "flies" in the search space through iterations to find the
optimal solution. In the iterative process, the particles, by tracking, adjust their position
to be updated by two "extremes" constantly. One extreme is the optimal solution found
47
by the particle itself, this solution is called "individual extreme" or individual optimal
Pg = pg1 , pg 2 ,..., pgd , becomes global minimum or global optimal solution, they then
find the optimal values of these two particles (2-9, 2-10) to update their velocity and
Where,
c1 、c2 are positive constants which is called the acceleration factor; r1 、r2
in the scope of the position − x j ,max , x j ,max and velocity range −v j ,max , v j ,max ,
xij vij
iteration, if or is beyond their border, and or take the boundary values. The
initial position and velocity of the particle swarm generates a random number, and then
As shown from equation (2-9), the three factors represent the three parts of the
(1) The first part reflects the influence of the next iteration, contacting the
particles current state, combining inertial particle performance, the particles ability to
balance global and local search. Therefore, it is called the inertia factor.
(2) The second part reflects the understanding of the particles “own experience",
namely the impact of the particles memory, this part of the particles has a global search
ability, to avoid falling into local minutia. Thus Venter and Socbeiski also defined this
as "self-awareness” “(Self-Confidence)".
48
(3) The third part reflects the entire population of the "social experience”, this part
helps to improve the global search ability of the particle, and therefore of the iterative
process before considering the entire populations’ collective "experience", Venter and
At present, all particles are divided into several parts in the basic PSO algorithm,
the particles are overlapping with neighbor particles, where the "neighbors" does not
general position of the particle based Euclidean distance exhaustive, but rather refers to
the number of particles adjacent to the neighbor relationship and this iterative process
exchanges according.
Begin
(1)The initialization of various random group velocities and the position of each
particle;
(2) Calculate the fitness function of particles. The position of each particle and the
fitness function are stored in an individual, the most optimal value of fitness function
According to the formula (2-9) and (2-10), Update the velocity and position of
particles:
If the fitness value of particle is better than the current value ,updated to the
current value of the current position and particle fitness function; If the particle fitness
value than the current global values, with fitness function optimal particle position
End while
End
49
2.8.2 ACO’s basic principles and mathematical models
Ant colony optimization (Ant Colony Optimization, ACO [101, 102]) algorithm is
called the ant colony algorithm. It is proposed by Colorni, Dorigo and Maniezzo. The
release special secretions (Pheromones) along their path - to find their way [102].When
they encounter an intersection which they cannot pass, they select a random path, and
release (information) on the path. The longer the path of the ants, the smaller the
amount of information is released. When the ants come again across this intersection, a
mechanism is formed. The amount of information on the optimal path always grows,
but the amount of information on other paths wills gradually abate. Ant colonies will
eventually find the optimal path. Meanwhile the colony is also able to adapt to changes
in the environment. For instance, if suddenly there is an obstacle on the path, ants can
quickly navigate and find the optimal path. Although the capacity of a single ant is
limited, the entire ant pheromone behavioral system has a high level of
self-organization, the exchange of information between the paths of the ants, and
optimal paths are found. Figure 2-11 illustrates further the search principle of a colony.
Figure 2.11, the set A point is a nest, D point is the food source, and the gray
area of the triangle is an obstacle which cannot be passed. Because of the presence of
50
obstacles, the Ant colony reaches D through E or F from A. The distance between
Assuming that 30 ants reach point D from A, the amount of information is left
as 1. For convenience, suppose the information residence time is 1unite time. In the
initial moment, because no information exists on the path AB, BE, EC, CD, EC, AF,
FD, located in A and D an ant can randomly select a path, from a statistical point of
view and can be considered that an equal probability exists for ants to choose AB,
AF, CD, FD, as shown in 2-11 (b), afteran unitnit of time, the amount of information
in path ABECD, AFD path has two times the amount of information. After another
period of time, there will be 20 ants who reached D from F, Fig 2-11 (c) shows, over
time, more and more ants will probably select path AFD, eventually fully choosing
path AFD, in order to find the shortest path from the nest to the food source.
ant pheromones and each ant only responds to the local environment around them, they
Because ants are genetically modified organisms, ant behavior is actually an adaptive
(3) To a single ant, each ant is only making independent selections according to
the environment; for the ant colony, they can form highly ordered behavior through
self-organizational processes.
The above assumptions and analysis, the parade mechanism of a basic ant colony
algorithm has two basic stages: adaptation stage and collaborative stage. In the
accumulated in its structure, the more ants on the path leave a greater amount of
51
information, so the paths are selected more; the amount of information that will
decrease over time. In the collaborative stage, candidate solutions are produced
learning.
entropy increase which is not affected by outside influences, the dynamic evolution is
Pheromone
Decision Point
Expression issues
Optimization
combinatorial problems
Figure 2.12 The logical structure of the basic ant colony algorithm
Assuming that
bi (t ) is the number of ants at time t for element i ,the τ ij (t ) is
the amount of information in t time on the path (i, j ) , said scale TSP, the n is
{τ }
n
lij
amount of information on the connection between two congregate city C at the t
time . In the initial moments, the amount of information h is equal to each path and set
τ ij (0) = const
up , the basic ant colony is implemented by a directed graph
=g (C , L, Γ)
.
52
Ants k (k = 1, 2,..., m) determine their transfer direction during movement
record the ants k with the currently traversed the city, their
tabuk makes adjustments
pijk (t )
information of each path. is transition probability of element at the time from
[ ]
τ ij (t ) β g[η ik (t )]β
j ∈ allowed k
, if
∑ [τ is (t )] g[η is (t )]
α β
pij (t ) = s⊂allowed k
k
0 else
(2.11)
allowed k = {C -tabu k }
In formula (2.11), which allows the selection of the next
city for ant k , α is a heuristic factor, it indicates the relative importance of the track,
the larger the value is, the stronger the collaboration between ants; The more ants tend
to choose the path that other ants travel; β shows the relative importance of visibility,
reflecting the ants heuristic information in motion the process to select the path in the
ant the degree of attention, the greater its value, the state transition probabilities closer
ηij (t )
greedy rule; as heuristic function, its expression is as follows
1
ηij (t ) =
dij
(2.12)
dij
In the above formula, means the distance between the two adjacent cities.
d η (t ) p k (t )
Ants k , the smaller ij is, ij and ij are greater. Obviously, this heuristic
function, said the desired level which ants moved from i the elements (city) to the
This update strategy mimics the characteristics of the human brain memory, stored in
the information system of the brain, while constantly on the information stored in the
brain gradually fade over time, or even forgotten. Whereby the amount of information
τ ij (t + n)= (1 − ρ )gτ ij (t ) + ∆τ ij (t )
(2.13)
m
∆τ ij (t ) =∑ ∆τ ijk (t )
k =1 (2.14)
∆τ ij (0) =
0 ∆τ ijk (t )
the cycle path (i, j ) , is the initial time, which means the amount of
basic ant colony algorithm models [98], referred to as Ant-Cycle model, Ant-Quantity
Model and Ant-Density model, the difference lies in the different methods of seeking
∆τ ijk (t )
.
Q
the ant k in cycle (i, j)
∆τ ijk (t ) = Lk
0 otherwise
(2.15)
2. Ant-Quantity model:
54
Q
d the ant k in cycle (i, j) form t to t + 1
∆τ ijk (t ) = ij
0 otherwise
(2.16)
3. Ant-Density model:
go.
The difference between formula (2.15) and (2.16) (2.17), (2.16) and (2.17) are use
of the local information, i.e., after the completion of the ant pheromone update path;
the formula (2.15) is the overall utilization of the information, i.e., after the completion
of a cycle Claim ant pheromone on all paths, better performance when solving TSP, so
the commonly used formula is (2.15) as the basic model of ant colony algorithm.
There is growing concern about the application of PSO in the field of combination,
algorithm simulating intergroup social behaviors of birds in the natural world and
seeking optimal solutions through mutual cooperation among individuals. Due to the
55
following characteristics:
through learning and adapt to the environment better through cooperation and have
convergence;
3. The algorithm has a strong applicability and effectiveness and good robustness
in different environments.
Currently, PSO has been used in multicast routing and route optimization with
coverage and clustering routing optimization etc. Xue Wang, Jun-Jie Ma, Sheng Wang,
and Dao-Wei Bi [105] puts forward a distributed energy efficiency coverage algorithm
combining PSO and simulated annealing algorithm (SAA) which uses PSO and SAA
to optimize energy consumption of SWN and obtain optimal deployment. The result
shows that this distributed algorithm saves network energy after optimizing
deployment. This algorithm improves network energy efficiency when applied in WSN
target tracking. Santi P [106] puts forward a wireless sensor network routing algorithm
based on effective avoidance of low energy or no energy areas PSO which converts
routing problems to linear programming problems and uses PSO to solve the routing
problem of low energy area avoidance on this basis. It has a good ability to adapt to
any network deployment and meets the requirement of adapting to its environment. Hu
et al. have proposed PSO-Traffic for topological planning for a real world traffic
positions of mobile nodes in order to improve average node density. Hong et al. have
PSO Multi-Base for optimal positioning of multiple base stations in a two tier WSN
56
[109]. The two-tier network consists of nodes that can communicate only with the
Ant colony is a group composed of ant individuals with simple functions under
WSN.
1. Individuals of ant colony algorithms only have simple functions, but can jointly
ant colony optimization algorithms to solve the design of WSN routing algorithms at
this level.
completes a task through the work of each ant and their interactions. In the execution
of ant colony algorithm, some individual factors will not influence optimal solutions.
Other individuals in the group are not disturbed and operate according to predefined
rules. Therefore, ant colony algorithm has a good ability to adapt to changes of
network topology and can seek a new data path in a short amount of time.
3. Local work. Nodes in WSN only record relevant information of neighbor nodes.
It is impossible to store the routing information of the whole network in each node.
algorithms based on ant colony algorithm, each node achieves global routing through
characteristic parameters of WSN such as link quality and residual energy of nodes and
parameters in ant colony algorithm such as path pheromones, path distance and path
57
angle can be associated. WSN route selection can be realized through parameter
pheromones on the path with a neighbor node. Nodes select the next path through the
control. Routing designed with this idea has a good fault tolerance and stability of data
transmission.
In recent years, the application of ACO in WSN routing has gradually become a
hotspot:
Xin Guan, Guan L., Wang X.G., Ohtsuki introduces routing algorithms[110]
based on ant colony system and uses multi-ant colony competitive mechanisms to
solve the problem of energy balance and congestion control in the routing processes of
WSN.
awareness, which effectively reduces the energy consumption of data transmission and
aggregation and greatly improves the network life cycle and energy consumption of
data transmissions.
optimization. Member nodes in the first stage send data to cluster heads. Among
cluster head nodes in the second stage, ant colony optimization algorithm is used to
produce efficient routing. This algorithm has little delay and good performance in
Ghasem Aghaei R. Rahman A.M. Rahman M.A, puts introduces the many-for-one
data transmission routing protocol based on ant colony which generates the shortest
generally only one part is considered. For example, the research on multi-hop routing
uses a simple clustering strategy, while the research on clustering neglects routing
optimization.
ideas are introduced into the research on clustering strategy, such as solving “hotspot”
problems based on graph theory and using non-uniform clustering thought, based on
geographical location and energy awareness etc. However, these strategies generally
generally use the method of producing random numbers and setting threshold values to
increase or decrease the weight of one or more factors determining cluster heads. Such
4. The weight of each decision factor is not analyzed in detail when PSO is used
to obtain the optimal cluster head. For example, in research using PSO to improve
clustering algorithms such as literatures [113], they generally take the same value for
resources and information services strength for a communication system to carry. The
definition of QoS in RFC2386 [114] (Request for Comments) is: QoS refers to a series
of service requirements when transmitting the data stream in the network. Typical QoS
parameters include delay, bandwidth, hops, packet loss rate and delay jitter.
59
2.10.1 Design requirements for ADHOC network QoS routing protocol
1. Quick route discovery, because the network nodes have mobility characteristics,
when moved to the network nodes, routing protocols should be able to protect the node
environments
4. The routing protocol can perceive any dynamic changes in the network
topology.
6 .To reduce the overhead of host resources, ADHOC network nodes should be
able to reduce the routing protocol transmission time and data transfer times while the
use of efficient routing algorithms, reduce CPU overhead, memory and other
resources;
Analysis
are researched by IETF MANET working group. Typical QoS routing protocols are
described as follows:
routing algorithm)[116], it is a protocol with a minimum average path delay time as the
QoS parameter index, is a table-driven proactive routing protocol. Each node needs to
60
periodically update the routing tables of the nodes and to have higher storage capacity
requirements,
2. Anelise Munaretto, Hakim Badis proposed LS-QoS (Link State Base QoS
Routing) [117]. The protocol selects routes by using the parameter of average survival
time of the route and packets error rate. Network nodes periodically broadcast link
state data to calculate the survival time, communication link and packet error rate, the
periodically maintain link data, increasing the routing overhead and energy
consumption of nodes and the need to take up storage space to save the link packet
protocol selects routes by the delay, bandwidth cost, it belongs to on-demand QoS
routing protocol. The protocol dynamically changes the routing table by sending a
number of packets (exploring packages) from the source node to the destination node.
Each packet arrives at an intermediate node, according to the link status information
and the neighbor status, the protocol determines the path to explore and discover the
packet routing. If the exploring package finally reaches the destination node, the
routing meets the QoS requirements of the path, the packet is sent by the destination
node along the path in the reverse direction of resource reservation. If the source node
does not receive the resource package, it indicates the establishment of QoS routing
failure.
[119]. The protocol is a protocol which selects routing by delay, bandwidth and QoS
parameters as indicators of cost, it is designed based on the TBP protocol, and belongs
network topology. The protocol applies changes slowly in the network topology.
reduces network latency and increases network throughput, mainly used in small-scale
Routing) [121], the protocol selects delay, bandwidth and QoS parameters as indicators
protocol. Only the path information is a binding agreement in the choice of location
protocol with bandwidth. The protocol introduces the concept of core nodes to build a
network through a core node, mainly used for small and medium ADHOC networks.
protocol extension which comes from CEDAR, it still uses bandwidth as the QoS
parameter index, and it is a hierarchical routing protocol. Through the expansion of the
expiration time) [124], the protocol selects the maximum connection time as a
parameter indicator. Mobile node location information is located by GPS and mobile
information. It can effectively reduce the time and cost of connection establishment.
Routing Protocol) [125], the protocol selects delay and bandwidth as the QoS
which exchanges routing information between cluster head nodes by each cluster, the
cluster node only needs to maintain routing information within the cluster. The
protocol needs to consume some energy and take up some storage space.
Characteristics of each QoS routing protocol are shown in Table 2-2. According
62
to Table 2-2 QoS analysis and comparison of various routing protocols, it shows that
demand distributed QoS routing protocols direct its development, with the size of the
and hierarchical structure and relatively large network for general use clustering
network topology. Referring to the different network application services, you can
There are many routing protocols to support QoS, but most of the existing
protocols usually use a single criterion based on node energy, bandwidth and delay
QoS indicators. In this thesis, the average delay link, the average packet loss rate and
signal strength indicators have been chosen as the node QoS parameters, to select the
63
Table 2-2 Comparison of routing protocols
Survival
time
Bandwidth
bandwidth
bandwidth
connection routing
time
Delay
routing modules. Routing Linux kernel supports rule-based strategy [126,127], the
rules include two selectors and an action: a selector chooses the format of the packet,
including the source address, destination, Type of Service(TOS), etc.; while the action
64
is defined by a specific treatment according to selector conditions. The action of core is
NAT. UNICAST which represents a routing table entry from the routing table;
addition, the network can match the kernel and creates three rules for all packets:
local_rule (local rule), main_rule (main rule), and default rule (the default rule). The
rule-based routing mechanism kernel shown in Figure 2-13, is set in accordance with
local rules, custom rules, the main rule, the default rule followed by the
The default
The default rule Routing
table
Rules for routing table management and routing table entries, Linux kernel
provides a network interface to handle Net link rules in Net link mechanisms, and the
65
2.10.5 MAC Protocol of WSN to support QoS
The medium access control (MAC) is responsible for the resource distribution of
the channel. The MAC can be classified into the time division multiple access,
frequency division multiple access, and coding division multiple access. Another
For WSN, MAC protocol has three reasons to cause energy consumption. The
first reason is the collision. When a transferred data packet is abandoned because of the
increase the loss of energy. The second reason is the listening. A node listens if other
nodes are sending the data. Listening will cause energy loss. The third reason is the
The Time Division Multiple Access (TDMA) [129] distributes the individual data
sending and receiving by time slot for the wireless sensor node. The data transmission
does not need too much control information; the node can fall asleep in the free time
slot. These characteristics make the WSN with TDMA mechanism avoid energy waste.
Based on the applications of the wireless sensor, the ideal TDMA MAC protocol can
be classified into the clustering networks based on TDMA type MAC protocol,
DEANA protocol [130], TRAMA protocol [131] and DMAC [132], etc. However
there are still some disadvantages in the TDMA mechanism, such as the strict time
The competition-based MAC protocol uses the channel according to its needs. A
node needs to use the channel by the competition to send the data. The sent data must
be resent if a collision happens until the data is sent successfully or the data is
MAC protocol [133], S-MAC [23], T-MAC protocols [134] and so on.
Aiming at the shortfall of S-MAC protocol on the fixed duty cycle, the T-MAC
66
on the basis of remaining the cycle’s length and sends messages with a burst mode,
Sift protocol [136] is a MAC protocol based on the competition and oriented
sensor networks aiming at even-driving. The main idea of this protocol is to use a fixed
backoff window, and select the appropriate transmission probability distribution for
nodes in different time slots, so that detecting a plurality of nodes that in a same event
can send messages without collision in the time slots before the contention window.
But it suffers from increased idle listening and system-wide time synchronization,
With the wide use of wireless sensor networks and the diversification of user
needs, more and more services need adaption and satisfaction. In the case of an
accident, fire, destruction of public facilities and other unexpected incidents, users
node immediately.
S-MAC protocol makes use of the periodically monitoring / sleep mechanism and
collision avoidance. However, the S-MAC protocol uses the solid frame length and
duty cycle. The frame length is limited by the delay requirement and the size of the
cache. The active time of the nodes relies on the rate of the message. When the
network load is very small, the long time of free monitoring will lead to serious
transmission delay. Thus, the S-MAC is not suitable for the applications of the high
cannot supply the different access mechanism for the different transactions. Thus,
under the conditions of limited channel, the S-MAC cannot guarantee that the data
with high priority has the superiority in the channel competition, and it cannot ensure
67
2.11 Summary
1. When the sensor nodes are deployed in a widely range, LEACH protocol needs
2. Particle swarm and ant colony algorithm in line with the characteristics of
WSN. Taking into account the combination of clustering and routing, PSO applied to
the ant colony clustering and applies to routing and clustering considered together with
route optimization to achieve improved routing algorithms for WSN research content.
development of the route requires practicality. The special focus of this study is how to
4. S-MAC protocol widely used in the wireless sensor networks is unable to meet
service differentiation. Due to the lack of S-MAC protocol, there is a need for
68
Chapter 3 RBLEACH PROTOCOL
selected according to random numbers, but communication cost and residual energy of
cluster nodes are not considered, the nodes whose remaining energy the lowest can still
be selected as the cluster heads, which means their lifetime is short; the network nodes
are farther away from the base station which means the communication cost is more,
resulting in unbalanced energy consumption; in the data transfer phase, due to data
integration and data forwarding,nodes who consume more energy have an early death.
LEACH is not suitable for wide areas. This thesis proposes RBLEACH protocol for
widely area.
In this project, there is a scene, where a lot of sensors are distributed on a wide
area and the Base Station is in the corner of the area, as Lake monitoring network.
The network model used is the same as in LEACH. It only limits region, which
the nodes are randomly distributed in the square, BS is located at one end of the
rectangle, according to the assumption §2.61. The network parameters are show as
follows:
2. The nodes are homogeneous, meaning nodes have the same initial energy,
3. The cluster heads can merge data according to data fusion rate δ .
4. The nodes are fixed and they can automatically constitute networks without
artificial help.
5. There is only one Base Station (BS) in the whole network; BS is located at one
69
6. A node knows the relative distance between itself and the other nodes
E Rx (k , d ) = Eelec k (2-3)
Taking the location of the Base Station as the center of coordinate, sensors are
distributed a rectangle on the first quadrant. The quadrant will be divided into arc areas
by the radius
Ri = Ani , as shown in Figure 3-1, which A is the unit length split from
side b.
Area=Si
es
b
al
Sc
1
C+
Qi
BS
90
A C
2A
Shown in Figure 3.1, the entire network area is divided into C + 1 region:
C = b / A (3-2)
Qi ∈ Q
C +1
Q = ∑ Qi ,
i =1
Si = π ( Ri2+1 − Ri2 ) / 4 (i ≠ C )
(3-3)
S i = b 2 − πRc2 / 4 (i = C )
ri Qi ,
The distance between a node to the Base Station in region i is in
Ri ≤ ri ≤ Ri +1
Definitions:
R i+1 + R i
Ri =
2 (3-4)
is the number of the The distance between a node to the Base Station in
Ni
region nodes in
Qi
N _ CH j
is the number of the cluster heads in Qi
( j = 1,2,3.... )
71
N _ CH j = 0
'
2.
i ≥ 2 ,cluster heads has N _ CH j
Consider the energy consumption of the nodes when data is transmitting, the
energy consumed by the power amplifier and receiving data according to (2.2)
Ni
The average number of nodes is − 1 except cluster head in a cluster,
N _ CH j
Each cluster members to send 1bit data in one round, a k data fusion energy
consumption is
EDA , Data fusion rate is η , When the data need to transmit, The
(3-6)
EN NO _ CH = KEelect + K * ε fs * RtoBS
(3-7)
The total energy consumption of cluster nodes and the cluster head is
E total = ∑ N i _ CH i * {ECH + (
Ni
− 1) * E NO _ CH }
N i _ CH j
j (3-8)
S 1
The average size for each cluster node is N CH , Node density ρ = S i
i
i_ i
N i _ CH i
(3-9)
RtoBS = ∫∫ r 2 ρ (r ,θ )dθdr
0 ≤θ ≤π , Ani ≤ r ≤ Ani+1
2 (3-10)
The expectation square distance from node to the cluster head is :
72
Si
E ( RtoCH ) = ∫∫ ρr 2 drdθ =
8πN i _ CH j
(3-11)
∂Etotal
=0
∂N i _ CH j
(3-12)
Ni ε fs S i Ni ε fs S i
N i _ CH jbest = ≈
4 2π ε amp Rtobs 4 2π
2
ε amp Ri2 (3-13)
After the first cluster head is selected based on region, for the region Qi , each
round, the sink node will calculate the remaining average energy of each cluster
Definition:
Eavgi1 + Eavgi 2 ..... + Eavgim
Eavgi =
l
(3-14)
Eavgi
Represents the remaining energy in the region Qi
In order to make the nodes with the highest energy be elected as the cluster head,
Definition:
Eij Q
Is the remaining energy of j node in i , its normalized value of the
73
remaining energy.
Eij (3-15)
β =j
E avgi Definition:
Ri
R (i ) = 1 −
2b (3-16)
Cluster head Selection is based on two things: First, the optimal number of nodes
in the network, Second the number of nodes in the front wheel in the diagram n was
That is, each node according to a formula (3-17). The first round of random r
calculated values associated with the energy and the distance of the value between 0-1.
(3-17)
(α1 + α 2 ) = 1
set which has not been selected in the cluster head which determines the number of
clusters by format.
74
N j is the nodes in Qi
If
E Rx j ( L, d j ) = E elect L ≤ E RThreshod
,
Node
N i belongs to the i cluster
If
N i is at the boundary of Qi and Q j ,
If
Else if
cluster.
the head of cluster and base station is the single-hop, which is data transmission from
each head of cluster to the base station. As shown in Figure 3.2, all the heads of
clusters focus the data, which come from all member nodes in the clusters and transfer
the data to the base station. However, it is obvious that this single-hop method does not
work. The head of cluster far away from the base station needs to consume much
energy to send the data to the base station, thus causing early death of nodes.
75
Head of cluster Base station
The single-hop does not work based on the analysis in Figure 3.2, so the
cluster does not need to transfer the data with a long distance, and the energy cost of
the sensor nodes can be reduced to elongate the life cycle of the networks. Thus, in this
thesis, the multi-hops data transmission between the head of clusters is employed. The
Compare Figure 3.2 and Figure 3.2, it is known that the data is not transferred to
the base station directly from each head of cluster. The selected head of clusters in
each round connects to each other to form a link with several branches. The data
76
collected from each head of cluster is transferred and aggregated in this link. Finally,
all the data is fused and aggregated, ready to be sent to the base station.
In the process of data transmission, the table of all sensor nodes contains
T (T= M + K )
time slots. Each node member (except the cluster head) transmits data
i (i ≤ M )
collected to cluster head nodes at time slot . Cluster head nodes aggregate data
received and then integrate them. At the former M time slots, the transmission of data
in all clusters is completed. At subsequent K time slots, cluster head data is transmitted.
Cluster head nodes integrate data received from other cluster head nodes and data
saved by itself and send data obtained after integration to the next hop of cluster head
nodes at time slot M + j until all data in base station nodes is fully integrated.
{E ( CH ) , E ( CH ) , ⋅⋅⋅, E ( CH )}
1 2 m
of a neighbor cluster head, where refers to the
residual energy of cluster head of the ith cluster at the current moment. Assume that
CH1 , CH 2 , ⋅⋅⋅, CH m are neighbor cluster heads around CH k (When cluster head CH k
calculate whether the base station is in the communication scope (radius) of its cluster
head; if it is, it will directly transmit data to the base station; otherwise, it will give the
process of transmitting data to the next hop, i.e. the process of cluster head jump. The
residual energy of neighbor cluster head nodes and the distance between this cluster
CH j Pj
head node and base station should first be considered. To cluster head , is
called the probability of cluster head jump. Its calculation is shown in formula (3-11).
E (CH j ) α
Pj = [ ] [exp(− Ri )]β (3-20)
E max
In formula (3-11),
Emax refers to highest residual energy among all neighbor
77
cluster heads of cluster head
CH k ; α and β are two factors used to control the
energy and position of cluster heads. After the calculation of relative probability of
different neighbor cluster heads being selected, the one with a higher probability value
will become the jump cluster head of this node. Therefore, it is obvious that, the more
the residual energy there is and the closer it is to the base station, the higher the
probability of being selected as jump cluster head will be. However, the cluster head
node selected as a routing hole does not have the chance of being selected as a jump
cluster head. Therefore, such path selection mode obtained based on the residual
energy of neighbor cluster head nodes and the distance between this cluster head node
3.7 Summary
This chapter proposed the performance of the RBLEACH algorithm. The regional
division, selection of cluster head and path depend on residual energy and distance,
these changes can improve the performance of the protocol, such as prolongs the
lifetime of each sensor node and death of the nodes, the simulation results are showed
in chapter 7.
conside
78
Chapter 4 PS-ACO-LEACH
Clustering strategy or multi hop routing are research hot issues. However,
protocols only focus on one factor. For example, in researching multi-hop routing, the
clustering strategy is simple; conversely, the cluster could be slightly neglected for
route optimization. RBLEACH is used in the wide area,but it only focuses on the
the clustering strategy and multi hop routing mechanism to be optimized? Based on
these problems, in this chapter, a WSN clustering routing protocol is proposed, which
(PS-ACO-LEACH).
The default scene of this protocol is a process, which is to randomly distribute the
wireless sensor nodes into a limited square area and then send the data collected from
The following assumptions are made of the networks considering the networks
1. All sensor nodes send the solid bits of data to the head of the cluster every
time. The bits will not increase or decrease because of data amount. The information
(position, residual energy and whether being the head of cluster or not) of the sensor
nodes are all contained in the data packets with a solid length. The sensor nodes will
2. The base station uses the external power supply and the energy will not be
exhausted.
3. The setting information sent from the base station is very simple and short.
79
There is no energy cost when the sensor receives this information.
4. The radio communication models used by WSN is the same with that in section
2.6
The clustering part of the PS-ACO-LEACH uses the centralized control strategy,
which executes the algorithm at the base station which has inexhaustible energy. The
protocol applies to the same ideas with the literature [8,45]. There are two rounds in
each round: creation of the cluster and steady-state stage. The creation of the cluster
(2) The basic PSO is applied to find out the optimized solution of the fitness
(3) The base station publishes the clustering information to the head of the cluster,
and the head of the cluster publishes the clustering information to the nodes in the
clusters.
LEACH considers the impact of the node in the cluster. Based on these two
judgment factors, in this thesis, the Euclidean distance to the head of the cluster and the
Euclidean distance from the head of the cluster to the base station are also considered
According to the energy information of all nodes, the base station calculates the
average energy of the node. The node whose node energy is more than or equal to the
average energy, is selected as the head of the cluster node. The candidate for the head
of the cluster node is set to narrow the selection range of the head of the cluster to
guarantee that the head of the cluster node finally selected has sufficiently large
amounts of energy and has the ability to play the role of head of the cluster.
80
Assume that there are N nodes in the network, Kth node is selected as the head of
the cluster, and there are M candidates for the head of the cluster (M>>K). Thus, in
total there are Q = CM probabilities for the head of the cluster combinations.
K
Modify the problem and describe it as: decide a group as the optimized solutions
(K solutions) in M candidate head of cluster nodes to make the value of the optimized
solutions minimal.
Where f1 、f 2 、f3 and f 4 are the evaluation factors considered in the selection of the
head of the clusters. α , β , λ and η represent the weights of each judgment factor in
the fitness function respectively. Formulas (4-2) to (4-5) are the mathematical formula
f1
k =1,2,..., K
∀ni ∈C p ,k
(
max ∑ d (ni , CH p ,k ) / C p ,k ∗ d ( BS , NC ) )
(4-2)
N' K
2 f = ∑ E (n ) / ∑ E (CH p ,k )
i
=i 1 = k 1 (4-3)
{
f3 = max d ( BS , CH p ,k ) / d ( BS , NC )
k =1,2,..., K
} (4-4)
f4 max min {d (CH p ,k , CH p ,e )} − l / d ( BS , NC )
k =1,2,..., K e =1,2,..., K
e ≠ k
(4-5)
Table 4-1 shows the parameters explanations from Formulas (4-2) to (4-5). It
d ( BS , NC )
should be noted that plays the role of dimensionless elimination.
d (parameter1, parameter2)
is the Euclidean distance between two parameters.
81
Table 4-1 The meaning of parameters in fitness function
in the particle p
Euclidean distance from the nodes in the each cluster to the corresponding
the current residual energy of all sensor nodes divided by the summation of
distance from the head of cluster to the base station divided by the distance
from Base station to the region center. The less value of the distance, the
larger probabilities that the head of cluster concentrate in to the hot zone.
distance from each cluster head to the nearest cluster head, and calculate
the difference between the value of this Euclidean distance and the ideal
distance. The less difference, the more uniform distribution of the cluster.
(1) The average Euclidean distance from the nodes to the corresponding cluster
head should be short, which is shown by the compact distribution of the nodes in the
(2) The summation of the cluster head energy is large, and is quantified by
f2
(3) The cluster head is close to the base station, and is quantified by
f3
(4) The distribution between the cluster heads is reasonable, and is quantified by
f4
This type of network clustering can minimize the energy cost in the clusters,
balance the energy cost and reduce the probabilities that the nodes far from the base
station become the cluster heads in order to maximally elongate the life of the nodes
83
Selecting the candidate
cluster head sets
PSO optimized
clustering
Whether particle P
Yes No
represents optimal ?
Transmission
of data, and
stable
operation
End
The judgment factors are analyzed based on the idea: the weight analysis of each
judgment factor needs to compare the difference on a relative fair “Platform”. The “fair”
means that each judgment factor has a similar influence to the selection of the cluster
Assume this scene: all nodes and all cluster heads in the networks are distributed
84
uniformly, as shown in Figure 4-2. This kind of network topology and clustering are
network environment and adjust the weight parameter of each factor accordingly to
make the final calculating value of each factor the same. Adjust slightly the value of
each weight parameter and observe the life cycle for different value cases.
Analyze the results according to the rationality and influence of the simulation
The following is the analysis of the initial value of four judgment factors under an
1. For f1 , each cluster head is responsible for a rectangular area under the
assumptions shown in Figure 4-2. The area of the region should follow formula (4-6).
The number of the cluster members in the region should follow formula (4-7)
S= ( X ∗Y ) ∗ p (4-6)
A = N ∗ p −1 (4-7)
85
Where S is the area that each cluster head is responsible for, A is the node number
of a cluster, X is the length of the network region, Y is the width of network region,
and P is the percentage of cluster heads. Assume that no matter what the value of X or
Y, the region that the cluster head is responsible for is close to the square which means
the length along the side is l = S . The nodes in the cluster are distributed uniform.
If the nodes are moved around the center diagonally with some degrees, as shown in
Figure 4-3, all nodes in the cluster are distributed uniformly along the diagonal. The
2
d (ni , CH p=
,k ) ∗l
distance from the nodes to the head of cluster is 4 . Assume that the
2 2
X Y
coordinate of the base station is
(x y
bs , bs ) , d ( BS , NC )= − xbs + − ybs
2 2 can
be obtained. Thus, formula (4-8) can be concluded:
f1 = d (ni , CH p ,k ) / d ( BS , NC )
2 X 2
Y
2
= ∗ ( X ∗ Y ) ∗ p / − xbs + − ybs
4 2 2
(4-8)
2. For f 2 , the energy of all nodes is equal to the initial condition. Based on formula
86
(4-3), the value of f 2 is same with the reciprocal of cluster head probabilities.
1
f2 = (4-9)
p
N∗p
cluster heads in the region, in which there are A cluster heads on the long side
formula (4-4) is analyzed. The base selection is selected in different locations because
of different application environments and purposes. The location might be in the center
of the region, at the edge of the region or someplace far away from the region. The
location of the base station is assumed as ( xbs , ybs ) , then the solutions for formula (4-11)
A∗ B = N ∗ p
A X (4-10)
B = Y
X
=A ( N ∗ p)∗
Y
(4-11)
Y
B= ( N ∗ p)∗
X
The location of the base station is set as (0,0) , and it can be concluded that the
coordinate of x of the farthest cluster head to the base station in the current network is
1 X 1 Y
X − ∗ , the coordinate of y is Y − 2 ∗ B . According to formula (4-4), the
2 A
87
2 2
1 X − x + Y − 1 ∗ Y − x
X − 2 ∗ bs bs
X 2 Y
( N ∗ p)∗
( N ∗ p)∗
Y X
=
2 2
X Y
− xbs + − ybs
2 2 (4-12)
The network environment is assumed and shown in Table 4-3. (It is named as the
first category environment). Based on the formulas 4-11, 4-12 and 4-15, the value of f1 ,
d (CH p ,k , CH p ,e )
the proportions closer, the difference between the late of the WSN
life cycle and l is assumed as 20. This means that the value of f 4 in the late
d (CH p ,k , CH p ,e )
is approximately 0.5. It is easy to set the least common multiple of
f i (i = 1, 2,3, 4 ) to be 30. The result of fi multiplying weight is 30, and the values in
The value in Table 4-5 can be obtained by normalizing the values in Table 4-4. In
Table 4-5, ρk is the weight of the corresponding factor f k , and the value of k can be
ranged as k = 1, 2,..., m where m is the number of the factors in the self-set fitness
function. The fitness function probably selects more different factors that will
As shown in Table 4-5, it is unreasonable to set the value of weights as the same
or set the weights to be subjective, which probably would cause the completely failure
89
After the creation of a fair “platform”, the value of each weight should be adjusted
to be 5 times or 20 times more. Then the difference of the simulation results between
the adjusted weight combination and the initial weight combination is observed to
determine which judgment factor is more important. It is noted that the simulation
mentioned is to peel off the multi-hops routing mechanism that the cluster head
transfer the data to the base station with single-hop like LEACH, and the networks
nodes are distributed randomly. The purpose is to determine if the judgment factors
joining the PS-ACO-LEACH are reasonable, and to analyze the importance of each
In Figure 4-5, the solid line indicates the rising curve of the dead nodes when the
values of the weight parameter α , β , λ , η of the judgment factors are averaged. The
dotted line indicates the rising curve of the dead nodes when the values of the weight
parameters are taken in the following Table 4-5. The region indicated by the arrow is
enlarged for the comparison of two simulation curves. It is observed that the life cycle
noted that the simulation curves straight up when the number of dead nodes is close to
90, which is caused by the added settings in the program. When the proportion of the
dead nodes is close to 90%, WSN is invalid. This will result in the rapid death of
residual nodes. The following simulation figure is set with the same assumptions.
90
Figure4-5 Comparison of weight parameters
Figures 4-5 to 4-8 show the simulation results that increase the values of α , β , λ
and η by 5 times and 20 times. Compared with the parameters in Table 4-5, the
(1). The simulation curves have a high degree of coincidence, but their
separations are not obvious, they need to be enlarged to see the tiny differences
(2) The value of the solid line is decided based on Table 4-4. Its life cycle is the
longest, demonstrating that considering the four judgment standards in this thesis
comprehensively and evenly is better than considering some judgment factor solely.
(3) The simulation curve in Figure 4-5 and Figure 4-8 has a high degree of
coincidence in the former and latter parts of the WSN statement, demonstrating that the
cluster compact judgment factors and “hot zone” relative judgment has a large
(4) The solid lines in Figure 4-5 and Figure 4-7 are always on the right side,
demonstrating that the cluster head energy judgment factors and the clustering
uniformity judgment factors have few influences on the cluster head. The separation in
Figure 4-9 is a little larger, demonstrating that the cluster head energy judgment factors
91
have a minimal influence in this network environment.
92
Figure 4-8 Comparison of weight parameters
(1) Two judgment standards proposed in this thesis are feasible, effective and
have a positive influence on the elongation of the life cycle of proposed networks.
(2) In this thesis, the methods of analysis for the weight of judgment factors and
the weight parameters obtained based on the analysis methods are optimized in the
network environment. The analysis methods are universal and can be used to compare
(3) In this network environment, the influence of each judgment is ranked from
PS-ACO-LEACH uses the basic ant colony algorithm [46-48] to select the
shortest path from the cluster head to the base station. According to ACO, The
93
[τ ij (t )]α + [η ik (t )}β
, j ∈ allowed k
pijk (t ) = ∑ [τ ij (t )] + [η ik (t )
α β
s∈allowed k
0 else
(4-14)
allowed k = {C -tabu k }
is all the states allowing ant k th to select for the next
step.
1
ηij (t ) =
dij
(4-15)
η ij dij
is the heuristic information, is the distance between the two adjacent
cities.
information will fade with time, and even be forgotten. The amount of information
τ ij (t + n) = (1 − ρ )τ ij (t ) + ∆τ ij (t )
(4-16)
∆τ ij (t )
is carried over the amount of information for k th ant in this cycle path.
ρ is a pheromone evaporation coefficient.
94
Start
1 plus the
number of
iterations
Ant K = 1
Ant K = K +1
No
Modify taboo
table
Yes
Yes
End
frequently. Both the death of the old nodes due to energy depletion and addition of the
new ones will contribute to changes in topology of the networks so that the routing
process fails. The PS-ACO-LEACH protocol uses the artificial ants to construct the
path, which can deal with the addition of new nodes and death of the old ones
conveniently. As a new node enters the network, the ants can rapidly construct new
As an old node dies because of energy depletion or for other reasons, its previous
hop-node will find the death caused by the data transmission time-out. Then the
information consistence of this path will decrease to zero to prevent continuous visits
to the dead node. All the characteristic information of the dead node in its near nodes
list will be deleted. Finally, the next hop-node will be calculated according to the
4.5 Summary
particle swarm fitness function in the clustering stage, considering the residual energy
distance between clusters, cluster head nodes to base station of the Euclidean distance
to optimize the cluster head configuration; Secondly, in the routing phase of ant colony
algorithm to find the best route from nodes to the base station of cluster head, cluster
96
Chapter 5 MIA-QRP protocol implementation
The network is Adhoc, which can origanize the network itself without relying on
PS-ACO LEACH are used for ADHOC, but the route protocls don’t consider QoS.
The routing protocols of Adhoc support the ones of the QoS [111-123], but most of the
existing protocols are criticized by one factor among the node energy, the bandwidth,
the delay and the other single QoS indexes. In this thesis, the average link delay, the
average package loss rate and the node signal strength are selected as the parameters of
QoS for the special requirements. Multiple Indicator Adaptive QoS Routing protocol
(MIA-QRP) is suggested.
[117], which can support at most two-hops. During the operation of the protocol, each
node maintains a network topology table. The nodes obtain the link relation by
exchanging the topology routing information. When the topology is updated, it will use
the routing algorithm to select the optimized path. The stored information of node
Loss means the package loss rate parameters of the link formed by the nodes and
parent nodes.
97
Delay means the delay parameters of the link formed by the nodes and parent
nodes.
Quality means the nodes’ signal strength of receiving the parent node signal
Link_statie means the link condition between the nodes and parent nodes.
In order to manage the nodes information normally and conveniently, the first
stored information of the topology table is set with the relative information of each
node. The MAC and IP in the table fill the MAC address and the IP address of the each
node respectively. The parent nodes MAC and the parent nodes IP fill the
00-00-00-00-00-00 and the Loop address 127.0.0.1. The value of the lost is 0, value of
the delay is 0, value of quality is 1, value of TTL is 0 and that of the link state is 2.
and node C should be finished by the data transmission of node B, then node B is the
Parent nodes: In a communication link, if node B is the relay node of the link
from node A to node C, then node B is the parent node of node C, and node A is the
Direct neighbor nodes: other nodes which are in the direct communication
distance range of node A are the direct neighbor nodes of node A. The topology
information of the direct neighbor nodes sets the parent MAC and the parent IP to be
Line of sight: the communication link built with the direct neighbor nodes is the
line of sight.
Multi-hop path: the communication link between the indirect neighbor nodes is
multi-hop path.
Two-way link: If node A and node B can receive a signal from each other, then
All nodes maintain their own network topology table. The nodes obtain each path
to communication with other nodes, and finish the selection of their optimized path and
the division of the alternate path by combining the path selection algorithm programs.
Finally, the settings of the nodes routing table are finished. All node information in this
The operations of this protocol are finished by the cooperation of seven types of
“delete”. The hello message is a broadcast message, in which the nodes will first send
this message to the surrounding nodes as they start up. During the operations of the
protocol, the nodes will regularly broadcast the hello message to the surrounding nodes
to maintain their own network topology information. The surrounding nodes will
response to the response message when they receive the hello message to determine the
direct neighbor nodes to form the line of sight. When one node has a new path, it will
send the updated message to the neighbor nodes directly so that the neighbor nodes can
update the network topology table in time. In order to guarantee the efficiency of the
node information, this protocol sets a detection timer to regularly maintain each node.
Once an expired node is found, the “delete” message will be sent to the neighbor nodes.
The nodes detect their own network topology table after receiving the delete message
and delete the information of the expired nodes. In order to prevent routing loops, an
“rsreq” path detection message and a “reqack” path confirmation message are designed.
The “ack” message is to finish the verification of the two-way link to ensure that the
types of messages, “hello”, “response”, “update”, “ack” and “delete”. The functions
99
of each message are exhibited in Table 5-2
Update Send the updated information of the network topology to the direct
neighbor nodes
Delete Send the routing deletion information to the direct neighbor nodes
Ack Detect the message in the adjacent nodes to remove the one-way
link
Seven types of message in this protocol have the similar format, which is called
Ipv4 address
MAC
MAC(cont’)
Value definitions of each field command: This field indicates the type of message,
which occupies eight bits. The value of this field is 1, which means it is a “hello”
message. The rest may be deduced by analogy, when the values of the fields are
2,3,4,5,6 and 7, the fields are response message, update message, delete message, ack
Version: This field shows the protocol version of this field, which occupies 4 bits
100
and is designed for the upgrading of the protocol. In this thesis, the value of the first
F: This field indicates the mark field. When the value of the command field is 5,
the value of this field is significant. If the value of the F field is 1, it means it needs the
other side to send the “ack” message for the confirmation. The value of the F field is 2,
Length: This field indicates the total length of the protocol message, including the
Ipv4 address: This field indicates the ipv4 address of this node, which occupies 4
bits.
MAC: This field indicates the physical address of the node, which is actually the
The format of the “hello” message is the same as the public radical of the message.
It just needs to give the relative value to each field. The value of the command is 1, the
value of version is 1, the value of F is 1, the value of length is 16, and the IPv4 and
MAC fields fill the IP address and the MAC address of this node respectively, as
Ipv4 address
MAC
MAC(cont’)
101
5.2.3 Format of “response” message
The “response” message is the response to the “hello” message. The node
receiving the “hello” message supplies the network topology information to the node
sending the “hello” message so that the node that sends the “hello” message can create
its own network topology table as soon as possible. The message format is shown in
Figure 5-3
0 7 15
Ipv4 address
MAC
MAC(Cont’)
n routing entries
In the “response” message, the radical of the message command field value is 2.
There are “n” routing entries after the public radical. Each routing entry indicates the
path information from one node to one of its direct neighbor nodes. The format of each
0 7 15 31
Ipv4 address
Link_state Delay
Lost Quality
The length of each routing entry is 12 bits, including IPv4 address, link state,
delay, package loss rate and signal strength. The definition of each field is described as
follows:
IPv4 address (IP) occupies 4 bits and indicates the IP address of the direct
neighbor nodes.
Link state occupies 2 bits. It is used to express the link state between direct
102
neighbor nodes and the original node. This field can supply criteria for routing
selection in the routing algorithm. If the value is 0, it means that the link between the
nodes is broken. If the value is 1, it means that the link between the nodes is one-way
link. If the value is 2, it means that the link between the nodes is two-way link.
Delay occupies 2 bits. It shows the statistical average value of the communication
delay between the original node and the direct neighbor nodes, including processing
Package Loss Rate occupies 2 bits. It shows the average value of the
communication package loss rate between the original node and direct neighbor nodes.
Signal strength (quality) occupies 2 bits. It shows the signal strength of the direct
It is known from the definitions of the message format that the total length of the
message minus the length of the message public radical is equal to the length of the
entry part of the routing. Each routing entry occupies 12 bits. Thus, the number N of
the routing entry in each response message can be calculated with the following
formula:
len − 16
N=
12 (5-1)
Where len is the length of the whole message, 16 is the length of the public
radical of the protocol message and 12 is the length of one routing entry.
The “update” message is used to report the finding of a new path or the updating
of a path to the direct neighbor nodes. It is an important part of the path updating and
maintenance. Each “update” message contains a path condition, and each condition is
expressed by one routing entry. The “update” message has a length of 28 bits and the
103
0 7 15 31
Command(3) Version(1) F
IPV4(Address)
MAC (Address)
MAC Address
IPV4(Address)
Link_state C Delay C
Lost C Quality C
The “delete” message format is similar to the “response” message format. Both of
them contain public message radicals and “n” routing entries. Its command value is 4.
Ipv4 address
MAC
MAC(Cont’)
n routing entries
The routing entry in the “delete” message is the routing entries that need to be
The “ack” message is mainly used for protocol message confirmation between the
neighbor nodes. The neighbor nodes confirm a two-way link based on the “ack”
104
message. The length and the format of the message are similar to the “request”
message. But the value of the command field is 5. The format of the “ack” message is
Ipv4 address
MAC
MAC(cont’)
In this protocol, the path discovery mechanism includes positive path discovery
and negative path discovery. The positive path discovery means that the nodes send the
“hello” message to the neighbor nodes to require positive routing information. The
negative path discovery means nodes receive the “update” message from the neighbor
nodes, in which the path is constructed based on the “update” message. The positive
The active path discovery of nodes includes three steps: perception of new nodes
to the path, confirmation of link state, and perception of the neighbor nodes to the new
nodes. The network topology is shown in Figure 5-9. The distance between the
neighbor nodes is in the one-hop, but the distance that is between the non-neighbor
nodes is beyond the direct communication range. It is assumed that nodes B, C and D
can communicate with each other directly, and the network topology shown in Figure
5-8 has been formed. Setting node A as an instance, the path active discovery of the
105
B
D
C
A
After the switch of node A’s hardware, node A first initializes self-hardware, then
it operates the content of this protocol. Node A first broadcasts a “hello” message to
the neighborhood the content of this message is shown in Figure 5-9. After sending the
“hello” message, node A is in the condition of loop waiting. After receiving the
protocol message from the other nodes, node A will operate the relative messages.
0 7 15 31
Ip A
Mac A
Mac A
Based on the node network topology in Figure 6-10, node B and node C will
receive the “hello” message sent from node A. According to the construction
regulation of the direct path, node B and node C will create the corresponding network
topology information based on the received “hello” message. The received “hello”
message can only confirm the one-way communication between the Link A-B and
Link A-C. The link state field is set as 1, the detailed generated network topology
Mac A IP A Mac B IP B - - - 0 1
as follows:
The nodes MAC address in the radical of the MAC and of the “hello” message
Package loss rate, because there is no two-way link confirmed. The measured data
is not generated.
Delay, because there is no two-way link confirmed, the measured data is not
generated.
Signal strength, because there is no confirmed two-way link, the measured data is
not generated.
Link state, because the “hello” message is just received, 1 is filled in to express
After node B and node C generate their own one-way topology information table,
node B and node C will check self-network topology information tables, and extract
and package the corresponding node information to the response message, which will
be sent to node A. The routing entry of the response message must be a two-way direct
path. The response message sent from the node B and node C to node A are shown in
107
0 7 15 31
Ip B
Mac B
Mac B
Ip C
link_state C Delay C
Lost C Quality C
0 7 15 31
Ip C
Mac C
Mac C
Ip B
link_state= =2 Delay B
Lost B Quality B
Ip D
link_ state
= =2 Delay D
Lost D Quality D
After node A receives the “response” message sent from node B and node C. The
network paths are constructed based on the message content and two direct paths and
108
Node MAC Node IP Parent node Parent node Packet Delay Signal Living
MAC IP loss rate strength time Link state
Mac B IP B Mac A IP A Lost B Delay B Quality B 0 2
Package loss rate, node A measures the statistical average value of package loss
rate of the communication between node A and the node related to the “response”
message.
communication between node A and the node related to the “response” message
Signal strength, node A measures the signal strength value of the node related to
construct three multi-hop paths. The content of network topology information content
109
parent node parent node packet Signal
NodeMAC NodeIP loss rate Delay Living time link state
MAC IP strength
Node mac, mac is filled in 00-00-00-00-00-00-00 because it is not the direct path.
Node IP, extracted from the routing entry information of the response message.
Package loss rate, the nodes related to the response message radical measure the
statistical average value of the package loss rate of the communication between the
nodes and the relative routing entry nodes delay, the nodes related to the response
message radical measure the statistical average value of the delay of communication
Signal strength, the nodes related to the response message radical measure the
Link state, the response message is promised to merely send the two-way path
B
D
C
A
110
Node A receives the “response” message by sending a “hello” message to the
neighbor nodes. Based on the detailed content of the “response” message, node A can
obtain the network topology structure of the neighbor nodes, and modify the network
topology structure information table of node A to create the communication path with
the neighbor nodes. The network topology structure of node A is shown in the dotted
After node B and the node C receive the “hello” message from node A, they can
only confirm the link A-B and link A-C as one-way paths, but not as the complete
communication path between nodes B, C and node A. In order to modify the network
topology information table of node B and node C, after node A finishes the operation
of the “response” message, it needs to feedback the “ack” path confirmation message
to node B and node C so that the direct neighbor nodes can confirm the creation of
two-way path. As node A has already confirmed the communication link as a two-way
link, it just needs to send the “ack” link confirmation message to the direct neighbor
nodes. The value of the field F of the message radical is 2, which means that the direct
neighbor nodes do not need to reply to the “ack” message for link confirmation. The
detailed “ack” message content sent from node A is shown in Figure 5-16.
0 7 15 31
Ip A
Mac A
Mac A
After receiving the “ack” link confirmation message, node B and node C will
correct the link state field of the information related to network information topology
table of the nodes, and correct 1 to 2 expressing the two-way link. They will also call
the package loss rate, delay and signal strength of the relative link obtained from the
111
link measurement program. The content of the corrected network topology information
Figure 5-17 Network topology information of the node B and the node C
After the “ack” link confirms the completion of message operations, the network
topology information tables of node A, node B and node C are modified, and the
communicated network topology between nodes is created. However, node D does not
update its own network topology information table, thus it does not have the multi-hop
path information to node A. This routing protocol also designs an updated routing
renewing message, by which node D modifies the topology information table of the
nodes. The update process of the network topology information table of node D is
introduced as follows:
Based on the network topology shown in Figure 5-8, after node C finishes the
“ack” link confirmation message and modifies its own network topology information,
it will send the updated routing message to the neighbor nodes. As the constructed C-D
link cannot be confirmed as a two-way link, the value of link state of the network
topology information will be corrected to 1 when node C sends the “update” message
to node D in order to confirm the C-D link state again. The content of the “update”
112
0 7 15 31
Ip C
Mac C
Mac C
Ip A
link_state=2 Delay A
Lost A Quality A
After node D receives the update routing message, it will create a D-C-A
multi-hop path from node D to node A according to the message content and to the
multi-hop path construction rules. Because the link state of path C-D needs to be
updated, the value of the link state of the created network topology information table
will be set as 1. The content of network topology information table created by node D
After node D updates the path topology information based on the “update”
message, it needs to send the “ack” link state request confirmation message to confirm
the D-C path as a two-way link. Because node D needs node C to feed back the “ack”
link confirmation message, the value of F field is set as 1. The content of the “ack”
113
0 7 15 31
Ip D
Mac D
Mac D
After node C receives the ack link state request message from node D, it modifies
its network topology information table first, and corrects the value of the link state of
the relative routing information from 1 to 2. It also marks the relative path as a
two-way available path. After modification of the information, node C will feed back
the ack link state confirmation message to node D. The value of the F field in the
Ip C
Mac C
Mac C
After node D receives the ack link state confirmation message, it will correct the
value of the path state of the network topology information based on the message
content, and set the value of link state of relative D-C link and D-C-A link as 2 to
express the relative path as the two-way path. The corrected topology information is
114
Node MAC Node IP Parent node Parent node Packet Delay Signal Living
MAC IP loss rate strength time Link state
Mac C IP C Mac D IP D Lost C Delay C Quality 0 2
After the update path message is completed and the network topology information
table of node D is modified by the ack link confirmation message, the node topology
accessible topology path information between each node and the path discovery is
B
D
C
A
This routing protocol is based on the table-driven routing protocol. Each node
implements the work of nodes routing table maintenance, mainly by setting the node
timing, updating the timer and the node inquiring timer. The nodes update the timer
claiming the existence of the self-nodes. The nodes inquiring timer is used to regularly
inquire the content of the network topology information table, and timely delete the
115
5.4.1 Regular updating strategy of routing
In this ADHOC network, the nodes can randomly move. The network topology is
the nodes can be changed at any time. The routing protocol needs to, on a timely basis,
communication.
the regular updating timing of nodes to guarantee the path effectiveness between the
nodes. Each communication node has a regular updating timer. Once the prescribed
amount of time elapses, the node will regularly broadcast the “hello” message to the
surrounding nodes to claim the existence of the nodes. Due to different application
conditions of the ADHOC networks, the external influences on the nodes are different,
and the moving conditions of the nodes are different. The detailed interval is set
When the time of the timer comes, the nodes will not only send the “hello”
message, but also update the value of the lifetime field of each path in the network
topology information table of the nodes. The nodes will also set regular intervals to
achieve the objective of recording the lifetime of a path. When receiving the “hello”
message, the surrounding nodes will timely correct the relative path lifetime of the path
information, which is reset to 0, based on the content of the “hello” message, and mark
In order to timely update the invalid routing information of the nodes in the node
network topology information table, an inquiry timer is designed in this protocol. The
nodes regularly travel through the network topology information table to check the
recorded value of the path lifetime field, and to judge if the lifetime of each path
116
exceeds the set maximum lifetime. If the lifetime of each path exceeds the set
maximum lifetime, the path is judged as an expired invalid path, and the corresponding
node is the invalid node. This node will delete the corresponding routing information
in the network topology information, and package the invalid nodes into the “delete”
message sent to the surrounding direct neighbor nodes. The surrounding direct
neighbor nodes will timely update the network topology information table according to
the “delete” message to remove the invalid routing information contained by the
expired nodes.
Node D in Figure 5-24 is assumed to be an invalid node, and the deletion process
of the path is described. If node D does not have failing node, the set request timer will
detect the maximum value that the C-D path lifetime exceeds the set value in the
network topology information table after a while. Meanwhile, node C judges node D as
an invalid one and deletes the routing information related to node D in the network
After deleting the information of the invalid node D, node C will package node D
into the “delete” message and send it to the direct neighbor nodes. The state value of
the link in the routing entry contained in the “delete” message is set as 0, which
indicates an invalid link. The content of the “delete” message is shown in Figure 5-25.
117
0 7 15 31
IP C
MAC C
MAC C
IP D
Link_state =2 Delay D
Lost D Quality D
After node A and node B receive the “delete” message, the lifetime of path A-C
and path B-C will be set to 0 according to the message content. The information of the
invalid nodes in the nodes network topology information table, which is the recorded
information of node D, will be deleted. After the deletion, the topology information of
node A and node B are shown in Figure 5-26 and Figure 5-27.
parent node parent node packet Signal
NodeMAC NodeIP loss rate Delay Living time link state
MAC IP strength
Mac B IP B Mac A IP A Lost B Delay B Quality B TTL 2
information table, they will delete the expired path information of node D. The
B
D
C
A
Many protocol modes always involve the Finite-state machine (FSM) [137],
which makes an accessible analysis by the state transmission and detects all kinds of
mistakes in the protocols and the standards. The FSM of the protocol is shown in
Figure 5-30. From the view of the form, the FSM mode of this protocol can be
In this triad,
The event trigger mode is used in the design of this protocol. As a protocol event
comes, the protocol transfers from the free state to the events processing state. After
Protocol initiation
Protocol exit
Over all, there are two states in this protocol: free waiting state and protocol event
processing state. In the free waiting state, the protocol machine does nothing and waits
for the coming events that initiate the protocol state transmission. The protocol event
processing state is a brief busy state of the protocol machine to process all kinds of the
protocol events. The detailed protocol events processing states are described as
follows:
Protocol initiation
120
New path construction
The core of this protocol is the processing of the protocol message. The protocol
machine makes the relative processing based on the received message. It returns to the
waiting state after processing. The two timers use the interrupt mechanism. After the
interruption mechanism, the interruption processing is done, and then the protocol
retunes to the waiting state. From the FSM mode mentioned above, the protocol always
repeats wait for the mission-processing when the mission returns back to the waiting
state, and there is no deadlock in the protocol mode. Thus, the protocol has no mistakes
in flow-processing design.
The routing algorithm can be classified into two types: self-adaptive routing
algorithm can feel the change of the networks and change the routing strategy
algorithm, the routing information has already been downloaded to the local when the
networks are launched. When the network topology or other networks statistics
changes, the nodes won’t change the routing strategy according to the network change.
These two routing algorithms have their own advantages and disadvantages. The
self-adaptive routing algorithm can timely change the routing strategy according to
network change, but it is very complex to calculate with this algorithm and has a high
121
consumption. Although the flexibility of non-self-adaptive routing algorithm is low the
dynamic change of network topology. The radio channel will constantly change, which
network topology path based on the link condition in order to supply the reliable QoS
assurance. In order to implement the dynamic aesthesia to the change of the networks,
self-adaptive routing algorithm is used in this protocol, which can improve an effective
ADHOC networks are mainly used for emergency communication and military
communications. Now, there are many routing protocols supporting the QoS, but most
of them use the node energy, with bandwidth, delay and some single QoS indicator as
the judgments. In this protocol the average delay of link, average package loss rate and
node signal strength are selected as the judgment standards to select the optimized
1. QoS
(1) Delay
The delay is the time needed to transfer a message or a grouping from a node to
another in the network. It includes sending delay, broadcast delay, processing delay
and queuing delay (delay = sending delay + broadcast delay + processing delay +
queuing delay). The average delay index is regarded as one of the link judgment
indices [140] [141]. For the multi-hop ADHOC networks, the total average delay of the
link equals to the accumulation of the average delay of each single-hop link. The
average delay reflects the effectiveness of network transmission. The less the delay is,
the more effective it is. Especially for voice packages, too much delay will badly
Package loss rate (loss) is the proportion of lost data packages in the total sent
data packages during the link transmission. For the multi-hop ADHOC networks, the
total average package loss rate of the link is the product of average package loss rate of
each single-hop link. The package loss rate is related to the length of the data package
and the sending frequency it also reflects network reliability. The less the package loss
The signal strength [142] indicates the signal strength of the nodes in the relative
surrounding points, which can reflect the communication quality of nodes and the
condition of residual energy, and is regarded as one of the QoS judgment indexes in
1 n
strength = ∑ strengthi
n i =1 (5-4)
balancing delay, package loss rate and signal strength of the nodes, the MIA-QRP can
overcome the defects of a single consideration of the QoS index in the traditional
determining the weight of each index with the entropy weight coefficient method.
For the original node S and the destination node D, the delay, package loss rate
and the signal strength of each link can be calculated by the formula (5-2), the formula
(5-3) and the formula (5-4) respectively. The set of the judgment indexes of the S and
123
Rj R j 2 R j3
D, which is ={ R j1 , , | j =1,2, ……, n }, can be obtained by combining each
R j1 R j2
R j3
link. is average delay index, is link loss packets index, is the link signal
strength index. Due to magnitude and dimension problem of each index, the judgment
Rj
indexes matrix is standardized as follows:
R jk − min R jk
max R − min R For signal strength index
jk jk
B jk =
maxR jk − R jk For average delay index and ink loss packets index
maxR jk − min R jk
(5-5)
After the standardization, the value of the non-dimension and the magnitude is
from 0 to 1. Assume that the relative weight of each index is ω1 ≥ 0、ω 2 ≥ 0、ω 3 ≥ 0 ,
follows:
u j = ω1 H j1 + ω 2 H j 2 + ω 3 H j 3
(5-6)
H jk = − B jk log B jk , k = 1,
2,3
where
After the weight of each index is determined, the weighted assessment value of
each path can be calculated. Thus the path with the highest assessment value can be
selected.
3. Decision of weight
Based on the extreme property of entropy, when each system condition has the
1
same probabilities, which is Pj = , j = 1,2 ……, n , the maximum value of the entropy
n
is:
124
1 1 1
H max = lg n = H , ,……
n n n (5-7)
When the entropy of one index gets larger, the difference of the relative index
value between each link is less. Then the effects of the judgment index are less, and its
weight value is less. The weight value of the judgment index mentioned above can be
D jk
d jk = n 3 (5-8)
∑∑ D jk
j =1 k =1
B jk
max{B } For signal strength index
jk
D jk =
min{B jk } For average delay index and ink loss packets index
B jk
(5-9)
According to the definition of entropy, the importance of each judgment index can
n
d k = ∑ d jk , k = 1,2,3
j =1
entropy to get the assessment importance entropy that characterizes the judgment
index:
Hk 1 n d jk d jk
hk =
H max
=− ∑ lg ,k = 1,2,3
lg n j =1 d k d k (5-11)
(5-12)
Thus, the judgment weights of the delay, package loss rate and the signal strength
ω1、ω 2、ω3 can be determined. Related to the path weighted assessment mode, the
nodes can select the path with the highest judgment to be the optimized path from the
original node S to the destination node D by calculating the judgment value of each
path.
1. Hardware resources
512G
Target board: The friendly Arm mini development developed board, arm 9
Wireless transceiver: 802.11xUSB Wireless network card, which uses the link
2. Software resource
The target board operates the embedded Operating system mirror, Linux 2.6.32.2
Kernel version.
126
5.7.2 Design and transplantation of wireless NIC driver
As shown in Figure 5-30, based on the TCP/IP network layer mode, the system
structure of the Linux networks driver can be divided into 4 layers [146], namely
network protocol interface layer, network device interface layer, device driven function
The network device and media layer is in the lowest layer of the network device
driver structure. It supplies directly the driver to access the physical network device.
The function of device driven function layer is to improve the operator interface to
access the outside device for the upper program, and to implement the driver of the
implements the operations by the interrupt trigger in the network device. The network
describe the characteristics and operations of detailed network device to the network
protocol interface layer. This structure is the container of each function in the networks
protocol interface layer. The network device interface layer is responsible for macro
plan of device driven function layer of the hardware. The network protocol interface
layer improves an unified sending and receiving interface to the networks layer
used to send the data, the netif_rx() function is used to receive the data. The design of
127
this layer makes it is unnecessary to consider the detailed implementation of the
The main functions achieved by the network device driver include system
initialization, data package sending and receiving etc. The system initialization is
net_device. The initialization function init() will detect the hardware information of the
device to determine whether to arrange the resource spaces to this device or not. After
deletion, the initialization function will fill the information of this device into the data
structure net_device and add this new device to the new device list.
The data package sending and receiving is the most important content in the
design of the network device driver. Whether the programming of this driver is good or
not will directly influence the overall quality of the driver. The sending of network
device needs to use the dev_queue_xmit() function in the protocol interface layer, by
which the pointer of the hard_header function in the data structure net_device is
adjusted, the data in the socket buffer saved in the sk_buff will be read, and the data
will be sent to the physical device. The receiving of the data package is always a
netif_rx() function. When driver programs of lower layer hardware receive the data
package, the hardware will create an interrupt signal. Then, the data in the socket
buffer sk_buff will be queued in the upper protocol queue by the netif_rx_schedule
All network devices are abstracted as an unified interface in the Linux, which is
the network device interface. It expresses the operation condition of the network device
in the kernel by the structure variables of the structure net_device type, including
128
loopback devices and hardware network device interface. The kernel administrates the
entire network device from the device list in which the dev_base is the head pointer.
important role in the sending and receiving of data package. The data of each network
layer in the Linux is sent by the sk_buff. In the network protocol interface layer, both
kernel functions the dev_queue_xmit() and the netif_rx() use the sk_buff as the
parameters.
In the Linux, most of the drivers are based on the development approach of the
module, and they can be loaded and unloaded freely. The design of this network card
driver is developed according to the module, which sets the module_init as the driver
The main tasks to be completed by the design of the network device driver
sent and received etc. It is also required to make the immediate processing in case of
The work of module_init is to register the rtusb driver to the kernel USB Drive
.owner = THIS_MODULE,
#endif
.name="rt73",
.probe=usb_rtusb_probe,
.disconnect=usb_rtusb_disconnect,
.id_table=rtusb_usb_id,
129
#ifdef CONFIG_PM
.suspend = rt73_suspend,
.resume = rt73_resume,
#endif
};
The usb_rtusb_probe function is the most important, and is mainly used for device
detection and initialization of the needed kernel resource. The rt73_suspend and the
rt73_resume are related to the power administration, such as how to work when it
usb_rtusb_disconnect will call the interface after the usb device is removed from the
system. The rtusb_usb_id is the usb devices ID lists driven by the rtusb_usb_id.
After the module initialization and registration to the system, the driver will scan
the system bus to check if the relative devices of this driver are on the bus. If there are
devices on the bus, the probe function will be called, or the device is inserted to the
net_device structure need to be instantiated. The relative content of this network card
netdev->priv_flags = INT_MAIN;
netdev->open = usb_rtusb_open;
netdev->hard_start_xmit = usb_rtusb_sendpkt;
netdev->stop = usb_rtusb_close;
netdev->do_ioctl = rt73_ioctl;
According to the instantiated code content of the net_device structure, the data
sending of the networks card is finished by calling the usb_rtusb_sendpkt, which will
call the RTMPSendPackages function to finish the sending of the data. The
example, when the IP or ARP layer needs to message, it can decide use which network
device (net_dev) to transfer the data according to the destination IP address, and it will
call its hard_start_xmit callback function. The call and control of the TCP/IP protocol
stack will have been finished in the kernel, and they will use the callback function until
the data comes to the device. This is the principle of the driver implementation. The
For the network card, the true data sending is finished by the USB. The
In the process of data package receiving, an interrupt will be generated when the
data packages arrive at the network device, and inform the driver to receive the data
packages. The interrupt processing program will apply for a period of addresses to the
system as the sk_buff buffer to save the received data. After the received data is saved
to the buffer, it is still needed to fill in the other parts information, such as the structure
of specified devices, data frame types and link layer data types. Finally, by using the
function sending the data packages to the upper layer for processing.
After the USB part receives the data, it will call the receiving function of network card
driver for simple protocol stack processing and copy the data to the upper data layer.
After the design of network card driver, the network card needs to be recompiled
in order to use the network card driver on the embedded Linux platform. This driver
follows:
131
Correct the compilation files
Correct the platform settings, use the embedded platform, PLATFORM= CMPC
(2) Correct the compiler settings, use cross-compiler and link tools
CC :=arm-linux-gcc , LD :=arm-linux-ld
/root/linux-2.6.32.2, this catalog is the saving path of the kernel head file.
2. Compilation
(1) Execute the command “make old config && make prepare && make
card driver. After the compilation, the driver kernel module files are generated finally:
rt73.bin, rt73.koand rt73sta.dat. The network card can be used on the destination board
There are two modes of design of embedded Linux based software, namely kernel
module design and user application software design. The kernel module development
program usually begins to run into the kernel state with the start of the operation
system. The development requirements of kernel program are high, which needs to
completely consider the calling mechanism of the kernel program. Designed for the
safety and convenience, this protocol applies the user application program so that the
132
5.8.1 Software layers model
According to the OSI design mode, layer modular design is also used in this
routing protocol to divide the protocol into four layers, each of which implements the
relative function. The layers call each other by the interface, and complete the function
of the routing protocol with help of each other. As shown in Figure 5-31, starting from
the top, this routing protocol software model can be divided into routing algorithm
execution layer, protocol event processing layer, protocol message analysis layer and
This is the bottom layer in the protocol layer model, mainly responsible for
supplying the original data related with this protocol to the upper layer. The function of
this layer is implemented according to the function of the OSI based data link layer.
133
The captured original data is the MAC frame data of the link layer, which has the
transparent and reliable data characteristics. The data captured by this layer will be
saved to the buffer of the original data for the use of the upper layer. Meanwhile, in
order to obtain the QoS parameter index of the link, this layer implements the statistics
function for the link average package loss rate and the average delay and the detection
function of the nodes signal strength to integrate the captured data and the detected
data, which is regarded as the basic data processed by the upper layer routing.
This layer is mainly responsible for extracting the data related to this protocol
from the original data buffer saved from the original data package capture layer, and
saves the data to the protocol data buffer for the calling of the upper layer. As the data
captured from the lower layer are all Ethernet data frames captured from the data link
layer, in addition to the data message types of this protocol, there are still other
networks protocol data frame types, such as IP, ARP data, PPP data. Thus, the type
Based on the Ethernet format, the types of Ethernet are marked and distinguished
according to the value of Length/EtherType field. The different value indicates the
different types of the data frame. When the value of the Length/EtherType field is
more than or equal to the hexadecimal 0x0600, it indicates the MAC client computer.
For example, the value of 0x0800 means IP datagram; the value of 0x0806 means the
ARP datagram, and the value of 0x8863 indicates PPPoE protocol datagram. In order
to mark the datagram type of this protocol, the value of the Length/EtherType field in
the Ethernet is set as 0x6c6c, this layer just needs to analyze the data frame with the
value of the type marked field, which equals to 0x6c6c, in the original networks data
This layer is the core of this routing protocol. It creates and maintains the network
topology path table, generates and updates the path information, and supplies the
134
foundation for the routing algorithm. This layer consists of two modules: protocol
path findings, path maintenance, and inquiry and confirming path state. The clock
provides basic timing for the protocol, and assists the nodes to accomplish the regular
message request, position update service and maintenance of life cycle. This layer
consists of four parts: update timer module, deletion timer module, path findings
module and path maintenance module, which work together to accomplish the
processing of the protocol message and calculate the optimized path to the destination
nodes.
The assignment of this layer is to calculate the optimized path to the destination
node according to the content calling routing algorithm in the network topology
routing table and adding the optimized path to the system kernel routing table and
Based on the protocol layers model, this protocol applies the technologies of the
multi-threading which designs three threading and three timers to accomplish the basic
work of the protocol. The three basic threading models are the original network data
package capture threading, the protocol data package analysis threading and the
protocol message processing threading. These three threads keep working with the start
implement the function of three basic timers. When the time of the timer comes, a
threading is destroyed after the assignment is accomplished. The creation of the timer
135
starts with the beginning of the protocol, and the timer will stop until the protocol
quits.
The routing selection algorithm of this protocol is designed as a call function. The
need to save the cost and improve the performance. The model of the protocol
According to the protocol layers design model, the data stream of this protocol is
136
The data of this protocol is captured and obtained according to the networks data
stream of the data link layer. The obtained data frame is saved to the protocol original
data buffer by the processing of the networks original data package capture layer. The
protocol data analysis layer will extract the data of this protocol from the original data
buffer to save the data to the protocol message buffer queue. The protocol
message-processing layer will make the further process to the protocol message buffer
queue to generate the network topology path information table. Finally, the protocol
message processing threading selects the optimized path of the network topology by
calling the routing algorithm, and the selected optimized path is added to the system
1. Synchronization of multi-threading
In the process of protocol data stream, the networks original data capture
threading will timely extract the networks data frame and save it to the networks
original data buffer. Meanwhile, the protocol message analysis threading will timely
extract the data in the networks original data buffer to extract and filter this protocol
message. The protocol threading makes a shared access to the data in the networks
data accessing errors will be generated. There is a shared access to the protocol
message buffer queue between the protocol message analysis threading and the
multi-threading, but the usual methods are mutual exclusion, condition variable and
by the method that combines the mutual exclusion and the condition variable, and
implements the gradual visit of the multi-threading to the shared resource by using the
mutual exclusion. This protocol also combines a condition variable to control the
137
access and the dormancy of threading in case of multi-threading access blocked caused
by only using the mutual exclusion, and increases the resource utilization and the code
execution efficiency.
The mutual exclusion and the condition variable used in this routing protocol are
defined as follows:
pthread_mutex_t raw_lock;
pthread_mutex_t pro_lock;
pthread_mutex_t topo_lock;
prthread_cond_t cond_raw;
prthread_cond_t cond_pro;
Where the mutual exclusion raw_lock and the condition variable cond_raw are
used for synchronization shared access of the network original capture threading and
the protocol message analysis threading to the networks original data buffer. The
mutual exclusion pro_lock and the condition variable cond_pro are used for the
synchronization shared access of the protocol message analysis threading and the
Where the mutual exclusion and the condition variable are used, mutual exclusion
locked and unlocked function, condition dormancy and the wake-up function are
described as follows:
function
unlocked function
138
The threading synchronization flow used by the mutual exclusion and the
Because this protocol needs to timely receive the networks data package and
processes the protocol message, it is needed to design a data buffer for this protocol in
case of loss of data received and processed. The design can effectively process the
The data buffer of this protocol, which applies to the loop queue, is implemented
by the structure. The saving unit of the loop queue consists of saving data and data
}raw_unit,*praw_unit;
All original data of this protocol is captured by the data link layer. In the
condition of Linux, the libpcap data package and the creation of the socket are used to
implement the capture of the networks data frame, where the libpacap is the open
139
source implementation code of the network’s programming on the Linux stage [147].
Based on the practical experience of the author to the Linux networks programming,
this protocol is implemented by applying the creation of socket under the Linux. The
direct access of the data in the networks data link layer is implemented by creating the
The function prototype of the Linux networks socket interface is the int socket (int
domain, int type, int protocol. In order to directly access the data in the data link layer,
“Type” is the type of the socket. The usual types are the stream socket
(SOCK_STREAM), the data gram socket (SOCK_DGRAM) and the original socket
The protocol is the socket protocol, and is set as htons (0x0003) in this protocol.
The data in this protocol capturing the threading needs to timely catch the
networks data, and set the networks socket as the non-blocked state. Then the function
After the creation and settings of original socket, the function send to() and
recvfrom() is used to implement the access the data in the data link layer. The
sendto(int sock, const void *buf, size_t len, int flags, const struct sockaddr *to,
socklen_t tolen);
from,int* fromlen).
140
Figure 5-35 Flow chart of protocol message processing
The path findings and maintenance in this protocol are implemented by the
effective processing of the protocol event process layer to this protocol message. The
processing protocol message is the key to process the data in this protocol. The
According to the protocol message processing flow chart, this routing protocol
extracts the protocol message one by one from the protocol message buffer queue first.
Then the protocol runs the switch branching processing based on the type of the
message, and calls different message processing programs to implement the message
processing.
Each type of the message processing branches firstly constructs a piece of network
topology information by the pretreatment of the message. Then the network topology
table is inquired to detect if there is the same network topology information. If no, a
141
new piece of topology information will be added in the network topology information,
otherwise, the content of the network topology information table is updated according
to the message content. The protocol message pretreatment procedures are shown in
Figure 5-36.
the protocol threading model, the routing algorithm will call in the message processing
as needed
5. Protocol timer
In this protocol, three modules are designed which accomplish the periodical
sending of node broadcast message, expired path information detection and link
parameter indexes detection respectively. The function of each timer has been
described in the last section. Now the operations of the timers are described as follows:
Linux arranges three internal timers for each assignment [148]. When the time
comes, the ITIMER_REAL real-time timer will send the SIGALRM signal to the
process, ITIMER_VIRTUAL timer will send the SIGVTALRM signal to the process
and the ITIMER_PROF timer will send the SIGPROF signal to the process. An initial
142
value is given to the timer, which decreases with time and sends the signal to the
process until it decreases to 0, and then it will return to its initial value. The
ITIMER_REAL real-time timer is used for the implementation of this protocol, which
can timely send the SIGALRM signal to the process and run the relative functions.
Linux uses timers, which need the initialization works and relative signal
processing mechanism. In the design of this protocol, the initialization and signal
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
The set timer function is used to accomplish the timer initialization. Each
Interval value of the timer. The detailed interval of the timer can be set by this
ovalue is used to save the previous value. It is not used usually, and is set as the
NULL here.
The sigaction function is used to create the signal processing mechanism of the
signum is the signal type, which is set as the SIGALRM signal type sent from the
ITIMER_REAL timer act is the structure type. The call function of the SIGALRM
The object pointed by the old act is used to save the processing to the old
In the design of the timer, the Linux system calls the timer signal to execute the
function by the method of creating the temporary threading, and accomplishes the
resource is released.
143
6. Design of routing algorithm program.
algorithm of this protocol runs the calling the execution by the protocol message
processing the threading to decrease the recourse cost largely, and improve the
executive efficiency of the program. The core idea of this protocol algorithm design is
to calculate the optimized path from the original node to the destination node according
to the path information in the network topology information table and the MIA-QRP
algorithm theory, and to improve a reliable QoS security service to the AD HOC
networks.
message and “ack” message, the function executed by the routing algorithm will be
When the routing algorithm program is called, it will first read the path
information between the original nodes to the destination node from the network
topology information table in order to detect if there is only one accessible path. If
there is only one path, then it will be directly added to the system routing table,
144
otherwise all the accessible information will be collected from the topology
information table to calculate the optimized path in all accessible paths by calling
MIA-QRP path selection algorithm, and to update the system routing table and ARP
table. When all the path information of the nodes is processed, the assignment is over
the inquiry operation of system routing table. The path information obtained from this
protocol is applied by the other networks program, and is added to the system routing
table. Thus, the system() function is further called to update and maintain the system
routing path.
described as follows:
In the Linux system, the kernel routing table accomplishes the routing function
with the connection of the ARP table. The corresponding relation between the IP
address and the hardware address can be inquired by the ARP table. The ARP table is
also used in the networks address analysis. The ARP table information should be
updated when the routing table is added. The operation of the system ARP table is
described as follows:
Assume that the IP address of the direct routing node is 192.168.1.170, its MAC
145
address is D8:5D:4C:7C:13:DF
If the IP address of the node is 192.168.1.171, the next hop from this node to the
D8:5D:4C:7C:13:DF)
D8:5D:4C:7C:13:DF’)
5.9 Summary
According to the multiple QoS parameters including delay, loss of package and
five kinds of protocol messages, including network route discovery and maintenance,
optimal path and update of system routing table. In the development of protocol
principle of the protocol, the software architecture of the protocol is given in this
146
Chapter 6 SMAC-SD Protocol
The main principles of the SMAC-SD protocol are: it follows the periodical
mechanism and the selection and maintenance scheduling, and the time
multi-requirements mechanism.
lay.
From the point of view of network QoS, how the data is delivered to the sink and
corresponding requirements are concerned. Generally, there are three basic data
[149]. Before presenting the application requirements, some factors that characterize
Real-time voice, image, or video data: Real-time data is delay-constrained and has
Non-real-time data: The sink may want to collect periodic data from the sensor
147
field.
This protocol defines two transaction classes: important transaction and general
transaction.
Important Transaction: low tolerance to the delay and high priority in the
General Transaction: high tolerance to the delay, and low priority in the networks
transmission.
For the different WSN, the users can define which transaction is the important
SMAC-SD defines two queues of access category (AC), and each queue has
Assume:
CWmin [1], CWmax [1], and AIFS [1] are for the high priority access class;
CWmin [0], CWmax [0] and AIFS [0] are for the low priority access class
where CWmax [0] ≥ CWmax [ 1],CWmax [0] ≥ CWmax [ 1] ,AIFS[0] ≥AIFS[ 1].
Two transmission queues are arrayed in the base station. Every sequence supports
an access classification, and its behavior is similar to DCF mechanism [145]. Every
queue runs a DCF function. The bigger backoff windows is, the lower the priorities of
The access classifications are divided into two types. It is assumed that there are n
active base stations in the WSN and every base station has the complete two queues,
there are 2n queue object, which means there are 2n base stations, their channel
148
compete by IEEE802.11DCF, as figure 6-1.
SMAC SDSMAC
Access Category
Only one AC is AC is
kind queue high low
transmission transmission
Figure 6-1 Flow Chart of the Probability priority mechanism of the Channel
Access
SMAC-SD protocol uses the probability priority mechanism of the channel access,
which can guarantee the higher efficiency of accessed data to the channel compare
with the general transaction. However, the probability of accessing the channel is not
completely equal to the successful probability of accessing the channel. The successful
probability of accessing the channel for the important transaction is related to the data
stream of the general transaction. The successful probability of accessing the channel
Psi is the successful probability of accessing the channel of the transaction data
With the analysis, the general transaction will influence the important transaction
149
by the following aspects: the data packet of the general transaction collides with the
important transaction; generally, the channel occupied time after the successful sending
in the general transaction makes the delay to the channel of the data access in the
important transaction. This will lead the channel competition advantages of the data
stream of the important transaction to be reduced by the large existed data stream of
high priority.
the principle of the differentiated services. Access of channel supplies one more
1. Important transaction: the interFrame space of the waiting queues with high
DIFS
If a node requires sending RTS request frame is successful, the receivers will
immediately responds to agree to send the CTS frame, and the senders begin to send
If the first requirement is failed, then it will resend the RTS requirement with the
the receivers will responds CTS frame, and the senders begin to send the data after
150
receiving. If the requirement is failed again, it turns into the backoff process.
2. General transaction: the timing chart of the waiting queues with low priority
DIFS
Collision RTS
DIFS
For the data stream of the general transaction with the low priority, Access and
If a node requires sending RTS request frame is successful, the receivers will
immediately responds to agree to send the CTS frame, and the senders begin to send
If the first requirement is failed, then it turns into the backoff process.
151
Begin
Type of traffic
General
Important
traffic
NO NO
RTS request RTS request
YES YES
Received Reserving channel
Received
CTS again after UIFS Backoff
Send data NO
RTS request Send data
YES
Received
Backoff
Send data
Assume that there are n nodes in the WSN sharing a radio channel without
considering the problems of the hidden terminal and channel fading. For the channel
access process of a node, set s (t ) as the back off level of the node at the moment, the
where
Wi = 2iW , the range of i is [0, m] ; W = CWmin , CWmax = 2mW . The two
random processes described by s (t ) and b(t ) are obviously not the Markov process.
Regard these two non- Markov random process as an entirety and use two-dimensional
Assume the probabilities of data frame collision are not related to the former
only related to the former status {s(t),b(t)} at t moment. It has no relationship with
former status such as {s(t-1),b(t-1)}, and the time and the status are discrete. Above all,
the backoff begins. Formula (6.3) shows that the backoff level will add 1 if the backoff
level does not achieve the maximal value m and if the sending of the data frame is
failed. The probabilities of the value of the counter is obtained randomly from the
range of [0, Wi +1 − 1] ; Formula (6.4) shows that when the backoff level get to the
maximal value m, the value of the backoff level keeps constant and the probabilities of
the value of the counter is obtained randomly from the range of [0, Wi − 1] if the
sending of the data frame is failed. Formula (6.5) shows that the backoff level value
will migrate to the minimal value 0 if the sending is successful at any backoff level.
It is defined:
Based on the Figure 6-5, the following status transmission formula can be
obtained:
(1 − p ) ∑ bk , 0 i=0
w − j k =0
bi , j = i pbi −1, 0 0<i<m (6-10)
wi
p(bm −1, 0 + bm, 0 ) i=m
All bi , j can be shown by b0, 0 and p. From Figure 6-5, it can be known that
m WI −1
∑ ∑b
i = 0 WI
i, j =1
Because
Wi − j
bi , j = bi , 0
Wi
Thus,
2(1 − 2 p )(1 − p )
b0, 0 =
(1 − 2 p )(W + 1) + pW [1 − (2 p ) m ] (6-11)
For the transaction with different priorities, the probability of sending the data
frame at any moment from the nodes of the real-time transaction with high priorities is:
m =1
2(1 − p1 )(1 − p1 )
τ1 = m +1 m +1 (6-13)
W1[1 − (2 p1 ) ](1 − p1 ) + (1 − p1 )(1 − p1 )
The probability of sending the data frame at any moment from the nodes of the
Where
W1 and W2 are the minimal competition window of the real-time
From formula (6.11), the probability of sending the data frame of the nodes at any
of sending the collision event of a node is: in the transmission networks with the node
numbers n , the collision happens in the data frame of a node. This collision happens
when there is at least one node sending the data in the n − 1 nodes. Set the
p = 1 − (1 − τ ) n −1 (6-15)
For the transactions with different priorities, the probabilities that there is a
collision taking place on the nodes n1 of the real-time transaction with high priority is:
p = 1 − (1 − τ 1 ) n1 −1 (6-16)
The probabilities that there is a collision taking place on the nodes n2 of the
p = 1 − (1 − τ 1 ) n1 (1 − τ 2 ) n2 −1 (6-17)
following:
Set Ptr as the probabilities when the channel is busy. The busy of channel means
that there is at least one node sending the data during the channel competition process
the data frame successful sending probabilities of the important transaction and the
general transaction without the collision, respectively; Pc1 is the collision probability
the general transaction data frames when there is no transaction; Pc11 is the collision
(6-22)
Ps 2 = n2τ 2 (1 − τ 1 ) (1 − τ 2 )
n1 n 2 −1
(6-23)
Pc1 = 1 − (1 − τ 1 ) n1 − n1τ 1 (1 − τ 1 ) n1 −1
(6-24)
1
Pc11 = ( ) n1 Pc1 (6-25)
2
1
Pc12 = [1 − ( ) n1 ]Pc1 (6-26)
2
Pc 2 = (1 − τ 1 ) n1 [1 − (1 − τ 2 ) n2 − n2τ 2 (1 − τ 2 ) n2 −1 ]
(6-27)
Ts11 , Ts12 , Ts 2 , Tc11 , Tc12 , Tc 2 response to the channel time of successful
157
Tc12 = 2 RTS + SIFS + slottime + DIFS
(6-32)
Tc 2 = RTS + DIFS
(6-33)
Based on the above analysis, the saturation throughput of the important
Ps1E[data ]
S1 =
(1 − Ptr )θ + Ps11Ts11 + Ps12Ts12 + Ps 2Ts 2 + Pc11Tc11 + Pc12Tc12 + Pc 2Tc 2 (6-34)
Ps 2 E[data ]
S2 =
(1 − Ptr )θ + Ps11Ts11 + Ps12Ts12 + Ps 2Ts 2 + Pc11Tc11 + Pc12Tc12 + Pc 2Tc 2 (6-35)
where θ is the duration of an empty slot, E[data ] is the average payload time of
transmission. It is known from analysis formulas (6-15) and (6-16), that the failure
probabilities caused by collision will be influenced by the transaction data stream with
higher priorities. From the formulas (6-19) and (6-22), when the probabilities of
sending frame and the number of nodes of the real-time transaction with high priorities
and the general transaction with the low priorities are same, the successful probabilities
of the real-time transaction is higher than the one of the general transaction. Thus the
Under the collision between the data stream of the important transaction and the
general transaction, the delay of data stream of the important transaction with the
Under the collision between the data streams of the important transaction, the
delay of data stream of the important transaction with the successful sending (TDc12)
TDc11 = Tc11
(6-37)
Under the collision between the data streams of the important transaction, the
delay of data stream of the important transaction with the failed sending (TDc12)
TDc12 = Tc12
(6-38)
158
Under the collision between the data streams of the general transaction, the delay
of data stream of the general transaction with the successful sending (TSs12)
TDc 2 = Tc 2
(6-39)
6.4 summary
distinction, priority mechanism based on service queue, and channel requests service
business, at the same time to establishing the analytical model by formula deduction to
159
Chapter 7 Simulation and analysis
Simulation process:
1. The simulation starts and the simulation programs begin. The simulation scene
3. Preset function is set based on the relative theories and the cycle setting is done.
The 400 sensor nodes are randomly distributed into the network region with the
area of 200m × 200m .The preventing position of the base station is ( 0,0 )
160
Table 7.1 Used parameters in the simulation
Parameter Value
E0 initial 0.05J
energy of single node
E fs 10 ∗10−12 J / bit / m 2
channel model of the free space
d0 border Threshold 84
(α1 ,α 2 ) (0.6,0.4)
(α , β ) (0.6,0.4)
161
Figure7.1 shows a network of 400 nodes randomly produced according to the
above parameters
practical situations, and to set a realistic parameter to these performance indicators. All
objectives initially set that need to be solved by the new protocols. In this experiment,
the results of the simulation are to prolong the life cycle of the networks. The energy
cost of nodes decreases in each round, and the energy cost of sensor nodes of data
collection and transmission can be balanced in the whole network. In order to achieve
this objective, the simulation implements LEACH algorithm and RBLEACH algorithm;
then compare the performance of the two algorithms. The standards to evaluate the
1. Network life: duration from the first dead node to the last one.
162
7.7.3 Experiment results of simulation and comparison of relative work
Figure 3.8 demonstrates the relation between the amount of dead nodes and the
network working time (rounds). Compared with LEACH, RBLEACH proposed in this
thesis can greatly prolong the life cycle of a network because every sensor node in the
cluster shares the energy cost evenly. Meanwhile, the node with more energy is first
selected as the cluster head, and the proportion of cluster head distribution is balanced
in the cluster head selection. It synchronizes the energy cost of each sensor node and
delays the moment of the first death of a node. The RBLEACH algorithm prolongs the
Figure 7.2 shows the death rate of sensor nodes. It is known from the first death of
a node that the death of all nodes will be concentrated in the last 40 rounds when using
RBLEACH algorithm, which is better than the death rate when using LEACH
algorithm, illustrating that the algorithm can balance the energy used by the nodes and
163
Figure 7.3 shows the number of cluster heads selected with different rounds in the
LEACH protocol and RBLEACH protocol. It is obvious that the amount of the live
sensor nodes in RBLEACH protocol is more than that of LEACH protocol. The
amount of the cluster heads selected with proportion of RBLEACH protocol is less
than that of LEACH protocol. Thus, the energy cost in the process of transmission in
Figure 7.4 shows the comparison of total residual energy when using LEACH
protocol and when using RBLEACH protocol for each round. It can be known from
Figure 3.10 that the total residual energy when using RBLEACH protocol is much
more than that of LEACH protocol, illustrating that the life cycle of the whole network
when using RBLEACH protocol is much longer than that when using LEACH
protocol.
164
Figure7.4 Comparison of residual energy for each round
4. Comparison of the energy cost of the cluster heads for each round.
Figure 7.5 shows the simulation results of cluster head energy cost of LEACH
protocol and RBLEACH protocol for each round. It’s shown in Figure 7.5that the
maximum value of the cluster head energy cost of RBLEACH protocol is less than the
minimum value of the cluster head energy cost of LEACH protocol for all rounds.
Thus, under the condition where the same initial energy is supplied, the cluster head
energy cost of RBLEACH protocol is less than that of LEACH protocol. Therefore, the
sensor nodes in the networks, RBLEACH protocol is better than LEACH protocol. In
165
RBLEACH protocol, the whole network is divided into several regions and the cluster
distribution of the cluster heads in the network. The node energy cost of the data
transmission from the member nodes to the cluster head and from the cluster head to
the base station is lower, resulting in a longer life for each node in the network.
Compared with LEACH protocol, the multi-hops selected by the cluster head in the
clusters are used for data transmission to save energy between the sensor nodes. This
1. Load balance: the routing protocol of WSN should distribute the network load
to each node evenly as much as possible and prevent few nodes or some region nodes
dying too early, which can affect the networks performance. This chapter is to analyze
2. Life cycle: the duration from the operation of the networks to the death of the
nodes is shown as “round”, which can be expressed by two durations: duration from
the first death and duration of the death of half the nodes, if there are half of the
3. Energy cost: the routing protocol of WSN should be good to save the energy of
the nodes in the networks and prevent the unnecessary consumption. This chapter
contributes to the analysis from the total residual energy of the nodes in each round.
scenes respectively. The area of scene 1 is 100m*100m, and the coordinate of the base
station is (0, 0). The nodes of scene 2 are distributed into the region with an area of
200m*200m, and the coordinate of the base station is (0, 0). The relative parameters
are shown in Table 7-2, and the detailed physical definitions are described in 4.2.2.
ε fs 10 pJ / bit / m 2 10 pJ / bit / m 2
ε mp
0.0013 pJ / bit / m 4 0.0013 pJ / bit / m 4
d0 87m 87m
1. Load balance
Assume that the area of the region is 200m*200m, there are 400 nodes and the
base station is located at (0,0). Figure 7-6 and Figure7-7 show the distribution of dead
early-term. Figure 7-8 and Figure 7-9 show the distribution of the dead nodes to these
167
two protocols in medium-term. The nodes far away from the base station begin to die
first due to single-hop routing used in LEACH protocol. Moreover, the distribution of
the cluster heads are more reasonable and the energy cost is less because of improved
thus the dead nodes are distributed evenly. LEACH protocol has a considerably large
part of its region that cannot be covered in the medium-term and late-term of the
network operation which means the network will fail. However, PS-ACO-LEACH
protocol can cover a large part of the region in the medium-term and late-term of the
168
Figure 7-7 Distribution of dead nodes distribution in early term of
PS-ACO-LEACH
2. Life cycle
Figure 7-10 shows the network life cycle in the 100m*100m scenario. The dotted
line represents the rising curve of dead nodes in the CRP-PSAC protocol, and the solid
line represents the rising curve of dead nodes in the LEACH protocol. In scenario 1,
the moment of the first nodes death (FND) in the CRP-PSAC is the 200th round and
that of the LEACH is the 166th round. For the half node death (HND) moment, the
CRP-PSAC is the 200th round and the LEACH is the 225th round, illustrating that that
the CRP-PSAC can distribute the energy cost more evenly into all the nodes to prevent
Figure7-11 shows the network life cycle in the 200m*200m scenario. In scenario
2, the advantages of the CRP-PSAC are further expressed. The moment of its FND and
HND are the 186th round and the 267th rounds respectively. The moment of LEACH’s
FND and HND are the 29th round and the 131st round respectively. This is because the
communication distance between the cluster head and the base station increases in the
LEACH protocol under the large scenario environment, and the single communication
energy loss of the cluster heads increases. However, in the CRP-PSAC protocol, the
communication between cluster heads and the base station uses a multi-hop routing
method, thus the single communication energy loss will not increase with the increase
of the area. Moreover, the PS-ACO-LEACH protocol considers the judgment standard
for multiple cluster heads to distribute network energy amongst all the sensors as much
as possible.
It is noted that the all curves are drawn by repeating the simulation 100 times to
calculate the average value in order to make the simulation results convincing. The
number of network nodes is set to the 110th and the 440th rounds respectively because
of programming needs. However, the curves are cut at the 100th and the 400th round in
the figures.
170
Figure 7-10 Relation between dead nodes and time in the 100m*100m scene
Figure 7-11 Relation between dead nodes and time in the 200m*200m scene
3. Energy cost
Figure 7-12 and Figure 7-13 show the relation between network energy cost and
time in the LEACH and the PS-ACO-LEACH protocol under the 100m*100m and the
between the networks residual energy and time. As shown in the figures,
PS-ACO-LEACH can save the network residual energy costs compared with LEACH.
The rate of the energy cost decreases, and the total residual energy of the
PS-ACO-LEACH is lower than that of LEACH at any moment. This is because most
of the nodes in LEACH have died over time, but there are still many live nodes in the
PS-ACO-LEACH. Thus, in LEACH, the covered area of the cluster head is larger, the
When the area of the network region becomes larger, the energy-saving effects of
PS-ACO-LEACH are more obvious, which can be explained in the same way as was
171
explained in Figure 7-11
Figure 7-12 Relation between network residual energy and time in the
100m*100m scene
Fiure 7-13 Relation between network residual energy and the time in 200m*200m
scene
To test the operation of this protocol, verify the correctness of routing protocol
172
accomplish the software design of the protocol and drive design and compilation of
wireless LAN, but also to set the forward of the data package supported by the
The ADHOC network is characterized by moving multi-hops, and the nodes can
randomly move in the networks. In the process of the network communication, each
node functions as both the client and router. When one node becomes the forwarding
node of one communication link, it needs to supply the forwarding of data package for
the network data communication between the original node and the destination one.
Thus, to test this protocol needs to modify the routing function of nodes, so that the
There is a complete TCP/IP protocol stack in the Linux, which supports the data
package forwarding. The Linux operation system has a powerful service, and has
functions of the network service of the client computer and the data package
forwarding of the router. However, the Linux is just used as the client computer in the
default condition without using the forwarding of the Linux to the data package. To
meet the need of this routing protocol testing, the destination machine regarded as the
nodes; need to start the forwarding function. The following are the detailed setting
commands:
sysctl -w net.ipv4.ip_forward=1
After start of the Linux system, imputing the above setting commands can
accomplish the forwarding of system to the network data package. As Linux operation
system does not start this function in the default condition, the data forwarding will be
shut down when the system is restarted. To reduce the repetition of data forwarding
configuration of system set in the each testing, the data package forwarding settings
can be written into system files to read the configuration file itself to start the
173
forwarding. The correction methods of the system configuration files are described as
follows:
First, open the configuration files, the command is: # vim /etc/sysctl.confined the
1”. After correction, save it and quit. In order to make the set configuration come into
effect timely, the command line needs to be input as “# sysctl –p” Input the command
The friendly arm company development board mini2440 is used for the testing
nodes in this protocol use. There are three tested nodes, and the networks card of each
node use rt73 USB wireless LAN. Each nodes target board needs to install the
compiled network card driver. The installation steps of the Rt73 USB wireless LAN
First, download the compiled files to the mini2440 development board and
# mkdir /etc/Wireless
# mkdir /etc/Wireless/RT73STA
# cp rt73.bin /etc/Wireless/RT73STA/rt73.bin
# dos2unix rt73sta.dat
# cp rt73sta.dat /etc/Wireless/RT73STA/rt73sta.dat
# /sbin/insmod rt73.ko
After the above operation, the compiled driver is successfully installed to the
After load of the networks card driver, it is need to start the networks and
configure network nodes. The basic configuration information of the network nodes is
described as follows:
174
Table 7-3 Node configuration
A 192.168.1.172 D8:5D:4C:7C:15:2F
B 192.168.1.171 D8:5D:4C:7D:95:1F
The node configuration and the network settings are described as follows:
(1)start the networks card: if config rausb0 up, rausb0 is the name of the networks
card interface
(2)set the IP address of the nodes: the IP address corresponding to the if config
rausb0.
(3) set the networks card to ad-hoc networks mode: iwconfig rausb0 mode ad-hoc
(4) set SSID for the node: iwconfig rausb0 essid “dsh”, which improves the
(5) download the protocol sdap to the development board and correct the
Through the above settings, the neighbor nodes have the function of data
There are many indexes to measure the performance of the routing protocol. This
thesis is mainly to judge the protocol by the primary path finding velocity, path
maintenance effectiveness, data package forwarding and protocol cost etc.. The
Due to limited resources, testing networks consist of the three networks nodes.
175
B
A
C
Based on the testing results of nodes, the operation of this protocol is described.
Start node B and node C before testing node A, and build path topology between node
B and node C. According to the design theory of this routing protocol, node A will
build a network topology information table with node B and node C after it starts to
form the A-B and the A-C two direct path and form the A-B-C and the A-C-B two
multi-hop path. Then the routing algorithm is called to select a optimized path between
7-15, after it starts and operates the routing protocol for a while.
topology information table of node A. The first one is the network information of node
A itself, which is designed and produced according to this protocol and has no
corresponding path. The second one and the third one are the direct path topology
7-3. It is known that the second one and the third one record the topology information
of path A-B and path A-C respectively. The mac address recorded in the fourth one
and the fifth one is 00-00-00-00-00, which records the multi-hop path information and
176
corresponds to topology information of the path A-B-C and the path A-C-B,
In order to inquire the selected final routing information of this protocol by the
MIA-QRP routing selection algorithm, the system routing table and the ARP table
information of the node A can be observed by using the routing information and arp
address analysis table information of the output system of the command route and
According to the recording of system routing table information, path A-B and
path A-C are finally selected in the routing algorithm designed in this routing protocol
finally as the optimized path for communication between node A and nodes B,C.
Meanwhile, the system ARP table records the physical address corresponded to the IP
address of node C and node B, which corresponds to the system routing table
A
C
Based on the distribution of the nodes in the networks shown in Figure 7-14, each
node has produced the network topology path information after the routing protocol
operation. Now shut down the main computer of node C, and further observe the
change of the network topology information of node A. The printed and outputted
network topology information of the A after shutdown of node C and waiting for a
Based on the topology path information of node A, node A only has the
information record of the direct path that arrives at node B. The network topology
compliance with the results of this routing protocol design. The system routing table
and the ARP table information of the node A, as shown in the Figure 7-20 and the
Figure7-21 respectively, are examined by the route command and arp command.
Based on the information between Figure 7-16 and Figure7-20 and by comparing
the ARP table information between Figure 5-44 and Figure 5-46, the node C becomes
invalid after it is shut down. Node A maintains and deletes the network topology
information related to node C after the routing, and updates the system routing table
information and ARP table information. There is only path information record of the
path A-B left. Based on this, node A can effectively run dynamic perception to the
178
network topology, timely update the network topology information, delete the expired
The tested nodes are redistributed by using the T-shaped corridor in the laboratory
building, as show in Figure 7-22. The direct communication link between node A and
node C is influenced by the wall, so the signal strength of node C tested by node A is
largely decreased. Meanwhile, the commutation delay between node A and node C and
the package loss rate are influenced with different degrees. However, node B is set at a
corner, so there is no any blocking between node B and nodes A, C. The design of this
distribution is mainly to test if node A and node C can select the multi-hop path that
Start the mechanism of node B and node C and build the network topology path of
node B and node C, then start the mechanism of node B. Export the network topology
information of node A after the operation for a while, as shown in Figure 7-23.
It is known from Figure 7-24 that node A has captured the network topology
179
information of node B and node C, and created a two-way direct path and two
multi-hop paths with each node. The system routing table and ARP table information
of node A, as shown in Figure 7-24 and Figure 7-25 respectively, are examined by the
They are shown from the system routing table information that the path from node
A to node C (IP address is 192.168.1.170) needs to go through the gateway (IP address
of node B). The physical address corresponding to the networks IP address of node C
demonstrate that this routing protocol sets the multi-hop path A-B-C as the
communication path between node A and node C, and node B plays the role of relay
node.
For multi-hop path A-B-C formed in Section 5.2.3, each index and performance
of the link can be detected and the data forwarding of the node B can be supported by
using ping command on node A. First, the simple ping command is used to test the link
connectivity.
From the testing results shown in the Figure 7-26, the communication data
package between the node A and the node C is implemented by the forwarding of the
node B. The response data package received from the node A is sent back from
192.168.1.171 (that is the IP address of the node B). Thus this can verify that node B
has the function of data package forwarding and the function to be the gateway router
180
and it can be the relay node of node A and node C.
In order to further detect the communication link delay between node A and node
C and the package loss rate performance, the statistic data can be obtained by the
extended instruction of ping command. The experiment tests the link performance by
changing the ping package number and the ping package sizes. The ping commands
The ping package number set in this testing are 50, 100, 300, 500, 700, 1200 and
1500. The ping package sizes are 1KB, 10KB and 50KB. The testing results under the
condition that the ping package number sent by the node A is 50 and the ping package
After the testing, the final testing results can be counted. The statistic results of
According to the testing results, for the two-hop A-B-C link, the communication
delay of the link is stabilized at about 11ms when the sizes of the sent data package are
181
1KB and 5KB, and the package loss rate is stabilized less than 5%. The link
performance is tending towards stability and the fluctuation is slight. However, when
the sent data package size increases to 50KB, the communication delay of the link will
increase with the increasing of the data package number, and the package loss rate
increases to higher than 10%. Every aspect of the performance decreases greatly.
5. Protocol cost
During operation of the protocol, using the top command can examine the
real-time occupation condition of protocol to the system CPU and the memory. The
and the memory are 0.4% and 27.0% respectively. Through the testing of protocol cost,
the occupation of this protocol to the system CPU is small. The occupation of this
protocol to the memory resource is up to 27%, including a buffer space of 15036K. But
this protocol is based on the mini2440 testing platform. The total memory size is 64M.
Thus, the memory cost of this protocol is small so that it can adapt to the using of the
Literature [153] reported the QoS protocol realization on Linux. According to zhu
Test environment
A(192.168.0.1),
B(192.168.0.2)
C((192.168.0.3)
Embedded nods A has a WIFI interface, it is used access the public network. IN
Let A,B,C access the FTP server, and it will get average download speed:
183
Table 7.5 QoS testing result1
A 41kbit/s 43kbit/s
B 25kbit/s 32 kbit/s
C 24bit/s 31 kbit/s
Let B,C access the FTP server, A is not work, B,C’ average download speed
speed speed
B 25kbit/s 32 kbit/s
C 24bit/s 32 kbit/s
The result shows MIA-QRP has more accurate flow control on every IP than
literature [153].
The SMAC-SD protocol is used to improve the S-MAC protocol. The realization
of the new protocol in the NS2 needs the finishing of the C++ protocol code and the tcl
debugging code. Compared to the code of the S-MAC protocol, the improvement is
made.
The modified sdsmac.h file and the sdsmac.cc file in the new SMAC-SD protocol
Simulation scene and parameter setting, tel sript in order to analyze the
performance, 20 nodes and two data streams of the different transaction with different
original node and destination node are set in the experiment. The protocol uses the
184
AODV routing protocol and control the network traffic by the data transmission rate.
packet
network and high-load network, respectively. By analyzing the throughput and the
collects the data for the nodes of the sensor, and then sends to the aggregation nodes
which will send the data to the users. Because the nodes will self organize the wireless
networks and the users are in the limited networks, the nodes of sensor cannot
communicate with the users directly. Thus, the combination of the wireless networks
and the limited networks is involved. In order to be closer to the using reality, the basic
185
Ad1
S1
S2
S3
route
route
BS
1
SN-
SN
Ad1
consists of the experiment one and the experiment two. The SMAC-SD protocol
performance is proved to meet the design objective by comparing the experiment one
networks.
(2) Experiment one: By the simulation model and the supporting settings of the
parameters, the networks is set in the low-load networks. The SMAC-SD protocol is
simulated.
(3) Simulation scene of the experiment one: set four mobile wireless nodes, one
base station and three wired nodes (one of them is set as the routing). The four wireless
nodes are the original nodes, which can set two data streams of the different
transactions. The wired nodes are objective nodes, and different objective nodes
receive the different transaction data stream. The original nodes 0,1 send the important
transaction data stream, which is received by the objective node 1. The original nodes
2,4 send the general transaction data stream, which is received by the node 2. The
wireless node 0 is responsible for the routing. The topology of the simulation scene of
186
S1
S2 Ad1
route
route
BS
S3
S4
Ad2
Ad1
The related simulation parameters of the important transaction data stream are
The related simulation parameters of the general transaction data stream are
187
Table 7.9 Simulation parameters
packet
priorities
high-load networks
Experiment two: By the simulation model and the supporting settings of the
parameters, the networks are set in the high-load networks. The SMAC-SD protocol is
simulated.
Simulation scene of the experiment two: set 8 mobile wireless nodes, one base
station and three wired nodes (one of them is set as the routing). The 8 wireless nodes
are the original nodes, which can set two data streams of the different transactions. The
wired nodes are objective nodes, and different objective nodes receive the different
transaction data stream. The original nodes 0,1, 2, 3 send the important transaction data
stream, which is received by the objective node 1. The original nodes 4, 5, 6, 7 send
the general transaction data flow, which is consider receiving by the node 2. The
wireless node 0 is responsible for the routing. The topology of the simulation scene of
188
S0
Ad1
S1
S2
S3
route
route
S4
BS
S5
S6
Ad1
S7
The related simulation parameters of the important transaction data stream and the
general transaction data stream are same with table 7.8 and table 7.9.
In this simulation experiment, the wired link is set as 10 M, the wireless link is set
as 1m, the sending rate of every wireless nodes are 100kb, and there are 4 wireless
nodes. The network is in the condition of relax facing to the load. The trace file is
obtained after the simulation. The following results are obtained by the analysis of the
AWK tool:
1. Throughput
Due to the large amount of the obtained data, the data analyzed by awk needs to
There are 7626 rows data in the original file of sdmac-put-important. In order to show
the change trend of the throughput with the time, and value of the throughput is set
equidistantly with the probability of 0.01. One group is taken out every 100 rows.
Under two transactions, the chart of the throughput as a function of time in the
SMAC-SD protocol at the low-load and the chart of the throughput as a function of
time in the S-MAC protocol at the low-load are shown respectively as follows figure:
189
Figure 7-33 Throughput of the Low-load SMAC-SD protocol in the Different
Trnasactions
Transactions
190
In the simulation, set the bandwidth wireless link as 1M, there are 4 wireless
nodes, the rate of sending is 100 kb/s, the percentage of load is less than 40% of the
maximal load of the channel. The channel is in the low-load condition with the
reasonable competition. It can be concluded from analyzing the above two figures at
the low-load:
In the SMAC-SD protocol, the important transaction is set as the high priority 0,
the general transaction is set as the low priority 1. The effective transmission of the
channel request mechanism of multi-sending RTS frames in the access slot. As shown
in the Figure 7-33, the important transaction almost uses all channel resources from 0
to 15s. However, the general transaction begins to receive the data packet from the 15s,
and there is no obvious difference throughput between the important transaction and
the general transaction after 15s. Thus, the ability to seize the channel of the important
transaction data is better than the general transaction data. Under the premise of good
transmission of the data for the two transactions, the SMAC-SD protocol can firstly
S-MAC protocol does not divide the priority of the transaction, all types of the
transactions compete fairly for the channel. As illustrated in the Figure 7-33 and 7-34,
the data Throughputs of different types of transactions are similar, and the slight error
can be omitted.
3. System delay
The time interval of the system delay data that is analyzed by awk is small, the
jitter amplitude is large, and the drawn pictures are not clear. In order to show the
delay-important original data is valued equidistantly with 0.01 probabilities, one group
Under two transactions, the chart of the throughput as a function of time in the
SMAC-SD protocol at the low-load and the chart of the throughput as a function of
191
time in the S-MAC protocol at the low-load are shown respectively as follows
Figure 7-35 System Delay of the Low-load SMAC-SD protocol in the Different
Transactions
Figure 7-36 System Delay of the Low-load S-MAC protocol in the Different
Transactions
192
Under the condition of low-load, it is known from the above the two figures7-35
and 7-36:
In the SMAC-SD protocol, from 0s to 15s, the system delay of the important
transaction data stream is concentrated with 0.0072s and is waved constantly with the
margin of 0.0003s. After 15s, the entire of the delay increases to be concentrated with
0.008s and is waved with the margin of 0.004s. In the general transaction, there is no
transmission before 15s, and the system delay is empty. After 15s, the system delay is
concentrated with 0.010s and is waved inconstantly with the margin of 0.005s. Thus,
the wave range of the important transaction is lower than the one of the general
transaction in the SMAC-SD. The delay in the important transaction is more stable,
In the S-MAC protocol, there is no big difference of the system delay between the
important transaction and the general transaction. Both of them is concentrated with
Table 7-10 Packet loss rate of the different transactions at low-load in the
Under the condition of the same load of the important transaction and general
transaction in the SMAC-SD protocol, the packet loss number of the important
transaction is 1285, the packet loss number of the general transaction is 2672; the
193
packet loss rate of the important transaction is 14.45%, the packet loss rate of the
general transaction is 29.98%. The packet loss rate of the important transaction is about
50% of the one of the general transaction, but the packet loss probabilities of two
transactions are small. Thus, under the condition of the low load, the SMAC-SD
protocol can effectively ensure the transmission of the different transactions, but it will
firstly ensure the transmission of the important transaction. The performance of the
Under the condition of the same load of the important transaction and general
transaction in the S-MAC protocol, the packet loss number of the important transaction
is 1314, the packet loss number of the general transaction is 1146; the packet loss rate
of the important transaction is 14.74%, the packet loss rate of the general transaction is
12.86%. Thus, the packet loss probabilities of the different data are similar in the
In this simulation experiment, the wired link is set as 10 M, the wireless link is set
as 1m, the sending rate of every wireless nodes are 125kb, and there are 8 wireless
nodes. The network is in the condition of full-load. The trace file is obtained after the
simulation. The following results are obtained by the analysis of the AWK tool:
1.Throughput
Due to the large amount of the obtained data, the data analyzed by awk needs to
There are 10180 rows data in the original file of sdmac-put-important. In order to show
the change trend of the throughput with the time, and value of the throughput is set
equidistantly with the probability of 0.01. One group is taken out every 100 rows.
the SMAC-SD protocol at the high-load and the chart of the throughput as a function
194
of time in the S-MAC protocol at the high-load are shown respectively as figure 7-37
Transactions
Transactions
It can be concluded from analyzing the above two figures at the low-load:
195
In the SMAC-SD protocol, the important transaction is set as the high priority 0,
the general transaction is set as the low priority 1. The effective transmission of the
channel request mechanism of multi-sending RTS frames in the access slot. As shown
in the Figure 5-9, the important transaction almost uses all channel resources from 0 to
15s. After 15s, the throughput of the important transaction remains as much as five
times than the one of the general transaction. However, the general transaction begins
to receive the data packet from the 15s, and the throughput increases slowly after 15s.
Thus, the ability to seize the channel of the important transaction data is better than the
general transaction data considering the full-load and the channel competition. There is
large difference throughput between the important transaction and the general
sacrificing the transmission performance of the general transaction. At the same time,
under the extreme conditions of the full-load system, the general transaction can seize
the channel to ensure that there is no transmission hunger in the general transaction and
S-MAC protocol does not divide the priority of the transaction, all types of the
transactions competite fairly for the channel. As illustrated in the Figure 5-10, the data
Throughputs of different types of transactions are similar, and the slight error can be
omitted.
2. System delay
The time interval of the system delay data that is analyzed by awk is small, the
jitter amplitude is large, and the drawn pictures are not clear. In order to show the
equidistantly with 0.02 probabilities. One group is taken out every 50 rows and there
Under two transactions, the chart of the throughput as a function of time in the
196
SMAC-SD protocol at the full-load and the chart of the throughput as a function of
time in the S-MAC protocol at the full-load are shown respectively as figure 7-39 and
figure 7-40.
Figure 7-39 System Delay of the high-load SMAC-SD protocol in the Different
Transactions
197
Figure 7-40 System Delay of the high-load S-MAC protocol in the Different
Transactions
Comparing the figure 7-39 and figure 7-40, it shows: in the SMAC-SD protocol
with high-load networks, from 0s to 15s, the system delay of the important transaction
data stream is concentrated with 0.0075s and is waved with low margin, which is
shown in Figure 5-11. After 15s, the entire of the delay begins to increase. After 20s, it
is concentrated with 0.01s and waved. The margin of waving is 6 times more than the
one from 0s to 15s. In the general transaction, there is no transmission before 15s, and
the system delay is empty. After 15s, the system delay is concentrated with 0.070s and
is waved inconstantly with the margin of 0.007s. The reason for the empty delay of the
first 15s in the general transaction is shown in Figure 5-9. The channel is used for the
transmission of the important transaction in the first 15s, and there is no data
transmission for the general transaction during this time. Thus, the concentration of the
delay and the wave range of the important transaction are lower than the ones of the
general transaction in the SMAC-SD. The delay in the important transaction is more
stable, which can ensure the effective transmission of the important transaction in the
198
SMAC-SD protocol.
In the S-MAC protocol, there is no big difference of the system delay between the
important transaction and the general transaction. Both of them is concentrated with
Table 7-11 Packet loss rate of the different transactions at high-load in the
In the full-load SMAC-SD protocol, the packet loss number of the important
transaction is 4671, the packet loss number of the general transaction is 3583; the
packet loss rate of the important transaction is 31.45%, the packet loss rate of the
general transaction is 48.25%. The packet loss rate of the important transaction is about
60% of the one of the general transaction. The packet loss number of the important
transaction is lower. Thus, the full-load SMAC-SD protocol can effectively ensure the
transmission of the important transaction and basically ensure the transmission of the
general transaction.
Under the condition of the same load of the important transaction and general
transaction in the S-MAC protocol, the packet loss number of the important transaction
is 2849, the packet loss number of the general transaction is 3885; the packet loss rate
of the important transaction is 22.55%, the packet loss rate of the general transaction is
48.87%. Thus, there are no differed priorities in the transactions of the S-MAC. The
Figure 7-41 Change Trend of the Throughput as a function of the load in the
From Figure 7-41, the total throughput of the SMAC-SD protocol is lower
than the one of the S-MAC protocol, and both of them slightly decrease with the
increasing of the load. There are two reasons leading to this change: (1) SMAC-SD
protocol focuses on the assurance for the performance of the important transaction. The
performance of the important transaction is higher than all other transactions in the
Thus, the system performance of the SMAC-SD decreases slightly. (2) the access slot
and the competition window of the SMAC-SD protocol increases, which lead to the
increasing of the free timing. To sum up, the total throughput of the SMAC-SD
200
Figure 7-42. The change of the packet loss rate as a function of the load in the
Figure 7-42 shows the result of simulation, because the throughput of the
SMAC-SD protocol is slightly lower than the one of the S-MAC protocol, the packet
loss rate of the SMAC-SD is slightly higher than the one of the S-MAC protocol.
201
Figure 7-43 the change of the packet loss rate as a function of the load in the
From the Figure 7-43, the average system delay of the SMAC-SD protocol is
lower than the one of the S-MAC protocol. For the data that is sensitive to the delay,
To sum up, although the total throughput of the SMAC-SD protocol slightly
decreases compared with the one of the S-MAC protocol, the throughput of the
important transaction is higher than all transactions in the S-MAC protocol. At the
same time, the average delay of the SMAC-SD protocol increases badly compared with
the one of the S-MAC protocol. Moreover, the delay of the important transaction in the
Under the condition of the intense competition in the channel, the SMAC-SD
protocol can effectively protect the transmission of the important transaction, which is
202
7.5 summary
simulation that RBLEACH has largely prolongs the lifetime of each sensor node. It
also solves the problem of the premature death of the nodes in LEACH protocol caused
by the far-to-close death and by the premature communication paralysis in the region
caused by unsatisfactory cluster head selection or poor routing paths. Compared with
promotes balance of network energy consumption and enhances the network life cycle
effectively.
delay, loss of package and quality. The test results show that the protocol can find a
4.To SMAC-SD, the new protocol was verified by the NS2 simulation platform.
The simulation results show that the improved protocol can gain the throughput of vital
service and shorten the delay at the same time, and improve the performance of
network effectively.
203
Chapter 8 Conclusions and Future Work
8.1 Conclusions
1. Comparing the RBLEACH algorithm and the LEAHC algorithm, the energy
cost of communication between each member node, head of cluster and base station is
less, the life cycle of the networks is elongated, and the multi-hop data transmission
between the clusters largely save the energy of each sensor node compared with the
LEACH protocol.
energy cost caused by the unsatisfactory selection of head of cluster or poor routing
network scalability, contributes to the balanced energy cost of network, and elongates
3. MIA-QRP self-adaptive routing algorithm can rapidly find the path and make
effective maintenance to the path. The optimized path to the destination node can be
based on different priorities. It can adjust priority mechanism based on service queue
and channel multi-request mechanisms, and configure waiting queues with different
priorities and RTS retries for different service with different priorities, which can make
vital service get high channel access probability and ensure the transmission quality of
vital service. The simulation results show that the improved protocol can gain the
throughput of vital service and shorten the delay at the same time, and improve the
204
8.2 Future work
1. In this thesis, the clusters are designed with the proportioned selections and
condition, there is possible difference density in the distribution of sensor nodes in the
network. The distributions do not show the uniform and random assumed in this thesis.
Thus, the division for the network should be judged by the density, which makes the
problem more complex. In the future, a clustering algorithm with optimized function
2. For PS and ACO, in this thesis, the PS optimization clustering just uses the
massive consumption of time. This basic PS also possibly results in the part
optimization, not the overall optimization. In the future, a more detailed research for
clustering. The basic ACO is also used in the stage of multi-jumping routing. Simply
seeking for the shortest routing in the ESN routing protocol is not the best program. In
the future, an improved AC should be developed in this part and should be connected
with energy, location and other information to optimize the routing selection in order
to decrease the energy consumption of routing and elongate the lifetime of the network.
decide the best parameters to optimize the settings of clustering groups. In this thesis, a
calculation method for the optimized parameters is concluded for the random
distribution of the nodes. However, this method is not universal, and cannot be applied
for the non-uniform distribution of the nodes (e.g. random Gaussian distribution). The
author will further research the optimized weight parameters combination in the fitness
functions.
3. In this thesis, the MIA-QRP self-adaptive QoS routing protocol just considers
205
the delay of link, package loss rate and strength of the node signal, which can be only
adaptive for the network application of the part QoS protection and needs. According
to the application prospects of the WSN, The networks should dynamically perceive
the networks application and the QoS service demands, and comprehensively evaluate
the QoS service guarantee. Moreover, because the limited resource can only build a
simple testing environment, the protocol function cannot be evaluated currently in the
4. For QoS, since WSNs have to interact with the environment, their
networks. Thus, while WSNs inherit most of the QoS challenges from general wireless
multiple sinks, packet criticality and so on, it will is studied how to design MAC
206
References
[1] Anna Hac. Wireless Sensor Network Designs [M].Hoboken, NJ: John Wiley
Wireless sensor networks for flash-flood alerting, in: Proceedings of the Fifth IEEE
Republic, 2004.
monitoring and patienttracking over a wireless network, in: Proceedings of the 27th
March/April 2006.
2000: 3005-3014.
[12] S.S. Satapathy and N. Sarma, TREEPSI: tree based energy efficient protocol
for sensor information ,Wireless and Optical Communications Networks 2006, IFIP
gray hole attack in Wireless Sensor Networks, Computer Communication and Informatics (ICCCI),
[15] Ravneet Kaur, Deepika Sharma2 and Navdeep Kaur, Comparative Analysis
[16] Qian Liao, Hao Zhu, An Energy Balanced Clustering Algorithm Based on
[17] Nguyen Duy Tan, Longzhe Han, Nguyen Dinh Viet, and Minho Jo,An
1694-0814,P155-164
[20] R.Sumathi and M.G.Srinivas,A Survey of QoS Based Routing Protocols for
2012,http://dx.doi.org/10.3745/JIPS.2012.8.4.589
LAN medium access control (MAC) and physical layer (PHY) specification,IEEE,
wireless sensor networks. In: Proc. of the 1st ACM Conf. on Embedded Networked
wireless sensor network. In: Proc. of the INFOCOM 2002. San Francisco: IEEE
B.Actuation sensor with adaptive routing and QOS aware checkpoint arrangement on
(ICRTIT), 2011 International Conference on 3-5 June 2011 Page 444 - 449.
[29] Jiming Chen, Linrui Zhong, SUN You-Xian, wireless sensor networks
[32] Considine, J.; Li, F.; Kollios, G. & Byers, J. (2004). Approximate
April, 2004.
[33] T.H. Kim and S. Hong, “Sensor Network Management Protocol for
[34] I.F. Akyildiz, J.N. and A. E. Kamal , “Routing techniques in wireless sensor
[35] Jiming Chen, Linrui Zhong, SUN You-Xian, wireless sensor networks
[38] C-Y. Chong, S.P. Kumar, Sensor networks: evolution, Opportunities, and
210
[40] W. Ye, J. Heidemann, and D. Estrin, “Medium Access Control with
[41] A. El-Hoiydi, “Spatial TDMA and CSMA with Preamble Sampling for
Low Power Ad Hoc Wireless Sensor Networks,” Proc. ISCC 2002, July 2002, pp.
685–92.
[43] Jeremy Elson and Deborah Estrin, Time Synchronization forWireless Sensor
USA.http://www.acm.org/sigcomm/HotNetsI
Technique for Wireless Sensor Networks, ACEEE Int. J. on Network Security , Vol.
[47] David E. Culler , Arch Rock Corp. TinyOS: Operating System Design for
WILEY&SONS,INC. PUBLICATION
[49] Gyanendra Prasad Joshi, Seung Yeob Nam and Sung Won Kim, Cognitive
227-233, 2004
[54] P. Tsigas, “Project on Moblie Ad Hoc Networking and Clustering for the
University Course.
[56] K. Akkaya, M. Younis. A survey on routing protocols for wire less sensor
Communications, 2005,4(5):2579-2590.
[59] G. Jolly, M. Younis. An energy efficient, scalable and collision less MAC
layer protocol for wireless sensor networks[J]. Wireless Communications and Mobile
heuristic for data gathering and aggregation in sensor networks[C]. Proceedings of the
[66] Yao Liang Rui Liu,Routing Topology Inference for Wireless Sensor
April 2013
[67] T. Zhao, W. Cai, and Y. Li. MPIDA: A sensor network topology inference
2007.
[70] Kemal Akkaya, Mohamed Younis,A survey on routing protocols for wireless
213
sensor ,Ad Hoc Networks 3 (2005) 325–349
[71] Jae-Hwan Chang, Maximum lifetime routing in wireless sensor networks, Browse
2010,p1060-1067
10.1007/978-1-84882-218-4 10,p261-291
29(11):1694-1701.
algorithm for wireless sensor networks[C]. Proceedings of the 22nd Annual Joint
2004, 3(4):325-349.
clustering for wireless sensor networks, in: Proceedings of the IEEE International
33rd Annual Hawaii Int’l conf. on System Science. Maui: IEEE Computer
Society,2000:3005-30
[86] Thiemo Voigt, Hartmut Ritter, Jochen Schiller,Adam Dunkels, and Juan
[88] Wu Xinhua ,Wang Sheng, Performance Comparison of LEACH and LEACH-C Protocols
by NS2, Distributed Computing and Applications to Business Engineering and Science (DCABES),
215
2010 Ninth International Symposium on 18-25 July 2010
[89] Sunkara Vinodh Kumar and Ajit Pal ,Assisted-Leach (A-Leach) Energy
2013
[93]. Jing Chen, Hong Shen. MELEACH-L: More Energy-efficient LEACH for
1694-0814
Energy Efficient Routing Scheme for Mobile Wireless Sensor Networks,IEEE ISWCS
2008,pp568-572
[99] Kenndy J, Eberhart R.C. Paricle Swarm Optimization. In: IEEE International
Center,1995.1942-1948.
[100] Shi, Y.; Eberhart, R.C. (1998). "A modified particle swarm optimizer".
pp. 69–73.
[102] Marco Dorigo, Luca Maria Gam bardella. Ant Colony System: A
B:CYBERNETICS,VOL,26,NO,1,February 1996
traffic sensor network,” Tsinghua Science & Technology, vol. 13,Apr 2008.
[108] J. Li, K. Li, and W. Zhu, “Improving sensing coverage of wireless sensor
[110]Xin Guan, Guan L., Wang X.G., Ohtsuki, A Novel Routing Algorithm based
2009: 1-5.
Efficient Wireless Sensor Networks based on Ant Colony Optimization [C]. Seventh
2009: 330-334.
Efficient Routing Protocol for Cluster-Based Wireless Sensor Networks Using Ant
2008: 1005-1010.
[114] http://www.rfc-base.org/rfc-2386.html
[115] Prasun Sinha, QoS Issues in Ad-Hoc Networks, Ad Hoc Networks,2005,
Diego,California,1997:2375-2380.
Link-state QoS Routing Protocol for Ad Hoc Networks, Mobile and Wireless
[120] Chenxi Zhu, M. ScottCorson. QoS routing for mobile ad hoc networks.
INFOCOM,2002,6(2): 958-967
Processing(ICPP).2004:502—509.
[122] Sivakumar, R.; Sinha, P. ; Bharghavan, V.,CEDAR: a Core-Extraction Distributed Ad
on (Volume:17 , Issue: 8 )
[124] Wang jianxin,et al,A quality of service routing protocol based on mobility
prediction in mobile ad hoc networks, Journal CSUT Vol 10, No1, 2003: 53—57.
[125] Li Layuan, Li Chunlin, A QoS multicast routing protocol for mobile ad-hoc
[126] Wang Lei. Research and implementation of Linux data packet capture
[129] http://onlinelibrary.wiley.com/doi/10.1002/0470867787.ch6/summary.
scheduling for ad hoc networks.[C] In: Proc 7th Annual Int’l Conference on Mobile
210~221
collision-free medium access control for wireless sensor networks[A]. Proc 1st Int’l
low-latency MAC for data gathering in wireless sensor networks.[C] In: Proc 18th Int’l
Parallel and Distributed Processing Symp (IPDPS’04), April 26-30, 2004,Santa Fe,
[133] IEEE Computer Society LAN MAN Standards Committee. IEEE Std
802.11-1999, Wireless LAN Medium Access Control (MAC) and Physical Layer
wireless sensor networks.[C] In: Proc 1st Int’l Annual Joint Conf on Embedded
Networked Sensor Systems (SenSys), Nov. 5-7,2003, Los Angeles, CA. 2003
for wireless sensor networks.[C] In: Proc 1st Int’l Annual Joint Conf on Embedded
Networked Sensor Systems (SenSys), Nov. 5-7,2003, Los Angeles, CA. 2003
[138] Matthias Grossglauser, David N.C. Tse, Mobility Increases The Capacity of
10 -14 vol.1.
[140] Wang, Yunbo Dept. of Comput. Sci. & Eng., Univ. of Nebraska - Lincoln,
Lincoln, NE, USA Vuran, Mehmet C.; Goddard, Steve.Cross-Layer Analysis of the
[141] Xing Yang, Li zhicun, Gao qian, A Delay guaranteed QoS routing protocol.
Mobile.Sept.2007:5717-5720.
[149] Sung-Ju Lee and Mario Gerla,A Simulation Study of Table-Driven and
July/August 1999,p48-54
coordination function,” IEEE J. Select. Areas Commun., vol. 18, pp. 535-547,Mar.
2000.
Communications.IEEE,June2004:170-174
222
Appendix1
Published papers
2. Hua Long, Joan Lu, S .Chao, Jim Yip, Handoff algorithm improvement and its
analysis for mobile networks. In: Proceedings of the 2007 International Conference on
3.Hua Long,Joan Lu, , Yip, J.; Hua Long Jiang, An Improved Access Scheme
International Conference
4.Hua Long, Joan Lu,Yubin Shao, Guantao and Yip, Yau Jim (2007) A Clustering
1757-4439
5.Hua Long, Joan Lu, Yubin Shao ,Guantao and Yip, Yau Jim ,A new backoff
scheme based on channel state for IEEE 802.11e WLANs,Proceedings of the fifth
6.Y Che, Hua Long, Joan Lu, YJ Yip,An investigation in self-similar study and
223
Appendix2
kernel program
1.RBLEACH algorithm
clear all %
close all %
clc %
%% Simulation parameters
%xm=100; %x
%ym=100; %y
xm=200; %
ym=xm; %
%sink.xd=0.5*xm;%
%sink.yd=0.5*ym;%
sink.yd=0;% BS y
224
DM=4000; % Data size
Efs=10*10^ (-12);% free space (free space) channel model (J/bit/ meters square)
(4 J/bit/ m)
Dead = zeros (1, Rmax);% the death of nodes for per round
for mc = 1:MC
225
%% The initialization of scene
figure(1)
hold off
for i=1:N
S(i).xd=rand(1,1)*xm;
S(i).yd=rand(1,1)*ym;
S(i).G=0;
S(i).E=E0;
S(i).type='N';
plot(S(i).xd,S(i).yd,'o');
hold on;
end
plot(sink.xd,sink.yd,'x');
network area
226
R = xm/ (QN-1);% zone radius
dd=R/10;
Dd=R/10;
Dd=R/10;
Dd=R/10;
Sqn(1)=1/4*pi*R^2;
Sqn(QN)=xm*ym-1/4*pi*(QN*R-R)^2;
for qn=2:QN-1
for qn=2:QN-1
Sqn(qn)=1/4*pi*(qn*R)^2-1/4*pi*(qn*R-R)^2;
end
end
for i=1:N
for i=1:N
qn = min(floor(distance(sink,S(i))/R),5);
QN_num(qn+1)=QN_num(qn+1)+1;
S(i).Q=qn+1;
end
end
CN_num(1)=0;
227
CN_num (1) =0;
CN_num(2)=1;
for qn=3:QN
for qn=3:QN
CN_num(qn)=floor(Sqn(qn)/Sqn(1));
end
end
alpha=pi/2:-pi/32:0;
Alpha=pi/2:-pi/32:0;
Xround=zeros(QN-1,length(alpha));
Yround=zeros(QN-1,length(alpha));
for qn=1:QN-1
for qn=1:QN-1
for i=1:length(alpha)
Xround(qn,i)=R*qn*sin(alpha(i));
Yround(qn,i)=R*qn*cos(alpha(i));
end plot(Xround(qn,:),Yround(qn,:),'r')
end
end
for r=1:rmax
figure(1);
hold on;
for qn=1:QN-1
plot(Xround(qn,:),Yround(qn,:),'r')
end
end
QN_num=tttemp;
for i=1:N
S(i).type='D';
plot(S(i).xd,S(i).yd,'r.');
if(flag_first_dead==0)
node
flag_first_dead=1;
end
end
else
229
S(i).type='N';
plot(S(i).xd,S(i).yd,'o');
end
endflag_first_dead=0;%
Cid=zeros(2/p,rmax);
Cnum=zeros(2/p,rmax);
tttemp=QN_num;
Tttemp=QN_num;
for r=1:rmax
for r=1:rmax
figure(1);
Figure 1.
hold on;
Hold on;
for qn=1:QN-1
For qn=1:QN-1
plot(Xround(qn,:),Yround(qn,:),'r')
end
End
dead=0; %
QN_num=tttemp;
for i=1:N
for i=1:N
if(S(i).E<=0) %
S(i).type='D';
S (I).Type='D';
plot(S(i).xd,S(i).yd,'r.');
QN_num(S(i).Q)=QN_num(S(i).Q)-1; %计算每个区域的存活节点
QN_num (S (I) =QN_num (.Q) S (I).Q) -1;% of each region was calculated
survival nodes
if(flag_first_dead==0)
If (flag_first_dead==0)
flag_first_dead=1;
Flag_first_dead=1;
end
end
end
end
else
Else
S(i).type='N';
S (I).Type='N';
231
plot(S(i).xd,S(i).yd,'o');
end
end
break;
Break;
end
End
cluster=0;
Cluster=0;
CN_num=zeros(1,QN);
CN_num(1)=0;
CN_num(2)=1;
Ptemp=floor(QN_num(2)*rand)+1;
Temp=0;
C2_id=0;
C2_id=0;
for i=1:N
For i=1:N
temp=temp+1;
Temp=temp+1;
if (Ptemp == temp)
If (Ptemp = = temp)
cluster=cluster+1;
Cluster=cluster+1;
S(i).type='C';
S (I).Type='C';
C(cluster).yd=S(i).yd;
C (cluster).Yd=S (I).Yd;
C(cluster).Next=0;
C (cluster).Next=0;
C(cluster).distance=distance(sink,S(i));
C2_id=i;
C2_id=i;
C(cluster).Q=S(i).Q;
C (cluster).Q=S (I).Q;
Packet_To_Bs (=1 cluster);% and transmitted to the base station data packet
number 1
end
End
end
233
End
p=Rc(S(i).Q);
P=Rc (S (I).Q);
if(rand<= p)
If (rand<= P)
cluster=cluster+1;
Cluster=cluster+1;
S(i).type='C';
S (I).Type='C';
C(cluster).yd=S(i).yd;
C (cluster).Yd=S (I).Yd;
C(cluster).Next=0;
C (cluster).Next=0;
C(cluster).distance=distance(sink,S(i));
C(cluster).Q=S(i).Q;
CN_num(S(i).Q)=CN_num(S(i).Q)+1;
end
end
end
234
CH_Num(r)= CH_Num(r) + cluster/MC; %
for i=1:N
if(S(i).type=='N'&&S(i).E>0)%
if (S(i).Q == 1)
Er1=0;
Et1=ETX*DM+Efs*DM*distance(S(i),sink)^2; % Free
space fading
elseif (S(i).Q == 2)
Er1=ERX*CM;
fading else
Er1=ERX*CM*CN_num(S(i).Q)*0.5;
min_dis = 999999;
Pcc=0;
for cc=1:cluster
if (C(cc).Q==S(i).Q)
if (distance(C(cc),S(i))<min_dis)
min_dis=distance(C(cc),S(i));
Pcc=cc;
end
end
end
if(min_dis==999999)
Et1=ETX*DM+Efs*DM*distance(S(i),sink); %
elseif (min_dis>do)
packet_To_Bs(Pcc)=packet_To_Bs(Pcc)+1;
235
Et1=ETX*(CM+DM)+Emp*(CM+DM)*min_dis^4; %
else
packet_To_Bs(Pcc)=packet_To_Bs(Pcc)+1;
Et1=ETX*(CM+DM)+Efs*(CM+DM)*min_dis^2; %
end
end
end
end
for c1=1:cluster
if (C(c1).Q>2)
min_dis=9999;
pmin=0;
flag=1;
qq = C(c1).Q;
while (flag)
qq = qq-1;
for c2=1:cluster
if (C(c2).Q==qq)
if (distance(C(c2),C(c1))<min_dis &&
distance(C(c2),C(c1))<0.8*distance(sink,C(c1)))
min_dis=distance(C(c2),C(c1));
pmin=c2;
end
end
end
236
if (min_dis ~= 9999)
plot([C(pmin).xd C(c1).xd],[C(pmin).yd
C(c1).yd],'g');
C(c1).Next=pmin;
if (qq==2)
packet_To_Bs(pmin)=packet_To_Bs(pmin)+packet_To_Bs(c1)/2;
else
packet_To_Bs(pmin)=packet_To_Bs(pmin)+packet_To_Bs(c1)/10;
end
flag=0;
elseif (qq==2)
flag=0;
end
end
end
end
for cc=1:cluster
if (C(cc).Next == 0)
end
end
for c=1:cluster
CEt2=(ETX+EDA)*DM*packet_To_Bs(c)+Efs*DM*cc*packet_To_Bs(c)*dd^2; %
else
CEt2=(ETX+EDA)*DM*packet_To_Bs(c)+Efs*DM*cc*packet_To_Bs(c)*dd^2; %
end
S(C(c).id).E=S(C(c).id).E-CEr1-CEr2-CEt1-CEt2;%此
end
for i=1:N
end
end
end
end
2.PSO-LEACH
clear all
238
close all
clc
%% simulation parameters
Efs=10*10^ (-12);% free space (free space) channel model (J/bit/ meters square)
%% scene initialization
figure(1)
for i=1:N
S(i).xd=rand(1,1)*xm;
S(i).yd=rand(1,1)*ym;
S(i).G=0;
S(i).E=E0;
S(i).type='N';
plot(S(i).xd,S(i).yd,'o');
hold on;
end
plot(sink.xd,sink.yd,'x');
Cid=zeros(2/p,rmax);
Cnum=zeros(2/p,rmax);
for r=1:rmax
figure(1);
plot(sink.xd,sink.yd,'x');%
hold on;
dead=0; %
if(S(i).E<=0) %
S(i).type='D';
plot(S(i).xd,S(i).yd,'r.');
if(dead==1) %
if(flag_first_dead==0)
first_dead=r; %
flag_first_dead=1;
end
end
else
S(i).type='N';
plot(S(i).xd,S(i).yd,'o');
end
end
Dead(r)=dead; %
break;
end
S1(i).G=0
for i=1:N
S(i).G=0;
end
241
end
[C,S]=GroupHead(S,N,dead,sink,p,r);
num_cluster=length(C); %
CH_Num(r)=length(C); %
for i=1:N
if (S(i).type ~= 'D')
if num_cluster >0
min_dis=distance(S(i),sink);
min_dis_cluster=0;
for c=1:num_cluster
temp=distance(S(i),C(c));
if(temp<min_dis)
min_dis=temp;
min_dis_cluster=c;
end
end
if (min_dis_cluster>0)
C(min_dis_cluster).ptb=C(min_dis_cluster).ptb+1; %
min_dis=distance(S(i),sink);
Er1=0;
end
else
min_dis=distance(S(i),sink);
242
Er1=0;
end
consumption data
if (min_dis>do)
Et1=ETX*(CM+DM)+Emp*(CM+DM)*min_dis^4; %
else
Et1=ETX*(CM+DM)+Efs*(CM+DM)*min_dis^2; %
Multipath fading
end
S(i).E=S(i).E-Er1-Et1; %
Residual energy
end
end
%% Cluster head routing decisions made for each cluster head to the base
C=HeadRoute(C,sink);
for c=1:num_cluster
CEr1=ERX*CM*(C(c).ptb-1); %
CEr2=ERX*DM*(C(c).ptb-1); %
if (N-dead<=num_cluster)
CEt1=0;
else
243
CEt1=ETX*CM+Efs*CM*(sqrt(xm*ym))*(sqrt(xm*ym)); %
end
if (min_dis>do)
CEt2=(ETX+EDA)*DM*C(c).ptb+Emp*DM*cc*C(c).ptb*C(c).distance^4; %
Multipath fading
else
CEt2=(ETX+EDA)*DM*C(c).ptb+Efs*DM*cc*C(c).ptb*C(c).distance^2; %
end
Cid(c,r)=C(c).id;
Cnum(c,r)=C(c).ptb;
end
end
244