# Improve Performances of Wireless Sensor Networks for Data Transfer Based on Fuzzy Clustering and Huffman Compression

Authors: Ali Mohammad Norouzzadeh Gil Molk; Seyed Mohsen Ghoreishi; Fatemeh Ghasemi; Iraj Elyasi
Journal: Journal of Sensors
 (2022)

---

## Abstract

In today’s world, the main challenge is to save use energy optimally. The IoT devices generate a large amount of data for wide applications. Considering the application perspective in the IoT market, in one instance of the IoT technology, that is a wireless sensor network, factors like energy, storage capacity, computation power, and limitations of communication bandwidth resources are the reason for using data fusion. Data fusion and aggregation in wireless sensor networks (WSNs) such that minimum energy is consumed are an essential issue. In most clustering models, data aggregation is carried out by the cluster-head (CH). In the proposed algorithm, data aggregation in the cluster-head is carried out using the lossless cascode Huffman compression algorithm. Due to the correlation among data of nodes, the data sensed by each node is compared with the data of the cluster-head node; after removing redundancy, the coded data is transmitted to the main node. The CH node is selected by an algorithm based on fuzzy logic according to the residual energy of the node and the distance of the node from the sink node. Various fuzzy type-I systems of Mamdani and Takagi-Sugeno and type-II systems are used. In this paper, the CH selection algorithms are evaluated using three scenarios in terms of the number of live nodes, received packets and CHs, proper distribution rate, and other parameters of the LEACH protocol, network lifetime, and network energy. In the following, to demonstrate the performance of this new algorithm, simulations are performed in MATLAB based on the proposed method. The results show that the proposed compression algorithm in environments with high data correlation improves the compression rate by 8% compared to the conventional Huffman compression, while in environments with low data correlation, these two algorithms perform almost the same. This compression helps reduce the energy consumption of the network.


---

## Body

## 1. Introduction

Internet of Things (IoT) as a novel technology that combines digital and physical aspects has provided wide access to information technology. As IoT becomes pervasive, it affects human life more and more. It is predicted that by 2025, the number of devices connected to the Internet exceeds 50 milliard [1–3]. The purpose of IoT is to make devices understand, detect, and analyze the world, but to achieve such a goal, low-cost solutions should be considered, demonstrating a set of constraints, like lifetime of a small battery, limited storage capacity, low accuracy, and sensors with low calibration. Data fusion is one of the most applied methods for improving the accuracy of the sensor and making a more accurate decision. An instance of IoT system used to collect information from various environmental sensors is the wireless sensor network. WSNs are comprised of various nodes that collect parameters in a monitoring environment. These nodes communicate with each other or can be controlled as clusters monitored by a CH, which has to change the route of the obtained data towards a base station.Since limited energy is one of the difficult challenges of WSNs, energy-saving becomes essential to increase the network lifetime. Data fusion provides the possibility to combine information from multiple sources, creating a unit scenario that can save the sensor’s energy considerably and increase accuracy of the measurement data. Data fusion and integration help collect data based on reducing the information volume [4, 5].Figure1 shows the relationship between the fusion of multiple sensors, integration of multiple sensors, data aggregation, data fusion, and information fusion. It is observed that both data fusion and information fusion can be used with the same meaning. Multisensor fusion is a subset that operates with sensing resources. Data aggregation defines another subset of information integration that is aimed at reducing data volume (in brief), which can manipulate any data/information type, including sensing data. On the other hand, multisensor integration is a bit different; it uses information fusion to interact with the environment using sensing devices and related information (for example, database systems). Therefore, multisensor fusion completely exists in the crossover of multisensor/sensor integration and information/data fusion [6–8].Figure 1
The relationship among the fusion terms: multisensor/sensor fusion, multisensor integration, data aggregation, data fusion, and information fusion [6].Data aggregation is another essential challenge in WSNs. Data aggregation is the collection of information and data of WSN nodes in the sink node. Considering continuous changes in sensor networks topology, the environmental efficiency of this network depends on the data aggregation technique. Data aggregation based on fuzzy clustering is one of the promising and applicable information collection methods in mobile WSNs. In recent years, various algorithms have been proposed for data aggregation in these networks, which are mainly based on common unreal assumptions that have made theoretical analysis of the algorithms possible. On the other hand, their implementation is challenging considering the constraints and capabilities of the mentioned networks [9]. In this study, a data aggregation algorithm based on CH selection using fuzzy logic in which the best data aggregation route via selecting the closest set with maximum energy connected to the sink node is presented. In this structure, a cascode Huffman compression technique in the CHs is used that outperforms the conventional compression method. The volume of data transmitted using compression is reduced, which increases the rate of information received in the sink node after decoding the received information.Signal processing techniques with data compression processes aggregate signals and increases storage efficiency and transmission reliability. Transmitting the main uncompressed data consumes a large bandwidth, which increases the transmission time and data volume. These constraints are applied to search the strategic compression techniques. The lossless compression techniques are essential when the main data, and the compressed data should be the same, or deviation from the main data results in disaster, particularly in analyzing medical and diagnostic signals.In this study, for combining data in CHs, the cascode Huffman compression method is used. This data compression method is used to reduce energy consumption to transmit information to the sink node by removing repeated information that occurs in most files. This technique is based on eliminating the redundancy resulting from data aggregation in the CH node. This technique helps increase the useful information transmission rate.Clustering is one of the methods used to implement routing algorithms. In clustering, the WSN environment is divided into sections called a cluster. The nodes in each cluster receive data from the environment and transmit it to the CH. After receiving the data, the CH aggregates data. After aggregation, data is transmitted to the main station through a single-hop or multihop route. Clustering has a significant shortcoming, which is nonuniform node energy consumption. Selecting the CH among network nodes considering different conditions helps increase the network lifetime for transmitting the aggregated data and reduces the energy consumption of the nodes. In the CH selection method, three techniques, including type-I Mamdani, Takagi-Sugeno, and type-II fuzzy systems. In this study, the results are compared with the LEACH clustering method.Following the methods described in this work, we will have a combined innovation to increase the number of transmission packets while increasing the life of the network. Therefore, with the help of the fuzzy clustering method with the mentioned techniques and cascading compression of data packets in two stages with the help of Huffman compression, we can reach a new combined approach to achieve the objectives of this paper. This paper is organized as follows: Section2 reviews the literature. Section 3 presents the primary concepts of the LEACH clustering, Huffman coding, and fuzzy logic. Section 4 describes the proposed clustering techniques for WSNs based on IoT using type-I and type-II fuzzy logic, and the compression method based on cascode Huffman coding is presented. In Section 5, the evaluation results of the proposed method are discussed. Finally, the paper is concluded in Section 6.


## 2. Related Works

In IoT systems, preserving the measured data with low energy consumption, delay and proper adaptive coverage affect the storage capacity. To preserve the balance between the factors mentioned above, the authors of [10, 11] have presented an Elfes Sugeno and trust-based neural networks (ESFTNN) that make triple algorithms feasible. First, the Elfes probability sensing (EPS) resolves a fraction of each sensor’s coverage. In the second phase, the Sugeno processing model adjusts the energy consumption through proper distribution of the data in the nodes without resolving possession. In the third phase, the trust-based neural data storage algorithm considers the medium classification ratio while processing the reconstructed data packets and enriches the information storage capacity to obtain the mutual information through the trust mechanism. The simulation results show that the proposed method covers the monitored area efficiently by consuming 15 J energy and a delay of 1 ms with sufficient storage capacity.In [12], in the cluster WSNs being studied, each CH transmits the data collected from the cluster members to the static base station using the middle communication nodes called moving gates. To reduce energy consumption and delay of packet delivery in the mentioned WSNs, two methods have been proposed: (1) designing a completely distributed fuzzy system for determining the validity of the node for being the CH node using two input factors, including the general state of a sensor node in WSN (GSoSN) and location of the sensor node relative to the mobile gateway nodes (LoSNRtMG). By defining the two primary factors, the accuracy of making a decision in selecting the CH node increases, and the computation overhead also decreases; (2) reducing the communication overhead through linear prediction for estimating the subsequent location of the mobile gateway nodes instead of the periodic broadcast of the spatial messages.In [13], a fuzzy logic-based clustering approach with an extension to the energy prediction has been proposed to prolong the lifetime of WSNs by evenly distributing the workload. The simulation results show that the proposed approach is more efficient than other distributed algorithms. It is believed that the technique presented in this paper could be further applied to large-scale wireless sensor networks.In [9], the shuffled frog leaping algorithm (SFLA) has been used to present a fuzzy multihop clustering protocol. SFLA is used for automatic configuration and optimization of the rules table in a fuzzy inference system and 5 adjustable parameters in two steps, selecting CH and parent, based on the program features. The proposed protocol (FMSFLA) considers effective parameters, including energy, distance from the BS, number of neighboring nodes, the distance of the real node from the BS, average route load, delay, overlap, and hotspots to achieve the best performance. FMSFLA includes rounds in which CH selection, parent selection, cluster constitution, and steady-state are performed. In the CH selection step, the CH is selected considering the overlap of the adjacent CHs with the candidate CHs based on the output fuzzy threshold and energy (a control parameter). In this protocol, the parents are selected by determining the CH level in a network. At the end of this step, the parents of each CH are determined based on the maximum fuzzy output based on the application. In the cluster constitution step, the clusters are constituted based on the determined CHs. Finally, the information received by the CHs is transmitted to the BS via their parents. FMSFLA is evaluated in terms of the number of live nodes, received packets, and CHS in addition to the proper distribution rate, and other parameters of LEACH, LEACH-EP, LEACH-FL, ASLPR, SIF, and ERA protocols. The network lifetime and scalability of the protocol are compared using the three mentioned scenarios.Authors of [14] have focused on the trust aggregation authentication protocol based on the machine learning technique. The total trust value for the internet gateways is taken for each device using its behavior and data trust value. In the authentication step, if the trust value is smaller than the standard threshold or it lacks the authentication password, the node is eliminated by the gateways. The threshold trust value is calculated adaptively using a technique called support vector machine (SVM) on collected traffic data. The performance of the TAAPML technique is evaluated considering the packet delivery rate, delay, residual energy, and computational overhead.WSN is mainly comprised of a large number of sensor nodes equipped with limited energy and resources. Therefore, energy consumption in WSNs is one of the most challenging issues. On the other hand, data fusion might reduce data redundancy significantly, reduce data transmission and energy consumption, increase network lifetime, improve bandwidth usage, and overcome the energy consumption and bandwidth usage bottlenecks. In [15], a novel data integration algorithm has been presented based on hesitant fuzzy entropy (DFHFS). The new algorithm is aimed at collecting repeated data in sensor nodes and tries to use the information provided by additional data to improve data reliability. The hesitant fuzzy entropy is used to combine the main data of the sensor nodes in the cluster existing in the sink node to achieve data of higher quality and make local decisions about the event of interest. The sink nodes transmit the local decisions periodically to the BS that collects the local decisions and makes the final judgment. In this process, the processing load of the BS is released significantly for all data.In [16], a novel algorithm called the Voronoi fuzzy clustering has been developed for aggregating common data with energy efficiency in WSNs. The VF algorithm is the integration of the Voronoi diagram and modified C-fuzzy considering distance and quality of service. Here, the operational power, delay, and delivery ratio are considered QOS parameters. After the completion of clustering the sensor nodes, the data management techniques like data collection or compression are performed to make more decisions at the sink node. The data mining clustering algorithm reduces the general data transmission from each sensor to the sink node; therefore, the energy consumed by the singular sensor node is minimized. The CHs collect all sensed data from the members of their cluster and perform data compression or aggregation before transmitting data to the sink node. Finally, simulations are carried out, and the results are analyzed to determine the performance of the proposed algorithm in WSN.In [2], several innovative techniques for the physical, the link, and the network layer of OSI model are implemented. Energy consumption in the WSNs is to find the best compromise of energy consumption between the various tasks performed by the objects, the detection, the processing, and the data communication tasks. It is this last task that consumes more energy. As a result, the main objective for the WSNs and the IoT is to minimize the energy consumed during this task. One of the most used solutions is to propose efficient routing techniques in terms of energy consumption.The data communication task, in wireless sensor networks (WSNs), is a major issue of high energy consumption. A hierarchical design based on a clustering algorithm is one of the approaches to manage the data communication and save energy in WSNs. However, most of the previous approaches based on clustering algorithms have not considered the length of the data communication path, which is a direct relation to energy consumption in WSNs. In [17], a novel scheme of a clustering algorithm has been proposed for reducing the data communication distance in WSNs. Hierarchical routing protocols were implemented for homogeneous and heterogeneous networks. The results show that the proposed scheme is more efficient than other protocols.In [4], the authors present a new routing protocol based on smart energy management and throughput maximization for clustered WSNs. The main objective of this protocol is to solve the constraint of closest sensors to the base station which consume relatively more energy in sensed information traffic and also decrease the workload on CHs. This approach divides the network field into the free area which contains the closest sensors to the base station that communicate directly with and clustered area which contains the sensors that transmit data to the base station through the cluster-head. So due to the sensors that communicates directly to the base station, the load on cluster-heads is decreased. Thus, the cluster-heads consume less energy causing an increase of network lifetime.In [18], DIKHE provides lossless DIKAE biomedical signal compression methods based on CR with reconstruction. Since the biomedical signals are subject to small changes, these methods provide a better path for telemetry and other biomedical applications wherever compression is required. To this end, the input signal reduces the channel dependencies using preprocessed differential pulse code modulation (DPCM) to obtain the output of interest. A set of unique compression techniques are used in the compression process. A combination of clustering (K-clustering, arithmetic encoding, and Huffman coding) and coding compression techniques is analyzed using electrocardiogram and electroencephalogram signals. The proposed method uses K-means clustering and Huffman coding (DiKHE) and K-means clustering with AE, independently.Before transmitting information to the internet, the information should be compressed, because it helps minimize time and cost. The main purpose of [7] is to develop and design a systematic and secure method for data encoding such that it can be used to implement lossless compression using steganography. This method helps reduce the volume of transmitted data and fast transmission. This paper presents compression using steganography that can be implemented to hide data with the considerable security and complete invisibility when using a combination of RSA and steganography skills, including the Huffman coding. Length encoding (RLE) and discrete wavelet transform with least significant bit steganography. The first step based on RSA is to encode and decode secret messages. The next step is compression, which is carried out based on Huffman programming; to compress sensitive data using lossless technology, RLE is a more natural method for data compression that compresses an image through weak compression to reduce the cover image. Then, LSB is used to implant the encoded information in the image on the compressed page.By studying the articles mentioned in this field, to have a wireless sensor network with maximum operational efficiency according to the techniques described in this work, the main contributions of this article are as follows:(i)
Increase the volume of transfer packets by the Huffman two-step cascading compression method with the help of removing duplicate data(ii)
Provide fuzzy clustering method for selecting clusters for data transfer with three different techniques(iii)
Provide distance and residual energy criteria for fuzzy clustering in data packet transmission(iv)
Combine compression and fuzzy clustering techniques for data transmission due to increased network life and optimal energy consumption between sensor nodes and maximum data packet transmission


## 3. Primary Concepts

### 3.1. Hierarchical Routing Based on Clustering

In the hierarchical routing method based on clustering, the nodes with higher energy can be used to process and transmit information, while nodes with lower energy can be used to implement the task of sensors adjacent to the target. The hierarchical method has a significant share in scalability, lifetime, and total energy efficiency of the system by creating clusters and allocating specific tasks to the CHs and avoids single-bus architecture. Hierarchical routing that combines data to reduce the number of messages transmitted to the BS is an efficient method for lower energy consumption in a cluster. Potential clustering routing methods are the most efficient methods to reduce energy consumption in SNs that have found wide applications in recent years. The most essential and well-known protocol in this category is called LEACH [11, 19, 20].


### 3.2. LEACH Clustering Protocol

The clustering hierarchical protocol with low energy, called LEACH, is the first and most well-known clustering-based protocol in WSNs in which clusters are created in distributed form. The most important objective of LEACH is to create local BSs (CHs) to reduce the energy consumption of data transmission to a remote BS. LEACH selects a few sensor nodes randomly as CH and organizes the local nodes as the local clusters [21].Nodes are assigned to the corresponding CH based on adjacency. Non-CH nodes transmit their data to the CH. Therefore, the only overhead is to establish intracluster communication. The CH nodes need CH energy is balanced by rotating the CH role among different nodes. Also, combining data in the CHs reduces the volume of data transmitted to the BS and saves energy. The performance of the LEACH protocol is divided into multiple periods. Each period starts with installation in which the clusters are organized. Followed by installation, data is transmitted in which the normal load transmits their data to the CHs, and the CS transmits the aggregated packet to the BS to reduce the amount of information that should be transmitted to the BS.


#### 3.2.1. Clustering Performance

This protocol is one of the most well-known hierarchical protocols for WSNs [22–24]. In this protocol, time is divided into sections called round. Each round is also divided into two phases. The first phase is called set up in which the clusters are constituted and the second phase is associated with the normal operation which is called the steady-state phase. In the first phase, the CHs are broadcast according to an adaptive probability function. For CH broadcast, each sensor note broadcasts a random number between zero and one. If this number is smaller than a determined threshold, it is selected as the CH in that round. Rather than employing wire or communication routes, packet routing techniques are used in this infrastructure [25, 26]. Because there are multiple potential paths to move from one node to another in these networks, an algorithm to find the best route to the target should be developed.This probability function is designed such that each sensor is selected as a CH in a specific number of rounds to reduce the energy consumption of the network. After selecting the CH in the setup phase of each round, each CH informed the other note that it is selected as the CH and each note select the proper CH for itself and inform it of the corresponding CH. Then HCH schedules its sensors and allocates them a time slot to prevent collision of sensor data. In the second phase, each sensor transmits is data in its timeslot. After receiving the information of all sensors, the sensor combines the information and transmits it to the BS. Since HCH combines all sensor data of its cluster, a significant saving is cheap in the volume of data transmitted to the BS and energy consumption.


### 3.3. Huffman Coding Algorithm

Huffman coding algorithm is one of the most common data compression methods in computer science. The algorithm developed by David Huffman is used to decrease coding redundancy without losing data quality. Using data repetition is the main idea in the Huffman coding algorithm [27, 28]. In this method, the symbols of the alphabet are assigned to the variable code words considering their frequency. A symbol with a higher frequency is used to achieve higher compression with shorter codes. The Huffman coding algorithm steps are as follows:Step 1: frequency of the symbols existing in data and facilities or mentioned. These probabilities are listed in descending order. A note with obtained probabilities is constituted as a binary treeStep 2: the least probable symbols in the cluster are restored. These two values are summed and a new probability is created. All probabilities are adjusted in a descending sequenceStep 3: a parent node is created, and the left branch and the right branch are specified as child 1 and child 2, respectivelyStep 4: to create a new node, nodes with the least probability are modified, and the tree list is updated. If there is only one node in the list, the process is terminated. Otherwise, step 2 is repeated


### 3.4. Fuzzy Systems

The starting point of constructing a fuzzy system is to obtain a set of if-then rules from the knowledge of experts. The next step is to combine these rules in a unit system. Various fuzzy systems use different methods and principles to combine these rules.In common books and papers, three types of fuzzy systems are discussed: Mamdani fuzzy systems; Takagi-Sugeno and Kang fuzzy systems; and type-II fuzzy systems.According to Figure2, these systems include fuzzifier and fuzzy inference based on fuzzy rules and defuzzification. In these structures, the input and output membership functions are used to define fuzzy systems and their types. On one hand, fuzzy systems are maps with multiple inputs and one output from one vector with real values to a scalar with real values (multiple output maps can be created by combining multiple single output maps) that their mathematical relationships can be obtained. On the other hand, fuzzy systems are based on human knowledge that is constructed as if-then rules. The important theoretical aspect of fuzzy systems is that it provides a systematic process for converting a knowledge base into a nonlinear map. Since we can use mathematical models, analysis and design of the systems can be carried out as a mathematical model [29–31].Figure 2
Fuzzy logic system block diagram.


## 3.1. Hierarchical Routing Based on Clustering

In the hierarchical routing method based on clustering, the nodes with higher energy can be used to process and transmit information, while nodes with lower energy can be used to implement the task of sensors adjacent to the target. The hierarchical method has a significant share in scalability, lifetime, and total energy efficiency of the system by creating clusters and allocating specific tasks to the CHs and avoids single-bus architecture. Hierarchical routing that combines data to reduce the number of messages transmitted to the BS is an efficient method for lower energy consumption in a cluster. Potential clustering routing methods are the most efficient methods to reduce energy consumption in SNs that have found wide applications in recent years. The most essential and well-known protocol in this category is called LEACH [11, 19, 20].


## 3.2. LEACH Clustering Protocol

The clustering hierarchical protocol with low energy, called LEACH, is the first and most well-known clustering-based protocol in WSNs in which clusters are created in distributed form. The most important objective of LEACH is to create local BSs (CHs) to reduce the energy consumption of data transmission to a remote BS. LEACH selects a few sensor nodes randomly as CH and organizes the local nodes as the local clusters [21].Nodes are assigned to the corresponding CH based on adjacency. Non-CH nodes transmit their data to the CH. Therefore, the only overhead is to establish intracluster communication. The CH nodes need CH energy is balanced by rotating the CH role among different nodes. Also, combining data in the CHs reduces the volume of data transmitted to the BS and saves energy. The performance of the LEACH protocol is divided into multiple periods. Each period starts with installation in which the clusters are organized. Followed by installation, data is transmitted in which the normal load transmits their data to the CHs, and the CS transmits the aggregated packet to the BS to reduce the amount of information that should be transmitted to the BS.


### 3.2.1. Clustering Performance

This protocol is one of the most well-known hierarchical protocols for WSNs [22–24]. In this protocol, time is divided into sections called round. Each round is also divided into two phases. The first phase is called set up in which the clusters are constituted and the second phase is associated with the normal operation which is called the steady-state phase. In the first phase, the CHs are broadcast according to an adaptive probability function. For CH broadcast, each sensor note broadcasts a random number between zero and one. If this number is smaller than a determined threshold, it is selected as the CH in that round. Rather than employing wire or communication routes, packet routing techniques are used in this infrastructure [25, 26]. Because there are multiple potential paths to move from one node to another in these networks, an algorithm to find the best route to the target should be developed.This probability function is designed such that each sensor is selected as a CH in a specific number of rounds to reduce the energy consumption of the network. After selecting the CH in the setup phase of each round, each CH informed the other note that it is selected as the CH and each note select the proper CH for itself and inform it of the corresponding CH. Then HCH schedules its sensors and allocates them a time slot to prevent collision of sensor data. In the second phase, each sensor transmits is data in its timeslot. After receiving the information of all sensors, the sensor combines the information and transmits it to the BS. Since HCH combines all sensor data of its cluster, a significant saving is cheap in the volume of data transmitted to the BS and energy consumption.


## 3.2.1. Clustering Performance

This protocol is one of the most well-known hierarchical protocols for WSNs [22–24]. In this protocol, time is divided into sections called round. Each round is also divided into two phases. The first phase is called set up in which the clusters are constituted and the second phase is associated with the normal operation which is called the steady-state phase. In the first phase, the CHs are broadcast according to an adaptive probability function. For CH broadcast, each sensor note broadcasts a random number between zero and one. If this number is smaller than a determined threshold, it is selected as the CH in that round. Rather than employing wire or communication routes, packet routing techniques are used in this infrastructure [25, 26]. Because there are multiple potential paths to move from one node to another in these networks, an algorithm to find the best route to the target should be developed.This probability function is designed such that each sensor is selected as a CH in a specific number of rounds to reduce the energy consumption of the network. After selecting the CH in the setup phase of each round, each CH informed the other note that it is selected as the CH and each note select the proper CH for itself and inform it of the corresponding CH. Then HCH schedules its sensors and allocates them a time slot to prevent collision of sensor data. In the second phase, each sensor transmits is data in its timeslot. After receiving the information of all sensors, the sensor combines the information and transmits it to the BS. Since HCH combines all sensor data of its cluster, a significant saving is cheap in the volume of data transmitted to the BS and energy consumption.


## 3.3. Huffman Coding Algorithm

Huffman coding algorithm is one of the most common data compression methods in computer science. The algorithm developed by David Huffman is used to decrease coding redundancy without losing data quality. Using data repetition is the main idea in the Huffman coding algorithm [27, 28]. In this method, the symbols of the alphabet are assigned to the variable code words considering their frequency. A symbol with a higher frequency is used to achieve higher compression with shorter codes. The Huffman coding algorithm steps are as follows:Step 1: frequency of the symbols existing in data and facilities or mentioned. These probabilities are listed in descending order. A note with obtained probabilities is constituted as a binary treeStep 2: the least probable symbols in the cluster are restored. These two values are summed and a new probability is created. All probabilities are adjusted in a descending sequenceStep 3: a parent node is created, and the left branch and the right branch are specified as child 1 and child 2, respectivelyStep 4: to create a new node, nodes with the least probability are modified, and the tree list is updated. If there is only one node in the list, the process is terminated. Otherwise, step 2 is repeated


## 3.4. Fuzzy Systems

The starting point of constructing a fuzzy system is to obtain a set of if-then rules from the knowledge of experts. The next step is to combine these rules in a unit system. Various fuzzy systems use different methods and principles to combine these rules.In common books and papers, three types of fuzzy systems are discussed: Mamdani fuzzy systems; Takagi-Sugeno and Kang fuzzy systems; and type-II fuzzy systems.According to Figure2, these systems include fuzzifier and fuzzy inference based on fuzzy rules and defuzzification. In these structures, the input and output membership functions are used to define fuzzy systems and their types. On one hand, fuzzy systems are maps with multiple inputs and one output from one vector with real values to a scalar with real values (multiple output maps can be created by combining multiple single output maps) that their mathematical relationships can be obtained. On the other hand, fuzzy systems are based on human knowledge that is constructed as if-then rules. The important theoretical aspect of fuzzy systems is that it provides a systematic process for converting a knowledge base into a nonlinear map. Since we can use mathematical models, analysis and design of the systems can be carried out as a mathematical model [29–31].Figure 2
Fuzzy logic system block diagram.


## 4. The Proposed Method

### 4.1. Fuzzy Clustering Algorithms

In this method, it is tried to introduce a routing algorithm based on fuzzy clustering algorithm and compare it with LEACH. In the proposed method, proper clustering methods are used such that the network parameters are optimized. In the clustering algorithms, the CH consumes more energy compared to the clusters; to resolve this problem, the CH should change in each step. This change is usually done randomly, but in the proposed method, this selection is targeted and calculated based on the residual energy of the nodes and distance from the sink node, which seems to make the CH selection targeted resulting in balanced energy consumption of the nodes. Thus, the nodes’ energy is finished at close times, and the network becomes more stable. In the proposed method, the network range is divided into subsections to make the nodes’ energy consumption more balanced. In most studies that have used clustering, the clusters are of the same size, and the number of clusters is constant. But in the proposed method, the clusters’ size is considered different considering the distance from the sink node, and the number of clusters decreases as the number of nodes decreases.In this paper, three type-I Mamdani fuzzy and TS and type-III clustering methods are used to select CH. In the Mamdani fuzzy method, a thresholding technique is used to select CH.The primary concepts of the parameters that create the numerical value of the chance of being-CH are ambiguous, which are described by accurate mathematical models. However, it is usually described through constructing fuzzy models. Two common information resources for constructing the fuzzy models are the previous data and knowledge. A fuzzy system is comprised of four sections [32–34]: (1) fuzzy system, (2) fuzzy rules, (3) inference motor, and (4) defuzzification system. The abstract scheme of the proposed FS for calculating the existence of CH is shown in Figure 2. In the first step (called fuzzification), after generating a clear set of input data, the set is converted to a fuzzy linguistic variable, fuzzy linguistic terms, and membership functions. Then, it is inferred using a set of fuzzy rules. Finally, the fuzzy output is drawn using membership functions [32, 35]. The last step is defuzzification. In the designed fuzzy system, fuzzy inference systems of Mamdani, TS, and type II are used. Also, the defuzzification approves the center of mass [36, 37]. In the following, details of inputs and outputs, membership functions, and fuzzy rules of the proposed systems are discussed.


#### 4.1.1. Input and Output Variables of the CH Selection Fuzzy Systems

The input-output set of the system is a numerical value of being-CH-chance defined in the range of zero and one. For the CH selection system, one is equivalent to selecting, and zero is equivalent to not selecting a node as CH. For the Mamdani system, the output is introduced as real values in the range of zero and one.The input set-two proposed factors are selected here; first, the residual energy of the network nodes is in the range of zero and maximum energy. The second is the distance of nodes from the sink node, which is normalized in the range of zero and one.


#### 4.1.2. Membership Functions according to [32]

The membership functions are used in the fuzzification and defuzzification steps of the fuzzy system to convert the nonfuzzy input values to fuzzy linguistic terms and vice versa. A membership function is used to determine the quantity of the linguistic terms. “According to the domain values of the variables, various fuzzy sets are defined, and a membership function is used to assign the membership degree of each value of a variable in the fuzzy sets.” In this paper, fuzzy membership functions are constructed using the results obtained from the intellectual approach [20, 38]. According to the previous studies, for determining CH in WSN based on fuzzy logic [23, 27, 30] and to save energy and simplicity in designing the network structure, triangular and trapezoidal membership functions are used. In the following, the input and output membership function and the governing rules for the three proposed fuzzy structures are studied.For fuzzy system inputs, residual energy with membership functions including high, low, and fuzzy input distance from the sink node with far, average, and near membership functions are introduced. Figure3 shows the introduced membership functions for different inputs. Trapezoidal membership functions have been used for the input variables. Figure 3(a) is defined for type-I fuzzy system, and Figure 3(b) is defined for type-II fuzzy system. According to Figure 3(b), the weighting range of the membership functions of the type-II fuzzy system can be changed at the up and down, but for the type-I fuzzy system, the weight of the membership functions is fixed for each input value.Figure 3
Linguistic terms of the input membership functions: (a) Fuzzy type I and (b) Fuzzy type II.
(a)(b)For the output of fuzzy systems, the chance of selecting a node as CH is as follows: They are equated as values of one and zero for the Takagi TS type-I fuzzy system and type-II fuzzy system with yes and no, respectively. For the Mamdani fuzzy system according to Figure4, trapezoidal membership functions in the range of zero and one have been used [39, 40].Figure 4
Linguistic terms of the output membership functions for the Mamdani fuzzy system.


#### 4.1.3. Fuzzy Rules

The fuzzy rules represented in Tables1–3 are introduced by type-I and type-II fuzzy systems. Figures 5 and 6 show the results of the rules. The criterion of applying fuzzy rules for all three desired fuzzy systems is to increase the lifetime of the network and reduce the loss of energy consumption for sending information. For this purpose, nodes should be selected as cluster-heads that have the highest amount of remaining energy (to increase lifespan) and the shortest distance to the destination node (to reduce energy losses along the path). For instance, the following rule shows that the sensor node has a weak position regarding the distance from the sink node and the residual energy is low; therefore, it is not a suitable candidate for being-Ch:
(1)IF<distanceisfar>AND<energyremindislow>THEN<CHisNO>.Table 1
Fuzzy rules consulted by Fuzzy type I. The output is being-CH-chance (Mamdani).
Energy remindDistanceCHBLowNearYesLowAverageNoLowFarNoHighNearYesHighAverageYesHighFarNoTable 2
Fuzzy rules consulted by Fuzzy type I. The output is being-CH-chance (Takagi-Sugeno).
Energy remindDistanceCHBLowNearNoLowAverageNoLowFarNoHighNearYesHighAverageNoHighFarNoTable 3
Fuzzy rules consulted by Fuzzy type II. The output is being-CH-chance.
Energy remindDistanceCHBLowNearNoLowAverageNoLowFarNoHighNearYesHighAverageNoHighFarNoFigure 5
Representation of type-I fuzzy rules: (a) Mamdani and (b) Takagi-Sugeno.
(a)(b)Figure 6
Representation of the type-II fuzzy rules.


#### 4.1.4. CH Selection Algorithm

In the CH selection problem, the important point in WSN is information transmission with minimum energy consumption to increase the network lifetime. The logical selection for determining the CH node is the most important part of the hierarchical routing for aggregating and transmitting the information. In this paper, a fuzzy logic structure considering the rules defined based on experiments is used to select CH optimally such that the number or information transmission rounds before the first dead node is increased. Figure7 shows the proposed algorithm for CH selection based on fuzzy clustering. According to the flowchart proposed in this article, first, the two criteria of the distance from the node to sink node and the remaining energy of the node are calculated for all nodes. With the help of these two criteria and fuzzy systems, cluster-head nodes are identified, and if no node is selected, according to this technique, the closest node to the sink node is selected as the cluster-head.Figure 7
Flowchart of the proposed CH selection algorithm.Based on the proposed flowchart in Figure7, it can be seen that two criteria are considered for selecting the optimal path for selecting the threaded node: first, the residual energy of the node, to increase the life of the wireless sensor network, and second, the distance of the node near the path to reduce the transmission distance, to increase the number of transmission packets and reduce power losses. Therefore, in the cluster selection to meet the cluster selection criteria for all sensor nodes, the parameters of distance and amount of residual energy are calculated and transferred to the defined fuzzy system. With fuzzy-defined rules, the chance of selecting a header for each node is determined, and by defining an average threshold, the values of zero and one are assigned to the sensor nodes. According to the value obtained for the sensor nodes, routing is selected for Huffman compressed packets. This operation continues until the death of all nodes to transmit information.


### 4.2. Cascode Huffman Compression

A proposed approach for aggregating the data transmitted to the CH is to compress data so that information is encoded and the volume of the information received at the sink node is increased. In this paper, the Huffman coding is selected for compression. The technique presented in this work uses two Huffman coders simultaneously in series and cascode form, and its structure is shown in Figure8. In the first phase, the data is encoded and compressed as a common Huffman coder. In the second phase, the binary code extracted from the Huffman coding of the first phase is converted to an octal code with values of 0,1,2,3,4,5,6,7. Now, the results are coded using the second Huffman coding for the second time. The obtained binary results of the Huffman coding in the second phase are prepared to be transmitted to the sink node. This helps compress the data more and reduces the energy loss for data transmission in the network. In the proposed approach for compression, we will achieve an improvement for information transmission in the studied sensor networks. Figure 8 shows the steps of implementing this method with two Huffman encoding steps in cascade. This technique leads to an average increase of 40% in the volume of sent packets compared to the transmission of information without compression.Figure 8
Flowchart of the Huffman compression technique.


## 4.1. Fuzzy Clustering Algorithms

In this method, it is tried to introduce a routing algorithm based on fuzzy clustering algorithm and compare it with LEACH. In the proposed method, proper clustering methods are used such that the network parameters are optimized. In the clustering algorithms, the CH consumes more energy compared to the clusters; to resolve this problem, the CH should change in each step. This change is usually done randomly, but in the proposed method, this selection is targeted and calculated based on the residual energy of the nodes and distance from the sink node, which seems to make the CH selection targeted resulting in balanced energy consumption of the nodes. Thus, the nodes’ energy is finished at close times, and the network becomes more stable. In the proposed method, the network range is divided into subsections to make the nodes’ energy consumption more balanced. In most studies that have used clustering, the clusters are of the same size, and the number of clusters is constant. But in the proposed method, the clusters’ size is considered different considering the distance from the sink node, and the number of clusters decreases as the number of nodes decreases.In this paper, three type-I Mamdani fuzzy and TS and type-III clustering methods are used to select CH. In the Mamdani fuzzy method, a thresholding technique is used to select CH.The primary concepts of the parameters that create the numerical value of the chance of being-CH are ambiguous, which are described by accurate mathematical models. However, it is usually described through constructing fuzzy models. Two common information resources for constructing the fuzzy models are the previous data and knowledge. A fuzzy system is comprised of four sections [32–34]: (1) fuzzy system, (2) fuzzy rules, (3) inference motor, and (4) defuzzification system. The abstract scheme of the proposed FS for calculating the existence of CH is shown in Figure 2. In the first step (called fuzzification), after generating a clear set of input data, the set is converted to a fuzzy linguistic variable, fuzzy linguistic terms, and membership functions. Then, it is inferred using a set of fuzzy rules. Finally, the fuzzy output is drawn using membership functions [32, 35]. The last step is defuzzification. In the designed fuzzy system, fuzzy inference systems of Mamdani, TS, and type II are used. Also, the defuzzification approves the center of mass [36, 37]. In the following, details of inputs and outputs, membership functions, and fuzzy rules of the proposed systems are discussed.


### 4.1.1. Input and Output Variables of the CH Selection Fuzzy Systems

The input-output set of the system is a numerical value of being-CH-chance defined in the range of zero and one. For the CH selection system, one is equivalent to selecting, and zero is equivalent to not selecting a node as CH. For the Mamdani system, the output is introduced as real values in the range of zero and one.The input set-two proposed factors are selected here; first, the residual energy of the network nodes is in the range of zero and maximum energy. The second is the distance of nodes from the sink node, which is normalized in the range of zero and one.


### 4.1.2. Membership Functions according to [32]

The membership functions are used in the fuzzification and defuzzification steps of the fuzzy system to convert the nonfuzzy input values to fuzzy linguistic terms and vice versa. A membership function is used to determine the quantity of the linguistic terms. “According to the domain values of the variables, various fuzzy sets are defined, and a membership function is used to assign the membership degree of each value of a variable in the fuzzy sets.” In this paper, fuzzy membership functions are constructed using the results obtained from the intellectual approach [20, 38]. According to the previous studies, for determining CH in WSN based on fuzzy logic [23, 27, 30] and to save energy and simplicity in designing the network structure, triangular and trapezoidal membership functions are used. In the following, the input and output membership function and the governing rules for the three proposed fuzzy structures are studied.For fuzzy system inputs, residual energy with membership functions including high, low, and fuzzy input distance from the sink node with far, average, and near membership functions are introduced. Figure3 shows the introduced membership functions for different inputs. Trapezoidal membership functions have been used for the input variables. Figure 3(a) is defined for type-I fuzzy system, and Figure 3(b) is defined for type-II fuzzy system. According to Figure 3(b), the weighting range of the membership functions of the type-II fuzzy system can be changed at the up and down, but for the type-I fuzzy system, the weight of the membership functions is fixed for each input value.Figure 3
Linguistic terms of the input membership functions: (a) Fuzzy type I and (b) Fuzzy type II.
(a)(b)For the output of fuzzy systems, the chance of selecting a node as CH is as follows: They are equated as values of one and zero for the Takagi TS type-I fuzzy system and type-II fuzzy system with yes and no, respectively. For the Mamdani fuzzy system according to Figure4, trapezoidal membership functions in the range of zero and one have been used [39, 40].Figure 4
Linguistic terms of the output membership functions for the Mamdani fuzzy system.


### 4.1.3. Fuzzy Rules

The fuzzy rules represented in Tables1–3 are introduced by type-I and type-II fuzzy systems. Figures 5 and 6 show the results of the rules. The criterion of applying fuzzy rules for all three desired fuzzy systems is to increase the lifetime of the network and reduce the loss of energy consumption for sending information. For this purpose, nodes should be selected as cluster-heads that have the highest amount of remaining energy (to increase lifespan) and the shortest distance to the destination node (to reduce energy losses along the path). For instance, the following rule shows that the sensor node has a weak position regarding the distance from the sink node and the residual energy is low; therefore, it is not a suitable candidate for being-Ch:
(1)IF<distanceisfar>AND<energyremindislow>THEN<CHisNO>.Table 1
Fuzzy rules consulted by Fuzzy type I. The output is being-CH-chance (Mamdani).
Energy remindDistanceCHBLowNearYesLowAverageNoLowFarNoHighNearYesHighAverageYesHighFarNoTable 2
Fuzzy rules consulted by Fuzzy type I. The output is being-CH-chance (Takagi-Sugeno).
Energy remindDistanceCHBLowNearNoLowAverageNoLowFarNoHighNearYesHighAverageNoHighFarNoTable 3
Fuzzy rules consulted by Fuzzy type II. The output is being-CH-chance.
Energy remindDistanceCHBLowNearNoLowAverageNoLowFarNoHighNearYesHighAverageNoHighFarNoFigure 5
Representation of type-I fuzzy rules: (a) Mamdani and (b) Takagi-Sugeno.
(a)(b)Figure 6
Representation of the type-II fuzzy rules.


### 4.1.4. CH Selection Algorithm

In the CH selection problem, the important point in WSN is information transmission with minimum energy consumption to increase the network lifetime. The logical selection for determining the CH node is the most important part of the hierarchical routing for aggregating and transmitting the information. In this paper, a fuzzy logic structure considering the rules defined based on experiments is used to select CH optimally such that the number or information transmission rounds before the first dead node is increased. Figure7 shows the proposed algorithm for CH selection based on fuzzy clustering. According to the flowchart proposed in this article, first, the two criteria of the distance from the node to sink node and the remaining energy of the node are calculated for all nodes. With the help of these two criteria and fuzzy systems, cluster-head nodes are identified, and if no node is selected, according to this technique, the closest node to the sink node is selected as the cluster-head.Figure 7
Flowchart of the proposed CH selection algorithm.Based on the proposed flowchart in Figure7, it can be seen that two criteria are considered for selecting the optimal path for selecting the threaded node: first, the residual energy of the node, to increase the life of the wireless sensor network, and second, the distance of the node near the path to reduce the transmission distance, to increase the number of transmission packets and reduce power losses. Therefore, in the cluster selection to meet the cluster selection criteria for all sensor nodes, the parameters of distance and amount of residual energy are calculated and transferred to the defined fuzzy system. With fuzzy-defined rules, the chance of selecting a header for each node is determined, and by defining an average threshold, the values of zero and one are assigned to the sensor nodes. According to the value obtained for the sensor nodes, routing is selected for Huffman compressed packets. This operation continues until the death of all nodes to transmit information.


## 4.1.1. Input and Output Variables of the CH Selection Fuzzy Systems

The input-output set of the system is a numerical value of being-CH-chance defined in the range of zero and one. For the CH selection system, one is equivalent to selecting, and zero is equivalent to not selecting a node as CH. For the Mamdani system, the output is introduced as real values in the range of zero and one.The input set-two proposed factors are selected here; first, the residual energy of the network nodes is in the range of zero and maximum energy. The second is the distance of nodes from the sink node, which is normalized in the range of zero and one.


## 4.1.2. Membership Functions according to [32]

The membership functions are used in the fuzzification and defuzzification steps of the fuzzy system to convert the nonfuzzy input values to fuzzy linguistic terms and vice versa. A membership function is used to determine the quantity of the linguistic terms. “According to the domain values of the variables, various fuzzy sets are defined, and a membership function is used to assign the membership degree of each value of a variable in the fuzzy sets.” In this paper, fuzzy membership functions are constructed using the results obtained from the intellectual approach [20, 38]. According to the previous studies, for determining CH in WSN based on fuzzy logic [23, 27, 30] and to save energy and simplicity in designing the network structure, triangular and trapezoidal membership functions are used. In the following, the input and output membership function and the governing rules for the three proposed fuzzy structures are studied.For fuzzy system inputs, residual energy with membership functions including high, low, and fuzzy input distance from the sink node with far, average, and near membership functions are introduced. Figure3 shows the introduced membership functions for different inputs. Trapezoidal membership functions have been used for the input variables. Figure 3(a) is defined for type-I fuzzy system, and Figure 3(b) is defined for type-II fuzzy system. According to Figure 3(b), the weighting range of the membership functions of the type-II fuzzy system can be changed at the up and down, but for the type-I fuzzy system, the weight of the membership functions is fixed for each input value.Figure 3
Linguistic terms of the input membership functions: (a) Fuzzy type I and (b) Fuzzy type II.
(a)(b)For the output of fuzzy systems, the chance of selecting a node as CH is as follows: They are equated as values of one and zero for the Takagi TS type-I fuzzy system and type-II fuzzy system with yes and no, respectively. For the Mamdani fuzzy system according to Figure4, trapezoidal membership functions in the range of zero and one have been used [39, 40].Figure 4
Linguistic terms of the output membership functions for the Mamdani fuzzy system.


## 4.1.3. Fuzzy Rules

The fuzzy rules represented in Tables1–3 are introduced by type-I and type-II fuzzy systems. Figures 5 and 6 show the results of the rules. The criterion of applying fuzzy rules for all three desired fuzzy systems is to increase the lifetime of the network and reduce the loss of energy consumption for sending information. For this purpose, nodes should be selected as cluster-heads that have the highest amount of remaining energy (to increase lifespan) and the shortest distance to the destination node (to reduce energy losses along the path). For instance, the following rule shows that the sensor node has a weak position regarding the distance from the sink node and the residual energy is low; therefore, it is not a suitable candidate for being-Ch:
(1)IF<distanceisfar>AND<energyremindislow>THEN<CHisNO>.Table 1
Fuzzy rules consulted by Fuzzy type I. The output is being-CH-chance (Mamdani).
Energy remindDistanceCHBLowNearYesLowAverageNoLowFarNoHighNearYesHighAverageYesHighFarNoTable 2
Fuzzy rules consulted by Fuzzy type I. The output is being-CH-chance (Takagi-Sugeno).
Energy remindDistanceCHBLowNearNoLowAverageNoLowFarNoHighNearYesHighAverageNoHighFarNoTable 3
Fuzzy rules consulted by Fuzzy type II. The output is being-CH-chance.
Energy remindDistanceCHBLowNearNoLowAverageNoLowFarNoHighNearYesHighAverageNoHighFarNoFigure 5
Representation of type-I fuzzy rules: (a) Mamdani and (b) Takagi-Sugeno.
(a)(b)Figure 6
Representation of the type-II fuzzy rules.


## 4.1.4. CH Selection Algorithm

In the CH selection problem, the important point in WSN is information transmission with minimum energy consumption to increase the network lifetime. The logical selection for determining the CH node is the most important part of the hierarchical routing for aggregating and transmitting the information. In this paper, a fuzzy logic structure considering the rules defined based on experiments is used to select CH optimally such that the number or information transmission rounds before the first dead node is increased. Figure7 shows the proposed algorithm for CH selection based on fuzzy clustering. According to the flowchart proposed in this article, first, the two criteria of the distance from the node to sink node and the remaining energy of the node are calculated for all nodes. With the help of these two criteria and fuzzy systems, cluster-head nodes are identified, and if no node is selected, according to this technique, the closest node to the sink node is selected as the cluster-head.Figure 7
Flowchart of the proposed CH selection algorithm.Based on the proposed flowchart in Figure7, it can be seen that two criteria are considered for selecting the optimal path for selecting the threaded node: first, the residual energy of the node, to increase the life of the wireless sensor network, and second, the distance of the node near the path to reduce the transmission distance, to increase the number of transmission packets and reduce power losses. Therefore, in the cluster selection to meet the cluster selection criteria for all sensor nodes, the parameters of distance and amount of residual energy are calculated and transferred to the defined fuzzy system. With fuzzy-defined rules, the chance of selecting a header for each node is determined, and by defining an average threshold, the values of zero and one are assigned to the sensor nodes. According to the value obtained for the sensor nodes, routing is selected for Huffman compressed packets. This operation continues until the death of all nodes to transmit information.


## 4.2. Cascode Huffman Compression

A proposed approach for aggregating the data transmitted to the CH is to compress data so that information is encoded and the volume of the information received at the sink node is increased. In this paper, the Huffman coding is selected for compression. The technique presented in this work uses two Huffman coders simultaneously in series and cascode form, and its structure is shown in Figure8. In the first phase, the data is encoded and compressed as a common Huffman coder. In the second phase, the binary code extracted from the Huffman coding of the first phase is converted to an octal code with values of 0,1,2,3,4,5,6,7. Now, the results are coded using the second Huffman coding for the second time. The obtained binary results of the Huffman coding in the second phase are prepared to be transmitted to the sink node. This helps compress the data more and reduces the energy loss for data transmission in the network. In the proposed approach for compression, we will achieve an improvement for information transmission in the studied sensor networks. Figure 8 shows the steps of implementing this method with two Huffman encoding steps in cascade. This technique leads to an average increase of 40% in the volume of sent packets compared to the transmission of information without compression.Figure 8
Flowchart of the Huffman compression technique.


## 5. Simulation Settings

In this section, the performance of the proposed aggregation method is estimated using matlab2017b. The results of the proposed approach are studied numerically. The studied IoT WSN is comprised of 10 active sensor nodes that are randomly distributed in a100m×100m rectangular area. The nodes in an area are distributed using the random simulation model. The link-layer provides the junction between two nodes, and the link is designed omnidirectional. The IoT gateway node collects the data packets in a variable area and stores information based on the data packet size; its size is 6400 bits. The simulation time varies between 10 and 120 minutes. The simulation parameters are given in Table 4.Table 4
Simulation parameters.
ParameterValueNumber of nodes10Area100m×100mLocation of BS50,175Initial energy0.5 JEelec50 nJ/bitPacket size6400 bitsTransfer/receiver50 NIn this paper, the proposed fuzzy clustering algorithm is compared with the LEACH clustering algorithm. In LEACH protocols the nodes’ energy level changes significantly. The results of this algorithm indicate that each cluster does not necessarily include the neighboring nodes, but it is a set of high-energy and low-energy nodes such that the energy is balanced among all clusters. In other words, the closest high-energy and low-energy nodes are virtually put in one cluster, while fuzzy clustering uses two measures of energy node and the distance based on selecting an intelligent fuzzy logic method so that it can change the position of the CH from one node to another if necessary. This helps even the energy consumption in the network and increase the network lifetime.The proposed algorithm is tested using three CH selection measures in the LEACH protocol. The results show that selecting a Mamdani fuzzy CH node with maximum energy level shows higher efficiency compared to the other two methods, which has a significant difference from the results of these two methods. Comparison is made using three standard measures in the SN routing algorithms:Death of the first node: the round at which the first node fails due to running out of energyDeath of half of the nodes: the round at which half of the network nodes fail due to running out of energyDeath of the last node: the round at which the last network node fails due to running out of energyThe results obtained from the three protocols and the results obtained from LEACH for different CH selection measures for the first and second patterns are given in Tables5 and 6, respectively. It should be mentioned that in the proposed protocol, the CH with maximum energy level is considered. Also, the results are obtained by averaging the statistical community. As shown in Table 5, the number of packets sent is proportional to the life of the network under study compared to the classical LEACH method, and this is consistent with data compression. Also, the average death of sensor nodes in the proposed algorithms of Mamdani and type II shows a good improvement in increasing the life of the network. Also, with the help of the proposed technique, an increase in the lifetime for the average death of the nodes has been achieved with the type-2 fuzzy and Mamdani fuzzy methods. Table 6 also shows the compression rate of the packets and shows the compression improvement rate for several samples according to the proposed Huffman cascade compression performance. According to the compression results obtained for several different text and image data samples, it was observed that the proposed method has created a better compression ratio in the volume of information compared to the usual method. The duration of the simulation for the implementation of each of the techniques represents the lifetime of the network, which is proportional to the number of transmission packets, so the proposed method with the Mamdani-type fuzzy system has been able to give the maximum time to transmit information packets to the network.Table 5
Comparison of the results of the three proposed algorithms and different CH selection measures with LEACH.
AlgorithmDeath of the first nodeDeath of the middle nodeDeath of the last nodeNumber of pockets sent to BSTime of simulation (s)Number of nodes 10 nodes (first pattern)Mamdani fuzzy clustering175924598359002197TS fuzzy clustering13573011551260468Type-II fuzzy clustering124134532313250956LEACH clustering283830365027301058Table 6
Comparing the performance of the proposed compression technique (in bits).
Length of the aggregated dataConventional Huffman compressionCascode Huffman compressionImprovement3001941788.986003993783.19006416380.47At the end, the performance of the proposed methods for a studied wireless sensor network with the specifications of Table4 is given. As can be seen in Figure 9, the proposed protocol outperforms the other two protocols and the LEACH protocol. These results prove that the proposed algorithm can ensure network lifetime in 63.9% of cases. According to Figure 9, the network lifetime is increased 4 times compared to type-II fuzzy and TS considering the death of the first node. In this figure, it can be seen that the proposed techniques have a good performance for energy consumption and maximum use of network energy, and in Mamdani’s fuzzy system method, the power loss has been reduced with a very small slope. Also, due to the compression approach, the number of transmission packets has been able to transfer information to the sink node with a good ratio, and the changes in information transmission are much less than the leach method. On the other hand, it can be seen that in the proposed technique, the death of nodes is caused with a greater distance in different periods compared to the leach method. This result represents the resistance of the proposed techniques for the death of nodes. Figure 10 shows a bar graph of the results for comparing different techniques. By observing the results, the superiority of Mamdani and type II of fuzzy system techniques compared to other methods is presented.Figure 9
Comparison of the efficiency of the three fuzzy clustering algorithms with LEACH in terms of the number of live nodes to the number of rounds. (a) Structure of the studied network. (b) Takagi-Sugeno fuzzy type-I clustering algorithm. (c) Mamdani fuzzy type-I clustering algorithm. (d) Fuzzy type-II clustering algorithm. (e) LEACH algorithm.
(a)(b)(c)(d)(e)Figure 10
(a) Round at which half of the nodes alive for each clustering approaches. (b) Average number of received packets at end round.
(a)(b)Also, by applying the cascode Huffman compression technique, a maximum of 40% and a minimum of 30% compression are obtained for different samples with various correlations. According to the given table, it is seen that for different samples with shorter lengths, the proposed compression has compressed the data volume more than the conventional Huffman compression method.


## 6. Conclusion

In this study, the simulation results of the new clustering protocol based on fuzzy Mamdani system are presented using the proposed algorithm. The difference of cluster formation in the fuzzy clustering method with previous protocols is shown. Then, the diagrams and statistics are used to prove that the Mamdani fuzzy clustering protocol outperforms the two similar fuzzy clustering protocols and LEACH clustering in terms of increasing the effective lifetime of the network and the number of packets. Also, by applying the cascode Huffman compression method to the WSN for data aggregation and compression, the data transmission rate increased by 40% without losing energy.



---

*Source: 3860682-2022-09-22.xml*