LACFA: an algorithm for localization aware cluster formation in wireless sensor networks

The ability of a sensor node to determine its position is a fundamental requirement for many applications in wireless sensor networks (WSNs). In this article, we address a scenario where a subset of sensors, called anchor nodes, knows its own position and helps other nodes determine theirs through range-based positioning techniques. Such techniques benefit from a high degree of connectivity, since range measurements from at least four anchor nodes are necessary (three-dimensional scenario). On the other hand, WSN topologies, most notably the cluster-tree topology, tend to limit connectivity between nodes to save energy. This results in very poor performance of the network in terms of localization. In this article, we propose LACFA, a network formation algorithm that increases the probability of localization of sensors in a cluster-tree topology. It does so by properly allocating anchor nodes to different clusters during the network formation phase. Our algorithm achieves very high localization probability when compared with existing cluster formation algorithms, at no additional cost. Moreover, a distributed cluster formation algorithm, with no need for any centralized information exchange mechanisms, is defined.


Introduction
Wireless sensor networks (WSNs) consist of small, lowcomplexity sensor nodes interconnected through wireless links.WSNs provide applications for monitoring and automation in different fields, such as agriculture, industrial environments, home, or smart cities.Low energy consumption is one of the main priorities of WSNs, as sensors are typically battery-operated, and battery replacement may be costly or not even possible.Therefore, it is crucial to employ energy-efficient protocols.The 802.15.4 [1] standard is a suitable candidate for WSNs, specifying both physical (PHY) and Medium Access Control (MAC) layers.Moreover, an alternative PHY, the IEEE 802.15.4a [2], based on ultra-wideband, has also been standardized.Finally, ZigBee [3] is an industrial standard that defines the network and application layers for sensor networks based on IEEE 802.15.4 PHY and MAC layers.One of the features that these standards characterize is the topology of the WSN.Besides a star topology, the 802.15.4/Zigbee standard supports mesh and cluster-tree topologies.
The ability of sensor nodes to know its location is an enabler for many location-based applications.Owing to the ad hoc character of WSNs, a distributed positioning of the target nodes is more attractive than centralized algorithms [4].Probabilistic methods (e.g., [5,6]) take into account uncertainty of the measurements, but they require larger computational complexity than deterministic methods.We focus on anchor-based algorithms with a scenario where some sensors, called anchor nodes, know its own location (by means of Global Navigation Satellite System, GNSS for short, or by installing them at points with known coordinates) and help localize other sensors.Sensors with unknown location information are called non-reference or target nodes, and their coordinates need to be estimated using a sensor network positioning algorithm [7].In this context, range-based algorithms [8] rely on distance between nodes, which is usually measured with received signal strength indicator (RSSI)-time of arrival (TOA)-time differential of arrival (TDOA)-or angle of arrival (AOA)-based techniques.Fingerprinting techniques [9] are based on ranges but require centralized algorithms.
Range-free techniques (e.g., [10,11]) are not based on the previous metrics, for instance, averaging broadcasted positions of surrounding anchor nodes.However, they typically provide a higher estimation error than the rangebased approaches.IEEE 802.15.4a provides mechanisms for precision ranging using TOA by means of an Ultra-Wide band (UWB) PHY layer and location primitives, while RSSI-based range estimation methods are also possible with IEEE 802.15.4.Thus, target nodes coordinates can be estimated using anchor-based algorithms [8] that use the available a priori knowledge of positions of anchor nodes in the network.This type of localization allows cooperation between the nodes [4].With cooperation, target nodes that are able to determine their position become anchor nodes, thus providing new references for the remaining target nodes.
In the literature, a number of algorithms based on range and anchor nodes have been proposed for sensor networks [4,[12][13][14].Also algorithms for TOA and UWB have been presented [15,16].Most of the previous references are based on mesh WSNs.Localization with Zigbee and RSSI in a cluster-tree WSN is studied in a few studies works such as [17].For range-based localization algorithms, the success of the location discovery depends on the network connectivity [12].In [12,13] a multilateration algorithm for localization is presented as well as multi-hop ranging solutions for nodes with low connectivity to anchor nodes.However, previous studies do not take into account the limitations that network topologies supported by the standards can introduce in range-based localization algorithms.While the connectivity between nodes in a mesh network is high, it is considerably reduced in a cluster-tree topology.This presents advantages, such as energy saving, but it severely degrades the performance of range-based localization.This aspect is not addressed in the literature, which focuses in providing clustering algorithms with high energy efficiency [18,19], such as, for example, the LEACH algorithm.The authors of [20] address the problem, showing that indeed localization does not work properly in cluster-tree topologies.However, the design of a clustering algorithm with the goal of enhancing localization performance has not been addressed to the best of these authors knowledge.
The main contribution of this article is to provide a solution to improve positioning in cluster-tree topologies defined in the standards.In this direction, we propose LACFA, a network formation algorithm that increases the probability of positioning of sensors in a cluster-tree topology.It does so by properly allocating anchor nodes to different clusters during the network formation phase, and by allowing peers in the same cluster to perform ranging with each other.This simple algorithm greatly improves the probability of positioning of sensor nodes for a moderate density of anchor nodes.As has been shown, it outperforms LEACH without paying a penalty in terms of energy consumption.Moreover, the algorithm is analyzed in terms of mean square error with both TOA and RSSI rangings, providing satisfactory results in all cases.Results show that LACFA increases one-hop connectivity from target to anchor nodes improving the one-hop range-based positioning.
The remainder of this article is organized as follows: In Section 2, we describe peer-to-peer topologies in the IEEE 802.15.4/Zigbee and 802.15.4a standards.In Section 3, we explain the considered range-based positioning algorithm based on trilateration.In Section 4, we describe rangebased positioning for the mesh and cluster-tree WSNs.Based on this analysis, we propose schemes for positioning in a cluster-tree topology.These solutions are used with our algorithm for localization aware cluster formation (LACFA) presented in Section 5. Numerical results are provided in Section 6, and conclusions are drawn at the end of this article.
2 Peer-to-peer topologies under Zigbee and IEEE 802.15

.4a
Peer-to-peer topologies supported by Zigbee and IEEE 802.15.4 standards will be used in this article.The IEEE 802.15.4/Zigbee protocol stack is shown in Figure 1.IEEE 802.15.4 defines physical and MAC layers, while Zigbee defines the network (NWK) and application layers.In order to enhance localization, the 802.15.4a alternate physical layer was standardized [2], supporting time of arrival ranging.In 802.15.4 [1], two types of devices, reduced function device (RFD) and full function device (FFD), are defined, where only an FFD may be the coordinator of a personal area network (PAN) or cluster.In the following, we will assume where necessary that sensors are FFDs.The 802.15.4/Zigbee standard supports star and peer-to-peer topologies.Within peer-to-peer topologies, we distinguish between mesh and cluster-tree networks [3], both shown in Figure 2.
In a mesh network, any sensor may communicate with any other sensor within its range, and route messages from other sensors, enabling the formation of complex self-organizing topologies.The mesh topology places no restrictions on the connectivity between nodes, maximizing network coverage.On the other hand, nodes need to listen to the medium continuously, causing this topology to be highly energy consuming.In a cluster-tree network as defined by Zigbee, a FFD, acting as PAN coordinator, initiates the network and becomes root.Sensors are then grouped in clusters where a coordinator is the cluster head, and several other devices are leaf or child nodes.The cluster head sends periodic beacon frames that are used by sensors within its range to attach to the cluster as child nodes.These nodes may, in turn, send new beacons and form a new cluster, resulting in a cluster-tree.This structure is highly energy efficient since sensors synchronize with their parent node.Moreover, the resulting tree topology greatly simplifies routing.The 802.15.4a standard supports both star and mesh topologies, while the clustertree topology falls outside the scope of the standard, since upper layers are not addressed.
The MAC layer defined by the 802.15.4 standard [1] specifies two modes of operation: beacon-enabled and non-beacon.In the non-beacon mode, Carrier Sense Multiple Access with Collision Avoidance (CSMA-CA) is used, which requires long listening periods which decrease the energy efficiency of the protocol.The beacon-enabled mode greatly improves energy efficiency by defining the so-called superframe, shown in Figure 3.The superframe, managed by the cluster head, contains the synchronization beacon, followed by a contentionaccess period (CAP), and an optional contention-free period (CFP).During the CAP, the channel is accessed using slotted CSMA-CA.In order to minimize interference, neighboring clusters in a cluster-tree may concatenate superframes as shown in Figure 3, where rectangles denote active parts of the superframe (beacon in black and CAP in white).The defined parameters that configure the superframe are adjustable by 802.15.4/Zigbee.

Range-based positioning in WSNs
In this section, we focus on the positioning problem in a WSN.Particularly, we address the range-based approach in which a node that aims at determining its position first estimates its distance to a reference node using a ranging technique (e.g., RSSI or TOA).Afterward, these ranges are used to solve a geometrical problem referred to as trilateration.
There is a plethora of techniques for ranging in WSNs, see, for instance, the studies in [8,21].In this article, we consider RSSI-and TOA-based techniques.While RSSI techniques use measurements from the signal power at the receiver, TOA is based on the estimation of the travel time that a signal takes from the transmitter to the receiving node.The advantage of the RSSI approach versus TOA techniques is that it requires no additional hardware.However, while RSSI is greatly affected by multipath fading, TOA with UWB is a much more robust ranging technique since the large bandwidth of a UWB signal provides high time resolution [4].
Concerning TOA-based ranging, the IEEE 802.15.4a [2] standard defines a mandatory ranging protocol called two-way time-of-arrival (TW-TOA) and an optional Symmetric Double Sided (SDS) TW-TOA protocol that reduces the effect of the finite crystal tolerances at the local oscillator [2].In order to start the ranging protocol, an upper layer of 802.15.4a standard (the protocol stack is shown in Figure 1) calls a primitive of the MAC layer.This primitive is named MCPS-DATA.requestand it is used for requesting data.Also, this primitive has to be called with a corresponding attribute to start ranging [2].
The problem under study involves the positioning of N n target coordinators in a WSN that contains N r reference coordinators emitting ranging signals to allow positioning of the latter.In this article, we consider the topologies defined in the two standards, namely, the Zigbee standard with RSSI-based ranging and the 802.15.4a standard with TOA-based technique for UWB devices.We address the following WSN topology configurations: 802.15.4a mesh WSN; Zigbee mesh and Zigbee cluster-tree WSNs; and a WSN based on 802.15.4aPHY layer with cluster-tree topology similar to Zigbee.We assumed a uniform random deployment of the N n + N r nodes in the simulation results that are provided in Section 6.Let us define the three-dimensional coordinates of target and reference nodes as respectively.Notice that for the trilateration procedure to be valid, we need to assume that positions of the reference nodes are known.The geometrical distance between the jth node and the ith anchor is defined as with ||•|| being the Euclidean norm in ℝ.
We can identify different range models depending on the technology used.On the one hand, we consider the following observation equation for TOA-based ranging where j = 1, 2,..., N n and i ∈ N j , with N j being the set of reference nodes from which the jth node receives ranging information.ν j,i ∼ N (0, σ 2 j,i ) is additive measurement noise, independent among measures.
On the other hand, RSSI-based ranging measures are commonly modeled using the log-normal path loss model [22], defined as where r o is the reference distance, L o is the attenuation at such reference distance in dB, r j,i is the distance between nodes j and i, L j,i the path loss for the distance r j,i in dB, and p the path loss exponent (typ.3 in our scenarios).Notice that L j,i = P T x,j − P Rx,i , where P T x, j and P Rx,i are the transmitted and received powers in dBm for the pair {j, i}, respectively.If the randomness due to received power estimation is modeled by ν j,i ∼ N (0, σ 2 j,i ) in dBm, then we can write resulting in and recognizing the terms, we obtain the observation equation for RSSI-based ranging: Once range measurements are available, either resorting to TOA or RSSI techniques, the target node computes its position based on a simple algorithm to solve the trilateration problem.A least square (LS) algorithm suffices for the purpose of this article, which is to propose and analyze network topologies formations that improve the overall positioning performance.Thus, the well-known LS method is used here as a comparison tool among topology creation algorithms.Particularly, we consider one-hop ranging, meaning that ranging is performed considering Figure 3 We consider a superframe structure that consists of a beacon frame and a contention access period (CAP).Also a inactive period is at the end of the superframe.
only those reference nodes which are in view.As commented earlier, a set of ranging measurements from at least four reference nodes can be seen as a geometrical problem, where each (3) defines a sphere centered at the corresponding x (i) r and with radii the measured range.The optimal positioning solution is given by the point in space where all the spheres intersect.Since the accuracy of range estimates is affected by noise (among other phenomena such as multipath components), the spheres are not likely to intersect at one single point and instead an uncertainty area is obtained in which the node can be found.The LS method provides an appealing solution to the problem, where the coordinates of the jth node are those which minimize the squared-error The optimization admits a closed-form solution [23] based on the Moore-Penrose pseudoinverse with the following definitions: x (3) − x (1) y (3) − y (1) z (3) − z (1)  . . . . . . . . .
where κ i p r is a constant, and |N j | indicates the cardinality of the set N j , i.e., the number ranging measurements at the jth node.
The next section describes algorithms for topology formation.Indeed, this comes before the position solution described above, from a practical point of view.Current topology formation criteria are focused on purposes other than localization; therefore, an effort is made in the sequel to the study existing methods and investigate clustering techniques aiming toward providing localization quality of service to the WSN.

Mesh and cluster-tree topologies
The success of range-based localization depends on the network connectivity [12].Thus, in our case, range-based techniques for positioning such as trilateration need at least four one-hop range estimations (three dimensional scenario) with reference or located nodes.However, in a 802.15.4/Zigbee or 802.15.4a network, RFD devices may communicate only with one coordinator within its range, therefore, in our case, these devices cannot be located.
Mesh topology allows a high connectivity between nodes because it places no restrictions on that.In fact in a Zigbee or 802.15.4a mesh WSN, any coordinator may communicate with any other coordinator within range.Therefore, the connectivity allowed by mesh topology is an advantage for range-based localization.
However, in a cluster-tree topology, there are restrictions on the connectivity between the nodes.For Zigbee (and in our 802.15.4aWSN with cluster-tree topology), nodes are grouped in clusters where any coordinator may communicate only with its parent and its children of its cluster.This excludes communication with other coordinators that may be in range.As a result, less nodes are available for ranging and localization.Therefore for onehop ranging between nodes, one coordinator j could be located under the following conditions: ( 1) it has at least four range estimations with reference coordinators, and (2) these reference coordinators have parent or children relationship with the j coordinator.

Improved localization in a cluster-tree topology
In this section, we explain a solution for the constraints of the range-based localization in a cluster-tree network.With this solution, we want to improve the localization, and thus to reach a trade-off between the connectivity of mesh topology and energy saving of cluster-tree topology.
For Zigbee cluster-tree topology, ranging among parent and children can be done with RSSI using the data interchange of frames [3].Also for 802.15.4a, ranging among parent and children can be done using the message sequence for ranging explained in the standard [2] that also uses data frames interchanging.We propose the following solution to increase the ranging between coordinators overcoming this parent-children-based connectivity: • Ranging is controlled by MAC layer: The ranging application is done in a MAC level, as in the IEEE 802.15.4 standard.The application layer (that controls the localization algorithm) calls the corresponding MAC primitives directly for doing ranging between two nodes.
In order to follow this solution, the MAC level frames for ranging should work with the Zigbee or upper layer superframe structures without collisions.For this propose, a scheme is proposed: • Ranging during the CAP of the superframe (RCAPS): A coordinator j can do ranging with its parent coordinator and with its child coordinators using the ranging interchange of frames defined in the standards.The improvement achieved is that this coordinator j also uses the CAP of its parent cluster superframe for ranging with its brother coordinators (coordinators with same parent that follow the same superframe) within range.Figure 4 shows the RCAPS solution with the superframes structures of the corresponding parent and children of three interconnected clusters.In Figure 5, the interchange of frames between two brothers of a cluster with RCAPS solution is presented.Figure 6 shows an example where cluster-tree and cluster-tree with RCAPS are compared.

Localization-aware cluster formation
We aim at designing a cluster-tree formation algorithm with the objective of improving of the average number of positioned target nodes.As the necessary signals for positioning of target nodes are emitted by anchor nodes, we propose to design a clustering algorithm that maximizes the connectivity of the anchor nodes in the cluster-tree topology.In this section, we resort to Graph Theory [24] to propose a solution for that aim.We demonstrate that in a cluster-tree topology, the best connectivity of anchor nodes is held by those nodes being cluster heads.Also, we propose that our algorithm controls the maximum number of anchor nodes in the clusters.
Graph theory describes the communication flow among the nodes of a network by an undirected graph G = (V , E ) where V = {1, ..., N} is the set of vertices (the set of N = N n + N r nodes in our case), and E is the set of edges (i.e., their links).The edge e ij represents a bidirectional communication link between a pair of distinct nodes i and j.The set of neighbors of a node i was defined previously as N i = {j ∈ V : e ij ∈ E } for all i, j = {1,..., N}, which represents the set of indexes of the nodes sending information to node i.
The connectivity matrix of a graph is a N × N matrix with entries 1 if i and j are connected 0 otherwise (13) with the degree of a vertex being the number of edges at i.The degree is equal to the number of neighbors Let us define the following sets: • V as the set of nodes in the ℓth cluster; • V ,p as the set of parent nodes in the ℓth cluster including the cluster-head, i.e., those generating a cluster; • V r as the set of anchor nodes in the graph, N r = |V r |.
• V n as the set of target nodes in the graph, The necessary signals for positioning of target nodes are emitted by anchor nodes.Therefore, for our purposes, it is necessary to design a clustering algorithm that maximizes the connectivity of the anchor nodes in the cluster-tree topology.We base on Proposition 1 to state that such algorithm should ensure that cluster heads are the anchor nodes of the network.
Proposition 1.Let the undirected graph G = (V , E )define a cluster-tree topology.Then, for the ℓth cluster we have that with d ℓ, CH being the degree of the ℓth cluster head.
Proof.The proof follows easily if one realizes that d ,CH = |V |, as the cluster-head is connected to all the Therefore, it arises that, in a cluster-tree topology, the best connectivity is held by anchor nodes being cluster-heads.Since, the objective of this article is to provide enhanced connectivity of target nodes to anchor nodes in cluster-trees, we conclude that a suitable algorithm should enforce that V ,p ⊆ V r, with anchor nodes being cluster-heads.
Another preferable feature of the proposed localization-aware topology formation algorithm is to design the maximum number of anchor nodes in the clusters R max .The algorithm proceeds as follows.Initially, ℓ = 1, and V ,p = CH =1 is the cluster-head (anchor node) of the first cluster.For each cluster ℓ, the cluster-head sends beacon frames to find cluster-children and join Figure 6 In the example the coordinators within range of C to do ranging are shown.In the unmodified cluster-tree case only parentchild ranging is allowed.In RCAPS ranging with coordinators sharing the same parent is also possible.
Figure 5 The figure shows the protocol between two coordinators (that share the parent coordinator) of a cluster which do ranging.The exchange of frames for ranging is done during the CAP of the superframe (RCAPS solution).them to the cluster.This set of nodes N is composed of target and anchor nodes within range, that is N = N n ∪ N r .They are selected randomly and for the anchor nodes |N r | ≤ R max .Notice that LACFA controls |N r | ≤ R max , but the maximum value of N is config- ured by the standard.Then, the anchor members N r of N start to send beacons to form its own clusters setting V ,p ⊆ V r.The process is performed sequentially until =1 N r = V r , that is, when all reference nodes have been included in one of the clusters.Notice that this is a completely distributed algorithm.
For a better understanding of LACFA's operation, Figure 7 shows the state machine running in each anchor coordinator in the network.Initially, state S0 represents the situation in which a node is listening to the environment, waiting for a beacon signal of a cluster-head.Once the node receives it, a request to join that particular cluster is emitted in S1.If joining fails, for instance, because cluster-head does not admit another child, then the node returns to S0; otherwise it moves to S2.In such situation, the node is correctly incorporated into a cluster, and its aim becomes to associate coordinators to its own cluster.To do so, it emits periodically beacons.If a beacon response from an anchor coordinator is received, then the node processes it in S3.If the responding anchor coordinator requests cluster joining, the node might reject or accept it following the rules explained earlier.In the latter, N r should be updated to N r + 1.Another situation accounted in S3 is that of an anchor node leaving the cluster, and thus N r = N r − 1. Analogously, S4 deals with messages received from target coordinators.
Considering the cooperation between nodes, that is, if a target node is located it might act as a reference for other coordinators target nodes, LACFA can be straightforwardly applied.In our case, the cluster-children coordinators (coordinators that share the same parent coordinator) that are positioned with the initial anchor coordinators can work as references to the positioning of other cluster-children coordinators (within range) of the same cluster using RCAPS solution.

LACFA protocol in mobile sensor networks
So far, we have addressed a WSN scenario where cluster formation takes place during the network startup phase.In Mobile scenarios, the network topology will inevitably suffer changes as nodes move.IEEE 802.15.4/ZigBee supports a fault-tolerance mechanism for orphaned coordinator's realignment [3].This process can start when the communication is lost between the child coordinator and its parent or when the child loses synchronization with its parent.This process is based on two different behaviors depending on the change: the orphaned realignment procedure with the same parent coordinator when it is possible, or otherwise, reset the MAC parameters leading to a new association procedure to the network.
Following this fault-tolerance mechanism, for our case depending on which node is moving, the impact on the topology will be small or considerable.Notice that in mobile scenarios, the anchor parents of a cluster have to count the set N r to be |N r | ≤ R max .For this purpose, when a node joins or leaves the cluster, it is notified with the corresponding primitives of the standard.However, also periodically, the anchor parents should send a request frame using the periodic beacons to the clusterchildren to cover the situation when a cluster-child leaves the cluster without notification.

No beacon reception
In the following, we classify the events associated with the mobility of a particular node.

Target node mobility
• Event 1: Target node gains or loses coverage of 3 or more anchor nodes.It will impact its own positioning capability.
• Event 2: Target node leaves cluster coverage area.It will cause the target node to reconnect, if possible, at a different cluster.It may impact its own positioning capability.

Non-cluster-head anchor node mobility
• Event 3: Target nodes within area of influence of anchor node gain or lose coverage.It may impact their positioning capability.
• Event 4: Anchor node leaves cluster coverage area.The old cluster loses one anchor node, reducing its positioning capability.The anchor node might join a new cluster following LACFA's algorithm, see Figure 7.

Cluster-head mobility
• Event 5: Child nodes may leave coverage area as cluster head moves.This is accounted for in previously defined mobility events (1:4).
• Event 6: Cluster head leaves parent cluster coverage area.It follows the procedure defined by LACFA to reconnect to a new parent cluster, as in Figure 7.
Notice that all these mobility events have implications in the network connectivity, such as the necessary updates on the routing tables.However, in this article, we focus on implications on positioning only.

Simulations and results
In this section, we present the simulations of the rangebased localization algorithm explained in Section 3 in different WSN topologies: mesh topology defined by Zigbee and 802.15.4a standards, cluster-tree topology defined by Zigbee, and a cluster-tree topology with 802.15.4aPHY layer.Also, we present the results of our solution RCAPS for the cluster-tree topologies with our clustering algorithm for localization LACFA, and we compare it with the well-known clustering algorithm LEACH.All the considered WSNs consist of N n + N r coordinators with N n = 100 target coordinators and N r reference coordinators.Nodes are randomly deployed in a cell of dimensions 50 × 50 m 2 .The range of the nodes equals 20 m, the standard deviation for TOA s t = 0.3, m and the standard deviation for RSSI s t = 0.6 dBm.
Taking into account the described scenario, Figure 8 shows the number of located coordinators (%) versus the density of anchor coordinators N r within range.With cluster-tree topology and the LEACH algorithm, the number of located nodes is very low because ranging only can be done between parent and children.Results improve with LEACH algorithm and RCAPS solution because ranging can be done between parent and children and also between cluster-children within the range of the same cluster.However, our clustering algorithm LACFA with RCAPS solution obtains better results than LEACH, because our algorithm increases the connectivity of the anchors coordinators.Also controlling the maximum number of anchor coordinators in a cluster (R max ) improves results.Best results are obtained with values of R max between 7 and 10.For R max = 7 and density of anchor nodes within range equal to 12, the number of located nodes is 50%; for density of anchor nodes within range equal to 30, the number of located nodes is 80%.Mesh topology is the upper limit because there are not limitations in the connectivity between nodes due to topology.In this case, the localization of all nodes (100%) is performed for density of anchor coordinators within the range equal to 10.
Figure 9 shows the Cumulative Distribution Function (CDF) of the position error for TOA-based ranging technique.For all the cases with our clustering algorithm LACFA, between 90 and 100% of the nodes have a position error less than 0.15 m.For mesh topology, the 100% of the nodes have an error less than 0.04 m.
The CDF of the position error for RSSI-based ranging technique is showed in Figure 10.The error increases for all the cases with respect to TOA CDF.With our clustering algorithm LACFA, between 90 and 100% of the nodes have a position error less than 1.8 m.For mesh topology, the 100% of the nodes have an error less than 0.8 m.
The histogram of the frequency that target nodes have anchor nodes within the range is represented in Figure 11.For LACFA with R max = 7, the majority of target nodes are located with five anchor nodes within range and the maximum is 7.For LACFA with R max = 10, the target nodes are located with higher number of anchor nodes until 10.However, for R max = 32, the frequency is lower, and it is distributed for all the numbers of anchor nodes until 30.Therefore, the information of this figure explains that in Figures 9 and 10, for CDF of the cases with LACFA, the best results are obtained for R max = 10.
Once a coordinator is located, it becomes a reference for locating other cluster-children coordinators (coordinators that share the same parent coordinator) within range of the same cluster.We consider this kind of cooperation between coordinators in Figure 12 where we compare it with the case of absence of cooperation shown in Figure 8.This cooperation improves results  for low R max , and for all the cases, the cooperation improves for low densities.Also, as cooperation increases the number of references for localization in the clusters, the CDF decreases as shown in Figure 13 for TOA-based ranging technique.
In mobile scenarios, LACFA can recompose the occurred events because of movement in the clustertree.It is done in a distributed way as explained in Section 5.1.An example is shown in Figure 14 with a density of 30 anchor nodes within the range and R max = 7. Anchor and target coordinators change its position following a random walk in each step.The number of located coordinators is maintained between 75 and 80%.
In this study, we have considered one-hop range-based localization.However, LACFA could also improve the performance of multi-hop ranging in a cluster-tree   topology as follows: first, as one-hop connectivity to anchor nodes increases with LACFA, it can be expected that second-hop connectivity will improve as well.Second, since LACFA provides a higher degree of one-hop connectivity, it is expected to reduce positioning error in multi-hop algorithms as well, since more one-hop distance measurements will be available.If an algorithm such as the weighted least squares is used, then one-hop links can be given higher weight thus reducing the error.

Conclusion
In this study, we have focused on increasing the probability of localization of sensors in a cluster-tree WSN.We have dealt with a scenario where a subset of sensors, called anchor or reference nodes, is aware of its own position and helps target nodes determine theirs through range-based positioning algorithms.Since at least four range measurements with anchor nodes are necessary for positioning of target nodes (three-dimensional scenario), range-based algorithms benefit from a high degree of connectivity.However, cluster-tree topologytends to limit connectivity between nodes in order to save energy.This results in very poor performance of the network in terms of localization.In order to improve range-based localization in a cluster-tree topology, we have proposed LACFA, an algorithm for Localization-Aware Cluster Formation in WSNs.It does so by properly allocating anchor nodes to different clusters during the network formation phase, and by allowing peers in the same cluster to communicate with each other.Results show this simple distributed cluster-formation algorithm greatly improves the probability of localization of sensor nodes for a moderate density of anchor nodes.Results show that LACFA increases onehop connectivity from target to anchor nodes improving the one-hop range-based positioning.Also, LACFA outperforms LEACH without paying a penalty in terms of energy consumption.

Figure 2
Figure 2 Mesh and cluster-tree topology examples.

Figure 4
Figure 4 RCAPS solution with the superframes structures of the corresponding parent and children of three interconnected clusters.

Figure 7
Figure 7 State machine of LACFA's algorithm.

Figure 8
Figure 8 Located coordinators (%) versus density of coordinators within range.

Figure 9
Figure 9 CDF of the position error with TOA-based ranging technique.

Figure 10 Figure 11
Figure 10 CDF of the position error with RSSI-based ranging technique.

Figure 12
Figure 12 Located coordinators (%) versus density of coordinators within range with cooperation among coordinators that share the same parent of the each cluster.

Figure 13
Figure 13 CDF of the position error with TOA-based ranging technique and cooperation among coordinators that share the same parent of the each cluster.