A Novel Cluster Based Time Synchronization Technique for Wireless Sensor Networks

Time synchronization is one of the important aspects in wireless sensor networks. Time synchronization assures that all the sensor nodes in wireless sensor network have the same clock time. There are various applications such as seismic study, military applications, pollution monitoring where sensor nodes require synchronized time. Time synchronization is mandatory for many wireless sensor networks protocols such as MAC protocols and also important for TDMA scheduling for proper duty cycle coordination. Time synchronization is a stimulating problem in wireless sensor networks because each node has its own local clock which keeps on varying due to variation in the oscillator frequency. The oscillator frequency is time varying due to ambient conditions which leads to re-synchronization of nodes time and again. This re-synchronization process is energy consuming whereas energy is constraints in WSN. This paper proposes a novel cluster based time synchronization technique for wireless sensor networks in which cluster head rotation is based on minimum clock offset. Simulation results based on energy analysis of the proposed model demonstrate that proposed novel cluster based time synchronization technique reduces the energy consumption and also the synchronization error compared with other existing protocols.

perform three major tasks i.e. sensing, data processing and communication [4].
Wireless Sensor Network (WSN) consists of large number of SNs deployed in unattended environment [7]. These SNs monitor objects in the sensing field and report the activities and events to sink. In order to establish correct logical order of the events, the data must be time stamped by the SNs. In WSN some applications such as military applications require accurate time of the event. Data fusion in WSN also demands time stamp of SNs to suppress the duplicate information of the SNs. Time is also important to implement the TDMA schedule in WSNs. Due to various challenges and constraints in WSNs, the clock synchronization protocols (NTP) [8] [9] designed by researchers for wired networks do not work in wireless sensor networks. In WSNs each node has its own local clock that may vary from the local clock of other nodes in the network which leads to clock offset. Higher clock offset degrade the WSNs performance and the information collected by the nodes may not provide the accurate timing of the event.
Whereas time synchronization in WSNs is important for efficient duty cycling, location based monitoring, target/event tracking data fusion and network scheduling and routing.
Keeping in view the importance of time synchronization as well as the constraints of SNs, the objective of the proposed research is to develop time synchronization technique that helps to synchronize the SNs in an energy efficient manner. This paper proposes a novel cluster based time synchronization technique for wireless sensor networks to keep local clocks of all the SNs synchronized with global clock.
In wireless sensor networks, a lot of research [10]- [31] has already been carried out to design time synchronization protocols such as Reference Broadcast Synchronization (RBS) [11], Romer synchronization [13], TPSN (Timing Sync Protocols for Sensors Networks) [15], Two-hop time synchronization protocol for sensor networks (TTS) [18], Fast distributed multi-hop relative time synchronization protocol and estimators for wireless sensor networks [19], Long term and large scale time synchronization in wireless sensor networks (2LTSP) [20], and Average time synchronization in wireless sensor networks by pairwise messages (ATSP) [21], Time synchronization protocol based on spanning tree [28], Lightweight and Energy Efficient Time Synchronization (LEETS) Protocols [29] and Lightweight Fault-tolerant Time synchronization [30]. Some of these protocols synchronize the nodes internally by placing the nodes on common notion of time and some synchronize externally by using large number of messages to adjust the clocks of the sensor nodes with global clock.
The proposed novel cluster based time synchronization technique for wireless sensor networks to keep local clocks of all the SNs synchronized with global clock by using less number of messages. In the proposed technique initially the SNs are arranged in clusters by using energy efficient clustering algorithm (EECA) and then time synchronization is performed.
The rest of the paper is organized as follows. In Section 2 describes the proposed energy efficient clustering algorithm (EECA) for WSNs. Section 3 describes the proposed time synchronization algorithm and synchronization error estimation. Energy analysis is performed in Section 4. Section 5 contains simulation and analysis and finally we conclude the paper in Section 6.

Energy Efficient Clustering Algorithm
In this section, we describe our proposed protocol, called Energy Efficient Clustering Algorithm (EECA) for wireless sensor networks. The proposed technique has been segregated into different phases; creation of clusters to prolong the network lifetime, CH selection and cluster head rotation. EECA forms clusters before selecting cluster-head. Our proposed EECA works in three steps: (2.1) Cluster formation process, (2.2) Cluster head selection process and (2.3) Cluster head rotation process.

Cluster Formation Process
In EECA clustering process is initiated by the sink. Sink calculates the preliminary mean points by sensing field size, optimum number of clusters and average distance of the nodes from the center of the sensing field. After the deployment of SNs in sensing field, the sink initiates the clustering process by finding the centroid of the sensing field by using the Equation (1) When the value of centroid is calculated, sink node finds the average distance d between centroid and all the SNs by using the Equation (2). Where X i and Y i are the coordinates of the node SN i .
Sink also computes the optimum number of clusters k using the Equation ( The objective of finding the preliminary mean points is to significantly reduce the iteration time of cluster formation. Figure 1 shows the preliminary mean points in 100 m × 100 m sensing filed area with 50 sensor nodes. When the SNs receive the sink message of preliminary mean points, each node find its minimum distance from preliminary mean points by using the Equation (5) and retain the minimum distance.  : for all 1, 2, , is the Cluster j in r th round. After tagging all the nodes with different clusters new mean points are created by using the Equation (7).  Priliminary mean points along with centroid is the number of SNs in the cluster j. Figure 2 shows the new mean points.
The process of finding the new mean points is iterative till the new mean points stop moving. As long as the preliminary mean points keep on changing the nodes are re-arranged again and again as per the Equation (6) and (7). The cluster formation process is complete when the new mean points are fixed and nodes join the final mean points with minimum distance. Figure 3 shows the flowchart of clustering process.

Cluster Head Selection
The clustering algorithm divides the whole network into different clusters. The next step is to elect CH within each cluster. Each node within the cluster calculates its distance from the cluster by using the Equation (8). Where X i is the coordinates of the SN i and C j is the coordinates of the final mean point in which The cluster head selection is performed using back off timer strategy. SN i sets its back off timer by using the Equation (9). The back off timer of each node starts decrementing and the node whose back    Figure 3. Flowchart of clustering process.
off timer expires first within the cluster, broadcasts a CH advertisement message to other nodes. The nodes receive a CH advertisement message joins the CH by sending the cluster member join message to CH. A node may receive more than one CH advertisement messages. If a node receives more than one message, checks the received signal strength of the messages and send the reply to the CH message received with larger signal strength. Figure 4 shows the clusters with their cluster heads formed after CH selection.

Cluster Head Rotation
The role of CH in a cluster must be rotated regularly among its members to prolong the network lifetime of sensor network by balancing the energy consumption of various sensor nodes. CH is required to perform extra tasks such as data gathering, data aggregation, etc. compared to the other sensor nodes. Energy consumption of CH is more compared to other sensor nodes therefore, some mechanism must be applied for CH rotation among the cluster members. A number of methods for CH rotation have been discussed in literature [33]- [38].
In CH rotation process, the new CH is selected from cluster members. CH rotation/re-election process is initiated when residual energy of a node falls below the threshold value. The new CH is elected with higher value of Candidacy factor (CF). Candidacy factor of SN i is defined as  Figure 5 shows the flowchart of CH selection/rotation process.

Cluster Based Time Synchronization
The proposed cluster based time synchronization (CBTS) algorithm is based on external synchronization. Once the clustering process is complete using EECA protocol proposed in section 3, time synchronization process is initiated by the parent node, which is the sink/base station during the initial phase. Sink/base station is used as a reference node for time. The proposed algorithm is using k CHs. There are k' CHs at level-1 and k'' CHs at level-2. The proposed model is shown in Figure 6.  The parent node ( n P ) initiates the synchronization process by broadcasting the Syn_start packet which contains the timestamp 1 T and then waits for the reply. When the CHs of level 1 (CH L1 ) receive Syn_start packet, they send reply to sink/base station by sending the Syn_ack packet. The Syn_ack packet contains the timestamp 1 2 3 , , T T T where time 1 T is the time of sending Syn_start packet, 2 T is the time when the CHs of level 1 receive the packet and 3 T time when CHs of level 1 send the Syn_ack packet. The parent node after receiving the Syn_ack packets, broadcasts Syn_pkt with timestamp 1 2 3 4 , , , , s T T T T T where 4 T is the time when the parent node receives the Syn_ack packet and s T is the time to set the clocks of the CHs of level-1. All CHs of level-1 receive the Syn_pkt and calculate the offset (θ) and delay (δ) and set the clocks as: In the initial synchronization phase, sink/base station functions as parent node. After synchronizing the CHs of level 1, it further functions as parent nodes and synchronizes the cluster nodes and CHs of level 2. Cluster based time synchronization algorithm is as below: SCOUNT --5. if n P wait for reply && SCOUNT = = 0 then repeat step 4 6. else n P receive (Syn_ack, 1 2 3 , , T T T ) 7. n P broadcasts (Syn_Pkt, 1

Synchronization Error
All WSN synchronization schemes [10]- [31] have four basic packet delay components: send time, access time, propagation time, and receive time as shown in Figure 7. The send time is that of the sender constructing the time message to transmit on the network. The access time is that of the MAC layer delay in accessing the network. The time for the bits to be physically transmitted on the medium is considered the propagation time. Finally, the receive time is the time spent by the receiver for processing the message. The synchronization error is calculated by using the time stamp message shown in the Figure 6. In synchronization error calculation, access time is combined with send time. The main problem of time synchronization besides having a packet delay is that, it is able to foresee the time spent on each, which can be challenging. Disregarding any of these will significantly surge the performance of the synchronization technique.
In the proposed CBTS synchronization, a message from the sink to SNs transmits through multi-hops that induce the time delay error because of various delays as shown in Figure 7. Exchange of timestamp messages among parent node and cluster heads (shown in the Figure 6) are used to analyse the synchronization error of the proposed CBTS. Simply by using send time, propagation time, receive time and clock drift and then equating the timestamps of cluster head and parent node following equations obtained:  (12) from Equation (13) as: Sender P n

Receiver CH
where Offset by subtracting the clock drift from the clock offset, synchronization error for one-hop 1 i i ω → + is obtained as: The Equation (17) can be modified to obtain multi-hop synchronization error as: Equation (19) calculates synchronization error for multi-hop communication.
The objective of finding the synchronization error i ω is to ensure that at any real time T, i ω is between lower and upper bounds [ ] min , max ε ε . If the value of synchronization error goes below min ε or exceeds max ε , the resynchronization process is initiated by the sink/base station. The energy consumed to receive m bit data is expressed as:  (20) and (21).

Energy Analysis of CBTS
Energy consumption at level 1 CHs: Total energy consumed in CBTS protocol while receiving and sending synchronization messages at level 1 CHs is given by Equation (22) Energy consumption at level 2 CHs: Energy consumed by level 2 CHs while receiving and transmitting synchronization messages is given by Equations (25) and (26) Energy consumption at SNs level: Energy consumed by SNs while receiving and sending synchronization messages is given by Equations (28)

Simulation and Results
In this section, the performance of Cluster Based Time Synchronization (CBTS) algorithm has been evaluated through simulation. The simulation has been performed in MATLAB 2013a. The performance of CBTS protocol is compared with TPSN [15] and TTS [18] protocols. The performance metrics include the number of nodes in the WSN, initial energy of the SNs, total number of messages per synchronization round, total energy dissipation per synchronization round, propagated synchronization error and convergence time. The simulation parameters are listed in Table 1 where for each parameter, simulation has been run many times and the average result of all runs has been taken for evaluation. The performance evaluation includes message complexity, total energy dissipation per synchronization round, propagated synchronization error with number of hops and convergence time.
The message complexity in terms of the total number of time synchronization messages per synchronization round while the number of nodes varies from 50 to 500 and the sensing field area is kept constant i.e. 300 m × 300 m as shown in the Figure 8. The simulation results show that the number of time synchronization messages increase with the increase in the number of nodes in a constant field size because increase in number of nodes leads to increase in time synchronization messages. There is a significant reduction in terms of time synchronization messages in the proposed CBTS method than TPSN and TTS methods. TPSN requires n n + messages to synchronize n SNs and TTS requires 2 n n + messages. CBTS reduces the number of synchronization messages by 40% as compared to TPSN and 25% as compared to TTS. The proposed CBTS method  to increase in the number of time synchronization messages which increases the total routing energy and thus total node energy consumed. The simulation results in Figure 9(a) show that CBTS protocol provides better performance compared to other two protocols. This is due to the less number of synchronization messages and better clustering technique as compared to TPSN and TTS.
It has been observed that the energy dissipation incessantly increases with the increase in the sensing field size. The distance between the sink and the sensing node increases with the increase in the sensing field size, which increases the transmission energy cost, although the time synchronization messages remain the same. Aforementioned, the performance of cluster based time synchronization (CBTS) is better than other two protocols due to the reduction in the number of synchronization messages and better clustering approach.   100  150  200  250  300  350  400  450  500  100  150  200  250  300  350  400  450  500  100  150  200  250  300  350  400  450  500  100  150  200  250  300  350  400  450  500  100  150  200  250  300  350  400  450  500 Total energy dissipation per synchronization round (J/round) is the highest because it uses n + n messages to synchronize n nodes as compared to TTS and CBTS. Synchronization error is the difference between the times of a CH with respect to the times of the sink. The synchronization error is added with the increasing number of hops generally. The variation in the synchronization error is studied by fixed number of nodes i.e. 300 nodes, while keeping the sensing field size constant at 300 m. The synchronization error increases with number of hops for CBTS, TTS and TPSN protocols in particular as shown in Figure 10. The values shown in the Figure 10 are the average of 50 simulation results.
The synchronization error of TPSN is high i.e. 16  uses large number of messages, since several messages bump into each other causing a collision and required to be sent again and leads to error. A large amount of message transmission leads to collisions and further to performance degradation. Synchronization error of TTS is also high because of using a pair of nodes to synchronize the SNs which increase number of messages and adds errors at each hop. The performance of cluster based time synchronization (CBTS) is better than other two protocols i.e. 2.6 μs for five hops due to less number of synchronization messages and better clustering approach which reduces the packet collisions and thereby reducing the synchronization error. Simulation results show that our proposed protocol outperforms other protocols in terms of synchronization error. In case of TPSN, the unbalanced clustering technique and the overhead of messages for synchronization are responsible for higher synchronization error. CBTS uses EECA clustering technique which required less number of synchronization messages to synchronize the sensor network.
The total time required to synchronize the network is known as convergence time. The variation in the convergence time is studied by fixed number of nodes i.e. 300 nodes, while keeping the sensing field size constant as 300 m. Convergence time is measured for five hops and observes that it increases with number of hops for TPSN, TTS and CBTS protocols as shown in Figure 11. Convergence time is directly proportional to message complexity and bandwidth use. TPSN requires n n + messages to synchronize n SNs and TTS requires

Conclusion
The