OPTIMIZATION OF THE LEACH ALGORITHM IN THE SELECTION OF CLUSTER HEADS BASED ON RESIDUAL ENERGY IN WIRELESS SENSOR NETWORKS

This research has a research object, namely the optimization of the LEACH (Low-Energy Adaptive Clustering Hierarchy) algorithm in the context of wireless sensor networks. The problem in this research is the imbalance in energy consumption across clusters, which has an impact on battery life and affects network performance. Other problems include selecting a cluster head that is not focused so that it is difficult to balance network performance as well as computational limitations that require optimization. The results obtained from this research are in the form of optimizing the leaching algorithm by modifying the clustering-based leaching algorithm that will be used in wireless sensor networks. In carrying out modifications, this research uses several stages in the process of selecting sensor nodes that will become members who function as cluster heads in a cluster that will be used in a wireless sensor network. In the LEACH (Low-Energy Adaptive Clustering Hierarchy) algorithm the cluster head will be selected based on the modified probability value. Modifying the algorithm by considering two factors, namely distance and remaining energy used in the Cluster Head selection process on the network and increasing network usage time must be based on the energy consumption used and then compared with the remaining energy. When modifying the LEACH (Low-Energy Adaptive Clustering Hierarchy) algorithm, it is necessary to pay attention to the distance factor between the nodes on a sensor and the selected cluster so that it can result in increased network performance. Network lifetime is indicated by the average death time of the first Node in the network. This research is novel in producing a modified leaching algorithm by improving network performance and extending battery life so that it can be used for wireless sensor networks in the context of natural disaster mitigation


Introduction
The increasing development of internet of things (IOT) technology in various applications means that devices are always connected to internet media, in the process IoT changes physical devices into shortcut devices that provide intelligent services [1][2][3].The IoT application framework generally consists of various layers such as the perceptual layer, network side layer, data processing layer, and application side which are integrated with each other [4,5].In its development, IoT technology requires a wireless sensor network which is used to carry out observation processes over large areas using small computer devices.WSN technology with many sensor Nodes uses wireless communication methods [6,7].Wireless sensor networks integrate communication and data processing technologies using sensor Nodes to collect data and collect information around the sensor range.WSN can carry out monitoring directly and has advantages including speed, low power requirements and the ability to limit interference that has a large strength.The wider reach of WSNs is influenced by strong data acquisition and processing capabilities [8].WSN can detect the surrounding environment such as earthquakes, humidity, light intensity, pressure, speed and electromagnetism [9].Routing algorithms that are often found on the Sensor Network side with Wireless technology will be used to optimize energy consumption.In optimizing energy consumption there are processes from Nodes with BTS to routing that can increase energy efficiency on data transmission communication lines.The routing process is also needed because of the large amount of energy at each Node and the bandwidth for communication on the wireless network [10,11].In routing protocols, there are three approaches that are often used in wireless sensor networks, namely chain-based, clustering, and tree-based approaches [12,13].The routing algorithm that will be used in WSN technology is the cluster-based LEACH algorithm.In this algorithm, Node selection aims to determine the cluster head which will be based on collecting data obtained from Node members so that the communication process can be carried out by the cluster head [14].In this research there is an urgency such as the large number of sensor nodes that are battery operated so that when the battery power is almost empty it becomes a challenge to recharge the battery so it is necessary to design a route with the aim of saving the energy that will be used in limited amount of energy in WSN.In the context of routing, there are two architectures in WSN such as flat architecture and hierarchical architecture.In a flat architecture, it will respond to excess data provided that the density at the Nodes increases, resulting in an incomplete distribution of energy so that in a hierarchical architecture its use increases.Previous research conducted by [15] will implement a cluster head by utilizing the LEACH algorithm for the remaining Node energy parameters which results in an increase in energy consumption of 15 %, another research conducted by [16] will increase network uptime by implementing Cross-layer Energy based Clustering (CEC) which produces CEC in better processing time on energy consumption and number of packets based on research related to the LEACH algorithm to be applied.
Therefore, studies that are devoted modification of algorithms on cluster selection are scientific relevance because the results of such studies will improve network performance and extend battery life for use in wireless sensor networks in the context of mitigating natural disasters.

Literature review and problem statement
In research [17] it is determined flight routes and schedules using a Simulated Annealing (SA) based heuristic algorithm combined with mixed integer mathematics for routing and scheduling in the aviation industry which will consider the proposed variable data.The complexity of this problem is determining the next route when passengers change planes to the next destination and there is a problem of uncertainty so that analysis and use of mixed integer mathematics can overcome this problem.However, this research has weaknesses in terms of complicated calculations, especially when discrete form variables are processed into the model which makes optimal solutions difficult to achieve.
In research [18] it is introduced the energy-efficient LEACH (EE-LEACH) protocol for data collection.This helps provide a better package delivery ratio with less energy usage.But it may suffer from security attacks because they only focus on reducing energy consumption and ignore data confidentiality and integrity.
In research [19] it is presented a centralized routing protocol called Base-station controlled dynamic clustering protocol (BCDCP), which distributes energy dissipation evenly among all sensor Nodes to save average energy and increase network lifetime.However, the design idea and process of the BCDCP algorithm are not given in detail.Taking into account the advantages of channel resources and using the uneven clustering method, This study proposes a modified cluster-head selection algorithm based on LEACH-LEACH-M.
In research [20] it is implemented a WSN network to monitor services in the environment, health, agriculture and disaster mitigation.This research applies an energy efficient algorithm by utilizing a dynamic canopy and a combination of the K-Means clustering algorithm.The results of this research provide a more effective and efficient network ser-vice life.The weakness of this research is that it is based on clustering which allows for irregular residual energy so that it requires implementation and optimization of the leach algorithm.
In research [21] it is applied the leach algorithm in routing with a typical concept to reduce energy consumption in transmission.This research uses a probing model to search for nodes randomly so that the required cluster head can be selected.This research combines using fuzzy to form Fuzzy-LEACH which produces sensitivity at each node to location dynamically.However, Fuzzy-LEACH has a weakness for irregular node movements so it is necessary to use optimization of the LEACH algorithm.
In research [22] it is optimized the lifetime of the sensor network (WSN) by saving energy in the data transmission process.This research selects the cluster head for each WSN sensor by proposing a solution where particle optimization (HPSO) is combined with the LEACH algorithm so that the distance between nodes and cluster members becomes more optimal.However, this research has weaknesses in the synchronization of HPSO particles so that further development is needed.
In research [23] it is explained that wireless sensor networks (WSN) have been used for various applications, especially on the environmental side, such as monitoring water quality.The problem that occurs is that WSN often experiences a lack of energy in devices for operating resources, which affects performance.To overcome this problem, use the LEACH algorithm with a combination of the K-means algorithm to determine the performance and quality of decision making in determining water quality.Grouping with the K-means algorithm can help analyze water quality.However, this research has shortcomings in the use of data because the k-means algorithm is very influenced by the quality of the data in grouping so that cluster head selection is more optimal.
In research [24] it is applied a wireless sensor network (WSN) to many applications that require sensors.In the WSN process, nodes are grouped based on the WSN needs of each cluster, then each cluster head will collect data obtained from sensor nodes and synchronize the submerged distance for decision making using an optimization algorithm so that the cluster head can be optimized so that parameter values must be optimized to determine network age and network stability.
In this research single and multi-clusters will be proposed so that it can show the effectiveness of the algorithm.This lack of research often results in failure in determining single and multi-clusters so that further development needs to be carried out.

The aim and the objectives of the study
The aim of this study is to present the results of modifying the LEACH algorithm to improve the performance of WSN networks by optimizing the LEACH algorithm for the process of selecting Cluster Heads based on remaining energy.This research will result in efficient use of energy and produce a longer network life.
To achieve the following objectives were set: -determine parameter values and approaches in modifying the LEACH algorithm; -determine the age of the network; -determine network stability.
algorithm design.This research provides better network efficiency results, increased network performance and better management of operational costs.In the process, the determination of nodes to become CHs is carried out alternately based on time, where there is one session which is interpreted as one round.During the initial stages of setting up a wireless sensor network, a new round is started, and each Node in the network selects a random number and then compares the threshold values used in that round.Which is calculated as a probability function used in LEACH, which is taken into consideration to determine the Node to be CH during the round.In this research there are detailed limitations and assumptions contained in the basic framework, such as this research limiting the number of sensor nodes to evaluate algorithm performance and then limiting the network that will be used to focus on certain conditions.The assumption related to this research is energy power consumption.In this model, if data is directly sent to two nodes that are only separated by distance, it will produce energy that immediately expands and can then be interpreted in (1): In equation ( 1), (2) there will be the symbol en_ Thx which will display the energy consumed by each packet at each Node to be sent and received, while the symbols en_ Thx_ elc and en_ Thx_ amf will be used as a parameter in carrying out network optimization.Then the energy that will be used by the sensor Node in receiving will be represented by equations (1), (2).Each bit Node will consist of data bits which contain important information such as information on the use of coding in transferring data source and destination addresses to be encrypted for security purposes.Then, in measuring the distance between Nodes, let's use an equation with the mathematical formula in equation (3).Then in equation (4) it is possible to measure the distance between normal and CH Nodes: .
The equations in (3), (4) have symbols A dst (b) which shows the distance between Nodes with the normal number of Nodes which will then be given in equation 5 after that value A dst (a) must be in that value range.0 and 1 are symbolized as BS: ( )

Materials and methods
In this research, there will be a research object, namely the LEACH (Low-Energy Adaptive Clustering Hierarchy) algorithm in the context of wireless sensor networks.The hypothesis in this research is to test the impact of leach algorithm optimization in terms of selecting cluster heads based on remaining energy which will result in a balance of energy consumption and increased network sensor performance.This hypothesis will produce a balanced distribution of energy.The problem in this research is that many sensor Nodes are battery operated so that when the battery is almost empty it becomes a challenge to recharge the battery so routes need to be designed with the aim of saving the energy that will be used.limited amount of energy in WSN.This research will use hardware such as a laptop with Windows 10 specifications with a Core i5 processor and software such as Microsoft Word and the use of NS2.This research will be designed according to Fig. 1 which consists of the implementation stages of the LEACH algorithm which will be a solution in resolving problems related to network age and network stability as well as excessive energy consumption in the LEACH algorithm.Then the NS2 Simulator is used to analyze and test the algorithm that has been created.The results that will be obtained are based on simulation analysis carried out to see network age, network stability, residual energy.The following architecture is in Fig. 1 which will explain the stages of determining the cluster head based on residual energy.In Fig. 1 there are stages of the LEACH algorithm which are then modified at the cluster selection stage using the distance and amount of remaining energy.Fig. 1 will explain that the energy model that can be used in optimizing the LEACH algorithm uses a radio model.In the process, the modification of the LEACH algorithm will consider the remaining energy in LEACH so that it can optimize the cluster threshold so that it can create a relatively good cluster process and save energy.In today's modern conditions, efficient energy consumption in WSN networks is very necessary to integrate the latest innovations with the LEACH  In the process of sending data there will be a delay process which can affect the delay in sending data by each Node according to equation (5).In this process the delay occurs in the range 0 and 1 so each feature can be reduced.The total duration of the delay by reducing the number of Nodes in each WSN feature.In the CH and WSN equations it will be represented by the total Nodes symbolized by M which is found in equation ( 6): ( ) .
Based on the equation that has been explained, it will be concluded that a node that has a lot of remaining energy will have a good network address that will have a threshold value for its cluster head.The equation notation used in the model being built is in Table 1 below.Energy spent to transmit l bits (d, mts) The order of cluster heads in energy consumption en Thx_elc Energy spent on each cluster move en Thx_amf Energy spent on the new cluster en elc Energy spent to transmit or receive one bit en fsp Amplification factor for the cluster head model

1. Modify the LEACH algorithm for network performance
This research produces performance in applying the LEACH modification algorithm to cluster head selection so that it can improve overall performance in the network.In its application, a number of parameters are adjusted by selecting the cluster head according to needs.In this case, a scenario simulation will be carried out to see the results of the LEACH algorithm modification.In the first scenario there will be 60, 80, 100 nodes in an area of 100×100m 2 which will be shown in Fig. 2-4 for the number of nodes which will result in network longevity and network stability.Following are the distribution results from Nodes 60, 80 and 100.In Fig. 2-4 there is a distribution of 60, 80 and 100 sensor Nodes in an area that has been determined by distribu-tion in random positions with the position of the base station at position 50 vertically and horizontally at position 50 which will then produce life network time and network stability which will be discussed below.

2. Network life time
Life-time or what is defined as the lifetime of the network, is a time interval from the start of communication until the condition of the last member Node is dead.This research resulted in a better modification of the LEACH algorithm as evidenced in Fig. 5-7, which are shown in round 100.In the 60 Node scenario, the result was 58 % with a number of 34 Nodes still alive, while the unmodified Leach algorithm resulted in the number of Nodes 15 are still alive in scenario 80 it produces 65 % with 52 Nodes still alive, while the unmodified leach algorithm produces 19 Nodes still alive.In the 100 Node scenario it produces 75 % with a number of 75 Nodes that are still alive, while the leach algorithm that has not been modified produces a number of Nodes that are 27 that are still alive.Thus, the Node that is the cluster head uses more energy to transmit data.The LEACH algorithm still has shortcomings compared to the modified LEACH algorithm because at the end of the simulation more Nodes die.This can be caused by the cluster head constantly changing and cluster members being sometimes far apart, thus requiring greater energy.The following are the network life time results in Fig. 5-7.
In Fig. 5-7 there is a scenario for each modification of the LEACH algorithm which produces a total representation for the modified LEACH algorithm which produces 162 nodes that are still alive, while for the unmodified LEACH algorithm it produces 61 nodes that are still alive.From these results for the life time side, it can be concluded that the modification of the LEACH algorithm is very effective for the life time side.

3. Network stability
Network stability can be interpreted as the time it takes for the first Dead Node (FDN) condition to occur until half of the total number of simulated Node members die.This research will use 3 scenarios in Fig. 8-10 with the number of nodes in each scenario.The number of important nodes is determined in each scenario to be able to interpret each cluster in selecting the cluster head.The following are the network stability results in Fig. 8-10.
In the first scenario in Fig. 8 with a total of 60 nodes, it produces network stability with member nodes in the WSN in the first dead condition in the modification algorithm occurring in the 20 th round and half of the dead nodes (HDN) occurring in the 79 th round, while the member nodes are in this condition.The first death in the LEACH protocol occurred in the 12 th round and some of the nodes died (HDN) in round 62.In the second scenario in Fig. 9 with a total of 80 nodes, it resulted in round 40 and some of the dead nodes (HDN) occurred in round 88 while the Node members were in a condition The first death in the LEACH protocol occurred in round 16 and some nodes died (HDN) in round 68.In scenario 3 in Fig. 10 with a total of 100 nodes, round 60 occurred and some dead nodes (HDN) occurred in round 98 while members of the first node in the dead condition in the LEACH protocol occurred in round 25 and the partial dead node (HDN) in round 78.

Discussion of leach algorithm optimization results
The result of this research is a modification of the clustering-based LEACH algorithm which will be used for wireless sensor networks.In modifying this research, several stages were used for the process of selecting sensor nodes that will become members who function as Cluster Heads in a cluster that will be used in a wireless sensor network.This modification will result in Network Stability and Life time.In the life time section there will be a scenario shown in Fig. 5-7 which produces a total representation for the modified LEACH algorithm producing 162 nodes that are still alive, while for the unmodified LEACH algorithm it produces 61 nodes that are still alive.From these results for the life time side, it can be concluded that the modification of the LEACH algorithm is very effective for the life time side, while in the Network Stability section there is a scenario in Fig. 8-10 which results in network stability at each node in the WSN with a total of 100 nodes, where the second round occurs.-60 and several dead nodes (HDN) occurred in the 98 th round while the first member node in the dead condition in the LEACH protocol occurred in the 25 th round and the partially dead node (HDN) in the 78 th round.
In the LEACH algorithm, CH will be selected based on the modified probability value, which is different from previous research conducted [25,26].Modification of the algorithm in this research takes into account two factors, namely distance and remaining energy used in the Cluster Head selection process in the network.The modified LEACH algorithm was tested with a simulator to obtain increased network lifetime values and network stability.The LEACH algorithm selects a node as a cluster head then collects information in the form of data from all nodes which can then communicate the scope of the cluster head.The cluster head that determines the variable used is the distance between nodes with the criterion that if the distance of the cluster head is close to the sink then it will be the Node member's choice.
The limitations of this research are the complexity of the algorithm which requires better computing and resource use and modification of the algorithm can cause communication overhead between nodes which causes an increase in energy resources and modification of the LEACH algorithm must be adapted to the environment that requires it due to the large resource factor while for weaknesses In this research, energy is a consideration in dealing with multiple cluster head and stray node problems, even though in several existing WSN routing algorithms if the energy factor is taken into account it will result in an increase in the age of a network.So to be able to overcome this, further analysis of the modification of the LEACH algorithm in the Cluster Head selection method is needed by considering distance, energy awareness, and selecting the best Cluster Head in terms of remaining energy.Distribution of sensor node members can be done using Gaussian distribution or Poison distribution.The condition of static sensor nodes can be tested and analyzed the condition of moving sensor nodes or moving sensors.

Conclusions
1.The increase in network usage time must be based on the energy consumption used and then compared with the remaining energy.Based on the modification of the LEACH algorithm, there is residual energy selected by Non-CH members at a sensor node.In modifying the LEACH algorithm, it is necessary to pay attention to the distance factor between the node on a sensor and the selected cluster so that it can result in increased network performance.
2. Network lifetime is shown by the average death time of the first FND Node in the network which increased by 779 minutes compared to without the algorithm.This research can be developed by distributing sensor node members using a Gaussian distribution or Poison distribution.The condition of static sensor nodes can be tested and analyzed the condition of moving sensor nodes or moving sensors.
3. Network stability shows increased energy efficiency and has the advantage of reducing the risk of failure due to lack or running out of power and can improve network performance in managing clusters.

Conflict of interest
The authors declare that they have no conflict of interest in relation to this research, whether financial, personal, authorship or otherwise, that could affect the research and its results presented in this paper.

Financing
The study was performed without financial support.

Fig. 1 .
Fig. 1.Proposed architecture en amf Parameters for computes L-bit messages transmitted over free space multipath propagation A dst (a) Energy required for sending and receiving the data bi The function of the algorithm is to determine the cluster head CH y Energy consumption cluster head function B x The unit of measurement for the simulation BS Base station Then from this equation a pseudo code modification algorithm from LEACH is produced as follows: Pseudo code Modification algorithm LEACH K_opt=Calculate () If (Random<T(n)) FOR(i=1,J=1;i≤(en)_(Thx_elc ) ,j≤ (en)_(Thx_amf)) Calculate (en)_fsp*d, (en)_amf*d Calculate T(n) (id)_head={id|T(n)_Max=max(t)≤(en)_(Thx_elc), j≤ (en)_(Thx_amf),(id)_cluster brodcast=(id)_head) else End.

Fig. 5 .Fig. 6 .Fig. 7 .
Fig. 5. Comparison of the number of nodes in live status in the 60 Node scenario

Fig. 8 .Fig. 9 .
Fig. 8.Comparison of the number of dead Nodes in the 60 Node scenario

Table 1 Notation
Set and Notation Parameter