Journal of Control Science and Engineering

Volume 2013 (2013), Article ID 538181, 7 pages

http://dx.doi.org/10.1155/2013/538181

## Achieving Relative Time Synchronization in Wireless Sensor Networks

^{1}Department of Electrical and Computer Engineering, University of Alberta, Edmonton, AB, Canada T6G 2V4^{2}Department of Control Science and Engineering, Harbin Institute of Technology, Harbin 150080, China

Received 5 May 2013; Accepted 8 August 2013

Academic Editor: James Lam

Copyright © 2013 Salman Ahmed et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

Time synchronization is required for a variety of distributed control applications in wireless sensor networks (WSNs). In this paper, a novel distributed time synchronization technique for WSNs is presented. The proposed technique does not require all the sensor nodes to have the same time periods or starting times. Furthermore, the communication topology of the WSN is not assumed to be static; it can change with time. The WSN is modeled by a time-varying discrete-time system. The objective is to design local control inputs to achieve relative time synchronization by using the neighbor sensor nodes information. By employing tools from nonnegative matrix and graph theories, the convergence analysis is presented. Numerical examples are presented to demonstrate the effectiveness of the proposed protocol.

#### 1. Introduction

Distributed time synchronization in wireless sensor networks (WSNs) has been an important topic of research in the control community [1–3]. In most distributed control applications, coordination among sensor nodes requires precise time synchronization [4, 5]. Time synchronization in a WSN is also required for many other tasks such as data fusion, transmission scheduling, and nodes sleep and wake-up scheduling. Therefore, it is important to design distributed protocols to achieve time synchronization in a WSN.

A common approach to design time synchronization protocols is to create a hierarchical structure within the WSN. The most prominent examples are the reference broadcast Synchronization (RBS) [6], timing-sync protocol for sensor networks (TPSN) [7], and flooding time synchronization protocol (FTSP) [8]. The implementation of RBS requires that the WSN should be divided into distinct clusters and each cluster should have a leader or reference node, all the leader nodes synchronize themselves with respect to each other and sensor nodes within the same cluster synchronize themselves with respect to their leader node. The implementation of TPSN and FTSP requires that a spanning tree rooted at a reference node should be built in the WSN and the time difference of any sensor node can be obtained with respect to the reference node. Although the hierarchy-based protocols have been experimentally tested in [8] and their performance is remarkable, they require substantial overhead to rebuild the spanning tree or clusters if a sensor node dies or a new sensor node is added.

Distributed time synchronization protocols which do not require a hierarchal structure have been proposed in [3, 9, 10], where the authors have considered a continuous time system to represent the clock of a sensor node. It is assumed that the clock of a sensor node has the same continuity property as the physical time and it can measure in any time interval. In actual implementation, the clock of a sensor node has some frequency or time period. A clock cannot measure a time interval which is shorter than its time period. Hence, it is more reasonable to use a discrete-time system to model a clock.

Discrete-time systems to model clocks in a WSN have been used in [1, 11, 12]. For the design of time synchronization protocol, the authors have assumed that all the sensor nodes should periodically exchange and update their clock states at the same time instants. This assumption is unrealistic since it requires synchronization of all clocks, which is the goal of the protocol. In this paper, we propose a time synchronization protocol which relaxes the three main assumptions used in the literature. First, the proposed protocol does not require all the sensor nodes to have the same time periods or starting times. Second, all the sensor nodes are not restricted to exchange and update their clock states at the same time instants. Third, the communication topology of the WSN is not assumed to be static. We use the discrete-time clock model presented in [1]. We assume that each sensor node knows its time period but does not know its exact starting time. Each sensor node exchanges its clock readings with its neighbors. The objective of the time synchronization protocol is to synchronize the clocks in a WSN with respect to a virtual clock, which is not physically present or accessible to any sensor node. The virtual clock is only used to demonstrate the concept of time synchronization in a WSN as the time periods and starting times of sensor nodes can be different.

The remainder of this paper is structured as follows: Section 2 presents some basic definitions and results from graph and matrix theories. The problem is formulated in Section 3. The main results and analysis are presented in Section 4. Numerical examples to demonstrate the effectiveness of the proposed protocol are presented in Section 5. Finally, concluding remarks are given in Section 6.

#### 2. Preliminaries

In this section, we present some definitions and results from graph and matrix theories which will be used in this paper.

Let , denote an identity matrix, and the symbol denote the set of nonnegative integers. A matrix is nonnegative if all its elements are nonnegative [13]. A non-negative, finite, and square matrix is called stochastic if the sum of each row is 1. A stochastic matrix is called indecomposable and aperiodic (SIA) if there exists a column vector such that [14]. Let denote the left product of the matrices . For any matrix , we write to represent the element which lies in the row and column of .

Consider an undirected (directed) graph which consists of a vertex set, , and an edge set, where an edge is an unordered (ordered) pair of vertices [15]. The index set of neighbors of vertex is denoted by and its cardinality by . A path from to is a sequence, of distinct vertices such that for any . An undirected (directed) graph is connected (strongly connected) if there is a path between any two distinct vertices. A directed tree is a directed graph where every vertex except the root vertex has exactly one parent vertex and the root vertex can be connected to any other vertices via paths. A spanning tree of directed graph is a directed tree whose edge set belong to and vertex set is the same as . The Laplacian matrix of is denoted by and is defined as follows: Let be a nonnegative matrix. Then, is defined as a directed graph having vertex set , and edges from to if and only if . We present some lemmas which will be used later.

Lemma 1 (see [16]). *Let be a stochastic matrix. If contains at least one spanning tree such that the root vertex of that spanning tree has a self-loop in , then is SIA.*

Lemma 2 (see [14]). * Let be a finite set of SIA matrices such that for each sequence of positive length, the matrix product is SIA. Then, for each infinite sequence , there exists a column vector such that the following holds:
*

#### 3. Problem Formulation

We consider a WSN having sensor nodes. Each sensor node has a local clock which consists of a software program and a hardware oscillator. The oscillator periodically generates time interrupts using its time period and the software computes the local time of the sensor node at those time instants when the interrupts are generated [1]. Let , and denote the time period, clock value, and starting time of sensor node , respectively, where . Each sensor node knows its time period but does not exactly know its starting time. Rather, its estimate, denoted by for sensor node , is known. Let represent the sequence of time instants when the clock of sensor node updates its state, where . The time computed locally by sensor node can be expressed as follows: If each sensor node does not exactly know its starting time, then the clocks in the WSN would not be synchronized. To achieve time synchronization, we apply a control input to adjust the clock readings of sensor nodes. The control input is applied periodically at a certain known integer multiple of the local clock time period. Let be the time instants when the control input is applied to the clock of sensor node , where is a known integer, and . We can write the following: where denotes the control input or protocol which is needed to be designed. A virtual continuous time clock can be expressed as follows: where represents the time of WSN, represents the clock readings, and and represent the time period and initial offset of the virtual clock, respectively. The virtual clock is not available to any sensor node. It is only used to demonstrate the concept of relative time synchronization. The clocks in a WSN are said to be synchronized if there exists a common virtual clock in the form of (5) such that the following holds: As each clock knows its own time period, we use for the common virtual clock. The sensor nodes communicate with their neighbors and exchange clock readings. The communication topology of the WSN can be modeled by a time-varying undirected graph, , where and . The neighbors of sensor node at consist of those sensor nodes which are able to communicate with node at , where and . Let denote the index set of sensor node neighbors and let represents the Laplacian matrix associated with . The following assumptions are required to ensure that the clocks can be synchronized.(A1) There exists a known integer such that each sensor node can obtain information at least once from any possible neighbor during , where and . (A2) There exists an integer such that the union of graphs , is connected, for all , and . (A3) For any two sensor nodes and , the following holds: It should be noted that (A1) is made to ensure that each senor node can receive information from its possible neighbors in a finite interval of time. Assumption (A2) is made to ensure that union of communication topologies during a specific time interval remains connected, although at some particular time instants the communication topology may not be connected. Assumption (A3) is made so that by using the proposed protocol the relative time synchronization error in the WSN can be driven to zero. In actual implementation, if (A3) can not be ensured to hold for all sensor nodes, then it can be relaxed to consider neighboring nodes only. If (A3) is not ensured for neighboring nodes, then a small approximation error may exist due to the fact that the starting times and time periods of the sensor nodes may be different. In the next section, we present the main results to achieve relative time synchronization.

#### 4. Main Results

We present the following protocol for achieving time synchronization: where denotes a gain which needs to be designed. For synchronized distributed control systems, a protocol similar to (8) has been presented in [17]. In this paper, we study protocol (8) for asynchronous distributed control systems. The following theorem presents the main results.

Theorem 3. *Consider a WSN which satisfies assumptions (A2) and (A3). Then, the clocks of the sensor nodes achieve relative time synchronization using protocol (8) if , and .*

*Remark 4. *If the communication topology of the WSN is static, then we can allow , and , where denotes the maximum of the diagonal entries of .

The proof of Theorem 3 consists of three main steps. In the first step, we combine the local clock models and define a new time sequence to represent the local clock models by a single time-varying system. In the second step, we use the new time sequence to compute an upper bound on the time interval in which each sensor node obtains information at least once from all its neighbors. Finally, we complete the proof by utilizing the properties of connected graphs and product of SIA matrices.

##### 4.1. Representation by a Single System

Before grouping the local clock models to represent them by a single system, we define a new state as follows: We rewrite the model expressed by (4) and control protocol (8) as follows: Let , and we define a new time sequence , where , which is the union of the distinct values of the sequences . We order the values of such that . We mention here that the distances between consecutive elements of are nonuniform. The time-synchronization objective can be rewritten as follows: for some . Let denote the group state vector. The dynamics of the overall system can be written as follows: where , , It should be noted that is a time-varying Laplacian matrix which can be unsymmetric and the graph associated with may not be strongly connected. Let , the solution of (12) can be written as follows: If , then are always stochastic matrices with positive diagonal entries. The product is also a stochastic matrix with positive diagonal entries. With this preparation, we proceed to the next step.

##### 4.2. Computation of an Upper Bound on the Time Interval

The following lemma is quite useful in the computation of an upper bound on the time interval in which each sensor node can obtain information at least once from its neighbors.

Lemma 5. *Let where . For any sensor node and , the number of elements in the set is not greater than , where and denotes the smallest integer not less than . *

*Proof. *Let be the sensor node such that where . When sensor node updates its control input at , the maximum number of times any sensor node can update its control input before the time instant cannot exceed , where . Since there are possible values of sensor node (excluding ), we conclude that the number of elements in is not greater than .

Using Lemma 5 and assumption (A1), we can state that each sensor node obtains information from all its neighbors at least once during the time interval , where .

##### 4.3. Technical Analysis

Let be the graph obtained by the union of . Using (A2), we conclude that is strongly connected. If is strongly connected, then, by using Lemma 1 together with [18, Lemma 3.9], we establish that the product of is SIA.

Let , , and so on. Then, it can be easily shown that all possible unique ’s are finite, where . Any product which involves a finite combination of the unique ’s is SIA. So, we can apply Lemma 2 to get the following conclusion: The vector depends on the order in which the matrices are multiplied, where , and it cannot be computed in advance. We can further write the following: Hence, we complete the proof of time synchronization protocol by taking .

#### 5. Numerical Examples

In this section, we present two examples to demonstrate the effectiveness of the proposed time synchronization protocol.

*Example 1 (static topology, small-size WSN). * We consider a WSN having sensor nodes and label them as . We assume that the communication topology of the WSN is not changing with respect to time () and is shown in Figure 1. Using Theorem 3, we choose . The values for different parameters satisfying (A2) and (A3) are listed in Table 1. By applying protocol (8), the WSN was simulated for 50 seconds. Figure 2 shows a plot of the clock readings for seconds. Figure 3 illustrates a plot of the local control inputs applied to the sensor nodes. Based on the plots, it can be concluded that this WSN achieves distributed time synchronization using the proposed protocol.

*Example 2 (switching topology, medium-size WSN). * We consider a WSN having sensor nodes and label them with . We consider that the communication links in the WSN are changing randomly with respect to time. Figure 4 shows the union of possible communication topologies of the WSN. We randomly select the parameter values for different sensor nodes from Table 1 and choose . For simulation purposes, we compute the relative time synchronization error of sensor node with respect to its neighbor nodes, denoted by , as follows:
Applying Theorem 3, we simulate the WSN for seconds and select the values for at run time based on the communication topology. Figure 5 shows a plot of the sum of time synchronization errors. Based on the plots, it can be concluded that, by using protocol (8) and applying Theorem 3, this WSN also achieves distributed time synchronization.

#### 6. Conclusions and Future Research Directions

In this paper, we presented a distributed time synchronization protocol for WSNs. The time periods and starting times of the sensor nodes were not restricted to be the same. By employing tools from stochastic matrix and algebraic graph theories, we presented the convergence analysis. In this paper, we considered that a sensor node could access the clock readings of its available neighbors without any delays. In actual implementation, time delay occurs between transmission and reception of information in a WSN. In the future work, we can consider this by modifying the protocol to handle time-delayed measurements from neighbors.

#### Acknowledgment

This research work was supported by the Natural Sciences and Engineering Research Council of Canada. Feng Xiao’s work was supported in part by NSFC (61273030).

#### References

- R. Carli, A. Chiuso, L. Schenato, and S. Zampieri, “A PI consensus controller for networked clocks synchronization,” in
*Proceedings of the 17th World Congress, International Federation of Automatic Control (IFAC '08)*, pp. 10289–10294, July 2008. View at Publisher · View at Google Scholar · View at Scopus - L. Schenato and F. Fiorentin, “Average timesynch: a consensus-based protocol for clock synchronization in wireless sensor networks,”
*Automatica*, vol. 47, no. 9, pp. 1878–1886, 2011. View at Publisher · View at Google Scholar · View at Scopus - I. Shames and A. N. Bishop, “Distributed relative clock synchronization in wireless sensor networks,” in
*Proceedings of the World Congress, International Federation of Automatic Control (IFAC '11)*, pp. 11 256–11 270, 2011. - B. Ekstrand, “Some aspects on filter design for target tracking,”
*Journal of Control Science and Engineering*, vol. 2012, Article ID 870890, 15 pages, 2012. View at Publisher · View at Google Scholar - L. Sheng, Y. J. Pan, and X. Gong, “Consensus formation control for a class of networked multiple mobile robot systems,”
*Journal of Control Science and Engineering*, vol. 2012, Article ID 150250, 12 pages, 2012. View at Publisher · View at Google Scholar - J. Elson, L. Girod, and D. Estrin, “Fine-grained network time synchronization using reference broadcasts,” in
*Proceedings of the 5th Symposium on Operating Systems Design and Implementation (OSDI '02)*, vol. 36, pp. 147–163, 2002. - S. Ganeriwal, R. Kumar, and M. B. Srivastava, “Timing-sync protocol for sensor networks,” in
*Proceedings of the 1st International Conference on Embedded Networked Sensor Systems (SenSys '03)*, pp. 138–149, November 2003. View at Scopus - M. Maróti, B. Kusy, G. Simon, and Á. Lédeczi, “The flooding time synchronization protocol,” in
*Proceedings of the 2nd International Conference on Embedded Networked Sensor Systems (SenSys '04)*, pp. 39–49, 2004. - R. Solist, V. S. Borkar, and P. R. Kumar, “A new distributed time synchronization protocol for multihop wireless networks,” in
*Proceedings of the 45th IEEE Conference on Decision and Control (CDC '06)*, pp. 2734–2739, December 2006. View at Scopus - L. Schenato and G. Gamba, “A distributed consensus protocol for clock synchronization in wireless sensor network,” in
*Proceedings of the 46th IEEE Conference on Decision and Control (CDC '07)*, pp. 2289–2294, December 2007. View at Publisher · View at Google Scholar · View at Scopus - O. Simeone, U. Spagnolini, Y. Bar-Ness, and S. H. Strogatz, “Distributed synchronization in wireless networks: global synchronization via local connections,”
*IEEE Signal Processing Magazine*, vol. 25, no. 5, pp. 81–97, 2008. View at Publisher · View at Google Scholar · View at Scopus - S. Bolognani, R. Carli, E. Lovisari, and S. Zampieri, “A randomized linear algorithm for clock synchronization in multi-agent systems,” in
*Proceedings of the IEEE Conference on Decision and Control (CDC '12)*, pp. 20–25, Maui, Hawaii, 2012. View at Publisher · View at Google Scholar - R. A. Horn and C. R. Johnson,
*Matrix Analysis*, Cambridge University Press, Cambridge, UK, 2012. - J. Wolfowithz, “Product of indecomposable, aperiodic and stochastic matrices,”
*Proceedings of the American Mathematical Society*, vol. 14, no. 5, pp. 733–737, 1963. View at Google Scholar - M. Mesbahi and M. Egerstedt,
*Graph Theoretic Methods in Multiagent Networks*, Princeton University Press, Princeton, NJ, USA, 2010. - F. Xiao and L. Wang, “State consensus for multi-agent systems with switching topologies and time-varying delays,”
*International Journal of Control*, vol. 79, no. 10, pp. 1277–1284, 2006. View at Publisher · View at Google Scholar · View at Scopus - R. Olfati-Saber, J. A. Fax, and R. M. Murray, “Consensus and cooperation in networked multi-agent systems,”
*Proceedings of the IEEE*, vol. 95, no. 1, pp. 215–233, 2007. View at Publisher · View at Google Scholar · View at Scopus - W. Ren and R. W. Beard, “Consensus seeking in multiagent systems under dynamically changing interaction topologies,”
*IEEE Transactions on Automatic Control*, vol. 50, no. 5, pp. 655–661, 2005. View at Publisher · View at Google Scholar · View at Scopus