Dept. Of Electrical Engineering | California State University, Long Beach| Summer 2014 Aeon LEACH An Efficient LEACH protocol in Heterogeneous and Homogenous Wireless Sensor Networks Vidhi Nagri (011451113) vidhi.nagri@gmail.com California State University of Long Beach EE-697 Summer 2014 This report has been reviewed by the advisor, Dr. Mohammad Mozumdar, and approved for submission to the committee. Under the guidance of Dr. Mohammad Mozumdar Aeon LEACH Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Acknowledgments I would like to express my special thanks and words of appreciation to Dr. Mohammad Mozumdar for the guidance and support in completing this project. You have been a tremendous mentor for me from the start of my Masters of Science degree. Your advice on both project as well as on my career have been priceless. A special thanks to my family. Words cannot express how grateful I am for all the sacrifices that you have made on my behalf. I wish to thank my family for the moral support and providing me with the resources to continue learning. Your prayer for me was what sustained me so far. I am also immensely happy to shower my gratitude towards all of my friends who supported me and incented me to strive towards my goal. Aeon LEACH Page 2 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Table of Contents Abstract………….………………………………………………………………………..4 Introduction………………………………………………………………………………5 Related Work and Motivation ………………………………………………………….6 Basic Terminology ………………………………………………………………………7 LEACH Protocol ………………………………………………………………………...8 Why do we need Aeon LEACH? ……………………………….………………..….….9 Radio Model for Aeon LEACH………………………………………………..………10 Aeon LEACH Phase 1……………………………………………………..………..….11 Simulation Aeon LEACH Phase 1 ………………………………………………..…..17 Protocols for Heterogeneous system…………………………………………………..20 Aeon LEACH Phase 2 ……..………………………………………..…………….…...23 Simulation Aeon LEACH Phase 2 …………………………………………………….28 Conclusion and Future work …...……………..…..…………………………………..31 References……………………………………………………………………………….32 Matlab Code…………………………………………………………………………….34 Aeon LEACH Page 3 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Abstract In recent years, many routing protocols have been proposed to improve the lifetime, energy efficiency, deployment of nodes, latency, fault tolerance, robustness, and reliability of Wireless Sensor Networks (WSN). The energy constraints and prolonging the lifetime of the WSN is very important role of routing protocols. Different cluster based routing protocol have proposed to improve the conventional protocols i.e. direct transmission, multi-hop routing, static clustering and minimum-transmission-energy. Among all cluster based protocols, Low-Energy Adaptive Clustering Hierarchy (LEACH) is the most prominent WSN protocol. In this project, we have tried to expand the LEACH by adding different features in LEACH for homogeneous and heterogeneous environments. We have proposed Aeon LEACH Phase-1 by introducing proficient cluster head selection scheme and different transmitting power levels for LEACH in homogeneous environment. But, energy saving scheme of homogeneous environment is not suitable for heterogeneous environment. Stable Election Protocol (SEP) is the dynamic heterogeneous routing protocol. SEP is based on weighted election probabilities of each node to become the cluster head according to the remaining energy in each node. We propose Aeon LEACH Phase-2 by applying different ways of communication (between CH to sink) for advanced and normal nodes. By showing simulation, we prove that Aeon LEACH is more energy efficient and has longer lifetime of network than LEACH in homogeneous and heterogeneous environments. Keywords: heterogeneous system, homogeneous system, distributed system, data aggregation, dynamic cluster head rotation, threshold value concept. Aeon LEACH Page 4 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Introduction: Wireless Sensor Networks (WSNs) represent a new paradigm in wireless technology drawing significant research attention from diverse fields of engineering. WSN technology is listed in “Top 10 Emerging Technologies” that will change the world. WSNs consist of many sensor nodes. These nodes sense the changes in the physical parameters similar to – pressure, temperature, etc. The data sensed by these nodes are then transmitted to the Base Station (BS) for estimation. WSNs are used for the variety of purposes like military surveillances, habitat monitoring, forest fire detections, and landslide detections (Figure 1). The main task of many researchers in this field is to develop smart surroundings with the help of WSNs containing thousands of planned or ad-hoc deployed sensors, each capable of detecting ambient conditions like temperature, sound, movements, light, or the presence of particular objects. It is very important to make these sensing nodes as cheap and energy efficient as possible and trust them to obtain high quality results. Hence, to have battery operated sensor nodes is a good option. But despite of their small sizes, these batteries must be capable of giving a longer life to these sensing nodes. The network protocol used must be very efficient to optimize the lifetime of the nodes. We also need to focus on algorithms and physical circuitries that can make maximum out of limited power source. Some of the promising routing algorithms can be categorized into three types as direct transmission algorithms, hop to hop transmission algorithms and cluster based algorithms. In cluster based protocols, most of the energy consumption depends on cluster head selection, cluster formation and the algorithm developed for routing the information. Aeon LEACH Page 5 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Related Work and Motivation: In direct communication protocol, each sensor node sends its data directly to the base station. Direct communication will require a large amount of transmit power from each node if the base station is far. The second conventional approaches we consider is a “minimum-energy” routing protocol. In this protocol, nodes route data through intermediate nodes ultimately destined for the base station. Thus every node acts as a router for other nodes in addition to sensing the environment. These protocols differ in the way the routes are chosen. We can divide cluster based routing protocols mainly in two parts, Protocols for homogeneous environment and protocols for heterogeneous environment. LEACH is one of the first cluster based routing protocol. It assigns equal probability for each node to become cluster head. This works well for the homogeneous networks but not for the heterogeneous networks because of the unequal energy of nodes. SEP prolongs the lifetime of WSNs by inserting a percentage of heterogeneous nodes. Heterogeneous WSNs consist of sensor nodes with different ability, such as different sensing range and data computing power. By adding these nodes we can follow different cluster selection scheme. This will give higher stability to the cluster and longer time to survive the cluster. This scheme depends on current node energy; each node will be CH depending on its remaining energy. Another problem occurs in handling the huge amount of information and to pass it over through every node of the network. To resolve this issue, we need to have an efficient routing protocol that has low routing overhead and a good data aggregation technique to save the limited power of sensing node. By introducing the Aeon LEACH, we are trying to improve lifetime of the LEACH protocol in homogeneous and heterogeneous mediums. It focuses on less power consumption for data aggregation by using threshold value concept. We are going to use distributed sensor nodes using dynamic cluster head rotation. Aeon LEACH can be divided into two parts: Phase-1 and Phase-2. Initially we are assuming that all the sensor nodes are at same energy level so that we can consider the system to be homogeneous. When some of the nodes die, system becomes unstable and homogeneous routing protocols are not able to take the advantage of remaining energy. After some time, the energy levels will be different among the nodes and hence the field can be assumed as heterogeneous system. We also assume that, all the nodes are steady. Aeon LEACH Page 6 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Basic Terminologies: Stability Period: Time interval between start to the death of the first sensor node in the network. Instability Period: Time interval between the deaths of the first node and the last node. Throughput: The total amount of data sent over the network i.e. the amount of data sent from cluster heads to base station and the amount of data sent from the nodes to base station. Network Lifetime: Time interval between the deployment of the network and the death of the last alive node. Epoch: Number of rounds after which a node is eligible for cluster head. Data Aggregation: Data collected in the sensors are derived from similar phenomena and hence nodes in a close area usually share same information. A way to reduce the energy consumption is the data aggregation technique. Aggregation also consists of suppressing redundancy in different data messages. When this suppression is achieved by some signal processing techniques, this operation is called as data fusion. Number of cluster heads per round: It reflects the number of nodes which would send the aggregated information directly to the sink. Number of total alive (advanced and normal) nodes per round: It reflects the total number of nodes including the nodes that have not spent their energies at all. Aeon LEACH Page 7 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 LEACH Protocol: LEACH is Low-Energy Adaptive Clustering Hierarchy, a clustering-based protocol that minimizes energy dissipation in sensor networks. The key features of LEACH are: Localized control and coordination for cluster set-up and its operation Randomized rotation of the cluster “base stations” or “cluster-heads” and the corresponding clusters Compression done locally to reduce global communication LEACH protocol has advantage over previous WSN routing protocols. It requires small transmit distances for most of the nodes, which uses only a few nodes to transmit far distances to the base station. LEACH outperforms classical clustering algorithms by using adaptive clusters and rotating cluster-heads, thus allowing the distributed energy requirements of the system among all the sensors. In addition, LEACH is able to perform local computation in each cluster to reduce the amount of data that has to be transmitted to the base station. This reduces the energy dissipation, as computation is much cheaper than communication. LEACH is following periodic process. In 1st Advertise Phase, election of cluster head and nodes covered in that cluster is defined. The 2nd Setup Phase consists of the planning of cluster schedule with base station. In the 3rd steady state, nodes send data to the respective base stations. LEACH is completely distributed and non-centralized control system. It can reduce communication costs by up to 8x because LEACH keeps the first node alive for up to 8x longer and the last node by up to 3x longer. Figure 2: LEACH Protocol Aeon LEACH Page 8 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Why do we need Aeon LEACH? Aeon LEACH is the proposed protocol to use the LEACH protocol for the longer time in the field by increasing its efficiency. It tries to improve some of the drawbacks of LEACH protocol in WSN. LEACH assumes that most of the WSN fields are homogeneous system, but in real-world situation, it is very difficult to find homogeneous system for a long time or till the network exists. Therefore, it is very essential to cover both homogeneous and heterogeneous environment situation while creating the protocol. LEACH assumes that all cluster heads pay the same energy cost, which is not possible. The cluster head in the WSN consumes different amount of energy depending upon the distance between n cluster head to base station and the amount of data it is transmitting. Therefore, calculation for the energy consumptions is wrong. Death model is incorrect. Compression may not be as cheap as claimed because it is unclear how much savings are from compression assumptions and how much from adaptive clustering. There is not any threshold decided for compression of sensed data. LEACH gives adaptive clustering mechanism which deals very efficiently with energy conservations. However, LEACH doesn’t take account of residual energy of a node. To address this, a novel technique as efficient cluster head selection is proposed. LEACH uses same amplification energy for both kinds of transmissions i.e. cluster head to base station and CM to CH. To address this, multi amplified power levels are introduced. This is how much of the energy wasted in cluster head formation process can be saved. Moreover, control overhead is also limited. LEACH does not determine optimal number of cluster heads in simulation, before implementation. Round durations never specified or explained in LEACH protocol. Aeon LEACH Page 9 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Radio model used for Aeon LEACH: For our work, we assume a simple model where the radio dissipates = 50 nJ/bit to run the transmitter or receiver circuitry and = 100 pJ/bit/ for the transmitter amplifier to achieve an acceptable Eb/ No. We consider these parameters because they are better than the current state-of-the-art in radio design1. Due to channel transmission, we also assume an energy loss. Figure 3: First order radio model Therefore to transmit k-bit message for a distance d using our radio model, the radio uses + €amp * k * And to receive this message, radio expends: For these values, message receiving is not a low cost operation; the protocols should thus try to minimize not only the transmit distances but also the number of transmit and receive operations for each message. Aeon LEACH Page 10 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Proposed Aeon Phase 1: Aeon phase-1 is an advanced version of LEACH protocol in the homogeneous environments. Assumption is that all the nodes initially have the same energy i.e. homogenous system. Aeon LEACH phase-1 introduces mainly two techniques to improve the LEACH protocol in the WSNs. In this section, we will observe how these techniques will work with existing LEACH protocol. 1. Proficient cluster head selection scheme: Same as LEACH, Aeon LEACH also has two phases: The Set-Up phase and the Steady-State phase. The Set-Up phase where cluster heads are chosen and Steady State where cluster head maintained and data is transmitted between the nodes and base station or between nodes and cluster heads. LEACH protocol changes the cluster head at every round and once a cluster head is formed, it will not get another chance for next 1/p rounds. Equation for LEACH protocol: For every round, cluster heads are replaced and whole cluster formation process is carried out again. For this reason, we propose an efficient cluster head selection scheme. It is the starting point in cluster head formation for every next round. If existing cluster has not spent much energy during its tenure and has the required threshold energy, then it will remain as cluster head for the next round too. And thus the energy wasted in routing the packets for new cluster head and cluster formation can be saved. If the cluster head has less energy than required threshold, new cluster head will be selected according to LEACH algorithm. Aeon LEACH Page 11 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 2. Different modes of transmission: Besides limiting energy utilization in cluster formation, Aeon LEACH introduces two different levels of power to amplify signals according to nature of transmission. There can be three modes of transmission in a cluster based network: a. Intra Cluster Transmission b. Inter Cluster Transmission c. Transmission between Cluster Head to Base Station Intra Cluster Transmission deals with all the communication within a cluster i.e. cluster member senses the data and report the sensed data to the cluster head. The transmission/ reception between two cluster heads can be called as Inter Cluster Transmission while a cluster head transmitting its data straight to the base station lies under the caption of Cluster Head to Base Station Transmission. The amount of minimum amplification energy required for inter cluster or intra cluster or cluster head to BS communication cannot be same. The amplification energies required for each mode of transmission in Aeon LEACH cannot be same. While in LEACH, amplification energy is same for all modes of transmission. Use of low energy level for Intra Cluster Transmission with respect to Cluster Head to BS Transmission could save much amount of energy. Moreover, multi power levels also reduce the packet drop ratio, collisions and/ or interference from other signals. In this context, we assume that a cluster at maximum may spread into an area of 15X15 in a field of 150X150 . Energy that is enough to transmit at far ends of a field of 150X150 must be lowered 10 times for intra-cluster transmission. When a node acts as a cluster head, routing protocol allows it to use high power amplification. When the same node becomes a cluster member, routing protocol changes it to low power amplification. At the end, soft and hard threshold schemes are also implemented in Aeon LEACH that gives better results. Aeon LEACH Page 12 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Aeon LEACH Phase-1 Algorithm Details: Figure 4: Comparison between LEACH and Aeon LEACH Phase 1 Aeon LEACH Page 13 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 We can compare LEACH and Aeon LEACH by considering different phases. 1. 2. 3. 4. 5. Advertisement Phase Cluster Set-Up Phase Schedule Creation Data Transmission Multiple Clusters 1. Advertisement Phase: In Aeon LEACH if CH energy is less than threshold, cluster will select new CH. While cluster formation is in process, each node is checked for the cluster head selection for current round. This selection is based on the required number of cluster heads for the network and the number of times the node being a cluster head till now. The decision is made by the node n by choosing a number between 0 and 1. If the chosen number is less than threshold, the node is chosen as cluster head for the current round. Each node which is chosen as cluster-head for the current round, will broadcast an advertisement message to all other nodes in the cluster. For this phase, the cluster head uses a CSMAMAC protocol. All cluster-heads transmit their advertisements using the same energy. The non-cluster head nodes must keep their receivers ON during this phase to hear these advertisements. As soon as this phase is over, each non-cluster head node chooses the cluster to which it will belong. This decision is done based on the received advertisement’s signal strength. . During start of any round, if CH has higher energy than threshold, same node will be CH for next round. In this way energy to choose cluster head again for round will be saved. All connection between cluster to cluster and CH to BS will be same. Aeon LEACH Page 14 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 2. Cluster Set-Up Phase: This phase will be used if CH has less energy than threshold value. New cluster will be created in this case. After each node decides to which cluster it will belong, it should inform the CH of that particular cluster. Each node will transmit this information back to the CH again using a CSMA MAC protocol. All CH nodes must keep their receivers ON during this process. 3. Schedule Creation: Based on the entire feedback signals CH received in the previous mode, CH will get information about nodes that would like to join the cluster. Based on this number, CH will assign TDMA schedule to each node. Once this schedule will broadcast to every node in the cluster, nodes will follow the same schedule for the data transmission. In Aeon LEACH, if CH is not changed during another round, Cluster will follow the same TDMA schedule for next round. By this way, cluster cam save the energy. 4. Data Transmission: In Aeon LEACH, this is the most important phase from the energy conservation point of view. Here we introduce two concepts: Hard Threshold and Soft Threshold. Hard Threshold Concept: When a sensed value is greater than the threshold value, data packet will only be transmitted to receiver. It will minimize the number of transmissions to save the energy of a node. However, it transmits data always when that threshold is broken; no matter if sensor is sensing the same value from last many rounds. Soft Threshold Concept: When sensed value from node is higher than the previous sensed value, node will transmit the data to receiver. This will pass messages which have some information in it. This will increase the network efficiency significantly. This is due to limiting number of transmissions (concept of soft threshold) along with efficient cluster head selection mechanism that preserve energy globally and multi power level for inter and intra cluster communication. In Aeon LEACH ST, number of transmissions are confirmed only when a pre-described change in sensed data is achieved. This limits number of transmissions to preserve residual energy of a sensor node (numbers of transmissions are inversely proportional to energy of sensor node). Aeon LEACH Page 15 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 After the calculation of soft and hard threshold, nodes start data transmission. When the clusters are created and the TDMA schedule is fixed, we can begin the data. Assuming that nodes always have some data to send and they send it during their allocated transmission time, each of them can be turned off until their allocated transmission time. This results in minimizing energy dissipation in these nodes. The CH node must keep its receiver ON until it receives all the data from all the nodes. When all the data is received, the CH performs signal processing functions to compress all the data into a single signal. Aeon LEACH uses different mode of transmission depending upon the distance between transmitter and receiver. 5. Multiple Clusters: The preceding discussion describes how the individual clusters communicate among nodes in that cluster. Intra Cluster Transmission, Inter Cluster Transmission, Cluster Head to Base Station Transmission. However, radio is essentially a broadcast channel. The transmission in one cluster will affect and hence degrade the communication in a nearby cluster. Aeon LEACH Page 16 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Simulations for Aeon LEACH Phase 1: Parameters used for calculation: Network Parameters Network Size Initial Energy of Sensor Nodes Packet Size Transceiver idle state energy consumption Data Aggregation/ Fusion Energy consumption Amplification Energy (Cluster to BS)d >= do Amplification Energy (Cluster to BS) d <= do Amplification Energy (Intra Cluster Comm.) Amplification Energy (Intra Cluster Comm.) Value 100X100 0.5 J 4000 bits 50 nJ/bit 5 nJ/bit/report = 10pJ/bit/ = 0.0013pJ/bit/ /10 = /10 = Figure 5: i) Alive nodes of the Network Vs. No of rounds in Aeon LEACH Phase 1. ii) Dead nodes of the Network Vs. No of rounds in Aeon LEACH Phase 1. In all Simulation figures, LEACH : Red Aeon LEACH : Green Aeon LEACH Hard threshold : Black Aeon Leach with Soft threshold : Blue Aeon LEACH Page 17 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Nodes will die soon in LEACH protocol as every round there will be new cluster head selection process will be performed. Again, all the nodes will transmit with the same energy.Aeon LEACH in green would have better performance than LEACH because these two issues are solved. Hard threshold will minimize the no of signals to be transmitted, because it will send only the value higher than threshold. This can also abort the signal which has importanat data in it,as this signal total information is lesser than threshold. Performace by using Soft threshold is best so far. This technique minimizes the no of packets transmitted to reciever. Again, it will only send the data if it has higher information than the previous signal. Graph for the dead nodes of the network will be exactly opposite. In LEACH, nodes will die soon as compared to Aeon LEACH with hard threshold and Aeon LEACH with soft threshold. Figure 6 : i) Packets transmitted to Base station in Aeon Phase 1 Vs. No of rounds ii) Packets transmitted to Cluster Head in Aeon Phase 1 Vs. No of rounds Better network life time and efficient cluster head selection mechanism are two major reasons of increased throughput in Aeon LEACH with soft threshold. Comparing Aeon LEACH and LEACH, Aeon LEACH gives better throughput due to same reasons i.e. increased network life time and better cluster head selection scheme. Aeon LEACH Page 18 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 One more prominent reason is dual transmitting power levels within network. Using different amplification energies for transmissions reduces packet drop ratio resulting in higher through put. Another reason that can distinguish throughput gain in all studied techniques is the mode of operation. LEACH and Aeon LEACH both are proactive (periodical transmissions) in nature while Aeon Leach with soft threshold and Aeon LEACH with hard threshold are reactive (event driven). This also depicts that proactive (periodical transmission) routing protocols have lower throughput than reactive (event driven) routing protocols. Aeon LEACH Page 19 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 WSN protocols for Heterogeneous system: LEACH, which is a WSN protocol for homogeneous systems, is not suitable for heterogeneous systems. Putting few heterogeneous nodes in a Wireless Sensor Network is an effective way to increase the network’s stability and lifetime. The energy saving schemes used for homogeneous WSNs does not work efficiently when used for heterogeneous WSNs. Thus, a new energy efficient clustering protocol should be designed for them. Heterogeneous WSNs are very much useful in real deployments because they are more close to real life situations. Figure 7: Heterogeneous model for Wireless Sensor Network Aeon LEACH Page 20 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 We can divide heterogeneous WSN system mainly in three parts. 1) Computational heterogeneity 2) Link heterogeneity 3) Energy heterogeneity Computational heterogeneity: In this type of system, some of the nodes have more energy than the other normal nodes. The heterogeneous nodes can provide some benefits such as complex data processing and long term storage with the use powerful computational resources. We are going to use this approach in Aeon LEACH Phase 2. Link heterogeneity: Here, some of the heterogeneous nodes have higher bandwidth and longer distance network transceiver than the normal nodes. It can provide more reliable data transmission. Energy heterogeneity: This system has some of the heterogeneous nodes that are line powered or their batteries are replaceable. For our protocol, Computational heterogeneity is the best suitable. Because in Aeon LEACH, we are trying to increase the lifetime of the network. By distributing powerful calculations to advance nodes, we can increase the network lifetime. Link heterogeneity is dealing with the quality and reliability of packets whereas; Energy heterogeneity can be implemented in practical situations. We are not considering Link and Energy heterogeneity from the algorithm point of view. Aeon LEACH Page 21 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Heterogeneous SEP Protocol: Aeon LEACH Phase 2 is dependent on SEP (A Stable Election Protocol for clustered Heterogeneous WSNs) protocol. SEP is based on weighted election probabilities of each node to become cluster head according to the remaining energy in each node. SEP tries to maximize the stability of the network. Stability can be increased by increasing the time of last node death. Clearly, larger the stable and unstable regions are, better is the reliability of the clustering process. On the other hand, there is a tradeoff between reliability and the lifetime of the system. Until the death of the last node, we still can have some feedback about the sensor field even though this feedback may not reliable. The unreliability of the feedback stems from the fact that there is no guarantee that there is at least one cluster head per round during the last rounds of the operation. In our model, the absence of a cluster head prevents reporting about the cluster to the sink at all. The throughput quantity captures the amount of such data reporting to the sink. In a heterogeneous WSN, LEACH doesn’t work well as it is very sensitive to the heterogeneity. Characteristics of SEP: Being aware of heterogeneity, SEP successfully outspreads the stable region by assigning weighted probabilities of cluster-head selection by the initial energy of initial nodes. Due to this outspreaded extended stable region, the throughput is also increased. The performance of SEP is extended by distributing the additional energy of the advanced nodes uniformly to all other nodes in the field. SEP is more robust than LEACH by carefully consuming this extra energy of the advanced nodes. It yields longer stability region for higher values of extra energy. Aeon LEACH Page 22 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Aeon LEACH Phase 2: In this section we present Aeon Phase 2 protocol. Here we assume that after couple of rounds of homogeneous system, system will be no longer homogeneous. This is possible because of data transmission is not always same from all the nodes. Nodes which are nearer to the base station, they have to pass more data compared to the nodes which are far away. This is the reason we assume that, the nodes at a far end from the base station have more energy and are considered as advance nodes. Nodes which are near to the base station are normal nodes with lesser energy than advanced node. Our protocol is extension of SEP. It follows the hybrid approach i.e. direct transmission as well as transmission via cluster head. Depending on Energy of nodes, we can divide all the nodes in advanced nodes with more energy than normal nodes. For Aeon Phase2 setup, we will put advance nodes in the corner for direct transmission and normal nodes in-between through cluster head transmission. Proposed Aeon Phase 2: Architecture: At the end of Aeon Phase 1, we assume that the nodes are placed randomly and with different amount of energies in all. So we can divide the nodes based on their energies: zone 0, Head zone 1, and Head zone 2. We assume that the advance nodes are having fraction of more energy than the normal nodes. Total m numbers of nodes out of n are having α time more energy than normal nodes. We refer these nodes as advance nodes and (1-m) ×n are normal nodes. Nodes in zone 0 have less energy and they are deployed near to the base station. These nodes will directly transmit the data to the sink. Nodes in Zone 1,2 have α times more energy than nodes in zone 0. Aeon LEACH Page 23 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Figure 8: Setup for the Advanced and normal node for Aeon phase 2 Operation: Aeon phase 2 uses two modes of data transmission techniques. Direct communication Transmission through cluster head Direct Communication: Normal nodes will sense environment and gathers data of interest. After that they will send it data to base station through direct communication. Transmission via Cluster head: Clustering Nodes in Head zone 1 and Head zone 2 transmit data to the base station through clustering algorithm. Cluster head is selected among nodes in Head zone 1 and 2. Cluster heads collect data from member nodes, aggregate them and transmit them to the base station. Cluster head selection is very important because it collects data from member nodes and transmits to sink. Figure shows only advanced node is creating Aeon LEACH Page 24 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 clusters. clusters Assume an n is the number of advance nodes and optimal number of . According to SEP, optimal probability of cluster head is Every node has to decide if it wants to be the cluster head in current round. A random number is generated between 0 and 1. As per SEP, if the generated number is less than or equal to threshold, that node will selected as cluster head. Threshold is given by if n € G = 0 Otherwise Where G is the set of all the nodes which have not been selected as cluster heads in the last 1/ rounds. Equation below gives the probability for advance nodes to become cluster head. * (1 + α) Also the threshold for advance nodes is given as, T (adv) = =0 if adv € Otherwise Where G' is the set of all the advance nodes that have not been selected as cluster head in the last 1/ rounds. Same as LEACH, Once the CH is selected then the CH will broadcast an advertisement message to all the other nodes. Other nodes will receive the message and decide whether to join with this CH or any other. This phase is known as cluster formation phase. On the basis of the received signal’s strength, nodes respond to cluster head and become member of cluster head. Cluster head then assign a TDMA schedule for the nodes during which nodes can send data to cluster head. After the clusters formation, every node data and sends it to the cluster head in the time slot allocated by the cluster head to the node. Cluster head then aggregates the received data from the nodes and sends it to the base station. This phase is called as transmission phase. Aeon LEACH Page 25 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Figure 9: Advance nodes select CH and send data to CH Figure 10: CH sends data to the sink by direct communication Aeon LEACH Page 26 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Flow Chart for Phase 2: Figure 11: Flow chart of Aeon Phase 2 Figure 11 briefly explain the operations of Aeon phase 2 for normal and advanced nodes. Because of the energies of normal nodes are less than those of advance nodes, normal nodes are not able to form a cluster. Also in receiving the data from all other nodes, the cluster head will consume more energy. If normal nodes are allowed to become cluster head then they will die soon making the stability period short. Aeon LEACH Page 27 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Simulation for Aeon Phase 2: Table shows the parameters used for simulation. Parameters Initial energy Eo Initial energy of advance nodes Energy for data aggregation EDA Transmitting and receiving energy Eelec Amplification energy for short distance Efs Amplification energy for long distance Eamp Probability Popt Value 0.5 J Eo(1+α) 5 nJ/bit/signal 5 nJ/bit 10 pJ/bit/m2 0.013 pJ/bit/m4 0.1 Figure 12: Alive nodes comparison fir LEACH, SEP and Aeon Leach phase 2 Vs. Number of rounds. Aeon LEACH Page 28 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Figure 13: Dead nodes comparison fir LEACH, SEP and Aeon Leach phase 2 Vs. Number of rounds. Figure 14: Packets to Base Station comparison for LEACH, SEP and Aeon Leach phase 2 Vs. Number of rounds. Aeon LEACH Page 29 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 In this simulation m=0.2 and α=1which means that we have 20 advance nodes out of total 100 nodes. According to our proposed protocol, Head zones 1 and 2 will contain 10 advance nodes each. Figure shows Aeon leach phase 2 is having higher stability than LEACH and SEP. In LEACH, nodes will die soon, because they do not support the heterogeneity of the system. SEP will give better result with two stage heterogeneity and weighted cluster head selection process. Aeon LEACH phase 2 performs better than LEACH and SEP, because nodes in Zone 0 (normal nodes) communicates directly to base station while nodes in head zones 1and 2 communicates base station through cluster head. In case of clustering technique, energy consumed by cluster head is in the form of data receiving from other nodes and doing the data aggregation.. This energy is conserved in normal nodes resulting in the increase of stability period. In Fig.5, we can clearly see that, use of advance nodes increases network lifetime. They have α time more energy than normal nodes. And hence advance nodes die after normal nodes resulting in the increase of the instability period. Aeon LEACH Page 30 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Conclusion and Future Work: In our work we have briefly describe how cluster based routing protocol LEACH can be utilized in better way for homogeneous and heterogeneous environment. Our simulation shows Aeon Phase 1 gives better throughput of the system compare to LEACH. We can get better efficiency by including new CH replacement scheme and different transmission energy. Moreover, stability of SEP can be improvised by using two different transmission techniques direct transmission and CH to sink transmission in heterogeneous environment implemented in Aeon Phase 2. In future, Aeon LEACH can be improvised by adding more techniques for hierarchal transmissions between CH to Sink. Again, It will be interesting to apply advanced node concept with Energy heterogeneity. Aeon LEACH Page 31 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 References: 1. Wendi Rabiner Heinzelman, Anantha Chandrakasan, and Hari Balakrishnan, Energy efficient cooperative LEACH protocol for wireless sensor networks, Massachusetts Institute of Technology, Cambridge, MA 02139 2. Georgios Smaragdakis, Ibrahim Matta , Azer Bestavros SEP: A Stable Election Protocol for clustered wireless sensor networks, Computer Science Department, Boston University, Boston, MA 02215, USA 3. Li Qing *, Qingxin Zhu, Mingwen Wang Design of a distributed energy-efficient clustering algorithm for heterogeneous wireless sensor networks, School of Computer Science and Engineering, University of Electronic Science and Technology of China, Chengdu 610054, PR China 4. Brahim Elbhiri, Saadane Rachid , Sanaa El fkihi Developed Distributed Energy-Efficient Clustering (DDEEC) for heterogeneous wireless sensor networks 5. Ajay.K.Sharma,Department of Computer Science & Engineering Parul Saini, Department of Computer Science & Engineering E-DEEC- Enhanced Distributed Energy Efficient Clustering Scheme for Heterogeneous WSN 6. T. N. Qureshi, N. Javaid, M. Malik, U. Qasim‡, Z. A. Khan§, On Performance Evaluation of Variants of DEEC in WSNs 7. Q. Nadeem, N. Javaid, S. N. Mohammad, M. Y. Khan, S. Sarfraz, M. Gull On Performance Evaluation of Variants of DEEC in WSNs 8. Parul Saini, Ajay K Sharma Energy Efficient Scheme for Clustering Protocol Prolonging the Lifetime of Heterogeneous Wireless Sensor Networks 9. K. Dasgupta, K. Kalpakis, P. Namjoshi, An Efficient Clustering-Based Heuristic for Data Gathering and Aggregation in Sensor Networks, Proceedings of Wireless Communication and Networking (WCNC’03), 3: 1948-1953, 2003 Aeon LEACH Page 32 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 10. Habib M. Ammari, Sajal K. Das Scheduling protocols for homogeneous and heterogeneous k-covered wireless sensor networks 11. Neha Mehndiratta, Manju, Harish Bedi Energy Efficient Homogeneous vs Heterogeneous LEACH International Journal of Innovative Technology and Exploring Engineering (IJITEE) 12. R Saravanakumar, S. G. Susila, J. Raja Energy Efficient Homogeneous and Heterogeneous System for Wireless Sensor Networks International Journal of Computer Applications (0975-8887) 13. Femi A. Aderohunmu, Jeremiah D. Deng Department of Information Science, University of Otago, New Zealand An Enhanced Stable Election Protocol (SEP) for Clustered Heterogeneous WSN 14. Dilip Kumar, Trilok C. Aseri, R.B.Patel A Novel Multihop Energy Efficient Heterogeneous Clustered Scheme for Wireless Sensor Networks 15. Lalitesh Sehgal, Vishal Choudhary REEH: Residual Energy Efficient Heterogeneous Clustered Hierarchy Protocol for Wireless Sensor Networks 16. B. Krishnamachari, D. Estrin, S.B. Wicker, The Impact of Data Aggregation in Wireless Sensor Networks, Proceedings of 22nd International Conference on Distributed Computing Systems Workshops (ICDCSW’02), 575-578, 2002 17. V. Mhatre, C. Rosenberg, Homogeneous vs. Heterogeneous Clustered Sensor Networks: A Comparative Study, Proceedings of IEEE International Conference on Communications (ICC’04), 2004 18. V. Mhatre, C. Rosenberg, Homogeneous vs. Heterogeneous Clustered Sensor Networks: A Comparative Study, Proceedings of IEEE International Conference on Communications (ICC’04), 2004 Aeon LEACH Page 33 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Aeon LEACH Phase 1 MATLAB code: clear; xm=400; %diameters of sensor network ym=400; sink.x=200; %distance of base station from the network sink.y=200; n = 200; %no of nodes p=0.1; %probibilty of a node to become cluster head Eo=0.5; %energy supplied to each node ch=n/10; ETX=50*0.000000001; %transmiter energy per node ERX=50*0.000000001; %reciever energy per node Efs=10*0.000000000001; %amplification energy when d is less than d0 Emp=0.0013*0.000000000001; %amplification energy when d is greater than d0 Efs1=Efs/10; % amp energy just for intra cluster communication. Emp1=Emp/10; %Data Aggregation Energy EDA=5*0.000000001; a=Eo/2; rmax=1800; %no of rounds %temprature range tempi=50; tempf=200; %Thresholod for transmiting data to the cluster head h=100; %%%%%%Hard Thres%%%%hold H(t) s=2; %%%%%%Soft thres%%%%hold S(t) sv=0; %%%%%%previously Sensed value S(v) do=sqrt(Efs/Emp); %distance between cluster head and base station do1=sqrt(Efs1/Emp1); for i=1:1:n S(i).xd=rand(1,1)*xm; %it will distribute the nodes in x axis randomly. XR(i)=S(i).xd; %we store its value in xr S(i).yd=rand(1,1)*ym; %it will distribute the nodes in y axis randomly YR(i)=S(i).yd; %we store its value in yr S(i).G=0; % as the no of node that have been cluster head is zero 0 S(i).E=Eo %%*(1+rand*a); %? %ch.E=x; % initial energy of all cluster heads in network %initially there are no cluster heads only nodes S(i).type='N'; end Aeon LEACH Page 34 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 S(n+1).xd=sink.x; %assume that base station is also a node sp total no of nodes is n and with base station it is n+1 S(n+1).yd=sink.y; countCHs=0; %the number of Stateflow objects in the current context. cluster=1; %first cluster is selected flag_first_dead=0; flag_teenth_dead=0; flag_all_dead=0; dead=0; first_dead=0; teenth_dead=0; all_dead=0; allive=n; %counter for bit transmitted to Bases Station and to Cluster Heads packets_TO_BS=0; packets_TO_CH=0; for r=0:1:rmax cv = tempi + (tempf-tempi).*rand(1,1); %%%%%%Current sensing value C(v) if(mod(r, round(1/p) )==0) %remainder for i=1:1:n S(i).G=0; % it will assign to the nodes that have not been cluster head . %%S(i).cl=0; end end dead=0; for i=1:1:n if (S(i).E<=0) dead=dead+1; if (dead==1) if(flag_first_dead==0) first_dead=r; flag_first_dead=1; end end if(dead==0.1*n) if(flag_teenth_dead==0) Aeon LEACH Page 35 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 teenth_dead=r; flag_teenth_dead=1; end end if(dead==n) if(flag_all_dead==0) all_dead=r; flag_all_dead=1; end end end if S(i).E>0 S(i).type='N'; end end STATISTICS.DEAD(r+1)=dead; STATISTICS.ALLIVE(r+1)=allive-dead; countCHs=0; cluster=1; if S(i).type=='C' && S(i).E>a for j=1:1:ch countCHs=countCHs+1; S(i).type='C'; S(i).G=round(1/p)-1; C(cluster).xd=S(i).xd; C(cluster).yd=S(i).yd; distance=sqrt( (S(i).xd-(S(n+1).xd) )^2 + (S(i).yd-(S(n+1).yd) )^2 ); C(cluster).distance=distance; C(cluster).id=i; X(cluster)=S(i).xd; Y(cluster)=S(i).yd; cluster=cluster+1; distance; % if (cv >= h) %test = cv-sv; %if (test >= s) if (distance>do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Emp*4000*(distance*distance*distance*distance )); end Aeon LEACH Page 36 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 if (distance<=do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Efs*4000*(distance * distance )); end %end %packets_TO_BS=packets_TO_BS+1; %PACKETS_TO_BS(r+1)=packets_TO_BS; % packets_TO_CH=packets_TO_CH+1; end else for i=1:1:n if(S(i).E>0) temp_rand=rand; if ( (S(i).G)<=0) if(temp_rand<= (p/(1-p*mod(r,round(1/p))))) countCHs=countCHs+1; packets_TO_BS=packets_TO_BS+1; PACKETS_TO_BS(r+1)=packets_TO_BS; S(i).type='C'; S(i).G=round(1/p)-1; C(cluster).xd=S(i).xd; C(cluster).yd=S(i).yd; distance=sqrt( (S(i).xd-(S(n+1).xd) )^2 + (S(i).yd-(S(n+1).yd) )^2 ); C(cluster).distance=distance; C(cluster).id=i; X(cluster)=S(i).xd; Y(cluster)=S(i).yd; cluster=cluster+1; % if (cv >= h) %test = cv-sv; %if (test >= s) distance; if (distance>do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Emp*4000*(distance*distance*distance*distance )); end if (distance<=do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Efs*4000*(distance * distance )); end end Aeon LEACH Page 37 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 end % end % S(i).G=S(i).G-1; end end end STATISTICS.COUNTCHS(r+1)=countCHs; for i=1:1:n if ( S(i).type=='N' && S(i).E>0 ) if(cluster-1>=1) min_dis=Inf; min_dis_cluster=0; for c=1:1:cluster-1 temp=min(min_dis,sqrt( (S(i).xd-C(c).xd)^2 + (S(i).yd-C(c).yd)^2 ) ); if ( temp<min_dis ) min_dis=temp; min_dis_cluster=c; end end % if (cv >= h) %test = cv-sv; %if (test >= s) min_dis; if (min_dis>do1) S(i).E=S(i).E- ( ETX*(4000) + Emp1*4000*( min_dis *min_dis * min_dis * min_dis)); end if (min_dis<=do1) S(i).E=S(i).E- ( ETX*(4000) + Efs1*4000*( min_dis * min_dis)); end S(C(min_dis_cluster).id).E =S(C(min_dis_cluster).id).E- ( (ERX + EDA)*4000 ); packets_TO_CH=packets_TO_CH+1; %end %sv S(i).min_dis=min_dis; S(i).min_dis_cluster=min_dis_cluster; else min_dis=sqrt( (S(i).xd-S(n+1).xd)^2 + (S(i).yd-S(n+1).yd)^2 ); if (min_dis>do) Aeon LEACH Page 38 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 S(i).E=S(i).E- ( ETX*(4000) + Emp*4000*( min_dis *min_dis * min_dis * min_dis)); end if (min_dis<=do) S(i).E=S(i).E- ( ETX*(4000) + Efs*4000*( min_dis * min_dis)); end packets_TO_BS=packets_TO_BS+1; sv=cv; end end end STATISTICS.PACKETS_TO_CH(r+1)=packets_TO_CH; STATISTICS.PACKETS_TO_BS(r+1)=packets_TO_BS; end first_dead; teenth_dead; all_dead; STATISTICS.DEAD(r+1) STATISTICS.ALLIVE(r+1) STATISTICS.PACKETS_TO_CH(r+1) STATISTICS.PACKETS_TO_BS(r+1) STATISTICS.COUNTCHS(r+1) r=0:rmax; figure (1); plot(r/10,STATISTICS.DEAD); xlabel('Rounds'); ylabel('Dead Nodes'); title('Aeon LEACH'); figure (2); plot(r/10,STATISTICS.PACKETS_TO_BS); xlabel('Rounds'); ylabel('Packets to BS'); title('Aeon LEACH'); figure (3); plot(r/10,STATISTICS.COUNTCHS); xlabel('Rounds'); ylabel('Number of Cluster Heads'); title('Aeon LEACH'); figure (4); plot(r/10,STATISTICS.PACKETS_TO_CH); xlabel('Rounds'); Aeon LEACH Page 39 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 ylabel('Packets to CH') title('Aeon LEACH'); figure (5); plot(r/10,STATISTICS.ALLIVE); xlabel('Rounds'); ylabel('Allive nodes') title('Aeon LEACH'); %subplot(2,2,1); %plot(r,STATISTICS.DEAD); %xlabel('Rounds'); %ylabel('Dead Nodes '); %subplot(2,2,2); %plot(r,STATISTICS.PACKETS_TO_CH); %xlabel('Rounds'); %ylabel('Packets to CH'); %legend('Aeon LEACH ST'); %,'LEACH' %subplot(2,2,3); %plot(r,STATISTICS.PACKETS_TO_BS); %xlabel('Rounds'); %ylabel('Packets to BS'); %subplot(2,2,4); %plot(r,STATISTICS.COUNTCHS); %xlabel('Rounds'); %ylabel('Number of Cluster Heads'); %title('\bf LEACH');% Aeon LEACH Page 40 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Aeon LEACH Phase 2 MATLAB code: clear; %Field Dimensions - x and y maximum (in meters) xm=100; ym=100; %x and y Coordinates of the Sink sink.x=50; sink.y=50; %Number of Nodes in the field n=100; %Optimal Election Probability of a node %to become cluster head p=0.1; %Energy Model (all values in Joules) %Initial Energy Eo=0.5; %Eelec=Etx=Erx ETX=50*0.000000001; ERX=50*0.000000001; %Transmit Amplifiers types Efs=10*0.000000000001; Emp=0.0013*0.000000000001; %Data Aggregation Energy EDA=5*0.000000001; yd1=33; %Values for Hetereogeneity %Percentage of nodes than are advanced m=0.1; %\alpha times advance nodes have energy greater than normal nodes a=2; %maximum number of rounds rmax=1500; %Computation of do do=sqrt(Efs/Emp); Aeon LEACH Page 41 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 Et=0; %Creation of the random Sensor Network %figure(1); for i=1:1:n S(i).xd=rand(1,1)*xm; XR(i)=S(i).xd; S(i).yd=rand(1,1)*ym; YR(i)=S(i).yd; S(i).G=0; %initially there are no cluster heads only nodes S(i).type='N'; temp_rnd0=i; %Random Election of Normal Nodes if (temp_rnd0>=m*n+1) S(i).E=Eo; E(i)=S(i).E; S(i).ENERGY=0; % plot(S(i).xd,S(i).yd,'o'); % hold on; end %Random Election of Advanced Nodes if (temp_rnd0<m*n+1) S(i).E=Eo*(1+a); E(i)=S(i).E; S(i).ENERGY=1; % plot(S(i).xd,S(i).yd,'+'); % hold on; end Et=Et+S(i).E; end S(n+1).xd=sink.x; S(n+1).yd=sink.y; %plot(S(n+1).xd,S(n+1).yd,'x'); %First Iteration %figure(1); %counter for CHs countCHs=0; %counter for CHs per round Aeon LEACH Page 42 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 rcountCHs=0; cluster=1; countCHs; rcountCHs=rcountCHs+countCHs; flag_first_dead=0; allive=n; packets_TO_BS=0; packets_TO_CH=0; for r=0:1:rmax r %Election Probability for Normal Nodes pnrm=( p/ (1+a*m) ); %Election Probability for Advanced Nodes padv= ( p*(1+a)/(1+a*m) ); %Operation for heterogeneous epoch if(mod(r, round(1/pnrm) )==0) for i=1:1:n S(i).G=0; S(i).cl=0; end end %Operations for sub-epochs if(mod(r, round(1/padv) )==0) for i=1:1:n if(S(i).ENERGY==1) S(i).G=0; S(i).cl=0; end end end %hold off; %Number of dead nodes dead=0; Aeon LEACH Page 43 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 %Number of dead Advanced Nodes dead_a=0; %Number of dead Normal Nodes dead_n=0; %figure(1); for i=1:1:n %checking if there is a dead node if (S(i).E<=0) %plot(S(i).xd,S(i).yd,'red .'); dead=dead+1; if(S(i).ENERGY==1) dead_a=dead_a+1; end if(S(i).ENERGY==0) dead_n=dead_n+1; end %hold on; end if S(i).E>0 S(i).type='N'; if (S(i).ENERGY==0) %plot(S(i).xd,S(i).yd,'o'); end if (S(i).ENERGY==1) %plot(S(i).xd,S(i).yd,'+'); end %hold on; end STATISTICS.DEAD(r+1)=dead; STATISTICS.ALLIVE(r+1)=allive-dead; end %plot(S(n+1).xd,S(n+1).yd,'x'); %When the first node dies if (dead==1) if(flag_first_dead==0) first_dead=r Aeon LEACH Page 44 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 flag_first_dead=1; end end countCHs=0; cluster=1; for i=1:1:n if(S(i).E>0) temp_rand=rand; if ( (S(i).G)<=0) %Election of Cluster Heads for normal nodes if( ( S(i).ENERGY==0 && ( temp_rand <= ( pnrm / ( 1 - pnrm * mod(r,round(1/pnrm)) )) ) ) ) countCHs=countCHs+1; packets_TO_BS=packets_TO_BS+1; PACKETS_TO_BS(r+1)=packets_TO_BS; S(i).type='C'; S(i).G=100; C(cluster).xd=S(i).xd; C(cluster).yd=S(i).yd; %plot(S(i).xd,S(i).yd,'k*'); distance=sqrt( (S(i).xd-(S(n+1).xd) )^2 + (S(i).yd-(S(n+1).yd) )^2 ); C(cluster).distance=distance; C(cluster).id=i; X(cluster)=S(i).xd; Y(cluster)=S(i).yd; cluster=cluster+1; %Calculation of Energy dissipated distance; if (distance>do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Emp*4000*( distance*distance*distance*distance )); end if (distance<=do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Efs*4000*( distance * distance )); end end Aeon LEACH Page 45 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 %Election of Cluster Heads for Advanced nodes if( ( S(i).ENERGY==1 && ( temp_rand <= ( padv / ( 1 - padv * mod(r,round(1/padv)) )) ) ) ) countCHs=countCHs+1; packets_TO_BS=packets_TO_BS+1; %PACKETS_TO_BS(r+1)=packets_TO_BS; S(i).type='C'; S(i).G=100; C(cluster).xd=S(i).xd; C(cluster).yd=S(i).yd; %plot(S(i).xd,S(i).yd,'k*'); distance=sqrt( (S(i).xd-(S(n+1).xd) )^2 + (S(i).yd-(S(n+1).yd) )^2 ); C(cluster).distance=distance; C(cluster).id=i; X(cluster)=S(i).xd; Y(cluster)=S(i).yd; cluster=cluster+1; %Calculation of Energy dissipated distance; if (distance>do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Emp*4000*( distance*distance*distance*distance )); end if (distance<=do) S(i).E=S(i).E- ( (ETX+EDA)*(4000) + Efs*4000*( distance * distance )); end end end end end packets_TO_BS=packets_TO_BS+1; STATISTICS.packets_TO_BS(r+1)=packets_TO_BS; Aeon LEACH Page 46 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 %Election of Associated Cluster Head for Normal Nodes for i=1:1:n if ( S(i).type=='N' && S(i).E>0 ) if(cluster-1>=1) min_dis=sqrt( (S(i).xd-S(n+1).xd)^2 + (S(i).yd-S(n+1).yd)^2 ); min_dis_cluster=1; for c=1:1:cluster-1 temp=min(min_dis,sqrt( (S(i).xd-C(c).xd)^2 + (S(i).yd-C(c).yd)^2 ) ); if ( temp<min_dis ) min_dis=temp; min_dis_cluster=c; end end %Energy dissipated by associated Cluster Head min_dis; if (min_dis>do) S(i).E=S(i).E- ( ETX*(4000) + Emp*4000*( min_dis * min_dis * min_dis * min_dis)); end if (min_dis<=do) S(i).E=S(i).E- ( ETX*(4000) + Efs*4000*( min_dis * min_dis)); end %Energy dissipated if(min_dis>0) S(C(min_dis_cluster).id).E = S(C(min_dis_cluster).id).E- ( (ERX + EDA)*4000 ); PACKETS_TO_CH(r+1)=n-dead-cluster+1; end S(i).min_dis=min_dis; S(i).min_dis_cluster=min_dis_cluster; end end end %hold on; countCHs; rcountCHs=rcountCHs+countCHs; end Aeon LEACH Page 47 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 %figure(1); for i=1:1:n if (i<=5) S2(i).xd=rand(1,1)*xm; S2(i).yd=rand(1,1)*yd1; S2(i).E=Eo*(1+a); S2(i).ENERGY=1; S2(i).type='A'; %plot(S2(i).xd,S2(i).yd,'og'); %hold on end if (i>10 && i<=100) S2(i).xd=rand(1,1)*xm; S2(i).yd=33+rand(1,1)*yd1; S2(i).E=Eo; S2(i).ENERGY=0; S2(i).type='N'; %plot(S2(i).xd,S2(i).yd,'ob'); %hold on end if(i<=10 && i>5) S2(i).xd=rand(1,1)*xm; S2(i).yd=66+rand(1,1)*yd1; S2(i).E=Eo*(1+a); S2(i).ENERGY=1; S2(i).type='A'; %plot(S2(i).xd,S2(i).yd,'og'); %hold on end end S2(n+1).xd=sink.x; S2(n+1).yd=sink.y; %%plot(S2(n+1).xd,S2(n+1).yd,'green x'); %figure(1); flag_first_dead2=0; allive2=n; %counter for bit transmitted to Bases Station and to Cluster Heads packets_TO_BS12=0; Aeon LEACH Page 48 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 packets_TO_BS22=0; packets_TO_BS2=0; packets_TO_CH2=0; for r=0:1:rmax r %Election Probability for Advanced Nodes padv= ( p*(1+a)/(1+(a*m)) ); %Operations for sub-epochs if(mod(r, round(1/padv) )==0) for i=1:1:n if(S2(i).ENERGY==1) S2(i).G=0; %S2(i).cl=0; end end end %hold off; %figure(1); dead2=0; %Number of dead Advanced Nodes dead_a2=0; %Number of dead Normal Nodes dead_n2=0; for i=1:1:n %checking if there is a dead node if (S2(i).E<=0) %%plot(S2(i).xd,S2(i).yd,'red .'); dead2=dead2+1; if(S2(i).ENERGY==1) dead_a2=dead_a2+1; end if(S2(i).ENERGY==0) dead_n2=dead_n2+1; Aeon LEACH Page 49 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 end %hold on; end if (S2(i).E>0) S2(i).type='N'; if (S2(i).ENERGY==0) %plot(S2(i).xd,S2(i).yd,'ob'); end if (S2(i).ENERGY==1) %plot(S2(i).xd,S2(i).yd,'og'); end %hold on; end %plot(S2(n+1).xd,S2(n+1).yd,'green x'); STATISTICS.DEAD2(r+1)=dead2; STATISTICS.ALLIVE2(r+1)=allive2-dead2; end %When the first node dies if (dead2==1) if(flag_first_dead2==0) first_dead2=r flag_first_dead2=1; end end for(i=1:1:n) if(S2(i).E>=0) if(S2(i).type=='N') distance=sqrt( (S2(i).xd-(S2(n+1).xd) )^2 + (S2(i).yd-(S2(n+1).yd) )^2 ); if (distance>do) S2(i).E=S2(i).E- ( (ETX+EDA)*(4000) + Emp*4000*( distance*distance*distance*distance )); end if (distance<=do) S2(i).E=S2(i).E- ( (ETX+EDA)*(4000) + Efs*4000*( distance * distance )); end packets_TO_BS12=packets_TO_BS12+1; end end end Aeon LEACH Page 50 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 countCHs2=0; cluster2=1; for i=1:1:n if(S2(i).E>=0) if(S2(i).G<=0) if(S2(i).type=='A') temp_rand=rand; if( ( S2(i).ENERGY==1 && ( temp_rand <= ( padv / ( 1 - padv * mod(r,round(1/padv)) )) ) ) ) countCHs2=countCHs2+1; packets_TO_BS22=packets_TO_BS22+1; S2(i).type='C'; S2(i).G=(1/padv)-1; C(cluster2).xd=S2(i).xd; C(cluster2).yd=S2(i).yd; %plot(S2(i).xd,S2(i).yd,'k*'); distance=sqrt( (S2(i).xd-(S2(n+1).xd) )^2 + (S2(i).yd-(S2(n+1).yd) )^2 ); C(cluster2).distance=distance; C(cluster2).id=i; X(cluster2)=S2(i).xd; Y(cluster2)=S2(i).yd; cluster2=cluster2+1; % Calculation of Energy dissipated distance; if (distance>do) S2(i).E=S2(i).E- ( (ETX+EDA)*(4000) + Emp*4000*( distance*distance*distance*distance )); end if (distance<=do) S2(i).E=S2(i).E- ( (ETX+EDA)*(4000) + Efs*4000*( distance * distance )); end end Aeon LEACH Page 51 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 end end for i=1:1:n if ( S2(i).type=='A' && S2(i).E>0 ) if(cluster2-1>=1) min_dis=inf; min_dis_clustera=1; for c=1:1:cluster2-1 temp=min(min_dis,sqrt( (S2(i).xd-C(c).xd)^2 + (S2(i).yd-C(c).yd)^2 ) ); if ( temp<min_dis ) min_dis=temp; min_dis_cluster2=c; end end %Energy dissipated by Cluster menmber for transmission of packet % min_dis; if (min_dis>do) S2(i).E=S2(i).E- ( ETX*(4000) + Emp*4000*( min_dis * min_dis * min_dis * min_dis)); end if (min_dis<=do) S2(i).E=S2(i).E- ( ETX*(4000) + Efs*4000*( min_dis * min_dis)); end %Energy dissipated by clustre head in receving if(min_dis>0) S2(C(min_dis_cluster2).id).E = S2(C(min_dis_cluster2).id).E- ( (ERX + EDA)*4000 ); PACKETS_TO_CH(r+1)=n-dead-cluster2+1; end S2(i).min_dis=min_dis; S2(i).min_dis_cluster2=min_dis_cluster2; end end end end Aeon LEACH Page 52 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 CLUSTERHS(r+1)=cluster2+1; STATISTICS.CLUSTERHEADS2(r+1)=cluster2+1; end packets_TO_BS2=packets_TO_BS12+packets_TO_BS22; STATISTICS.PACKETS_TO_BS2(r+1)=packets_TO_BS2; end for i=1:1:n S3(i).xd=rand(1,1)*xm; XR(i)=S3(i).xd; S3(i).yd=rand(1,1)*ym; YR(i)=S3(i).yd; S3(i).G=0; %initially there are no cluster heads only nodes S3(i).type='N'; temp_rnd0=i; %Random Election of Normal Nodes if (temp_rnd0>=m*n+1) S3(i).E=Eo; S3(i).ENERGY=0; %plot(S3(i).xd,S3(i).yd,'o'); %hold on; end %Random Election of Advanced Nodes if (temp_rnd0<m*n+1) S3(i).E=Eo*(1+a) S3(i).ENERGY=1; %plot(S3(i).xd,S3(i).yd,'+'); %hold on; end end S3(n+1).xd=sink.x; S3(n+1).yd=sink.y; %plot(S3(n+1).xd,S3(n+1).yd,'x'); Aeon LEACH Page 53 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 %First Iteration %figure(1); %counter for CHs countCHs3=0; %counter for CHs per round rcountCHs3=0; cluster3=1; countCHs3; rcountCHs3=rcountCHs3+countCHs3; flag_first_dead3=0; allive3=n; packets_TO_BS3=0; packets_TO_CH3=0; for r=0:1:rmax r %Operation for epoch if(mod(r, round(1/p) )==0) for i=1:1:n S3(i).G=0; S3(i).cl=0; end end %hold off; %Number of dead nodes dead3=0; %Number of dead3 Advanced Nodes dead_a3=0; %Number of dead Normal Nodes dead_n3=0; %figure(1); for i=1:1:n %checking if there is a dead node if (S3(i).E<=0) %plot(S3(i).xd,S3(i).yd,'red .'); dead3=dead3+1; Aeon LEACH Page 54 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 if(S3(i).ENERGY==1) dead_a3=dead_a3+1; end if(S3(i).ENERGY==0) dead_n3=dead_n3+1; end %hold on; end if S3(i).E>0 S3(i).type='N'; if (S3(i).ENERGY==0) %plot(S3(i).xd,S3(i).yd,'o'); end if (S3(i).ENERGY==1) %plot(S3(i).xd,S3(i).yd,'+'); end %hold on; end STATISTICS.DEAD3(r+1)=dead3; STATISTICS.ALLIVE3(r+1)=allive3-dead3; end %plot(S(n+1).xd,S(n+1).yd,'x'); %When the first node dies if (dead3==1) if(flag_first_dead3==0) first_dead3=r flag_first_dead3=1; end end countCHs3=0; cluster3=1; for i=1:1:n if(S3(i).E>0) temp_rand=rand; if ( (S3(i).G)<=0) %Election of cluster3 Heads if(temp_rand<= (p/(1-p*mod(r,round(1/p))))) countCHs3=countCHs3+1; Aeon LEACH Page 55 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 packets_TO_BS3=packets_TO_BS3+2; % PACKETS_TO_BS3(r+1)=packets_TO_BS3; S3(i).type='C'; S3(i).G=round(1/p)-1; C(cluster3).xd=S3(i).xd; C(cluster3).yd=S3(i).yd; %plot(S3(i).xd,S3(i).yd,'k*'); distance=sqrt( (S3(i).xd-(S3(n+1).xd) )^2 + (S3(i).yd-(S3(n+1).yd) )^2 ); C(cluster3).distance=distance; C(cluster3).id=i; X(cluster3)=S3(i).xd; Y(cluster3)=S3(i).yd; cluster3=cluster3+1; %Calculation of Energy dissipated distance; if (distance>do) S3(i).E=S3(i).E- ( (ETX+EDA)*(4000) + Emp*4000*( distance*distance*distance*distance )); end if (distance<=do) S3(i).E=S3(i).E- ( (ETX+EDA)*(4000) + Efs*4000*( distance * distance )); end end end end end STATISTICS.CLUSTERHEADS3(r+1)=cluster3-1; CLUSTERHS(r+1)=cluster3-1; %Election of Associated Cluster Head for Normal Nodes for i=1:1:n if ( S3(i).type=='N' && S3(i).E>0 ) if(cluster3-1>=1) min_dis=sqrt( (S3(i).xd-S3(n+1).xd)^2 + (S3(i).yd-S3(n+1).yd)^2 ); min_dis_cluster=1; for c=1:1:cluster3-1 temp=min(min_dis,sqrt( (S3(i).xd-C(c).xd)^2 + (S3(i).yd-C(c).yd)^2 ) ); Aeon LEACH Page 56 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 if ( temp<min_dis ) min_dis=temp; min_dis_cluster=c; end end %Energy dissipated by associated Cluster Head min_dis; if (min_dis>do) S3(i).E=S3(i).E- ( ETX*(4000) + Emp*4000*( min_dis * min_dis * min_dis * min_dis)); end if (min_dis<=do) S3(i).E=S3(i).E- ( ETX*(4000) + Efs*4000*( min_dis * min_dis)); end %Energy dissipated if(min_dis>0) S3(C(min_dis_cluster).id).E = S3(C(min_dis_cluster).id).E- ( (ERX + EDA)*4000 ); PACKETS_TO_CH3(r+1)=n-dead3-cluster3+1; end S3(i).min_dis=min_dis; S3(i).min_dis_cluster=min_dis_cluster; end end end %hold on; packets_TO_BS3=packets_TO_BS3+1; STATISTICS.packets_TO_BS3(r+1)=packets_TO_BS3; countCHs3; rcountCHs3=rcountCHs3+countCHs3; end figure(2); r=0:rmax; plot(r,STATISTICS.ALLIVE3(r+1),'-b',r,STATISTICS.ALLIVE2(r+1),'-g') legend('LEACH m=0.1,a=2','Aeon Leach 2 m=0.1,a=2'); xlabel('Rounds'); ylabel('Allive Nodes'); Aeon LEACH Page 57 Vidhi Nagri | Dept. of Electrical Engineering |California State University, Long Beach | Summer 2014 figure(3); plot(r,STATISTICS.DEAD3(r+1),'-b',r,STATISTICS.DEAD2(r+1),'-g') legend('LEACH m=0.1,a=2','Aeon Leach 2 m=0.1,a=2'); xlabel('Rounds'); ylabel('Dead Nodes'); figure(4); plot(r,STATISTICS.packets_TO_BS(r+1),r,STATISTICS.PACKETS_TO_BS2(r+1),'-g') legend('LEACH m=0.2,a=1','Aeon Leach 2 m=0.2,a=1'); xlabel('Rounds'); ylabel('Packets to BS'); Aeon LEACH Page 58