average time synchronization in wireless sensor networks by pairwise messages

13
Average time synchronization in wireless sensor networks by pairwise messages Jianshe Wu , Licheng Jiao, Ranran Ding Key Laboratory of Intelligent Perception and Image Understanding of Ministry of Education of China, 224#, Xidian University, Xi’an 710071, PR China article info Article history: Received 26 March 2011 Received in revised form 5 September 2011 Accepted 12 September 2011 Available online 17 September 2011 Keywords: Sensor networks Time synchronization Pairwise messages Clock skew abstract Most of previous algorithms for time synchronization choose a specific node’s (denoted as a root or lea- der) local time to be the reference time, which is easily disturbed by many events (e.g. root node’s power down or damage). The Gaussian distribution for the nodes’ local clocks has been reported by a few authors based on laboratory tests, the average of all nodes’ clocks is the best approximation to the ideal time. In this paper, the possibility to realize average time synchronization in wireless sensor networks by pairwise messages exchange is studied, and a simple algorithm (ATSP) is proposed, which synchronizes all the nodes’ clocks to their average. For networks with clock skew, the algorithm compensates the fre- quencies of nodes to their average also. Using the Lyapunov’s stability theory, convergence analyses and proofs of the algorithm are given. Synchronization error (accuracy) of the algorithm is estimated by using probability theory also, which indicates that the synchronization error of the algorithm is linearly related to the standard deviation of the message delay. Simulations are performed on a 300 nodes network to examine the performance of the algorithm, which verified the theoretical results. Ó 2011 Elsevier B.V. All rights reserved. 1. Introduction Wireless sensor networks (WSNs) have drawn much attention from the academia to industry in recent years [1–3]. WSNs have many applications including environmental monitoring, health monitoring, inventory location monitoring, factory and process automation, objects tracking, etc. It is envisioned that WSNs will be an integral part of our lives, more than the present-day personal computers [4,5]. Time synchronization of the nodes has been an open research issue in WSNs [6], which is very important for energy conservation [7]. Energy will be conserved when there are less retransmissions and collisions. Network-wide synchronization allows the nodes to transmit data in a scheduled manner with cooperation. The lack of time synchronization can significantly reduce not only the net- work’s lifetime but also its functions [6], the detection of an event is meaningless to many applications [8]. For time synchronization in WSNs, valuable researches have been done in the recent past years [9–34]. Most existing works aim at accurately estimating the clock offset and synchronizing each node’s local clock to a root node or an external time reference, only a few works on average time synchronization [9–11]. Syn- chronizing to a root node or external time reference may have many advantages, e.g. smaller number of messages exchanges (see Section 4.4 of this paper), higher accuracy, etc. But the root node’s local clock is usually easy to be disturbed by incidental events (e.g. oscillator’s frequency drift, circuit’s invalidation, power down, etc.) or damaged by intended attack (e.g. in military applica- tions), and external time reference is not always available in ordin- ary applications. Li and Rus provided two diffusion-based methods for average time synchronization [9,10]: one is the rate-based syn- chronous diffusion algorithm and the other is the asynchronous diffusion algorithm. The ATS algorithm in [11] can provide average time synchronization in a cluster of the network by broadcasting. Without a root node or an external time reference, average time synchronization means that all the nodes’ local clocks synchronize to their average, which enhances the robustness and scalability of the network. The diffusion method in [9,10] for average time synchronization is a good idea for sensor networks, which spreads the local time synchronization to the entire network for network-wide time syn- chronization. To the best of our knowledge, which may be the first idea of average time synchronization in WSNs, and the complete mathematical proofs are also excellent. Inspired by the previous works on average time synchroniza- tion [9–11], an average time synchronization algorithm by pair- wise messages exchange (ATSP) is proposed in this paper, which can provide network-wide average time synchronization for WSNs, random time delay and clock skew are also considered. WSNs usually consist of a large number of nodes that are orga- nized as a distributed multihop configuration. The Gaussian distri- bution for the nodes’ local clocks has been reported by a few authors based on laboratory tests [12]. If each node’s local clock is a random variable with its expectation being the ideal time 0140-3664/$ - see front matter Ó 2011 Elsevier B.V. All rights reserved. doi:10.1016/j.comcom.2011.09.007 Corresponding author. Tel.: +86 29 88202279; fax: 86 29 88201023. E-mail addresses: [email protected] (J. Wu), [email protected] (L. Jiao), [email protected] (R. Ding). Computer Communications 35 (2012) 221–233 Contents lists available at SciVerse ScienceDirect Computer Communications journal homepage: www.elsevier.com/locate/comcom

Upload: jianshe-wu

Post on 05-Sep-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Average time synchronization in wireless sensor networks by pairwise messages

Computer Communications 35 (2012) 221–233

Contents lists available at SciVerse ScienceDirect

Computer Communications

journal homepage: www.elsevier .com/locate /comcom

Average time synchronization in wireless sensor networks by pairwise messages

Jianshe Wu ⇑, Licheng Jiao, Ranran DingKey Laboratory of Intelligent Perception and Image Understanding of Ministry of Education of China, 224#, Xidian University, Xi’an 710071, PR China

a r t i c l e i n f o

Article history:Received 26 March 2011Received in revised form 5 September 2011Accepted 12 September 2011Available online 17 September 2011

Keywords:Sensor networksTime synchronizationPairwise messagesClock skew

0140-3664/$ - see front matter � 2011 Elsevier B.V. Adoi:10.1016/j.comcom.2011.09.007

⇑ Corresponding author. Tel.: +86 29 88202279; faxE-mail addresses: [email protected] (J. Wu),

[email protected] (R. Ding).

a b s t r a c t

Most of previous algorithms for time synchronization choose a specific node’s (denoted as a root or lea-der) local time to be the reference time, which is easily disturbed by many events (e.g. root node’s powerdown or damage). The Gaussian distribution for the nodes’ local clocks has been reported by a fewauthors based on laboratory tests, the average of all nodes’ clocks is the best approximation to the idealtime. In this paper, the possibility to realize average time synchronization in wireless sensor networks bypairwise messages exchange is studied, and a simple algorithm (ATSP) is proposed, which synchronizesall the nodes’ clocks to their average. For networks with clock skew, the algorithm compensates the fre-quencies of nodes to their average also. Using the Lyapunov’s stability theory, convergence analyses andproofs of the algorithm are given. Synchronization error (accuracy) of the algorithm is estimated by usingprobability theory also, which indicates that the synchronization error of the algorithm is linearly relatedto the standard deviation of the message delay. Simulations are performed on a 300 nodes network toexamine the performance of the algorithm, which verified the theoretical results.

� 2011 Elsevier B.V. All rights reserved.

1. Introduction

Wireless sensor networks (WSNs) have drawn much attentionfrom the academia to industry in recent years [1–3]. WSNs havemany applications including environmental monitoring, healthmonitoring, inventory location monitoring, factory and processautomation, objects tracking, etc. It is envisioned that WSNs willbe an integral part of our lives, more than the present-day personalcomputers [4,5].

Time synchronization of the nodes has been an open researchissue in WSNs [6], which is very important for energy conservation[7]. Energy will be conserved when there are less retransmissionsand collisions. Network-wide synchronization allows the nodesto transmit data in a scheduled manner with cooperation. The lackof time synchronization can significantly reduce not only the net-work’s lifetime but also its functions [6], the detection of an eventis meaningless to many applications [8].

For time synchronization in WSNs, valuable researches havebeen done in the recent past years [9–34]. Most existing worksaim at accurately estimating the clock offset and synchronizingeach node’s local clock to a root node or an external time reference,only a few works on average time synchronization [9–11]. Syn-chronizing to a root node or external time reference may havemany advantages, e.g. smaller number of messages exchanges(see Section 4.4 of this paper), higher accuracy, etc. But the root

ll rights reserved.

: 86 29 [email protected] (L. Jiao),

node’s local clock is usually easy to be disturbed by incidentalevents (e.g. oscillator’s frequency drift, circuit’s invalidation, powerdown, etc.) or damaged by intended attack (e.g. in military applica-tions), and external time reference is not always available in ordin-ary applications. Li and Rus provided two diffusion-based methodsfor average time synchronization [9,10]: one is the rate-based syn-chronous diffusion algorithm and the other is the asynchronousdiffusion algorithm. The ATS algorithm in [11] can provide averagetime synchronization in a cluster of the network by broadcasting.Without a root node or an external time reference, average timesynchronization means that all the nodes’ local clocks synchronizeto their average, which enhances the robustness and scalability ofthe network.

The diffusion method in [9,10] for average time synchronizationis a good idea for sensor networks, which spreads the local timesynchronization to the entire network for network-wide time syn-chronization. To the best of our knowledge, which may be the firstidea of average time synchronization in WSNs, and the completemathematical proofs are also excellent.

Inspired by the previous works on average time synchroniza-tion [9–11], an average time synchronization algorithm by pair-wise messages exchange (ATSP) is proposed in this paper, whichcan provide network-wide average time synchronization for WSNs,random time delay and clock skew are also considered.

WSNs usually consist of a large number of nodes that are orga-nized as a distributed multihop configuration. The Gaussian distri-bution for the nodes’ local clocks has been reported by a fewauthors based on laboratory tests [12]. If each node’s local clockis a random variable with its expectation being the ideal time

Page 2: Average time synchronization in wireless sensor networks by pairwise messages

222 J. Wu et al. / Computer Communications 35 (2012) 221–233

(i.e. the time measured by an ideal clock.), then the average of allnodes’ clocks is the best approximation to the ideal time. In a net-work without external time reference, synchronize to the averagetime scale should be the best way to approximate to the idealclock.

Clocks can be out of synchronization in two ways: shifting(clock offset or phase offset) or drifting (clock skew-oscillator’s fre-quency offset). In the former case, they run at the same frequency,but their clock readings differ by a constant value—the offset be-tween the clocks. In the latter case, they run at different frequen-cies. Synchronizing drifting clocks are much more costly anddifficult than synchronizing two shifting clocks. Due to the imper-fections in the quartz crystal, clocks of nodes may run at slightlydifferent frequencies, which is the main reason why clock offsetskeep drifting away. Adjusting clock skew can guarantee long-termreliability of synchronization and reduce the number of messageexchanges. Some of the previous algorithms adjust the frequencyoffset (clock skew) relative to a certain frequency [12]. In this pa-per, the frequencies of all nodes are adjusted to their average. Sim-ilar to the clock offset, if there is not standard crystal oscillator inthe network, compensating the frequencies of all nodes to theiraverage may be the best way to approximate to the standardfrequency.

ATSP compensates both the nodes’ local clocks and the frequen-cies to their average, respectively, which is simple and easy toimplement, but it’s somewhat troublesome to prove its correctnessin mathematics. So we provide the algorithm step by step: startingfrom the simplest case without message delay and clock skew,then to the case with message delay, to the case with clock skew,finally to the case with both random message delay and clockskew. Theoretical analyses about the convergence and synchroni-zation error are verified by computer simulations, which show thatthe synchronization error is linearly related to the standard devia-tion of message delays.

The remainder of this paper is organized as follows. The relatedworks and mathematical preliminaries to prove the algorithm areprovided in Section 2. Section 3 is the framework of ATSP. The algo-rithm for average time synchronization with message delay is pre-sented and analyzed in Section 4. Section 5 provides the algorithmfor frequency adjustment and the analyses about its convergence.The algorithm with clock offset, frequency skew, and random mes-sage delay is presented in Section 6. Section 7 is the conclusion ofthis paper. For emergent readers, the mathematical preliminariesin Section 2 and the analyses in the rest sections can be neglectedwithout affecting the readability.

2. Related works and preliminaries

2.1. Related works

The network time protocol (NTP) [15] is an algorithm (or pro-tocol) widely used in the Internet. It uses a symmetric architec-ture in which a subnet of time servers operating in ahierarchical configuration synchronizes local clocks within thesubnet and to external global time sources (national time stan-dards). In the reference broadcast synchronization (RBS) scheme[12], each node sends reference beacons to its neighbors. A refer-ence broadcast does not contain an explicit timestamp. Receiversexchange with each other the arrival time of the beacon as apoint of reference for comparing their clocks. The accuracy ofthe RBS is improved by eliminating the synchronization error in-duced by the random processing time spent at the transmitternode. The timing-sync protocol for sensor networks (TPSN) worksin two phases [16]: level discovery and synchronization. A hierar-chical structure is established in the level discovery phase. In the

second phase, pair wise synchronization is performed along theedges of the hierarchical structure to establish a global timescalethroughout the network, eventually all nodes in the network syn-chronize their clocks to a reference node.

Typical algorithms also include the lightweight time synchroni-zation (LTS) [17], flooding time synchronization protocol (FTSP)[18], TSync [19], Tiny-Sync and Mini-Sync (TS/MS) [20], pairwisebroadcast synchronization (PBS) [21], PCO protocol [13], self-cor-recting time synchronization (SCTS) [22], advanced self-correctingtime synchronization (ACSTS) [23], time synchronization algo-rithm with gradient property [24], physical-layer (pulse-coupled)distributed synchronization algorithm [25], attack-resilient timesynchronization which can detect and accommodate the delay at-tacks [26], self-stabilizing clock synchronization with security con-cerns [27], and the pseudo-synchronization [28], etc. Just to namea few.

To summarize, the existing time synchronization algorithms (orprotocols) can be classified into three categories by the eventuallysynchronized time scale: (1) synchronize to one or more externaltime sources via one or several nodes; (2) synchronize to a root(or parent, reference, leader in some references) node; (3) synchro-nize to their average.

2.2. Mathematical preliminaries

Assuming there are n nodes in a wireless sensor network,denoted by a graph G(V,E,A), where V = {v1,v2, . . . ,vn} is the setof nodes, E = [eij] the set of edges, and A = [aij] the adjacentmatrix. If vi and vj are neighbors, then aij 2 E. Assuming thatthe adjacency elements aij associated with the edges of theundirected graph are all one, i.e. eij 2 E indicate aij = 1, aii = 0for all i = 1, . . . ,n.

Local clock of node i usually expressed as

xiðtÞ ¼ wit þ xið0Þ; i ¼ 1; . . . ;n ð1Þ

where xi(t) is the local clock of vi at time t, wi is the frequency ofcrystal oscillator in vi, and xi(0) is the initial local clock at t = 0. Clockmodel Eq. (1) is equivalent to Eq. (2) in [30], Eq. (1) in [20], and theclock model in [22].

For clarity in denotation, we say an operation on the sensor net-work which means partial or all the nodes’ local clocks or/and fre-quencies have been updated by the operation.

Definition 1 (Average time synchronization). If all the crystaloscillators of the nodes in the network have identical frequencyor can be compensated to an identical frequency, that isw1 = w2 = � � � = wn = w, and after some operations on the network,there are

xavg synðtÞ ¼ wt þ avgðxð0ÞÞ ð2Þ

for all nodes, where

avgðxð0ÞÞ ¼ 1n

Xn

i¼1

xið0Þ ð3Þ

is the average clock of all nodes at time t = 0, the network is calledto realized average time synchronization. Eq. (2) is said to be theaverage timescale at time t of the sensor network.

From Eq. (2), if the frequencies of all the crystal oscillators in thenodes are identical, then the average timescale at time t is onlydependent on the average clock at time t = 0.

Suppose starting from time t = 0, after several operations whichupdated partial or all nodes’ local clock, then the clocks of all nodesat time t are expressed as

Page 3: Average time synchronization in wireless sensor networks by pairwise messages

J. Wu et al. / Computer Communications 35 (2012) 221–233 223

x1ðtÞ ¼ wt þ e1ðtÞx2ðtÞ ¼ wt þ e2ðtÞ...

xnðtÞ ¼ wt þ enðtÞ

8>>>><>>>>:

ð4Þ

where variable ei(t) is the clock offset between the local clock of vi

and the value of wt,

eiðtÞ ¼ xiðtÞ �wt; i ¼ 1; . . . ; n ð5Þ

which are frequently used in analyses and proofs of ATSP in the fol-lowing of this paper. For clarity, ei(t) is called the offset observationvalue of vi’s clock at time t. Since the local clocks of all nodes alwaysincrease as the time elapses regardless time synchronization or not,whereas ei(t) do not. From Eq. (4), ei(t) are constant after the net-work realized synchronization. So it is convenient to use the offsetobservation values ei(t) instead of xi(t) to observe the evolution oftime synchronization of the nodes.

To synchronize the network, discrete operations have to bedone on the network to update the nodes’ local clocks. After thekth operation on the network, the local clocks are usually writtenas

x1ðkÞ ¼ wtðkÞ þ e1ðkÞx2ðkÞ ¼ wtðkÞ þ e2ðkÞ...

xnðkÞ ¼ wtðkÞ þ enðkÞ

8>>>><>>>>:

ð6Þ

where xi(k) is the local clock of vi after the kth operation and t(k) thetime after the kth operation. The t(k) in Eq. (6) has no virtual differ-ence with the t in Eqs. (2), (4) and (5), only that t(k) is customarilyused in discrete equation and t in continuous ones.

In Eq. (6), ei(k) is the offset observation value of the vi at timeafter the kth operation. Then from Eq. (6)

eiðkÞ ¼ xiðkÞ �wtðkÞ; i ¼ 1; . . . ;n ð7Þ

when t = 0,

eið0Þ ¼ xið0Þ; i ¼ 1; . . . ; n:

By comparing Eqs. 1, 2 and 4, it is obvious that if the network real-ized average time synchronization, one has

avgðxð0ÞÞ ¼ avgðeð0ÞÞ ¼ 1n

Xn

i¼1

eiðtÞ ð8Þ

It follows

Xn

i¼1

eiðtÞ ¼ n� avgðxð0ÞÞ ¼Xn

i¼1

xið0Þ ð9Þ

Eq. (9) indicates that, the sum of ei(t) of all nodes should be invari-able before and after each operation if the network realized averagetime synchronization.

From the analyses above, two lemmas in discrete equation areobtained, which will be used in Section 3 and 4 in proofs of thealgorithm.

Lemma 1. Suppose after finite separate operations, the networkeventually realized time synchronization, then the network realizedaverage time synchronization if the sum of ei(k) of all nodes keepsinvariable after each operation. That is

Xn

i¼1

eiðkÞ ¼Xn

i¼1

eiðk� 1Þ ð10Þ

Proof. Suppose after the kth operation, the network realized timesynchronization. Then

x1ðtÞ ¼ x1ðtÞ ¼ � � � ¼ xnðtÞ

From Eq. (4), one has

xiðtÞ ¼1n

Xn

i¼1

xiðtÞ ¼ wt þ 1n

Xn

i¼1

eiðtÞ ð11Þ

Since Eq. (10) holds for each operation, which follows

Xn

i¼1

eiðkÞ ¼Xn

i¼1

eiðk� 1Þ ¼ � � � ¼Xn

i¼1

eið0Þ ¼Xn

i¼1

xið0Þ

Together with Eq. (11), condition (2) is satisfied. The proof is com-pleted by Definition 1.

If Eq. (10) does not hold for some operations, the network is notsure to realize average time synchronization in general. It is easy toverify that condition Eq. (10) is satisfied for the operations in boththe rate-based synchronous diffusion algorithm and the asynchro-nous diffusion algorithm in [9,10].

To ensure Eq. (10) holds after an operation on the network, itrequires at least two nodes are involved in the operation andupdate their local clocks, only one node updating its clock willinevitably break condition (10). h

Lemma 2. Suppose e1, e2, and e are three numbers with e1 – e2 – e,then

ðe1 � eÞ2 þ ðe2 � eÞ2 > 2e1 þ e2

2� e

� �2

ð12Þ

Proof. Let a = e1 � e and b = e2 � e, then 2 e1þe22 � e

� �2 ¼2 aþb

2

� �2 ¼ 12 ðaþ bÞ2.

Eq. (12) is equivalent to

a2 þ b2>

12ðaþ bÞ2 or a2 þ b2

> 2ab ð13Þ

Obviously, Eq. (13) comes from (a � b)2 > 0 when a – b. This com-pletes the proof. h

Algorithm 1. Average time synchronization by pairwisemassages exchange

1. for all connections in the network, which is turned on bythe switching signal s(k) in sequence, do

2. the two nodes (e.g. vi and vj) which is connected by the edgeexchange local clocks xi(k � 1) and xj(k � 1),

3. the two nodes update their local clocks toxi(k) = xj(k) = (xi(k � 1) + xj(k � 1))/2.

3. Framework of ATSP

Time synchronization in WSNs is usually realized by broadcast orpairwise (two-way in some references) timing messages [8,12,16,19,20,22]. Here, network-wide average time synchronization algo-rithm by pairwise timing message exchanges will be proposed.

For clarity and simplicity in analyses, time synchronizationalgorithm for the simplest case without frequency offset and mes-sage delay is proposed firstly in this Section, which is the founda-tion of Sections 4–6 in mathematical analyses and proofs. Thealgorithm will be provided in Sections 3.1 and 3.2 is the mathemat-ical analyses and proof.

3.1. Synchronization algorithm

The topology of sensor networks is switching due to the mobil-ity of the wireless nodes. In this paper, switching topologies of aWSN are described by switching edges in proof of the algorithm.

Page 4: Average time synchronization in wireless sensor networks by pairwise messages

224 J. Wu et al. / Computer Communications 35 (2012) 221–233

The graph G(V,E,A), which describes the topology of a wirelesssensor network, is undirected. And the adjacent matrix is symmet-ric, eij 2 E indicates eji 2 E.

In our synchronization algorithm (see algorithm 1), a node ex-changes messages with only one of its neighbors at each operation,though many it may have. The undirected graph may have manyedges, but there is only one or several edges work at each operation.In mathematical denotations, there is a switching signal s(k), whichturns on one or several edges on the graph at the kth operation, withthe constraint that each node exchanges messages with only one ofits neighbors. For example, s(k) = {e13,e26} in time step k indicatesthat the two edges are turned on and the two pair of nodes exchangetiming messages respectively at the kth operation. s(k) = {e13,e16} isnot allowed because two edges of v1 are turned on by the switchingsignal.

In our algorithm, if an edge eij is turned on in time step k, nodes vi

and vj send their local clocks xi(k � 1) and xj(k � 1) to each other, andthen update their local clocks to their average xi(k) = xj(k) =(xi(k � 1) + xj(k � 1))/2, respectively.

3.2. Convergence analyses

Assuming that the undirected graph is connected, to analyze theconvergence of the average time synchronization algorithm, an en-ergy (or Lyapunov) function is defined to describe the differencebetween the states of the network and the average timescale afterthe kth operation.

FðkÞ ¼Xn

i¼1

½eiðkÞ � avgðxð0ÞÞ�2 ð14Þ

If the energy function approaches to zero asymptotically, then thesensor network approaches to the average time synchronizationasymptotically by Lyapunov’s stability theory. Obviously, F(k) is alsoa measure of the synchronization errors. Using the energy functionto the analyses of time synchronization in WSNs is inspired by theresearches about synchronization in complex networks [35–37].

Theorem 1. Suppose the graph which describes the topology of thesensor network is connected, and each edge of the graph will be turnedon infinite times as k ?1, then the sensor network will realizeaverage time synchronization asymptotically by algorithm 1.

Proof. Without loss of generality, suppose at time step k, the edgebetween nodes v1 and v2 is turned on, and both of the two nodesupdate their local clocks from x1(k � 1) and x2(k � 1) tox1(k) = x2(k) = (x1(k � 1) + x2(k � 1))/2, the rest nodes (i = 3, . . . ,n)do not update their local clocks. Then from Eq. (6), one has

e1ðkÞ ¼ x1ðkÞ �wtðkÞ ¼ 12ðx1ðk� 1Þ þ x2ðk� 1ÞÞ �wtðkÞ

¼ 12ðe1ðk� 1Þ þ e2ðk� 1ÞÞ ð15Þ

Similarly, one has

v1

v2

v3

v6

v4

v5

v7

v8

v10

v9

Fig. 1. The graph of a sensor network.

e2ðkÞ ¼12ðe1ðk� 1Þ þ e2ðk� 1ÞÞ ð16Þ

and ei(k) = ei(k � 1) for all i = 3, . . . ,n. So condition (10) is satisfied forthe network. By Lemma 1, if the network realized time synchroniza-tion, it should be realized average time synchronization.

By substituting Eqs. (15) and (16) into Eq. (14), obtains

FðkÞ ¼Xn

i¼3

½eiðkÞ � avgðxð0ÞÞ�2 þ ½e1ðkÞ � avgðxð0ÞÞ�2 þ ½e2ðkÞ

� avgðxð0ÞÞ�2

¼Xn

i¼3

½eiðkÞ � avgðxð0ÞÞ�2

þ 212ðe1ðk� 1Þ þ e2ðk� 1ÞÞ � avgðxð0ÞÞ

� �2

The following inequality is obtained from Lemma 2,

FðkÞ < Fðk� 1Þ ð17Þ

if e1(k � 1) – e2(k � 1) (or x1(k � 1) – x2(k � 1)).Eq. (17) indicates that, if an edge between two nodes is turned

on in time step k and the two nodes’ local clocks are different, thenthe energy function F(k) will decrease essentially. Because theundirected graph is connected and each edge will be turned oninfinite times as k ?1, F(k) will eventually approach to zeroasymptotically, and the network will realize average time syn-chronization. The case that several edges are turned on in each stepcan be proved similarly. This completes the proof. h

Corollary 1 can be directly obtained from Theorem 1, which isanother criterion for average time synchronization of algorithm 1.

Corollary 1. Suppose the graph which describes the topology of thesensor network is connected, and each edge of the graph will be turnedon at least once in a finite time range T, then the sensor network willrealize average time synchronization asymptotically by algorithm 1.

Proof. Because in a finite time range T, each edge will be turned onat least once, then each edge of the graph will be turned on infinitetimes as k ?1. Then the result comes directly from Theorem 1.

For the diffusion algorithm for average time synchronization in[10], many nodes evolved in the operation at a time (see algorithm3 and its proof in [10]). If each edge of the graph will be turned oninfinite number of times, then average time synchronization canalso be reached.

3.3. An illustrate example

From Eq. (4), if the network realized synchronization, one has

e1ðtÞ ¼ e1ðtÞ ¼ � � � ¼ enðtÞ ð18Þ

Furthermore, as shown in Eq. (14), if the sensor network realizedaverage time synchronization, then

e1ðtÞ ¼ e2ðtÞ ¼ � � � ¼ enðtÞ ¼ avgðxð0ÞÞ ð19Þ

which are constant. On the other hand, one can obtain Eq. (2) fromEq. (4) if Eq. (19) holds, the network realized average consensus byDefinition 1. Eq. (19) is the necessary and sufficient condition foraverage time synchronization.

If the offset observation values ei(t) are all equal (Eq. (18)holds), the network realized time synchronization by Eq. (4). Butwhether the network realized average time synchronization ornot, which should be judged by Eq. (19). For convenience to detectaverage time synchronization in analyses and computer simula-tions, a new variable is introduced here. From Eq. (19), let

Page 5: Average time synchronization in wireless sensor networks by pairwise messages

J. Wu et al. / Computer Communications 35 (2012) 221–233 225

biðtÞ ¼ eiðtÞ � avgðxð0ÞÞ; i ¼ 1; . . . ;n ð20Þ

then bi(k) can be the variables to observe the average time synchro-nization, called average observation values. If all the averageobservation values approach to zero, the network realized averagetime synchronization; else if all the average observation values ap-proach to a constant other than zero, the network realized time syn-chronization but not average time synchronization. In discrete case,bi(k) are used to denote the average observation values after thekth operation on the network. Obviously, bi(k) and jbi(k)j are alsoa measure of the average time synchronization error.

As a simple illustrate example, consider a network consists of10 nodes, which have identical oscillator frequency. At time t = 0,the local clocks of the nodes are respectively: 0.0350, 0.8710,1.2283, 2.6122, �0.8573, �0.5226, 1.5378, 0.1102, �0.8813, and0.8155, which are computer generated gaussian distribution ran-dom variables with the mean and variance are 0.5 and 1, respec-tively. Let the switching signal s(k) be periodic which turns oneach edge on the graph one by one, after all the edges have beenturned on once, then go to the next period, . . .. Simulation resultsare shown in Fig. 2, which shows that the offset observation val-ues ei(t) of all the nodes are approached to 0.5 after about 15 times’operation on each edge (see Fig. 2(a)), the network realized timesynchronization. Fig. 2(b) shows that the average observation val-ues bi(k) of all nodes approached to zero after about 15 times’ oper-ation on each edge, so the network really realized average timesynchronization.

4. Synchronization with random message time delay

In Section 3, message delay is neglected in algorithm 1. In fact,the delay from sending to receiving of a message including send,

0 10 20 30 40−1

−0.5

0

0.5

1

1.5

2

2.5

number of switching times to each edge

offs

et o

bser

vatio

n va

lues

of

all

node

s

(a)

0 10 20 30 40−1.5

−1

−0.5

0

0.5

1

1.5

2

number of switching times to each edge

aver

age

obse

rvat

ion

valu

es

of a

ll no

des

(b)

Fig. 2. Time synchronization of the network. (a) Offset observation values ei(k) of allnodes versus the number of updating times on each edge. (b) Average observationvalues bi(k) of all nodes versus the number of updating times on each edge.

access, propagation, and receive time [6,32]. Message delay isdecomposed as send, access, transmission, propagation, reception,and receive time in TPSN [16], similar decomposition can also befound in [12]. The uncertainty of message time delay is a mainsource of synchronization errors [33]. In this section, the algorithmwith message delay is provided in Section 4.1; theoretical analysesabout the algorithm with constant and random delay are presentedin Sections 4.2 and 4.3, respectively; comparison with TPSN is per-formed in Section 4.4.

4.1. Synchronization algorithm

Pairwise message synchronization mechanism with packet de-lay has been employed in TPSN, LTS, TSync, and TS/MS, etc.Fig. 3(a) shows its fundamental steps:

1. Node i sends a packet at its local clock T1 to node j, and node jreceives the packet at its local clock T2. Then T2 = T1 + d + d,where d and d are respectively the packet time delay and clockoffset between the two nodes.

2. Node j sends back an acknowledgment packet at its local clockT3, which contains the information of T2 and T3. Node i receivesthe packet at its local clock T4, where T4 = T3 + d � d.

With the two packets, node i can calculate the packet delay be-tween the two nodes as d = (T4 � T3 + T2 � T1)/2 and offsetd = (T3 � T4 + T2 � T1)/2. Then node i can update its clock to thatof node j [32,33].

To obtain average time synchronization, the packet delay d orthe offset d has to be sent back to node j. The third packet is re-quired as shown in Fig. 3(b), which has three steps.

1. The first packet. Node i sends a packet at its local clock T1 tonode j, and node j receives the packet at its local clock T2. ThenT2 = T1 + d1 + d. This is the same as that in the traditionalscheme.

2. The second packet. Node j sends back an acknowledgmentpacket as soon as possible at its local clock T3, which containsthe information of T2, T3, and d1. Node i receives the packet atits local clock T4 and updates its clock toT 04 ¼ ðT2 þ T4 þ d1 þ d2Þ=2. Here T4 = T3 + d1 � d, d2 = T3 � T2,and d1 can be calculated by node j as d1 = (T4 � T3 + T2 � T1)/2.

3. The third packet. Node i sends back the third packet as soon aspossible at its local clock T5, which contains the information ofT4; T

04; T5, and d1. When node j receives the packet at its local

clock T6, it updates its clock to T 06 ¼ ðT4 þ T6 þ d1 þ d3Þ=2, whered3 = T5 � T4.

node i

node j

xt j(k -1)

xs i ( k-1 )

node i

node j

T1

T 2 T3

T 4

T1

T 3

T 5

(a)

(b) T 2

T 4

T6

d d

d 1

d 2

d 1

d 3

xf j( k-1 )

Fig. 3. Pairwise message exchange scheme between nodes i and j with packetsdelay. (a) Traditional scheme, two packets. (b) Average time synchronizationscheme, three packets, s = d1 + d2.

Page 6: Average time synchronization in wireless sensor networks by pairwise messages

226 J. Wu et al. / Computer Communications 35 (2012) 221–233

Assume d2 = d3 (see Fig. 3(b)). For clarity, let s = d1 + d2, which isthe total time delay between receiving (or sending) of two packets(See Fig. 3(b)). In the following of this paper, the total time delaymay be replaced by time delay or packet delay in case of withoutconfusion. From Fig. 3(b) obtains s = [(T4 � T2) + (T3 � T1)]/2. As-sume that all the information to calculate s is contained in thepackets of algorithm 2. Then

T 04 ¼ ðT2 þ T4 þ sÞ=2 ð21Þ

T 06 ¼ ðT4 þ T6 þ sÞ=2 ð22Þ

T2, T4, and T6 are respectively the local clocks of receiving the threepackets, we use xfj(k � 1), xsi(k � 1), and xtj(k � 1) to denote them initerative algorithm, respectively. After the kth operation, T 04 and T 06are denoted as xi(k) and xj(k), respectively. Then Eqs. (21) and (22)are rewritten as Eqs. (23) and (24) in algorithm.

xiðkÞ ¼12ðxfjðk� 1Þ þ sþ xsiðk� 1ÞÞ ð23Þ

xjðkÞ ¼12ðxsiðk� 1Þ þ sþ xtjðk� 1ÞÞ ð24Þ

Algorithm 2. Average time synchronization by pairwisemassages exchange with packet delay

1. for all connections in the network, which is turned on bythe switching signal s(k) in sequence, do

2. after receiving the first packet from node vi at its local clockxfj(k � 1), node vj sends back the second packet as soon aspossible; node vi sends back the third packet as soon aspossible after receiving the second packet at its local clockxsi(k � 1),

3. node vi updates its clock by (23) after receiving the secondpacket at its local clock xsi(k � 1); node vj updates its clockby (24) after receiving the third packet at its local clockxtj(k � 1).

Assume all the information needed is contained in the packets.

4.2. Convergence analyses

Assuming the total time delay s is constant in this section; wewill show that the sensor network will realize average time syn-chronization by algorithm 2. The effects of the uncertainty of thetotal time delay will be analyzed in the next section.

Theorem 2. Suppose the graph which describes the topology of thesensor network is connected, the total time delay between sending (orreceiving) of two packets is constant, and each edge of the graph willbe turned on infinite times as k ?1, then the sensor network willrealize average time synchronization asymptotically by algorithm 2.

Proof. Without loss of generality, suppose at the kth operation, theedge between v1 and v2 is turned on, node v1 (corresponding tonode j in Fig. 3(b)) sends the second packet as soon as possible afterreceiving the first packet at its local clock xf1(k � 1), after time selapses, node v2 (corresponding to node i in Fig. 3(b)) receivesthe second packet at its local clock xs2(k � 1) and updates its clockto

x2ðkÞ ¼12ðxf1ðk� 1Þ þ sþ xs2ðk� 1ÞÞ ð25Þ

After receiving the second packet, node v2 sends back the thirdpacket with the information of xs2(k � 1) to node v1, after time selapses, node v1 receives the third packet at its local clock xt1(k � 1)and updates its clock to

x1ðkÞ ¼12ðxs2ðk� 1Þ þ sþ xt1ðk� 1ÞÞ ð26Þ

where the total time delay s is constant.The rest nodes (i = 3, . . . ,n) do not update their clocks. Then

from Eqs. (7) and (25), after the kth operation on node v2’s clock,one has

e2ðkÞ ¼ x2ðkÞ �wtðkÞ ¼ 12ðxf1ðk� 1Þ þ sþ xs2ðk� 1ÞÞ

�wtðk� 1Þ ¼ 12ðxs2ðk� 1Þ �wtðk� 1ÞÞ

þ 12ðxf1ðk� 1Þ þ s�wtðk� 1ÞÞ ¼ 1

2e2ðk� 1Þ

þ 12e1ðk� 1Þ ð27Þ

Similarly from Eqs. (7) and (26), after the kth operation on the nodev1’s clock,

e1ðkÞ ¼ x1ðkÞ �wtðkÞ ¼ 12ðxs2ðk� 1Þ þ sþ xt1ðk� 1ÞÞ

�wtðk� 1Þ ¼ 12ðxs2ðk� 1Þ þ s�wtðk� 1ÞÞ þ 1

2ðxt1ðk� 1Þ

�wtðk� 1ÞÞ ¼ 12e2ðk� 1Þ þ 1

2e1ðk� 1Þ ð28Þ

For the rest nodes, ei(k) = ei(k � 1), i = 3, . . . ,n. So condition (10) issatisfied. By Lemma 1, if the network realized time synchronization,it should be realized average time synchronization.

By substituting Eqs. (27) and (28) into Eq. (14) obtains

FðkÞ ¼Xn

i¼3

½eiðkÞ � avgðxð0ÞÞ�2 þ ½e1ðkÞ � avgðxð0ÞÞ�2

þ ½e2ðkÞ � avgðxð0ÞÞ�2 ¼Xn

i¼3

½eiðkÞ � avgðxð0ÞÞ�2

þ 212ðe1ðk� 1Þ þ e2ðk� 1ÞÞ � avgðxð0ÞÞ

� �2

Again from Lemma 2, one has

FðkÞ < Fðk� 1Þ ð29Þ

if e1(k � 1) – e2(k � 1). The rest of the proof is similar to that of The-orem 1 and omitted here.

From the proof of Theorem 2, if the total time delay s is constant,the sensor network will realize average time synchronization byalgorithm 2 without synchronization errors in theory. In fact, smay be a random variable due to transmission and receptionuncertainties [30]. h

4.3. Convergence analyses with random message delay

If the total time delay s is a random variable, then from Eqs.(25)–(28), the local clocks and offset observation values ei of allnodes are all random variables, also. But Definition 1 about aver-age time synchronization is not applicable for random variables.Here, a new definition of average time synchronization is needed.

For clarity, �s is used here to denote the random total time delayin the following, s and r2 are respectively the mean and variance of�s. Now it is clear that the variance of packet delay will result insynchronization error [18,33]. Suppose k operations on the net-work with �sð0Þ; . . ., and �sðk� 1Þ are respectively the total time de-lays of the packets in the k operations, s(h) and r2(h) arerespectively the mean and variance of �sðhÞ; h ¼ 0; . . . ; k� 1. Thenall the r2(h), h = 0, . . . ,k � 1, will made a contribution to thesynchronization errors of the network after the k operations. Theenergy function (14) can not approach to zero because of synchro-nization errors.

Page 7: Average time synchronization in wireless sensor networks by pairwise messages

J. Wu et al. / Computer Communications 35 (2012) 221–233 227

Let Fm(k) be a measure of the synchronization error induced byr2(m) after the k operations, where 0 6m 6 k � 1. Fm(k) is calcu-lated from Eq. (14) by letting r2(h) = 0, h = 0, . . . ,m � 1,m + 1, . . . ,k � 1.

Definition 2 (Average time synchronization with random timedelay). If the expectation of F0(k) asymptotically approach to zeroas k ?1 by an algorithm, that is

EðF0ðkÞÞ ! 0 as k!1 ð30Þ

the network is said to be realized average time synchronization bythe algorithm.

Obviously if Eq. (30) holds, then for any a natural number m,(m 6 k � 1), one has

EðFmðkÞÞ ! 0 as k!1:

Since the uncertainty of packet delay, synchronization errors ofa sensor network can not approach to zero. Definition 2 requires atleast the synchronization error induced by the uncertainty of pack-et delay in a single operation will approach to zero.

Let us start the analyses from the simplest case that a networkconsists of only two nodes, denoted as node v1 and v2 respectively.Without loss of generality, for the kth operation, after receiving thefirst packet at its local clock xf1(k � 1), node v1 sends back the sec-ond packet to node v2(see Fig. 3(b), node v1 corresponds to node j),and node v2 receives the second packet at its local clock xs2(k � 1)after time delay �sðk� 1Þ. Node v2 updates its local clock by Eq. (31)with s replaced by �sðk� 1Þ in Eq. (25). When node v1 receives thethird packet, it updates its local clock by Eq. (32) with s replaced by�sðk� 1Þ in Eq. (26).

x2ðkÞ ¼12ðxf1ðk� 1Þ þ �sðk� 1Þ þ xs2ðk� 1ÞÞ ð31Þ

x1ðkÞ ¼12ðxs2ðk� 1Þ þ �sðk� 1Þ þ xt1ðk� 1ÞÞ ð32Þ

When k = 1, similar to Eq. (27), obtains

e2ð1Þ ¼ x2ð0Þ �wtð0Þ ¼ 12e2ð0Þ þ

12ðxf1ð0Þ þ �sð0Þ �wtð0ÞÞ ð33Þ

Similarly to Eq. (28), obtains

e1ð1Þ ¼ x1ð0Þ �wtð0Þ ¼ 12ðxs2ð0Þ þ �sð0Þ �wtð0ÞÞ þ 1

2e1ð0Þ ð34Þ

From Eqs. (33) and (34), the variance of e1(1) and e2(1) are obtainedas follows.

Dðe1ð1ÞÞ ¼ Dðe2ð1ÞÞ ¼14

Dð�sð1ÞÞ ¼ 14r2ð0Þ

Let r2(i) = 0 for i = 1, . . . ,k � 1. From Eq. (27) obtains

Dðe2ð2ÞÞ ¼ D12e2ð1Þ

� þ D

12e1ð1Þ

� ¼ 1

8r2ð0Þ

Similarly, from Eq. (28) obtains

Dðe1ð2ÞÞ ¼ D12e2ð1Þ

� þ D

12e1ð1Þ

� ¼ 1

8r2ð0Þ

Dðe2ðkÞÞ ¼ D12e2ðk� 1Þ

� þ D

12e1ðk� 1Þ

� ¼ 1

2kþ1 r2ð0Þ

Dðe1ðkÞÞ ¼ D12e2ðk� 1Þ

� þ D

12e1ðk� 1Þ

� ¼ 1

2kþ1 r2ð0Þ

From Eqs. (33) and (34), the expectation of e1(1) and e2(1) are

Eðe1ð1ÞÞ ¼ Eðe2ð1ÞÞ ¼12ðe1ð0Þ þ e2ð0ÞÞ ¼ avgðxð0ÞÞ

Again from Eqs. (27) and (28), we have

Eðe1ðkÞÞ ¼ Eðe2ðkÞÞ ¼12ðe1ð0Þ þ e2ð0ÞÞ ¼ avgðxð0ÞÞ

From Eq. (14), the expectation of the energy function is

EðF0ðkÞÞ ¼ E½e1ðkÞ � avgðxð0ÞÞ�2 þ E½e2ðkÞ � avgðxð0ÞÞ�2

¼ Dðe1ðkÞÞ þ Dðe2ðkÞÞ ¼1

2kr2ð0Þ ð35Þ

Obviously, condition (30) holds for the two nodes network by Eq.(35). The network will realize average time synchronization by Def-inition 2.

The above result can be easily extended from a two nodes net-work to a general network with n nodes.

Theorem 3. Suppose the graph which describes the topology of asensor network is connected, the total time delay �sðhÞ between thereceiving (or sending) of two packets is a random variable(r2(h) – 0,h = 0, . . . , k � 1), and each edge of the graph will be turnedon infinite times as k ?1, then the sensor network will realizeaverage time synchronization asymptotically by algorithm 2.

Proof. The proof is according to Definition 2, see appendix A fordetailed proof.

4.4. Comparison with TPSN

TPSN is a classical protocol for time synchronization in sensornetworks by pairwise (two-way) message exchanges [16]. Thealgorithm works in two steps. In the first step (level discoveryphase), a hierarchical structure is established with only one node,root node, at level 0. The nodes can communicate with the rootnode are assigned level 1, etc. In the second step (synchronizationphase), sender–receiver synchronization is performed along theedges of the hierarchical structure to establish a global timescalethroughout the network. Eventually all nodes in the network syn-chronize their clocks to the root node.

Using sender–receiver synchronization, TPSN would giveroughly a 2� better performance as compared to RBS by recei-ver–receiver synchronization. However, in multihop instances,the synchronization error by TPSN may be blown up with thehop distance due to the hierarchical structure [16].

The synchronization error (phase offset) of the nodes in level 1is estimated here for comparison. Assume that the variance of thepackets delay is r2. From d = (T3 � T4 + T2 � T1)/2 (see Ref. [16] orSection 4.1 of this paper), the variance of the phase offset in level1 is

DðdÞ ¼ 14ðr2 þ r2Þ ¼ 1

2r2 ð36Þ

Assume that d is a gaussian random variable with E(d) = 0, then the

probability density function of jdj is f ðjdjÞ ¼ 2ffiffiffipp

r

R10 e

�d2

r2 dd. The

expectation of jdj in level 1 is then obtained as follows

Ejdj ¼ 2ffiffiffiffipp

r

Z 1

0jdje

�d2

r2 dd ¼ rffiffiffiffipp

Z 1

0e�d2

r2 dðd2

r2Þ ¼�rffiffiffiffipp e

�d2

r2 j10

¼ rffiffiffiffipp � 0:5642r ð37Þ

Compared to TPSN, both TPSN and ATSP use pairwise message ex-changes for synchronization, but ATSP has not hierarchical struc-

Page 8: Average time synchronization in wireless sensor networks by pairwise messages

228 J. Wu et al. / Computer Communications 35 (2012) 221–233

ture and root node, so the synchronization error of ATSP has no rela-tion to the hop distance. In synchronization of only two nodes, ATSPand TPSN has the same synchronization error but ATSP using onemore timing message (detailed analyses about the synchronizationerror of ATSP can be found in Section 6.3). Here, comparison be-tween TPSN and ATSP by simulation is done on the same sensor net-work shown in Fig. 1 with random message time delay. In the firststep of TPSN, the hierarchical structure is established as shown inFig. 4, and does not change for all the simulations. Node 1 is the rootand node 2 is in level 1. It can be seen that there are total 9 edges;

1

2

3 6

4

5

7

8

9

10

Fig. 4. The hierarchical structure of the network of Fig. 1 for TPSN.

0 10 20 30 40 50−2

−1

0

1

2

number of switching times to each connection

aver

age

obse

rvat

ion

valu

es

of a

ll se

nsor

s

Fig. 5. Average observation values bi(k) of all sensors versus the number ofswitching times to each connection.

1 2 3 4 5 6 7 8 9 100

0.5

1

node

sync

hron

izat

ion

erro

r (¦Ì

s)

ATSP

TPSN

Fig. 6. Synchronization errors jbij of all sensors. For TPSN, bi is phase offset of node ito the root node. The values shown are the average of 100 simulation results forboth TPSN and ATSP with r = 1 � 10�6. The average observation values bi for ASTPare depicted after 50 times operation on each connection.

therefore, 2 � 9 = 18 timing messages are enough to synchronizethe network by TPSN. Fig. 5 shows the simulation result by ATSP,in our simulation, each of the 11 connections in Fig. 1 is switchedon one by one, after all connections are turned on one time, thenturn to the second time. Abscissa of Fig. 5 presents the number ofswitching times to each connection of Fig. 1, after about 15 opera-tions to each connection, the network realized synchronization.Thus about 3 � 11 � 15 = 495 timing messages are required forATSP to synchronize the network. Synchronization errors for bothTPSN and ATSP are shown in Fig. 6, which show that the synchroni-zation error of all nodes of ASTP is approximate to that of node 2 (inlevel 1) of TPSN and has no relation to the hierarchical structure;the cost of ASTP is many times of the timing messages required.

Algorithm 3. Average time synchronization by massageexchanges with frequency adjustment

1. for all connections in the network, which is turned on bythe switching signal s(k) in sequence, do

2. the two nodes (e.g. vi and vj) exchange local clocks andfrequencies xi(k � 1), xj(k � 1), wi(k � 1), and wj(k � 1) bytwo packets,

3. both of the two nodes update their local clocks toxi(k) = xj(k) = (xi(k � 1) + xj(k � 1))/2,

4. both of the two nodes update their frequencies towi(k) = wj(k) = (wi(k � 1) + wj(k � 1))/2.

5. Clock frequency adjustment

In Section 3 and 4, clock skew is not considered in the algo-rithm—it is assumed that all the nodes’ clocks are running at thesame frequency. But clock skew is usually inevitable due to manyfactors [12]. Clock skew has a great effect on the time synchroniza-tion of the network. For example, two connected sensors v1 and v2

in a network have different frequencies, w1 – w2. Suppose theclocks of the two nodes are equal at time t = 0, x1(0) = x2(0), thenx1(t) = x1(0) + w1t – x2(t) = x2(0) + w2t, the offset between the twoclocks is x1(t) � x2(t) = (w1 � w2)t, which is increasing with time t.Two synchronized nodes have to resynchronize when clock skewexists. If there is not frequency adjustment on the crystal oscilla-tors, many additional messages exchange have to be done on thenodes to decrease the synchronization errors in the network. Nohet al. have proposed clock skew estimators assuming different de-lay environments for WSNs [33]. Sari et al. have considered thejoint maximum likelihood (JML) estimation of clock offset andskew under exponential noise model in the Reference BroadcastSynchronization (RBS) protocol [34].

Similar to the average time synchronization by pairwise mes-sage exchanges, the entire nodes’ frequencies can also be compen-sated to the average, w = (w1 + w2 + � � � + wn)/n. Thus smallernumbers of messages exchange will be enough to synchronizethe network.

For frequency adjustment by two-way message exchanges, thefrequencies of the two nodes or the frequency offset (clock skewor rate of clock drift in some references [17]) have to be known. Thusthe frequencies of the two nodes can be compensated to their aver-age similar to their local clocks by using three packets. Noh et al.have proposed practical clock skew estimator using two-way timingmessages exchanges under different random delay environments[33], including Gaussian environment. The proposed scheme canbe used here for clock skew estimation. For partial of the sensor net-works, the frequency of oscillator may be known, as stated in Section5.4 of Ref. [17]: ‘‘The clock drift of oscillators can be found in stan-dard specification sheets and can easily be programmed on thenodes during assembly or during a network initialization phase.’’

Page 9: Average time synchronization in wireless sensor networks by pairwise messages

J. Wu et al. / Computer Communications 35 (2012) 221–233 229

Similar as that in Ref. [17], for clarity in notation, it is assumed thateach node can read its own frequency in this section.

5.1. Synchronization algorithm with frequency adjustment

Suppose a pair of nodes exchange packets with each other with-out packets delay. They send packets with the information of theirlocal clocks and frequencies to each other, and then both of themupdate their clocks to xi(k) = xj(k) = (xi(k � 1) + xj(k � 1))/2, and fre-quencies to wi(k) = wj(k) = (wi(k � 1) + wj(k � 1))/2. Obviously, twopackets are enough in the process.

The algorithm can be described as follows (see algorithm 3).

5.2. Convergence analyses

The convergence analyses of algorithm 3 include two parts: one isthe convergence of the frequencies of crystal oscillators to the aver-age w by compensation; the other is the convergence of all the localclocks. The first part, i.e. the convergence analysis of the frequenciesof all nodes to the average w, is similar to the average time synchro-nization analysis of algorithm 1 in Section 3.2, thus omitted here. Forthe second part, it will be shown that the local clocks of all nodes willbe realized average time synchronization by Definition 1.

Similar to Eq. (4), suppose from t = 0 and after several opera-tions which updated partial or all the nodes’ local clocks, the clocksof all the nodes are expressed as follows at time t,

x1ðtÞ ¼ w1t þ e1ðtÞx2ðtÞ ¼ w2t þ e2ðtÞ...

xnðtÞ ¼ wnt þ enðtÞ

8>>>><>>>>:which can be equivalently written as

x1ðtÞ ¼ wt þ ðw1 �wÞt þ e1ðtÞx2ðtÞ ¼ wt þ ðw2 �wÞt þ e2ðtÞ...

xnðtÞ ¼ wt þ ðwn �wÞt þ enðtÞ

8>>>><>>>>:Let

e�i ðtÞ ¼ ðwi �wÞt þ eiðtÞ; i ¼ 1; . . . ;n ð38Þ

where e�i ð0Þ ¼ eið0Þ ¼ xið0Þ. Then one hasx1ðtÞ ¼ wt þ e�1ðtÞx2ðtÞ ¼ wt þ e�2ðtÞ...

xnðtÞ ¼ wt þ e�2ðtÞ

8>>>><>>>>:

ð39Þ

The discrete form of Eqs. (38) and (39) are respectively Eqs. (40) and(41)

e�i ðkÞ ¼ ðwiðkÞ �wÞtðkÞ þ eiðkÞ; i ¼ 1; . . . ;n ð40Þ

x1ðkÞ ¼ wtðkÞ þ e�1ðkÞx2ðkÞ ¼ wtðkÞ þ e�2ðkÞ...

xnðkÞ ¼ wtðkÞ þ e�2ðkÞ

8>>>><>>>>:

ð41Þ

By comparing Eqs. (4) and (6) with Eqs. (39) and (41) respectively, itis obvious that Lemma 1 can be extended to Lemma 3 by replacingei(k) with e�i (k) for sensor network with clock skew.

Lemma 3. For sensor networks with clock skew, suppose after finiteseparate operations which updated partial or all the nodes’ clocks andfrequencies, the network eventually realized time synchronization.

Then the network realized average time synchronization if the sum ofe�i ðkÞ of all nodes keeps invariable after each operation. That is

Xn

i¼1

e�i ðkÞ ¼Xn

i¼1

e�i ðk� 1Þ ð42Þ

Proof. The proof of Lemma 3 is similar to that of Lemma 1 andomitted here.

e�i ðkÞ is also called the offset observation value of node vi.The following theorem is about the second part of convergence

analyses. h

Theorem 4. Suppose the graph which describes the topology of thesensor network is connected, and each edge of the graph will be turnedon infinite times as k ?1, then the sensor network will realize aver-age time synchronization asymptotically by algorithm 3.

Proof. Without loss of generality, suppose at time step k, the edgebetween nodes v1 and v2 is turned on, and both of the two nodesupdate their clocks from x1(k � 1) and x2(k � 1) tox1(k) = x2(k) = (x1(k � 1) + x2(k � 1))/2, and their frequencies fromw1(k � 1) and w2(k-1) to w1(k) = w2(k) = (w1(k � 1) + w2(k � 1))/2, the rest nodes (i = 3, . . . ,n) do not update their clocks and fre-quencies. Then from Eq. (41) obtains

e�1ðkÞ ¼ x1ðkÞ �wtðkÞ ¼ 12ðx1ðk� 1Þ þ x2ðk� 1ÞÞ �wtðk� 1Þ

¼ 12ðx1ðk� 1Þ �wtðk� 1ÞÞ þ 1

2ðx2ðk� 1Þ �wtðk� 1ÞÞ

¼ 12ðe�1ðk� 1Þ þ e�2ðk� 1ÞÞ ð43Þ

Similarly,

e�2ðkÞ ¼12ðe�2ðk� 1Þ þ e�2ðk� 1ÞÞ ð44Þ

Thus

e�1ðkÞ þ e�2ðkÞ ¼ e�2ðk� 1Þ þ e�2ðk� 1Þ

Since e�i ðkÞ ¼ e�i ðk� 1Þ for all i = 3, . . . ,n. So condition (42) is satisfiedfor the network. By Lemma 3, if the network realized time synchro-nization by algorithm 3, then it realized average timesynchronization.

To analyze the convergence of algorithm 4, define the followingenergy (Lyapunov) function

Fw�cðkÞ ¼Xn

i¼1

e�i ðkÞ � avgðxð0ÞÞ� �2 ð45Þ

Obviously, if the energy function approaches to zero asymptotically,then

e�i ðkÞ ¼ avgðxð0ÞÞ; i ¼ 1; . . . ;n

From Eq. (41), the sensor network approaches to average time syn-chronization asymptotically by Definition 1.

From Eq. (45), after the kth operation, one has

Fw�cðkÞ ¼Xn

i¼3

e�i ðkÞ � avgðxð0ÞÞ� �2 þ e�1ðkÞ � avgðxð0ÞÞ

� �2

þ e�2ðkÞ � avgðxð0ÞÞ� �2

¼Xn

i¼3

e�i ðk� 1Þ � avgðxð0ÞÞ� �2

þ 212ðe�1ðk� 1Þ þ e�2ðk� 1ÞÞ � avgðxð0ÞÞ

� �2

Page 10: Average time synchronization in wireless sensor networks by pairwise messages

230 J. Wu et al. / Computer Communications 35 (2012) 221–233

From Lemma 2, if e�1ðk� 1Þ– e�2ðk� 1Þ, obtains

Fw�cðkÞ < Fw�cðk� 1Þ

Since the graph is connected and the each edge will be turned oninfinite times as k ?1, thus Fw�c(k) ? 0 as k ?1. This completesthe proof. h

6. Synchronization with offset, clock skew, and random timedelay

Based on the analyses of Sections 3 and 4, it is ready to analyzethe most realistic case with offset, clock skew among nodes, andrandom message delay in this section.

6.1. Algorithm with offset, clock skew, and random delay

Assume there is random time delay �s between receiving (orsending) of two messages for each pair of connected nodes, andthe frequencies of all nodes are not exactly identical. The schemeof pairwise message exchanges is similar to that in Section 4 (seeFig. 3(b)).

After receiving the first packet at time xfj(k � 1) by its local clock,node j sends back the second packet with the information ofxfj(k � 1) and wj(k � 1). After node i receives the second packet atits local clock xsi(k � 1), it sends back the third packet with the infor-mation of xsi(k � 1) and wi(k � 1) as soon as possible. Node i updatesits clock to ðxfjðk� 1Þ þ �sðk� 1Þ þ xsiðk� 1ÞÞ=2 and its frequency to(wi(k � 1) + wj(k � 1))/2 at time xsi(k � 1) by its local clock. Whennode j receives the third packet at its local clock xtj(k � 1), it updatesits clock to ðxsiðk� 1Þ þ �sðk� 1Þþ xtjðk� 1ÞÞ=2 and frequency to(wi(k � 1) + wj(k � 1))/2 immediately.

6.2. Convergence analyses

By comparing algorithms 3 and 4, it can be seen that the oper-ations on the frequencies of the two algorithms are the same. It ob-tains that the frequencies of all nodes will converge to theiraverage w by algorithm 4.

Theorem 5. Suppose the graph which describes the topology of thesensor network is connected, the total time delay �sðhÞ between thereceiving (or sending) of two messages is a random variable withmean s(h) and variance r2(h), and each edge of the graph will beturned on infinite times as k ?1, then the sensor network will realizeaverage time synchronization asymptotically by algorithm 4.

Proof. The proof is according to Definition 2, see appendix B fordetailed proof. h

6.3. Estimation of the synchronization error

After the frequencies of nodes are compensated to the averagew, synchronization errors of the network are only determined bythe uncertainty of the total time delays of messages. The operationof algorithm 4 on the local clocks of nodes is the same as that ofalgorithm 2.

Suppose the variances of the packets delays are all r2, that isr2(0) = r2(1) = � � � = r2(k) = r2. Since F(k) = F0(k);+ F1(k) + � � � +Fk�1(k), from Eq. (35), for the network consists of only two nodes,one has

EðFðkÞÞ ¼ EðF0ðkÞ þ F1ðkÞ þ � � � þ Fk�1ðkÞÞ

¼ 1

2kþ 1

2k�1 þ � � � þ12

� r2 ¼k!1r2 ð46Þ

On the other hand, from Eq. (14), one has

EðFðkÞÞ ¼ E b21ðkÞ þ b2

2ðkÞ� �

¼ 2Ejbj2 ð47Þ

where b is the random variable which describes the synchroniza-tion errors of all nodes. From Eqs. (46) and (47), one has

Ejbj2 ¼ Db ¼ 12r2 ð48Þ

Until now, it is clear that b is a random variable which satisfiesEb = 0 and Db = r2/2, we want to know Ejbj, which describes thesynchronization errors of the network. The central limit theoremof the probability theory asserts that the probability density func-tion of the sum of a large number of independent and identicallydistributed (iid) random variables approaches that of a Gaussianrandom variable. Since the time synchronization of the network isa result from large number of iid operations, it is reasonable toguess that b is a variable of Gauss distribution (or approximationto the Gaussian distribution, this will be verified by simulations inSection 6.4, see Fig. 8). Then jbj is a variable of the following prob-ability distribution function

fðjbjÞ ¼ 2ffiffiffiffipp

r

Z 1

0e�b2

r2 db

Ejbj ¼ 2ffiffiffiffipp

r

Z 1

0jtje

�t2

r2 dt ¼ rffiffiffiffipp

Z 1

0e�t2

r2 dt2

r2

� ¼ �rffiffiffiffi

pp e

�t2

r2 j10

¼ rffiffiffiffipp � 0:5642r ð49Þ

Algorithm 4. Average time synchronization by massageexchanges with offset, clock skew, and random message delay

1. for all connections in the network, which is turned on bythe switching signal s (k) in sequence, do

2. after receiving the first packet at its local clock xfj(k � 1),node vj sends back the second packet vi; after receiving thesecond packet at its local clock xsi(k � 1), node vi sends backthe third packet, which is received by vj at its local clockxtj(k � 1),

3. at time receiving the second message, node i updates itsclock and frequency by

xiðkþ 1Þ ¼ ðxfjðk� 1Þ þ �sðk� 1Þ þ xsiðk� 1ÞÞ=2

and wi(k) = (wi(k � 1) + wj(k � 1))/2, respectively4. at time receiving the third message, node j updates its clock

and frequency by

xjðkþ 1Þ ¼ ðxtjðk� 1Þ þ �sðk� 1Þ þ xsiðk� 1ÞÞ=2

and wj(k)=(wi(k � 1) + wj(k � 1))/2, respectively.

That is, the expectation of the synchronization errors is linearlyrelated to the standard deviation of the packets delays.

For a general network with n nodes, the variances of the packetsdelays are all r2. Suppose after a period of operations, the sensornetwork achieved time synchronization by Definition 2, but thesynchronization error of all nodes is a random variable b withEb = 0 and Db – 0. From Eq. (14), one has

EðFðk� 1ÞÞ ¼ nðDbÞ ¼ nEb2

More operations on the network will not reduce the synchroniza-tion error (E(F(k)) or Eb2). Without loss of generality, suppose atthe kth operation, the edge between nodes v1 and v2 is turned on,but after the operation, E(F(k)) is not decreased(E(F(k)) = E(F(k � 1)) = nEb2). From Eqs. (A.1) and (A.2), one has

Page 11: Average time synchronization in wireless sensor networks by pairwise messages

0 10 20 300

5

10

15

20

standard deviation of packet delays (¦Ìs)

aver

age

sync

hron

izat

ion

erro

r

(¦Ìs)

Fig. 7. Simulation result about the relation between the average synchronizationerror and standard deviation of packet delay

Table 1Average synchronization error of 100 simulations.

r (ls) avg(jbj)

1 5.8574E�075 2.9569E�06

10 5.9690E�0615 8.5899E�0620 1.1688E�0525 1.4791E�0530 1.7554E�05

J. Wu et al. / Computer Communications 35 (2012) 221–233 231

Dðe1ðkÞÞ ¼ Dðe2ðkÞÞ ¼14

Dðe1ðk� 1ÞÞ þ 14

Dðe2ðk� 1ÞÞ þ 14r2

¼ 12

Eb2 þ 14r2

Then,

EðFðkÞÞ ¼ ðn� 2ÞEb2 þ Dðe1ðkÞÞ þ Dðe2ðkÞÞ ¼ ðn� 1ÞEb2 þ 12r2

Together with E(F(k)) = E(F(k � 1)) = nEb2, again one obtains Eq. (48)for a general network. It follows that Eq. (49) hold for a general net-work with n nodes, also. By comparing Eq. (49) with Eq. (37), the

−2.4 −2.1 −1.8 −1.5 −1.2 −0.9 −0.6 −0.3 00

10

20

30

40

50

60

synchronizat

num

ber

of n

odes

Fig. 8. The distribution of the synchronization error (b

synchronization error of all nodes of ASTP is approximate to thatof the nodes in level 1 of TPSN (see Fig. 6).

6.4. Simulation studies

Simulations are done to verify the correctness of algorithm 4 andthe analysis results about synchronization errors.

All simulations are done on a computer generated network with300 nodes and 8970 edges (edge density is 0.2). In each simulation,a constant variance is applied to generate the message delays toobserve the average synchronization error that be reached by thealgorithm. After the each edge has been turned on 100 times, thenobserve the synchronization error (bi) of the nodes, averagesynchronization error of the simulation is calculated byavgðjbjÞ ¼ 1

N

PN1 jbij. Table 1 shows the average of 100 independent

simulations. From Table 1, the relation between the average syn-chronization error and the standard deviation of message delaysis shown in Fig. 7, which shows that the average synchronizationerror of the network is linearly related to the standard deviation(r) of the message delay. Fig. 8 shows the distribution of the syn-chronization error (bi) of the 300 nodes in a simulation (r = 1 us),which approximates to the Gaussian distribution.

7. Conclusion

Average time synchronization algorithm by using pairwisemessages exchanges (ATSP) for sensor networks is provided.Mathematical analyses and proof of the algorithm are also givenby defining two variables: offset observation value and averageobservation value. The offset observation value plays a key rolein analyzing and proving of the algorithms; the average observa-tion value facilities the simulations on judging whether thenetwork realized average time synchronization. Two packets areenough for traditional time synchronization algorithms by pair-wise message exchanges, which update one node’s clock to theother; whereas three packets are needed to the average time syn-chronization algorithm by pairwise message exchanges, whichupdate both the two nodes’ clocks to their average. The synchro-nization error of all nodes of ASTP is approximate to that of thenodes in level 1 of TPSN.

The sequence, by which the pair of nodes are turned on toaverage their clocks, has important effects on the performance of

0.3 0.6 0.9 1.2 1.5 1.8 2.1 2.4 ion error (us)

i) of the 300 nodes in a simulation with r = 1us.

Page 12: Average time synchronization in wireless sensor networks by pairwise messages

232 J. Wu et al. / Computer Communications 35 (2012) 221–233

average time synchronization of the network, which requiresfurther researches.

8. Appendix A (Proof of Theorem 3)

Proof. By Definition 2, we will show that (30) holds for thenetwork. Without loss of generality, suppose at the kth operation,the edge between nodes v1 and v2 is turned on. Similar to the proofof Theorem 2, from (7) and (31) obtains

e2ðkÞ ¼ x2ðkÞ �wtðkÞ

¼ 12ðxf1ðk� 1Þ þ �sðk� 1Þ þ xs2ðk� 1ÞÞ �wtðk� 1Þ

¼ 12ðxs2ðk� 1Þ �wtðk� 1ÞÞ þ 1

2ðxf1ðk� 1Þ þ �sðk� 1Þ

�wtðk� 1ÞÞ

¼ 12ðxs2ðk� 1Þ �wtðk� 1ÞÞ þ 1

2ðxf1ðk� 1Þ þ sðk� 1Þ

�wtðk� 1ÞÞ þ 12ð�sðk� 1Þ � sðk� 1ÞÞ

¼ 12e2ðk� 1Þ þ 1

2e1ðk� 1Þ þ 1

2ð�sðk� 1Þ � sðk� 1ÞÞ ðA:1Þ

Similarly, from (7) and (32) obtains

e1ðkÞ ¼ x1ðkÞ �wtðkÞ

¼ 12ðxs2ðk� 1Þ þ �sðk� 1Þ þ xt1ðk� 1ÞÞ �wtðk� 1Þ

¼ 12ðxs2ðk� 1Þ þ �sðk� 1Þ �wtðk� 1ÞÞ þ 1

2ðxt1ðk� 1Þ

�wtðk� 1ÞÞ

¼ 12ðxs2ðk� 1Þ þ sðk� 1Þ �wtðk� 1ÞÞ þ 1

2ðxt1ðk� 1Þ

�wtðk� 1ÞÞ þ 12ð�sðk� 1Þ � sðk� 1ÞÞ

¼ 12e2ðk� 1Þ þ 1

2e1ðk� 1Þ þ 1

2ð�sðk� 1Þ � sðk� 1ÞÞ ðA:2Þ

Here e1(k) and e2(k) are random variables. From (Eqs. (A.1) and(A.2)), the uncertainty of e1(k) and e2(k) are determined by theuncertainty of e1(k � 1) ,e2(k � 1), and the uncertainty of packetsdelays at the kth operation. Again from Eqs. (A.1) and (A.2)

Eðe2ðkÞÞ þ Eðe1ðkÞÞ ¼ Eðe2ðk� 1ÞÞ þ Eðe1ðk� 1ÞÞ

Since the rest nodes do not update their clocks at the kth operation,so we have

Xn

i¼1

EðeiðkÞÞ ¼Xn

i¼1

Eðeiðk� 1ÞÞ ¼ � � � ¼ n� avgðxð0ÞÞ

The graph is connected and each connection will be turned on infi-nite time as k ?1, the network will eventually evolve to

EðeiðkÞÞ ¼ avgðxð0ÞÞ; i ¼ 1; . . . n

Let r2(h) = 0 for h = 1, . . . ,k � 1, then �sðhÞ ¼ sðhÞ for h = 1, . . . ,k � 1.From (Eq. (A.1)) obtains

Dðe2ðkÞÞ ¼14

Dðe2ðk� 1ÞÞ þ 14

Dðe1ðk� 1ÞÞ ðA:3Þ

From (Eq. (A.2)), obtains

Dðe1ðkÞÞ ¼14

Dðe2ðk� 1ÞÞ þ 14

Dðe1ðk� 1ÞÞ ðA:4Þ

From (Eqs. (A.3) and (A.4)), it is obvious that

Dðe2ðkÞÞ þ Dðe1ðkÞÞ ¼12

Dðe2ðk� 1ÞÞ þ 12

Dðe1ðk� 1ÞÞ ðA:5Þ

Then from Eq. (14)

EðF0ðkÞÞ ¼Xn

i¼3

E½eiðkÞ � avgðxð0ÞÞ�2 þ E½e1ðkÞ � avgðxð0ÞÞ�2

þ E½e2ðkÞ � avgðxð0ÞÞ�2 ¼Xn

i¼3

E½eiðk� 1Þ

� avgðxð0ÞÞ�2 þ Dðe1ðkÞÞ þ Dðe2ðkÞÞ ðA:6Þ

Since the rest nodes do not update their clocks at the kth operation,from (Eq. (A.5)) obtains

EðF0ðkÞÞ < EðF0ðk� 1ÞÞ

E(F0(k)) will asymptotically approach to zero as k ?1, the networkwill realize average time synchronization by Definition 2. The casethat several edges are turned on in each operation can be provedsimilarly. This completes the proof. h

9. Appendix B (Proof of Theorem 5)

Proof. It can be seen that the operations on the frequencies ofalgorithms 3 and 4 are the same, so the frequencies of all nodeswill converge to their average w by algorithm 4. For clarity innotation, in the proof follows, it is assumed the frequencies of allnodes have already converged to their average w in the beginningk � 1 operations. By Definition 2, if (30) holds then the networkwill realize average time synchronization asymptotically by algo-rithm 4. Without loss of generality, suppose at the kth operation,the edge between nodes v1 and v2 is turned on. From (41), one has

e�i ðkÞ ¼ ðwiðkÞ �wÞtðkÞ þ eiðkÞ ¼ eiðkÞ; i ¼ 1; . . . ;n

Similar to the proof of Theorem 3 (see Eq. (A.1) in appendix A), from(7) and (31) obtains

e�2ðkÞ ¼ x2ðkÞ �wtðkÞ

¼ 12e�2ðk� 1Þ þ 1

2e�1ðk� 1Þ þ 1

2ð�sðk� 1Þ � sðk� 1ÞÞ ðA:7Þ

From (7) and (32) obtains

e�1ðkÞ ¼ x1ðkÞ �wtðkÞ

¼ 12e�2ðk� 1Þ þ 1

2e�1ðk� 1Þ þ 1

2ð�sðk� 1Þ � sðk� 1ÞÞ ðA:8Þ

Here e�1ðkÞ and e�2ðkÞ are random variables. From (Eqs. (A.7) and(A.8)), the uncertainty of e�1ðkÞ and e�2ðkÞ are determined by theuncertainty of e�1ðk� 1Þ; e�2ðk� 1Þ, and the uncertainty of packetsdelays at the kth operation. Then, the expectation of e�1ðkÞ ande�2ðkÞ satisfies

E e�2ðkÞ� �

þ E e�1ðkÞ� �

¼ E e�2ðk� 1Þ� �

þ E e�1ðk� 1Þ� �

Since the rest nodes do not update their clocks at the kth operation,so one has

Xn

i¼1

E e�i ðkÞ� �

¼Xn

i¼1

E e�i ðk� 1Þ� �

¼ � � � ¼ n� avgðxð0ÞÞ

The graph is connected and each connection will be turned on infi-nite time as k ?1, the network will eventually evolve to

Page 13: Average time synchronization in wireless sensor networks by pairwise messages

J. Wu et al. / Computer Communications 35 (2012) 221–233 233

E e�i ðkÞ� �

¼ avgðxð0ÞÞ; i ¼ 1; . . . n

Let r2(h) = 0 for h = 1, . . . ,k � 1, then �sðhÞ ¼ sðhÞ for h = 1, . . . ,k � 1.From (Eq. (A.7)) obtains

D e�2ðkÞ� �

¼ 14

D e�2ðk� 1Þ� �

þ 14

D e�1ðk� 1Þ� �

ðA:9Þ

From (Eq. (A.8)), obtains

D e�1ðkÞ� �

¼ 14

D e�2ðk� 1Þ� �

þ 14

D e�1ðk� 1Þ� �

ðA:10Þ

From (Eqs. (A.9) and (A.10)), it is obvious that

D e�2ðkÞ� �

þ D e�1ðkÞ� �

¼ 12

D e�2ðk� 1Þ� �

þ 12

D e�1ðk� 1Þ� �

ðA:11Þ

Then from Eq. (45)

EðF0ðkÞÞ ¼Xn

i¼3

E e�i ðkÞ � avgðxð0ÞÞ� �2 þ E e�1ðkÞ � avgðxð0ÞÞ

� �2

þ E e�2ðkÞ � avgðxð0ÞÞ� �2 ¼

Xn

i¼3

E e�i ðk� 1Þ � avgðxð0ÞÞ� �2

þ Dðe�1ðkÞÞ þ Dðe�2ðkÞÞ: ðA:12Þ

Since the rest nodes do not update their clocks at the kth operation,from (Eq. (A.11)) obtains

EðF0ðkÞÞ < EðF0ðk� 1ÞÞ:

E(F0(k)) will asymptotically approach to zero as k ?1, the networkwill realize average time synchronization by Definition 2. The casethat several edges are turned on in each operation can be provedsimilarly. This completes the proof. h

Acknowledgement

Project supported by the Natural Science Foundation of China(No. 61072139).

References

[1] I.F. Akyildiz, T. Melodia, K. Chowdhury, Wireless multimedia sensor networks:a survey, IEEE Wireless Communications (2007) 32–39.

[2] S. Misra, A. Vaish, Reputation-based role assignment for role-based accesscontrol in wireless sensor networks, Computer Communications 34 (2011)281–294.

[3] I.F. Akyildiz, T. Melodia, K. Chowdhury, A survey on wireless multimediasensor networks, Computer Networks 51 (2007) 921–960.

[4] J. Yick, B. Mukherjee, D. Ghosal, Wireless sensor network survey, ComputerNetworks 52 (2008) 2292–2330.

[5] A. Friggeri, G. Chelius, E. Fleury, A. Fraboulet, F. Mentré, J.C. Lucet,Reconstructing social interactions using an unreliable wireless sensornetwork, Computer Communications 34 (2011) 609–618.

[6] B. sundararaman, U. Buy, A.D. Kshemkalyani, Clock synchronization forwireless sensor networks: a survey, Ad Hoc Networks 3 (2005) 281–323.

[7] G. Anastasi, M. Conti, M.D. Francesco, A. Passarella, Energy conservation inwireless sensor networks: a survey, Ad Hoc Networks 7 (2009) 537–568.

[8] K-Y. Cheng, K-S. Lui, Y.-C. Wu, V. Tam, A distributed multihop timesynchronization protocol for wireless sensor networks using pairwisebroadcast synchronization, IEEE Transactions on Wireless Communications 8(4) (2009) 1764–1772.

[9] Q. Li, D. Rus, Global Clock Synchronization in Sensor Networks, IEEE INFOCOM2004.

[10] Q. Li, D. Rus, Global clock synchronization in sensor networks, IEEETransactions on Computers 55 (2006) 214–226.

[11] L. Li, Y. Liu, H. Yang, H. Wang, A Precision Adaptive Average TimeSynchronization Protocol in Wireless Sensor Networks, in: Proceedings ofthe IEEE International Conference on Information and Automation, Zhangjiajie,China, 2008.

[12] J. Elson, L. Girod, D. Estrin, Fine-Grained Network Time Synchronization usingReference Broadcasts, in: The fifth Symposium on Operating Systems Designand Implementation, 2002, pp. 147–163.

[13] Y-W. Hong, A. Scaglione, A scalable synchronization protocol for large scalesensor networks and its applications, IEEE Journal on Selected Areas inCommunications 23 (2005) 1085–1099.

[14] D. Zhou, T-H. Lai, An accurate and scalable clock synchronization protocol forIEEE 802.11-based multihop ad hoc networks, IEEE Transactions On Paralleland Distributed Systems 18 (2007) 1797–1808.

[15] D.L. Mills, Internet time synchronization: the network time protocol, IEEETransactions on Communication 39 (1991) 1482–1493.

[16] S. Ganeriwal, R. Kumar, M.B. Srivastava, Timing-sync Protocol for SensorNetworks, in: Proceedings of the first ACM conference on embeddednetworked sensor systems, 2003, pp. 138–149.

[17] J. Van Greunen, J. Rabaey, Lightweight time synchronization for sensornetworks, in: the second acm international workshop on wireless sensornetworks and applications (WSNA’03), 2003, pp. 11–19.

[18] M. Maroti, B. Kusy, G. Simon, Á. Lédeczi, The flooding time synchronizationprotocol, in: Proceedings of the second international conference on embeddednetworked sensor systems, 2004, pp: 39–49.

[19] H. Dai, R. Han, Tsync: A Lightweight Bidirectional Time SynchronizationService for Wireless Sensor Networks, ACM SIGMOBILE Mobile Computing andCommunications Review 8 (2004) 125–139.

[20] M.L. Sichitiu, C. Veerarittiphan, Simple, Accurate Time Synchronization forWireless Sensor Networks, in: IEEE wireless communications and networkingconference (WCNC), 2003.

[21] K.-L. Noh, E. Serpedin, K.A. Qaraqe, A new approach for time synchronization inwireless sensor networks: pairwise broadcast synchronization, IEEETransactions on Wireless Communication 7 (2008) 3318–3322.

[22] F. Ren, C. Lin, F. Liu, Self-correcting time synchronization using referencebroadcast in wireless sensor network, IEEE Wireless Communications (2008)79–85.

[23] B. Liu, F. Ren, J. Shen, H. Chen, Advanced self-correcting time synchronizationin wireless sensor networks, IEEE Communications Letters 14 (2010) 309–311.

[24] R.M. Pussente, V.C. Barbosa, An algorithm for clock synchronization with thegradient property in sensor networks, Journal of Parallel and DistributedComputing 69 (2009) 261–265.

[25] O. Simeone, U. Spagnolini, G. Scutari, Y. Bar-Ness, Physical-layer distributedsynchronization in wireless networks and applications, PhysicalCommunication 1 (2008) 67–83.

[26] H. Song, S. Zhu, G. Cao, Attack-resilient time synchronization for wirelesssensor networks, Ad Hoc Networks 5 (2007) 112–125.

[27] J-H. Hoepman, A. Larsson, E.M. Schiller, P. Tsigas, Secure and self-stabilizingclock synchronization in sensor networks, Theoretical Computer Science(2010), doi:10.1016/j.tcs.2010.04.012.

[28] J. Liu, Scalable synchronization of clocks in wireless sensor networks, Ad HocNetworks 6 (2008) 791–804.

[29] R. Olfati-Saber, R.M. Murray, Consensus problems in networks of agents withswitching topology and time-delays, IEEE Transactions on Automatic Control49 (2004) 1520–1533.

[30] C.H. Rentel, T. Kunz, A mutual network synchronization method for wireless adhoc and sensor networks, IEEE Transactions on Mobile Computing 7 (2008)633–646.

[31] J. Chen, Q. Yu, Y. Zhang, H-H. Chen, Y. Sun, Feedback based clocksynchronization in wireless sensor networks: a control theoretic approach,IEEE Transactions on Vehicular Technology 59 (6) (2010) 2963–2973.

[32] T. Cooklev, J.C. Eidson, A. Pakdaman, An implementation of IEEE 1588 over IEEE802.11b for synchronization of wireless local area network nodes, IEEETransactions on Instrumentation and measurement 56 (2007) 1632–1639.

[33] K-L. Noh, Q.M. Chaudhari, E. Serpedin, B.W. Suter, Novel clock phase offset andskew estimation using two-way timing message exchanges for wireless sensornetworks, IEEE Transaction on Communications 55 (2007) 766–777.

[34] I. Sari, E. Serpedin, K-L. Noh, Q. Chaudhari, B. Suter, On the joint synchronizationof clock offset and skew in RBS-protocol, IEEE Transaction on Communications56 (2008) 700–703.

[35] J. Wu, L. Jiao, Synchronization in complex delayed dynamical networks withnonsymmetric coupling, Physica A 386 (2007) 513–530.

[36] J. Wu, L. Jiao, G. Chen, Cluster synchronization in a network of non-identicaldynamic systems, Chinese Physics B 20 (6) (2011) 060503.

[37] J. Wu, L. Jiao, Synchronization in complex dynamical networks withnonsymmetric coupling, Physica D 237 (2008) 2487–2498.