Two novel protocols for optimizing energy consumption in heterogeneous wireless sensor networks using fuzzy logic for monitoring, diagnosis and target tracking

In this study, we present two novel protocols for optimizing energy consumption in heterogeneous wireless sensor networks for supervising the environment and multi-target detecting and tracking in real large-scale areas. The use of mobile sink in wireless sensor networks, despite its numerous advantages, is impossible in the majority of environments. Hence, by utilization of a novel scheme for duty cycle integrated with fuzzy logic, despite using a fixed base station, the propose protocol can enhance network lifetime even more than those protocols which use mobile sink for data collection. In this protocol, by introducing an unequal clustering method based on fuzzy logic, the possibility of energy holes problem is very far from expectation. Simulation of the proposed protocol through Matlab indicated that the proposed method outperformed other available methods with regard to preventing energy hole. Consequently, network lifetime is enhanced even in large-sized networks.


Introduction
A wireless sensor network (WSN) comprises a group of nodes working in co-ordination to accomplish the desired task. These sensors are efficient enough to manipulate the physical parameters such as temperature, moisture, vibrations, seismic events, moving objects, detection and measurement of materials resulting from chemical and microbial weapons and surveillance of the surrounding environments, etc. [1]. In general, a wireless sensor network consists of hundreds or maybe thousands of sensors with limited power for transmitting information. These sensors are autonomously placed in the respective environment and are able to self-manage themselves [2]. Nowadays, WSNs are widely associated with numerous applications such as military and medical applications, in defense systems, crisis management etc. Through sensing, sensors collect data from the surrounding environment.
Then, they transmit the gathered data to the base station. As mentioned above, sensors have limited computational and communication powers. In addition, their energy is provided by batteries that lose a part of their energies after each round of network operations and one bad thing is that replacing and charging batteries are impossible as they are in remote or impassable locations. As a result, optimizing energy consumption of sensor nodes is regarded as a fundamental challenge in WSNs which has widely attracted many researchers' attention in recent years.
Previous studies indicate that in case sensors directly transmit their gathered data to the base station or if they transmit the gathered data to the base station via other intermediate sensors which play the roles of gateways, energy consumption as well as data redundancy will be increased. Given the problem of increased energy consumption, clustering of WSNs is one of the recent solutions which has notably optimized energy consumption. The main rationale behind clustering is that network sensors are divided into small groups, called clusters, and each cluster selects a cluster head for itself which is responsible for transmitting the received data to the base station. Clustering generates a logical organization of network which facilitates the management of large-sized networks as well as small-sized networks [3]. Hence, a structured network has advantages over a structure less network. These advantages are: collecting data, reducing overhead caused from communications, simplicity of management, optimizing power consumption and enhancing network lifetime. Another challenge which leads to the early termination of network lifetime is the energy hole problem. After clustering is done and cluster heads are determined, sensors transmit their gathered data to the related cluster head. Next, the relevant cluster head compiles and overviews the collected data; after that, in case the cluster head is within an optimal distance from the base station, it will send the received data in one step; otherwise it will transmit the gathered data by means of other cluster heads. Hence, it can be maintained that those cluster heads which are within a shorter distance from the base station transmit not only the data of their own cluster members but also the data of other clusters. Consequently, sensors closer to the base station lose their energy earlier than the other sensors which leads to energy hole [4,5].
Motivated by the above challenges, we presented the Optimization energy consumption with multiple mobile sinks using fuzzy logic in wireless sensor networks [6], in this protocol we used the mobile sink and fuzzy logic to reduce energy consumption and prevent energy hole. Analysis of this protocol showed that thanks to using rendezvous nodes, fuzzy logic and smart trajectory selection by mobile sink the network lifetime can dramatically improve. However, this protocol suffers from complexity of mobile sink because in some cases such as mountainous areas it is not possible to use mobile sink. Therefore, in this paper we proposed two novel protocols which can be widely used in different scenarios. Performance evaluation of proposed protocol shows that although they are using fixed base station but can increase network lifetime and prevent energy hole problem in WSNs.
The rest of the paper is organized as follows: in Sect. 2, reviews some of the proposed related protocols and discusses their design and implementation. In Sect. 3 system model is mentioned. Section 4 presents the design details of the novel protocol. Section 5 presents a thorough performance evaluation of the proposed protocol. Finally, in section six, the conclusion of the study and directions for further research are reported.

Related works
In recent years, several methods have been proposed for sorting out energy hole problem and power consumption of sensors. Each of the proposed methods has its own pros and cons with respect to these problems. One of the common methods in this area is to cluster WSNs [7,8]. Here, the studies related to the method proposed in this paper are briefly reviewed.
CBHRP is a two-layered hierarchical routing protocol based on clustering [9]. Optimal use of energy is one of the most significant approaches for enhancing network lifetime. Hence, clustering-based hierarchical routing protocol was introduced which was a two-layered hierarchical routing protocol. The major difference between this protocol and LEACH protocol is related to a novel concept, namely the set of cluster heads which includes a dynamic cluster head and a number of other colleague cluster heads. Members of the set of cluster heads are in charge of controlling and managing network.
In 2000, with regard to clustering WSNs, Heinzelman et al. [10], introduced a protocol which is now regarded as the basis of many of studies. LEACH is assumed to be one of the first and most famous clustering protocols which has been proposed for WSNs. This protocol is probably the first dynamic routing protocol which specifically takes the requirements of WSNs into consideration and uses randomly distributed homogeneous sensor nodes. LEACH protocol is still regarded as the basis for other advanced clustering protocols in WSNs.
In 2013, Li et al. [5] introduced a method, namely the production and architecture of the construction of optimal clusters for enhancing throughput and network lifetime in homogeneous sensor networks (COCA). The solution proposed in this method is as follows: in case more than just a given node is involved in transmitting data to the base station and power consumption is distributed among all nodes, network lifetime will be developed accordingly. Also, in this year another protocol named EAUCF was introduced, in this protocol the CH is selected from among tentative CHs based on competition with regard to the remaining energy by means of fuzzy logic [11]. In this protocol fuzzy logic has two inputs and an output. The inputs are remaining energy and distance to base station and the only output is competition radius which uses the Center of area. In 2015, using fuzzy logic, Sert et al. [12], introduced a distributed unequal algorithm called MOFCA. In this method, the ultimate cluster head is competitively selected from among tentative cluster heads with respect to the amount of remaining energy. The tentative cluster heads are also determined based on a probable model. This algorithm uses the following three significant parameters: the amount of remaining energy, distance to the base station and the nodes' density. Here, using fuzzy logic, each node measures and checks its own competition radius. Then, tentative cluster heads are selected. Finally, the ultimate cluster heads are selected from the tentative cluster heads. This is considered to be a multi-purpose method which achieves an optimal method for clustering in both fixed and mobile networks.
In 2018 a virtual region based data gathering method was introduced to prolongs the network lifetime and enhance the efficiency of data gathering [13]. In this method they introduced a region based data gathering method with one mobile sink to solve the hot spot problem, it means, network is divided into several virtual regions consisting of some data gathering device. In each region they have one or more leaders according to their residual energy as well as the distance to all of the neighbors. In 2017, Srinivasa Rao et al. [14] proposed an energy efficient cluster head selection algorithm which is based on particle swarm optimization (PSO) called PSO-ECHS. In this method for energy efficiency of their approach various parameters are considered such as intra-cluster distance, sink distance and remaining energy of sensor nodes. They also proposed a cluster formation in which non-cluster head sensor nodes join their CHs based on derived weight function which introduced in this paper.
In 2019, in line with smarting the movement trajectory of the mobile sink, a protocol called Optimization energy consumption with multiple mobile sinks using fuzzy logic in wireless sensor networks was introduced [6]. Thanks to using mobile sink, this protocol enhances network lifetime. However, since this protocol cannot use mobile sink in rough locations with ups and downs and in impassable places, it may not be implemented in scenarios such as jungles, and mountainous areas.
All these methods have many advantages but also some drawbacks. Our proposed protocol has the following advantages over the existing algorithms: • Although [5,9,11,12] have somewhat resolved the energy hole problem. There are still some issues in large scale networks. However, based on simulation results the proposed method by using fuzzy logic and periodic sleep mechanism outperformed these previous methods in large scale networks. • In [11,12], they used fuzzy logic for clustering formation but they do not considered a sleeping mechanism which may lead to serious energy inefficiency of the network, whereas, our algorithm provides novel sleeping/wakeup mechanism and also we considered distance, residual energy and density parameters for clustering formation using fuzzy logic in contrast to the existing fuzzy algorithms. • Although proposed protocol uses stationary base station but simulation shows that it can outperform existing algorithms such as [6,15] which takes the advantage of mobile sink. • Proposed protocols can be used in different areas such as rough places with ups and downs where other methods such as [6,13,15] which uses mobile sink cannot be used.
In the present study, due to the limitations of using mobile sink in some areas, we used a fixed base station and two separate protocols for network clustering. A probable method was used in both protocols for selecting tentative cluster head and the final cluster head. Also, using fuzzy logic, we introduce a clustering method according to the following three input parameters which are used for solving the energy hole problem: distance to the base station, remaining energy and the density of the introduced tentative cluster head. It is observed that thanks to using fuzzy logic in unequal clustering and periodic sleep mechanism of sensors, network lifetime is improved even better than those protocols which use mobile sink for gathering data.

System model
The proposed method consists of a number of heterogeneous sensors which are distributed in the respective environment either randomly or in a predetermined mode according to two different protocols. In both protocols, different sensors were used for detecting sound, seismic features, chemical substances, movement and for detecting weight and other features. Also, in both proposed protocols it is assumed that the base station wakes up nodes using interrupt message and nodes are sleeping and wakes up using radio-trigged method which has been proposed in [16].
The first protocol was used for supervising the surrounding environment. It consists of a base station which is located at the center of network and a number of sensors which are randomly distributed in the environment. In this protocol, after sensors are placed in the environment, they will be able to start their activities.
The function of the second protocol is to detect targets. In this protocol, the location of each sensor is predetermined before deployment. It consists of a number of photoelectric super nodes located in the four corners of the network and a number of ultrasonic or acoustic sensors placed in the supervised area. In this protocol, ultrasonic or acoustic sensors go to the sleep mode for saving energy but as soon as photoelectric sensors detect an object, an interrupt message is sent which wakes up only those sensors in the relevant area. Hence, the related sensors go into the active mode so as to detect the respective object and inform the base station about it. In this protocol, sensors which are in the sleep mode for saving energy just listen to interrupt signals. In this way, the network will be able to be active for a longer period of time. Before discussing the details of the proposed protocol, the assumed system hypotheses, used in the evaluation, are mentioned below: • Sensors are heterogeneous and they have the same energy level at the distribution time. • Sensors are randomly distributed and each sensor is aware of its own location. (Most of the localization methods are carried out with the help of anchor or beacon node, which knows its location. Based on the location information provided by these nodes, other nodes localize themselves). • Base station consists of a sensor with an unlimited power source. • Base station is aware of the places at which sensors are located. • Each sensor is able to adjust its signal strength based on its distance from the destination. • The distance between two sensors is measured according to the received signal strength. Hence, sensors need not be aware of each others' placement locations. • As a result of the environmental factors, sensors will have small displacements. Nevertheless, since such displacements are due to external factors, they do not result in energy consumptions. • The super-node used in the network is a sensor with a high processing capability and more memory, stronger communication ability and a battery with a longer life in comparison with other network sensors.
The proposed protocol consists of several rounds where each round begins with a set-up phase and continues with a steady phase. Set-up phase includes the selection of awake sensors, tentative cluster heads, formation of competition radius, selection of ultimate cluster heads based on competition among tentative cluster heads and, at the end, formation of clusters. Also, in the steady phase, sensors sense data from the surrounding environment and exchange data from one another. The detailed descriptions of each of the two proposed protocols are given below.

The proposed algorithm
In designing the proposed protocol, two factors are taken into consideration. Firstly, it should be so light and feasible that it can be implemented in a real environment. Secondly, it should be optimal regarding energy consumption so as to enhance performance and network lifetime.

The first protocol
In this protocol, the network can support three different modes which are remotely managed by the command center. These three different modes include peace mode, semi-alert mode and fully-alert mode.
In all modes, the network is logically divided into four identical parts by the base station. Then, given the remaining energy of sensors and the current mode (peace, semialert or fully-alert modes) in which the network is located, the number of active sensors for each current round as well as their IDs are determined by the base station and they are informed about it through a broadcast message before the round starts. Regarding the peace mode, as its name denotes, the highest number of sensors will be in the sleep mode in each round. That is, as the peace mode is selected by the command center, the base station will broadcast a message to network nodes to inform them about the state of network modes. Then, since the base station is aware of the nodes location, remaining energy, ID number which is unique for each of them and dimension of network, it can logically divide network into four equal parts which means sensors are grouped in four different arrays. In each round, the base station will take 50% of the members of each part into the sleep mode. The sleeping sensors will turn off their radios and will only wait so that an interrupt message will wake them up. The remaining sensors will be clustered with respect to their distance from the base station and the cluster head will be selected.
Throughout the execution of the protocol, each sensor informs the base station about its remaining energy level as well as transmitting the sensed data by the cluster head. Hence, the base station will be always aware of the remaining energy level of the network sensors. It keeps these values (each separate part) in an array and sorts them in the ascending order. In this way, at the beginning of each round, 50% of the sensors with the least amount of the remaining energy in each part are taken into the sleep mode and the remaining sensors keep doing their activities. It should be pointed out that whenever the base station desires, it can return the sleeping sensors into the awake mode by sending a high-priority interrupt message.
Thus, at any moment, the command center can change network operation mode. Figure 1 illustrates an instance of clustering in the first mode; as shown in this figure, black circle indicates base station and triangular nodes denote sensors which have been taken into the sleep mode in the current round; moreover, nodes denoted by black circle are the sensors which are beyond an optimal distance for establishing communication with the nearest cluster head. Hence, in the current round, they have been also taken into the sleep mode.
In the second mode, referred to as semi-aware or semialert mode, due to higher significance, only 25% of the members of each part are in the sleep mode in each round and a higher number of sensors sense data from the surrounding environment. Like the peace mode, at the beginning of each round in this mode, network configuration is done by the base station for the current round. Then, sensors get to sense the surrounding environment and transmit information. Figure 2 shows an instance of clustering in the second mode.
In the third mode which is fully-alert or the critical status, all the network capacity is used for receiving data from the surrounding environment. Since high reliability is required in this mode, all network nodes are active for covering probable errors. Thus, higher number of active nodes as well as higher reliability provide the opportunity for sensing more data from the surrounding environment. Nevertheless, it is expected that more energy is consumed in this mode in comparison with the other modes. The steps of executing this protocol are given in pseudocode 1.

The second protocol
This protocol consists of a number of super photoelectric nodes which are located in the four corners of the supervised environment. The remaining sensors are acoustic or ultrasonic types which are distributed in the network environment in a predetermined way. The base station is located in the center of the network and sensors are clustered by means of fuzzy logic and send data to the base station via multi-mutation. In this protocol, after sensors are located in the environment, the base station logically divides network into 16 equal parts and ID is dedicated to each part. Next, the distance of each part from photoelectric sensors is measured; then, regarding the measured distance, each part is allocated to a photoelectric sensor.
After each photoelectric sensor recognizes its own parts, all network sensors, except for the photoelectric sensors, will go into the sleep mode via a message broadcast by the base station. In this way, they will save their energies. Now, after an object is supervised in a place near the environment, the closest photoelectric sensor will detect it and it will estimate its position and its distance from it. Next, via a high-priority-interrupt message, the photoelectric sensor will activate the part near that object which is on its path. Also, the photoelectric sensor will directly send a message to the base station and will inform it about the position and distance of the respective object. In this stage, the base station takes high-energy parts with closest distance to previous awakened part into the awake mode so that it can establish communications with the active part. As a result, the part close to the object will be into the supervision area of the next photoelectric sensor; that photoelectric sensor will wake up another part of the network. In this way, the object will be constantly supervised. In this protocol, one round denotes the distance limit in which an object can be detected up to the place from which the object gets out of the limit. Figure 3 shows an instance of WSN in which the second protocol is used. In this WSN, after an object enters the supervised environment, the first photoelectric sensor (bottom right side) detects it, wakes up the nearest part to the object and informs the base station about its presence. In a similar vein, the base station wakes up the needed parts. Next, clustering is done by means of fuzzy logic. In this stage, with the help of the cluster head, sensors start to transmit their own sensed data towards the base station.In case the sensors awakened by the photoelectric sensor are beyond the optimal distance for exchanging information with the base station, the base station will wake up high-energy sensors which are closer to it via an interrupt message in the multi-mutation method. Hence, network lifetime is improved more than that of the traditional methods. That is, in the traditional methods, sensors are in the active mode in all the network rounds but it is not the case with the proposed protocol. After information exchange is finished and the object exits the area, the base station takes the sensors to the sleep mode again through a broadcast message and the execution of the protocol restarts. The steps in implementing this protocol are given in pseudocode 2. able to transmit its sensed data by means of other parts and through multi-mutation method. Next, clustering is done with the aid of fuzzy logic. By disseminating sound and receiving it, ultrasonic sensors detect the speed and movement direction of the object and inform the base station about it. In case the respective object moves along the borderline of the network, the object will get

Network clustering
Network clustering is one of the methods for reducing energy consumption in WSNs which has been proved to be effective. Classical WSNs is composed principally of central sink that is responsible for data collection in the network. Cluster heads and sensor nodes can be deployed to transmit and relay the message to central sink by using the 802.15.4 protocol [17][18][19]. However, as mentioned before, clustering leads to the occurrence of energy hole problem. The main rationale behind clustering via fuzzy logic is that as the distance of clusters from the base station is reduced, the number of cluster heads increases. By applying this method, when more distant cluster heads want to transmit their data to the base station through closer cluster heads, energy consumption is shared among much more cluster heads that are available in the vicinity of the base station. As a result, the occurrence of energy hole problem is notably prevented. Clustering and fuzzy logic applied in both of the proposed protocols are an identical method. Before discussing fuzzy logic, behavior of nodes after their placement in the network in both of the two proposed protocols should be described.
In the first protocol, after sensors are placed in the environment (first round), given the fact that the remaining energy of all the sensors are equal and they all have identical status, the base station will be responsible for clustering. In other words, regardless of the network mode, the base station will establish clustering in the first round through broadcasting a message. In the clustering process for the first round, the base station is aware of the number and location of sensors and their IDs. Hence, it determines the optimal number of clusters and cluster heads and the ID of each cluster head. Then, it informs all the network sensors about the optimal number of clusters and cluster heads. After that, by broadcasting a separate message, each of the selected cluster heads introduces itself to the other nodes as the ultimate cluster head of the current round. As network nodes receive the cluster heads' broadcast message, they select the nearest cluster head based on the strength of the received signal (the stronger the signal, the shorter the distance). Then, by directly sending a message to the cluster head, each node introduces itself as a cluster member by announcing their ID and location. Now, through sending a direct message, the cluster heads will send a separate verification message to each of the cluster nodes. In this way, clusters of the current round are formed and the network enters a steady phase mode in which all the sensors get to sense the environment and transmit their data. In the first protocol, network sensors, in each round, send not only their data but also their remaining energy and IDs to the base station through a cluster head. Hence, as the first round ends and the second round begins and with respect to the selected mode of the network, the base station logically divides network into four equal parts. Then, in each round, it introduces a number of nodes in the sleep mode and other nodes in the awake mode. If it is assumed that network is in the peace mode, as the second round starts, the base station broadcasts a message and in this way, it changes the mode of 50% of each part sensors into the sleep mode. After each sensor gets aware of its status for the current round, clustering for the current round starts. At this time, provided that nodes were not cluster heads in the previous round, they select a random number between zero and one. In case the selected number is less than the threshold (Th) of the tentative cluster head, that node will be changed into tentative cluster head (TCH). In the next stage, tentative cluster heads execute fuzzy logic, which is discussed in the next section. Then, they obtain their competition radius; next, as a result of competition among tentative cluster heads, final cluster heads are formed. This procedure is done in each round.
Regarding the second protocol, the main difference in comparison with the first one is that network does not have different modes. Rather, using a smart algorithm, it makes use of a number of photoelectric sensors for awakening other sensors. Clustering mechanism of the second protocol is similar to that of the first protocol. That is, after sensors are placed in the environment, at first, the base station logically divides the network into 16 equal parts in the first round. Then, by broadcasting a message, it mentions the locations and ID of the photoelectric sensors to the other sensors. Next, via a direct message, the base station informs photoelectric super nodes about the ID and location of each of the other sensors. In this way, photoelectric sensors do the same division and nominate certain parts for themselves which should be awakened in dangerous conditions. After sensors get aware of each others' locations, the first round ends and, except for the photoelectric sensors, the remaining sensors are taken into the sleep mode via a broadcast message by the base station; they also put their radio in the low-power mode for consuming less energy and wait for the interruption message from the photoelectric sensors or the base station. Towards the end of each round, sensors in the active mode announce their remaining energy as well as sending their data. In this way, the base station will be always aware of the remaining energy of the network sensors. Photoelectric sensors in this protocol are referred to as super-nodes which denotes that they have higher computational capability, memory capacity, power source and radio wavelength in comparison with other nodes.

Fuzzy logic
In clustered WSNs nodes closer to the sink run up their energy sooner because they transmit large amounts of data, this is called energy hole problem or also called as the hot spot problem. So the energy hole problem is created due to energy depletion of the node which is near the sink. In this manner, no more data can be delivered to the sink after energy hole appears. Consequently, a considerate amount of energy is wasted and the network lifetime ends prematurely. In this paper we used fuzzy logic approach which have recently used in [12,20] to handle uncertainties in cluster head radius estimation. In this fuzzy approach the CH election occurs by considering three fuzzy descriptors namely distance to BS, residual energy of each node and the density of the node with the aim of estimating the competition radius for tentative CHs. At the beginning of each round, network nodes are in a normal status. If they were not cluster heads in the previous round, they can select a random number between zero and one. In case the selected number is less than threshold of the tentative cluster head, that node will change its status into the tentative cluster head. Then, using three parameters, namely distance to the base station, density and remaining energy, these tentative cluster heads will measure and create their competition radius according to the fuzzy rules [12,20]. Given the fact that tentative cluster heads make use of the above-mentioned three parameters for measuring competition radius, it is obvious that the value of competition radius will change as these input parameters vary throughout the execution of the protocol; otherwise, the energies of the sensors will deplete quickly.
Regarding the three input parameters, distance to the base station is aimed at determining the sizes of clusters and the number of clusters in the network. Density parameter is intended to cover and consider the impacts caused by the probable displacements of sensors due to natural factors; remaining energy is regarded as a key parameter in selecting the ultimate cluster head. According to fuzzy rules in case the tentative cluster head has high density and its distance to the base station is medium or far, it will have a large competition radius (the density of the ultimate cluster heads in this part of the network will be less) and it will include a higher number of nodes within its cluster. On the other hand, when the distance of the tentative cluster head to the base station is close, high density is regarded as an appropriate opportunity for establishing higher number of clusters and, consequently, more cluster heads. Hence, competition radius of the tentative cluster heads in this area of the network will be minimal. Using this distributed mechanism and thanks to the fuzzy logic, unequal clusters are formed. As a result, higher number of nodes, located near the base station, function as a relay and transmit data to the base station; they also prevent the energy hole problem. The density of tentative cluster heads is measured via Eq. 1.
In this equation, d i denotes the density of the tentative cluster heads; NOA indicates the number of alive nodes, i.e. the ones which have energy, within the coverage radius of that tentative cluster head; n refers to the number of alive sensors in the entire network. The value of NOA is measured in this way: a Hello message is sent by the tentative cluster head within its coverage range and the number of received responses (Ack) from the other sensors is measured and the n value is diffused and broadcast by the base station throughout the entire network at the end of each round. Thus, it can be argued that, in the proposed protocol, all the sensors are obliged to respond to the Hello message.
In the proposed protocol, the only output variable is the competition radius of the tentative cluster heads. The fuzzy set involved with this output variable may vary according to different scenarios. Hence, given different simulation scenarios, different fuzzy sets were used. In case a specific cluster head has the highest distance to the base station, its power source is full and its density is congested, it will have the largest competition radius. In reverse, if a tentative cluster head has close distance to the base station, its remaining energy is low and its measured density is dense, it will have the minimum competition radius; in this case, we will have more cluster heads. Other modes and statuses are between the above-mentioned modes. For controlling the size of clusters, a fixed parameter, namely maximum competition radius, is needed which is announced to network nodes by the base station. As a result, each node will measure its competition radius according to this value.
After tentative cluster heads are determined and they specify their competition radius, at this point, the competition involving the selection of the ultimate cluster head starts. Each tentative cluster head sends a message to other tentative cluster heads among its competition radius. This message includes ID, competition radius value, density and remaining energy of that node. It should be underscored that the remaining energy level is a key parameter in this competition. When tentative cluster heads receive a candidacy message from a tentative cluster head which is within their competition radius and the remaining energy of the sender is more than the receiving tentative cluster heads, they will quit the competition by sending a cancellation message. However, if the remaining energy of the message sending and message receiving tentative cluster heads are the same, the node with (1) d i = NOA n more density will be selected as the ultimate cluster head. This competition guarantees that there is no other cluster head within the finally selected cluster head's competition radius. By controlling the size of competition radius, we can have more cluster heads in the vicinity of the base station.
When the competition ends and the final cluster heads are selected, each of them broadcasts a message and introducing itself by sending its ID as the cluster head in the current round. Other nodes select the nearest cluster head based on the strength of the received signal. By sending a message, they introduce themselves as the members of that cluster. Each cluster uses a different CDMA code for preventing radio disorder among neighboring clusters. That is, after cluster is formed, cluster head randomly selects a model from its table of codes and informs its members by broadcasting it through a message. As a result, cluster members will exchange information based on the announced code. In this way, no disorder or collision will occur among the network clusters. On the other hand, with respect to the prevention of congestion and useless energy consumption of sensors, in the first protocol, the cluster head allocates a time interval for each node based on TDMA scheduling; accordingly, at this assigned time interval, each node should send data and use the communication channel. Regarding the second protocol, based on CSMA/CD scheduling protocol, each node checks the environmental conditions before it transmits data. Only if there is no traffic in the environment, it sends its data. That is, the transmitter gets feedback from the receiver before sending data so that it can figure out whether another transmitter is busy sending a message or not. In case the communication channel of the receiver is free, data will be transmitted. For more details about fuzzy approach and its tables please refer to [12,20].

Routing
After the end of the cluster formation process, now, it is time to send data to the base station. In this stage, network nodes send their sensed data to the cluster head according to the scheduling which cluster head has given to them at the beginning of the clustering. After compressing data and eliminating duplicate data, the cluster head directly sends the gathered data to the base station provided that the distance is less than TD_MAX which is equal to d 0 (optimal value for data transmission by the wireless media which described in Eq. 5). Otherwise, the cluster head will transmit data to the base station with the help of other cluster heads. In the proposed clustering, after the clustering process is ended and cluster heads get members, nodes, located at distances more than d 0 from the nearest cluster heads, go into the sleep mode because their information exchange will be costly. Furthermore, the sleeping one or a few nodes in each round will not affect network performance.
In the proposed protocol, in case the data transmission distance is less than d 0 , the consumed power resulting from the data transmission will be the second exponent of d. On the other hand, if the transmission distance is more than this value, due to using amplifier, the consumed power will the fourth exponent of d. Thus, in routing of the proposed protocol, the value of TD_MAX = d 0 is taken into consideration. Based on the assumptions, in the proposed protocol, sensors can adjust the strength of their transmitted signal according to their distance from the destination. Hence, the distance between two sensors or the distance between a sensor and the base station are measured according to Eq. 2.
After the end of clustering, cluster heads compute their distance to BS. Then, through broadcasting an ID message, the cluster heads inform their neighboring cluster heads about the remaining energy and distance to the base station. Consequently, each cluster head will have an array of its neighbors' distances from the base station as well as their remaining energy and ID. Next, it will sort the array in terms of the maximum energy and the least distance from the base station. In this way, if the distance to the base station is more than d 0 at data transmission time, the cluster head will transmit data by means of the neighboring cluster head in the first index of the sorted array. Other cluster heads buffer the data received from other cluster heads for a certain time and send them to other cluster heads after doing some processes on them. Hence, in case the memory of the neighboring cluster head which wants to do the relay operation is full, the cluster head will select another node from the next index of the array of neighboring cluster heads. Figure 4 illustrates an instance of clustering by the first proposed protocol under the conditions in which all the network nodes are active and the base station is at the center of the network. As shown in this figure, 100 sensors have been randomly distributed in a 200 m*200 m area. The base station is denoted by a black circle at the center; cluster heads and other network members have been also illustrated. It is observed that a sensor which does not have a desirable distance (d 0 ) from any cluster heads, will go into the sleep mode in this round and will switch off its radio. Furthermore, thanks to using fuzzy logic, the shorter the distances of the clusters from the base station, the smaller the sizes of the clusters and the higher the number of cluster heads. In reverse, the more the distance, the bigger the clusters and the lower the number of cluster heads.

Energy model
The energy model used in this paper is based on the same radio model as used in [10]. Hence, the consumed energy for transmitting a data bit with the d 0 distance is measured via Eq. 3.
In this equation, l denotes the data length; d refers to the distance in meters. The consumed energy at the data reception time is measured through Eq. 4.
The value of d 0 which refers to the optimal distance for data transmission is measured through Eq. 5. E TX parameter denotes the consumed energy for sending one data bit; E fs refers to the consumed energy by power amplifier in the free space model; E amp refers to the consumed energy by the power amplifier in the multiroute model. If data transmission distance is less than the optimal value d 0 , the consumed energy will be the second exponent of d. On the other hand, if transmission distance is more than d 0 , the consumed energy will be the fourth exponent of d [21]. The total consumed energy for sending and receiving data is measured via Eq. 6.

Simulation and evaluation of the results
The proposed protocol was simulated and the related results were investigated and compared with those of EAUCF [11] and MOFCA [12] protocols in which the location of the base station is fixed. It was also compared with a protocol based on mobile sink in which fuzzy logic, namely an energy efficient new protocol for wireless sensor networks with multiple mobile sinks (in this section it will be referred as Mobile Sink protocol) [6]. It was found that, thanks to using sleep mode for sensors, the proposed protocol, despite using a fixed base station, was able to notably reduce energy consumption of sensors to prolong network lifetime.
Handy et al. [22], used certain criteria such as the first node die (FND), half of the nodes alive (HNA) and the last node die (LND) for evaluating the simulation results. FND refers to the number of the round in which the first node in the network completely loses its energy. Nevertheless, this criterion is not appropriate for large-sized networks with huge number of sensors. That is, in such a huge network, the loss of one sensor has no significant impact on network performance. HNA denotes the number of round in which half of network nodes lose their energies and only the other half of sensors can keep operating in the network. This criterion is regarded as the most significant and the most reliable criterion in evaluating the performance of WSNs. LND is not regarded as an efficient and reliable criterion for checking network performance because simulation results indicate that after 75% of network sensors are lost, network will turn inefficient and inadequate. Hence, the number of the round in which the last sensor is lost has no significance in the evaluations. Also, in the conducted evaluations in this paper, we used another criterion, i.e. total remaining energy (TRE), which denotes total remaining energy of the nodes at a specific round. This value is measured by Eq. 7.
In this equation, E r (N) refers to the energy level of N nodes at the rth round. After the formation of network, each ordinary node transmits 4000 data bits to the previously selected cluster head. Also, the cluster head compresses the data received from its members as much as (7) Remain.Eng total (r) = n ∑ N=1 E r (N) Fig. 4 WSN using the first proposed protocol in the fully-alert mode 10% and sends them to the base station. The length of the aggregated data is measured by Eq. 8.
In this equation, L agg indicates data length in bit; L rec refers to the data received from the cluster members; R agg denotes the aggregation rate and N refers to the number of cluster members. The proposed protocol was simulated in four scenarios in different modes and different network sizes. The initial energy of the sensors in all scenarios was 0.25 J and the base station was located at the center of the network. Moreover, all the stages of the simulation in each scenario were executed more than 100 times by MAT-LAB R2015a and an average result was measured for them. Table 1 gives the simulation details in all scenarios [10,15].

Scenario 1
In this scenario, network size was 150 m*150 m and the base station was located at the center of the network. Maximum competition radius for the first and second proposed protocols was 50 and 40 m, respectively. Table 2 gives the results of different criteria for the first scenario.
As shown in this table, the second protocol had relatively better performance than the other methods. The simulation results indicate that the proposed protocols, except for the fully-alert mode in the first protocol, had a better performance which is attributed to using fuzzy logic and sensors sleep and wake up process. It should be highlighted that the proposed protocol outperformed even those protocols with mobile sink. However, in the fully-alert mode, since all sensors were used in all rounds which is the case with other protocols, the network had the highest energy consumption and lost its energy earlier than the other methods. As shown in Table 2 the peace mode of the first protocol saved up to 265% more energy compared to fully alert mode. The semi-alert mode also saved up to 110% more energy compared to the fully alert mode. Figure 5 shows the ratio for the number of dead nodes to the number of rounds in the first proposed protocol in comparison with other protocols. As shown in this figure, the peace mode has the best performance in comparison with other modes and protocols.
Moreover, Fig. 6 depicts the ratio of the number of dead nodes to the number of rounds in the second proposed protocol. As shown in the following figure, the second proposed protocol outperformed the first proposed protocol and other protocols, even the ones with mobile sink. It loses its sensors later than the other protocols.
In addition, Fig. 7 illustrates the total remaining energy of all sensors (TRE) in relation to the number of rounds. (8) L agg = L rec + L rec × R agg × N Since the initial energy of each node was assumed to be 0.25 J, the total energy of all sensors will be 25 J. It is expected that, as the number of rounds increases, the total energy of the sensors decreases. Hence, as shown in the following figure, the peace mode has the highest performance in comparison with the other methods.
Moreover, Fig. 8 depicts the total remaining energy in relation to the number of rounds for the second proposed protocol. It can be observed that the second proposed protocol outperforms the first proposed protocol and the other protocols.

Scenario 2
In this scenario, the network size was 200 m*200 m and the base station was located at the center of the network. Given the simulation results, the optimal value of the maximum competition radius for the first and second proposed protocols were 60 and 40 m. Table 3 gives the simulation results for different criteria in the second scenario.
As expected, according to Table 3, the second proposed protocol and peace and semi-alert modes of the first proposed protocols had the highest performances, respectively, in comparison with the other protocols. However, it should be pointed out that the method with the mobile sink performed better than the fully-alert mode. In contrast, since a number of sensors go into the sleep mode in each round in the semi-alert and peace modes, network lifetime is enhanced and they have more the implementation ease and simplicity than the method with mobile sink. Figures 9 and 10 illustrate the ratio of the number of dead nodes to the number of rounds. It was found that the second proposed protocol and peace and semi-alert modes of the first proposed protocol had the highest performances in comparison with the other methods.
The results indicated that the protocol including the mobile sink performed better than the fully-alert mode in which all the sensors are awake in all rounds.
Also, Figs. 11 and 12 depict the total remaining energy in relation to the number of rounds (TRE).
It can be observed from Figs. 11 and 12 that the second proposed protocol has better performance than the other protocols.

Scenario 3
In this scenario, network size was 300 m*300 m and the base station was at the network center. Based on the obtained results from the conducted simulations, the optimal value of the maximum competition radius for this size of the network was 70 m in the first proposed protocol and 60 m in the second proposed protocol. Table 4 gives simulation results for the different criteria.
As it is observed in the table above, as expected, the second proposed protocol performed better than the other protocols. As shown in Table 4 the peace mode of the first protocol saved up to 116% more energy compared to fully alert mode. The semi-alert mode also saved up to 61% more energy compared to the fully alert mode. Figure 13 and 20 depict the ratio of the number of dead nodes to the number of rounds. Thanks to the application of photoelectric sensors and sensors sleep and wake up process, sensors lose their energy notably later than the nodes of other protocols.
Next to the second proposed protocol, peace and semi-alert modes in the first proposed protocols lose their energy, respectively. Also, the protocol including mobile sink performed better than the other methods (Fig. 14).
In addition, Figs. 15 and 16 shows the total remaining energy (TRE) in relation to the number of rounds.
The results indicate that, the second proposed protocol remarkably outperforms the other protocols.

Scenario 4
In this scenario, a 400 m*400 m network was taken into consideration. Given such a network scale, the majority of the current protocols encounter different issues and problems regarding power consumption and energy hole. In a similar vein, in this scenario, the base station was located at the center of the network. Maximum competition radius in this scenario was 90 m for the first proposed protocol and 80 m for the second proposed protocol. The following table gives simulation results with respect to different criteria.
As shown in Table 5, despite the huge size of the network, the first and second proposed protocols outperformed other methods. This table shows that the peace mode of the first protocol saved up to 149% more energy compared to fully alert mode. The semi-alert mode also saved up to 86% more energy compared to the fully alert mode. Figures 17 and 18 illustrate the number of dead nodes in relation to the number of rounds in the simulation of the proposed and other protocols.
It can be observed in these figures that all the protocols in such a large network lose their energy much faster.   Nevertheless, despite high power consumption in such a large network, the second protocol managed to significantly enhance network lifetime. Also, peace and semialert modes were able to improve lifetime better than others. Finally, Figs. 19 and 20 depict the total remaining energy (TRE) in relation to the number of rounds.
According to the results, the second and first protocols enhanced lifetime and prevented energy hole problem.

Conclusion
In this paper, we have presented two novel protocols to optimize power consumption in WSNs using unequal clustering with the help of fuzzy logic and fixed base station rather than a mobile sink. As mentioned in this paper, the application of mobile sink in different areas such as rough places with ups and downs is impossible. Thus, in this study, we proposed two protocols for enhancing network lifetime in different scenarios such as target tracking. We have shown simulation results along with their comparisons with various existing algorithms. The algorithm has been extensively tested with several scenarios of WSNs. The results indicated that, thanks to using fuzzy logic as well as sensors sleep and wake up  process and despite using a fixed base station, peace mode of the first proposed protocol is 95% better than the Mobile Sink protocol in the HNA criteria. Also, semialert mode of the first proposed protocol is 20% better than the Mobile Sink protocol in the HNA criteria. But the Mobile Sink protocol works 22% better than fully-alert mode of the first proposed protocol. As an average, the first proposed protocol improved 31% total lifetime in comparison to Mobile Sink protocol in the HNA criteria. The second proposed protocol, on average, increased 461% network lifetime according to the HNA criteria in comparison to Mobile Sink protocol. However, in the first proposed protocol, three modes, i.e. peace, semi-alert and fully-alert, were able to improve network lifetime in both FND and HNA criteria as well as implementation simplicity and acceptable network coverage. In other words, by applying sensors in real environments, we can supervise and control the intended area.
As a direction for further research, because of the importance of information security and network reliability in military areas we look forward to implement a link layer encryption protocol that provides all required security services to prevent attacks such as reply or active attack and improves the reliability of network.   In addition to the above, it must able to reduce energy consumption by minimizing security related communication overhead. Also, the proposed protocols can be improved with regard to different aspects. That is, in case the environmental conditions are provided, a mobile sink rather than the fixed base station might be used in the first proposed protocol. Also, multiple base stations may be used in large supervised environments. In the proposed protocol, due to using the parameter of density in clustering, nodes' displacements by natural environments were taken into consideration. At this point, the intentional displacements of the nodes can be added to the network so that, if needed, nodes can change their positions. In the proposed protocols particularly the first protocol, we used broadcast mechanism to determine nodes status at the beginning of each round. However, this will lead to some failures especially in large scale networks and will decrease fault tolerance of the proposed algorithm.

Declarations
Conflict of interest The author declares that they have no conflict of interest.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.