Broadcast Time Synchronization Algorithm for Wireless Sensor Networks Chaonong Xu1)2)3), Lei Zhao1)2) , Yongjun Xu1)2) and Xiaowei Li1)2)
1)
Key Laboratory of Computer Architecture, Institute of Computing Technology Chinese Academy of Sciences, Beijing PR China, 100080 2) Advanced Test Technology Lab, Institute of Computing Technolog Chinese Academy of Sciences, Beijing PR China, 100080 3) Department of computer science, Hefei University of Technology, Hefei PR China, 230009
[email protected] Abstract - We proposed a time synchronization algorithm based on packet exchange mechanism for wireless sensor networks. A single-hop synchronization scheme was presented where piggyback technique and the least-squares linear regression technique were employed. Multi-hop synchronization scheme consists of topology construction algorithm, single-hop synchronization scheme and time transformation algorithm. Topology construction algorithm constructs a breadth-first spanning-tree. Single-hop synchronization scheme is employed on every single-hop area of the spanning-tree, and time transformation algorithm is to relate the time of nodes in different single-hop area. Simulation results indicate that in an 8-hop network where every node has 8 neighbor nodes, the single hop synchronization error is about 61.86 microseconds on Mica2. Average synchronization error increases linearly at the rate of 19.2 microseconds for one additional hop. To synchronize a multi-hop network, 2n packets are needed in one synchronization cycle where n is the number of non-leaf node in the spanning tree.
I. INTRODUCTION Recently, research interest has been drawn towards wireless sensor networks (WSN). Time synchronization [1] is one of the basic services of WSN. It can be used in many occasions such as time-stamping sensor event, localization, energy-saving sleep mode, data fusion and time-division multiplexing access to the shared wireless media(TDMA), etc. Many time synchronization algorithms for WSN have been proposed over the past few years [2][3][4][5][6][7]. They will be discussed in section II. In this paper, we present BTS(broadcast time synchronization) for wireless sensor networks. Based on packet exchange mechanism, it combines the sender-receiver synchronization scheme with the receiver-receiver synchronization scheme. In single-hop network, we conclude that its synchronization error is the sum of two parts. One is the synchronization error caused by the sender-receiver synchronization scheme, the other is the synchronization error caused by the receiver-receiver synchronization scheme. We implement BTS and other two related algorithms on Simsync[8], a time synchronization simulator which simulates the time character of Mica2 [9][10]. The simulated results are also presented. We also extend BTS algorithm from single-hop to multi-hop network. Multi-hop synchronization scheme consists of three parts which are the topology construction algorithm, the single-hop synchronization algorithm and the time transformation algorithm which is the most contribution of this paper. The topology construction algorithm constructs a breadth-first spanning-tree. The single-hop synchronization
algorithm is performed in every single-hop area of the spanning-tree, and the time transformation algorithm is employed on the spanning-tree to relate the time of nodes in different single-hop area. BTS is fit for wireless sensor networks. First, only 2 packets are needed to synchronize a single-hop area in one synchronization cycle. So the energy consumption for time synchronization is small. Second, BTS is a continuous time synchronization algorithm which means that the local time of node will never be modified. In many occasions such as energy-saving sleep [11], it is important to make sure that the local time of node is independent with the time synchronization algorithm. Third, all algorithms in BTS are lightweight in complexity, even an eight-bit microcontroller will suffice. The organization of this paper is as follows: In section II, we introduce the related works. Section III details the BTS algorithm in a single-hop network. Section IV analyzes the synchronization error of BTS and some of its features. Section V expands BTS from single-hop to multi-hop network. A topology construction algorithm and a time transformation algorithm are also presented in this section. Section VI presents the simulated results. The last section is the conclusions of this paper and future works. II. RELATED WORKS Elson and Estrin propose RBS(reference broadcast synchronization) [3]. As shown by Fig. 1, RBS is a typical receiver-receiver synchronization algorithm [3], it excludes the time uncertainty on sender. Fig. 1 illustrates the critical path of the sender-receiver synchronization scheme and the receiverreceiver synchronization scheme. RBS(Reference Broadcast Synchronization) is a pair-wise synchronization algorithm in essence. So if all nodes in network need to be synchronized, its energy consumption is tremendous. Furthermore, the reference node can not synchronize with any other nodes. But the idea of receiver-receiver synchronization scheme is revolutionary. Many latter time synchronization algorithms adopt the idea. TPSN(Timing-sync Protocol for Sensor Networks) [4] is a typical sender-receiver synchronization algorithm. It indicates that synchronization error can be greatly decreased by stamping time at MAC layer. HRTS(Hierarchy Referencing Time Synchronization Protocol) is not a pair-wise synchronization algorithm. Its synchronization scheme in single-hop network is similar to our BTS algorithm. So it will be introduced in section III.A. III. BTS IN SINGLE-HOP NETWORK
In this section, we introduce BTS algorithm in single-hop network. Since the synchronization scheme of BTS is derived from HRTS, we first have an overview of HRTS. Then we introduce their difference briefly. At last, BTS is introduced. NIC
NIC
Sender
Sender
Receiver1
Receiver Critical Path
Receiver2 Time
Critical Path
Fig. 1. Sender-receiver and receiver-receiver synchronization
Two terms have to be explained firstly, which is the local time and the estimated time. Fig. 2 illustrates their difference. Counter pulse
Local time from other nodes
Local time Counter
Continuous Time Synchronization Algorithm
Instantaneous Time Synchronization Algorithm
Estimated time
The replier
Nodej
t1
t4
M1
M2 t2
M3
t3
t2k t2j
Time
Fig. 3. Synchronization scheme of HRTS algorithm
Counter pulse
Counter
The time reference node
Nodek
A. Continuous synchronization
Local time from other nodes
with the local time of the time reference node. t2 is the time when M1 is just received, t3 is the time when M2 is just transmitted. Both of them are recorded with the local time of the replier. t2 and t3 are contained in M2 which is send to the time reference node by the replier. We assume that the propagation delay of M1 and M2 are same and the time offset between them is fixed during the time from t1 to t4. If we refer the propagation delay of M1 as d1, and the time offset between the time reference node and the replier is referred as d2. Since the time reference node has known about the t1, t2, t3 and t4 when it receives M2, so: Node
Estimated Time = Local time
B. Instantaneous synchronization Fig. 2. Local time and estimated time
The local time is actually the value of time counter which increases with counter pulse. If we look time synchronization algorithm as a system and the local time as system input, the estimated time can be looked on as the system output. Fig. 2.A illustrates their relationship in continuous time synchronization algorithm. The estimated time never influences the local time. But for an instantaneous time synchronization algorithm as in the lower part of Fig. 2.B, at the beginning of a synchronization cycle, the value of time counter is replaced with the estimated time once the estimated time is worked out by the instantaneous time synchronization algorithm. Since then, the estimated time is same to the local time. Both of them will increase with counter pulse until the next synchronization cycle. Its estimated time is returned when a node is inquired about its time. So the duration of synchronization cycle will influence more heavily on instantaneous time synchronization algorithm than continuous time synchronization algorithm. A. HRTS in Single-hop Network Fig. 3 illustrates the scheme of HRTS algorithm. When it is time to synchronize, the time reference node randomly appoints one of its neighbours as the replier. First, it broadcasts a packet which is referred as M1, every of its neighbours including the replier records the arrival time of M1 with their local time and save it into buffer. For example, the replier records it as t2 and nodeK records it as t2k. Then, the replier will return a packet to the time reference node which is referred as M2. In Fig. 3, t1 is the time when M1 is just transmitted, t4 is the time when M2 is just received. Both of them are recorded
t 2 = t1 + d1 + d 2 t 4 = t3 + d1 − d 2 d1, d2 can be worked out as follows: d 1 = (t 2 − t1 + t 4 − t 3) / 2
(1) If we refer the local time of the time reference node as Tr, the local time of the replier as Tp and the local time of other nodes such as nodeK as Tk. We can know that: (2) Tr = Tp - d2 At last, the time reference node broadcasts a message which is referred as M3 with t2 and d2 contained in it. If we assume that all nodes receive M1 at the same time, we can know that: Tp - Tk = t2 - t2k Combined with equation (2), it can be know that: (3) Tr = Tk + t2 - t2k - d2 t2 - t2k - d2 is called compensated time of nodeK. NodeK can now adjust its local time by adding compensated time onto its local time. If K is equal to P, then t2 is same as t2k, in that case, equation (3) is equivalent to equation (2). After adjustment, the local time of every node in the network is equal to that of the time reference node under assumption. We can think that the whole network is synchronized at that instant. d 2 = (t 2 − t1 + t 3 − t 4) / 2
B. BTS in Single-hop Network In single-hop network, BTS modifies HRTS in two aspects. First, the t2 and d2 can be piggybacked in M1 of the next cycle. There are only two packets in one synchronization cycle. So when a node receives M1, it not only records time information for this cycle but also computes the compensated time for last cycle. Second, when the compensated time is worked out, every node will save it into buffer instead of adjusting its local time immediately. BTS then employs the least-square linear regression technique to smooth the jitter of synchronization error. So a linear equation which describes the
time relationship between itself and the time reference node is setup. To describe the scheme of BTS in more formal language, we have some notations: we refer the local time of nodeK as [t1]ik when it sends M1, [t 2] ik when it receives M1, [t 3] ik when it sends M2, [t 4] ik when it receives M2 in the i’th synchronization cycle. The clock offset in the i’th synchronization cycle between nodeK and the time reference node is referred as [d 2]ik . For convenience, we assume that the time reference node is node0. Steps in the i’th synchronization cycle are as follows: Step1: The time reference node broadcasts M1. It randomly appoints a neighbour node (assume it is nodeK) as the replier for this cycle, [t 2 ] ik−1 and [ d 2 ] im−1 of the (i-1)’th synchronization cycle are also piggybacked in M1 (assume nodeM is appointed as the replier in the (i-1)’th synchronization cycle). At the same time, the time reference node records its time as [ t 1 ] i0 . Step 2: When one node(assume it is nodeP) receives M1, it records the arrival time of M1 as [t 2]ip with its local time, it also computes the compensated time of the last cycle according to equation (3), the value of the compensated time is [t 2] im−1 − [t 2] ip−1 − [d 2] im−1 , for simplicity, we refer it as [tc]ip−1 . Then the point ( [t 2]ip−1 , [tc]ip−1 ) is saved into its buffer. The meaning of the point is that when the local time of nodeP is [t 2]ip−1 , it needs to add [tc]ip−1 on its local time so as to synchronize with the time reference node. Step 3: the nodeK who is appointed as the replier for this cycle sends M2 back to the time reference node with [t 2 ] ik and [t 3]ik contained in it.
Step 4: the time reference node records the arrival time of M2 as [ t 4 ] ik . It now works out [d 2] ik according to equation (1). When the nodeP is inquired about the time, its estimated time is returned. Steps are as follows: Step 1: find the point whose x-coordinate is the smallest in buffer. Notate the point as ( [t 2] pj , [tc] pj ). Step 2: construct a point set {( [t 2]ip − [t 2] pj , [tc]ip − [tc] pj )} (for all i in buffer) and do the least-squares linear regression on the constructed point set. So linear equation y = kx + b is constructed. We can know that b must be 0. Step 3: if we refer the local time of nodeP as RT p , then: ET 0 p = RT
p
+ k × ( RT
p
− [ t 2 ] pj ) + [ tc ] pj
= (1 + k ) × RT
p
+ [ tc ] pj − k × [ t 2 ] pj
=
p
= f ( RT
k p RT
P
+ d
p
)
(4)
That is, nodeP can estimate the local time of node0 according to equation (4). ET0p stands for the estimated value. According to Fig. 2, it is also the estimated time of nodeP. We point out here that ET0p may be unequal to the local time of node0 in real circumstance. Their difference is the synchronization error between nodeP and node0. We call k p and d p as local skew and local offset of nodeP respectively. Equation (4) means that
the estimated time of a node can be worked out based on its local time, local skew and local offset. This is the basis of the time transformation algorithm which will be discussed latter. IV. ANALYSIS FOR BTS A.
Error Analysis We now try to find what influences the synchronization error of BTS. For convenience, we assume that there are only three nodes in a single hop network, their ID number are 0, 1 and 2 respectively. We also assume that node0 is the time reference node and the three nodes starts running at the same instant and their frequencies are same at any instant. So their local times are completely equal at any instant. We now consider the instant when M2 has just been received by node0 in i’th synchronization cycle. Assume that node1 is appointed as the replier in the cycle. It is obvious that the synchronization scheme between node0 and node1 is the sender-receiver synchronization. It is same with TPSN algorithm. There, the author declares that propagation time, reception time are main erroneous factors. Of course, TPSN stamps time at MAC layer while BTS does not, so the critical path of BTS is from the application layer of sender to that of receiver. We refer the synchronization error caused by all components in the critical path to be δ 0,1 (it can be either positive or negative). So: RT 0 = ET 01 + δ 0 ,1
(5)
The synchronization scheme between node2 and node1 is the receiver-receiver synchronization. It is same with RBS algorithm. There, the author declared that the receive time on receiver is main erroneous factor. We refer the synchronization error caused by it to be ∆ 1, 2 (it can be either positive or negative). So: ET 01 = ET 02 + ∆ 1 , 2
(6)
According to equation (5) and (6), So: RT
0
= ET
2 0
+ δ 0 ,1 + ∆ 1 , 2
(7)
If e stands for the synchronization error between node2 and node0, abs(x) is the function which gets back the absolute value of the variable x, so: (8) abs ( abs (δ 0 ,1 ) − abs ( ∆ 1, 2 )) ≤ abs ( e ) ≤ abs ( abs (δ 0 ,1 ) + abs ( ∆ 1, 2 )) From equation (8), we can see that BTS is equivalent to RBS if δ 0,1 is zero. Furthermore, BTS is equivalent to TPSN if ∆ 1, 2 is zero and time-stamping at MAC layer.
There exists the inequality between the replier and the non-replier in one synchronization cycle. For the replier, its synchronization error is only influenced by the sender-receiver synchronization scheme while the synchronization error of the non-replier is influenced by both the sender-receiver synchronization scheme and the receiver-receiver synchronization scheme. So in a single-hop network, the average synchronization error will keep increasing with the number of node and keep approaching a limit which it never reaches for ever. B.
Other Analysis Both time complexity and space complexity of BTS algorithm are low. Both of them are O(n) where n is the size of buffer. Furthermore, computation is no more than operation of
addition and multiplication on integer. Any 8-bit microcontroller suffices. The energy consumption of BTS is very low. Only 2 packets are transmitted for time synchronization in each synchronization cycle. The operation of least-square linear regression will not be done until the node is inquired about its time. Since the replier is randomly appointed in every cycle, the energy consumption will be distributed uniformly in the network. One fault of BTS is that the energy consumption of the time reference node is tremendous. But in many applications, the sink node has sufficient energy supply. If the sink node is also the time reference node, the fault can be overcome. Since the synchronization error can not be decreased by the size of buffer, buffer size is not an important parameter. But it can smooth the jitter of synchronization error in some degree. So if external environment change fiercely, the buffer size should be set larger. In our experiment, it is set as 30.
to see how the time transformation algorithm works. When we apply single-hop BTS algorithm on Area1, node0 and node1 will synchronize soon. If we don’t consider synchronization error, we can know: (10) ET 01 = RT 0 Assume that ki is the local skew of nodei, di is the local offset of nodei. According to (4), we can get the following: (11) ET 01 = f ( RT 1 ) = k 1 × RT 1+ d 1 By analogy, when we apply single-hop BTS algorithm on Area2 and Area4, we can get the following: 0 1
Area2
A. Topology Construction Algorithm It is obvious that the synchronization error of a node is highly related to its hop number to the time reference node. So the aim of the topology construction algorithm is to construct a breadth-first spanning-tree. Every node has a variable “level” to indicate its hop number to the time reference node. Initially, its value of the time reference node is 0, and the value of other nodes are n+1 where n is the number of node in network. There is a field named “packet_level” in M1. When a node transmits M1, it will copy its “level” into the “packet_level” field in M1. When a node receives M1, it will test if the “packet_level” contained in M1 is no less than the variable “level”. If yes, it will ignore the message, otherwise, it will update its “level” to be (packet_level+1) and transmit another M1. So, a tree hierarchy topology is constructed with the time reference node as the root of the tree. B. Time Transformation Algorithm To clearly explain the principle of the time transformation algorithm, we take an example to describe its idea. We take Fig. 4 as example. The spanning-tree is constructed by the topology construction algorithm discussed above. Assume that Node0 is the time reference node. So: (9) ET 00 = RT 0 It is obvious that any node can directly communicate with its son nodes in the spanning-tree. That is, a node and all of its son nodes in the spanning-tree form a single-hop area. Based on it, we divide the spanning-tree into many single-hop areas where single-hop BTS algorithm can be directly applied. Fig. 4 illustrates that there are 4 single-hop areas in the spanning-tree. Here, we focus on the time of node0, node1, node2 and node3
5
2
Area3
4
Area4
6
3
Fig. 4. A spanning-tree constructed by the topology construction algorithm
V. BTS IN MULTI-HOP NETWORK In this section, we extend BTS from single-hop to multihop network. First, a topology construction algorithm is employed to construct a breadth-first spanning-tree. Single-hop synchronization is performed on every single-hop area in the spanning-tree. Second, a time transformation algorithm is introduced which is employed to relate the time of different nodes which belong to the different single-hop area.
Area1
(12) (13) (14) (15)
ET 12 = RT 1 ET12
= f ( RT 2 ) = k 2 × RT 2 + d 2
,
3 2
ET ET 23
= RT
2
= f ( RT 3 ) = k 3 × RT 3+ d 3
According to (10), (11), we can get the following: (16) According to (10), (11), (12) and (13), we can get the following: RT 0 = k 1 k 2 × RT 2 + k 1 d 2 + d 1 (17) According to (10) to (15), we can get the following: (18) RT 0 = k 1 k 2 k 3 × RT 3 + k 1 k 2 d 3 + k 1 d 2 + d 1 ' ' We recursively define k i and d i as follows: RT 0 = k 1 × RT 1+ d 1
k i' = k i × k i' − 1 k 0' = k 0 = 1
d i' = k i' − 1 × d i + d i' − 1 d 0' = d 0 = 0
We have already referred to
ki
and d
(19) as local skew and
i
local offset respectively. Here, we refer to k i' and d i' as global skew and global offset respectively. According to the recursive definition, We now rewrite equation (9),(16),(17) and (18) as follows: ' 0 + d 0 ' ' RT0 = k1 × RT 1+ d1 = × RT1 + k 0 d1 + d 0 = k1' × RT1 + d1' RT0 = k2k1 × RT2 + k1d2 + d1 = k2k1' × RT2 + k1' d2 + d1' = k2' × RT2 + d2' RT0 = k3k2k1 × RT3 + k1k2d3 + k1d2 + d1 = k3k2' × RT3 + k2' d3 + d2' = k 3' × RT 3 + d 3'
RT
0
= 1 × RT
0+0
= k 0' × RT
k1k 0'
By analogy, for nodei, we can get the following: (20) So, if a node knows its global skew, global offset, it can estimate the local time of the time reference node according to the local time of its own. Of course, global skew and global offset can be get recursively. We now consider how to realize the algorithm. Every time a node is about to send an M1, it piggybacks its global_skew and global_offset into the M1 so that every of its son nodes can construct its own global_skew and global_offset based on equation (19). The global_skew and global_offset of the time reference node is 1 and 0 respectively. We can see that the time transformation algorithm needs no any additional message. When a node is inquired about its time, it works out RT
0
= k i' × RT
i
+ d i'
its estimated time of the time reference node according to equation (20) and returns it as results. VI. SIMULATION To test the performance of BTS algorithm, we have developed a time synchronization simulator named Simsync. Specific information about Simsync can be got from [8]. In this section, we first simulate BTS, RBS and HRTS algorithm in single-hop network. Then, we simulate BTS algorithm in multi-hop network. A. Simulation in Single-hop Network We first realize BTS, RBS and HRTS in a single-hop network on Simsync. 3 nodes named node0, node1 and node2 are deployed in a single-hop network. Node0 is the time reference node in BTS and HRTS. In RBS, node0 is the reference node. The synchronization cycle is set as 10 seconds, the buffer size is set as 30. For every algorithm, we simulate it for 50 minutes. At the beginning of every synchronization cycle, we inquire and record the time of every node in sequence. At the end of simulation, all these time is exported as a file used for further analysis. So there are 300 time items for each node. For BTS and HRTS algorithm, based on the exported file, we work out the difference between node1 and node0 for every time item, the difference between node2 and node0 for every time item is also worked out. The synchronization error is the mean of them. For RBS algorithm, we work out the difference between node1 and node2. The difference is actually the synchronization error of RBS algorithm. The simulated results are listed in Table I, there, µ is the mean of the synchronization error, σ is the standard deviation of the synchronization error. Their units are microsecond(µs)..∆ is the number of messages used for time synchronization in one synchronization cycle. N is the number of node in the network. TABLE I SIMULATED RESULTS OF BTS, RBS AND HRTS Algorithm µ(unit: µs) σ(unit: µs) BTS 59.94 48.60 RBS 26.96 20.90 HRTS 130.36 80.67
∆ 2 N(N-1)+1 3
According to Table I, from the view of synchronization error, RBS is the best, BTS takes the second place and HRTS is the worst. The result is consistent with our previous analysis. In section IV, we have stated that the synchronization error of BTS must be larger than that of RBS. Furthermore, the synchronization scheme of BTS and HRTS are very alike, but HRTS is an instantaneous synchronization algorithm while BTS is a continuous time synchronization algorithm, so BTS will not be influenced so heavily with the duration of synchronization cycle than HRTS. As to the message number in one synchronization cycle, RBS is the worst and BTS is the best. Based on the result, we can conclude that the power consumption of BTS is the least. Table II is copied from [7], we can see that its results of HRTS have great gaps with our simulated results, but its results of RBS and ours are very alike. The reason is analyzed as follows: in [7], besides a public wireless channel, every node has a special wireless channel to directly communicate
with the time reference node. As in Fig. 3, the time reference node broadcasts M1 and M3 using the public channel so that all of its neighbours can receive them, but the appointed replier replies to the time reference node using its special channel, so there is no wireless collision at all. But Simsync has already built the wireless collision into its model. We have known that wireless collision is the main cause of synchronization loss, so the results of HRTS from [7] must be better than our simulated results. As to the results of RBS, in [7], although every node has a special channel, all messages have to be broadcasted using the public channel, there must be some wireless collisions. So its results of RBS and ours must be very alike. In a word, the results from [7] defend our results.
Algorithm RBS HRTS
TABLE II EXPERIMENT RESULTS FROM [7] µ(unit: µs) 20.38 21.23
σ(unit: µs) 22.47 23.48
B. Simulation in Multi-hop Network We also simulate the multi-hop BTS on Simsync. 20 nodes are deployed alone a straight line. Every node can only communicate with its last and next neighbour. The simulation parameters and statistical method are same to that of singlehop simulation. We list the detailed simulated results from 1 hop to 8 hops in Table III. Fig. 5 illustrates the relation between the mean of synchronization error and hop number. It also illustrates the relation between the standard deviation of synchronization error and hop number. We can see that both the mean and the standard deviation of the synchronization error increase linearly with the hop number. Synchronization error increases at the rate of about 9.6 microseconds for one additional hop. TABLE III SIMULATED RESULTS OF MULTI-HOP BTS FOR LINEAR TOPOLOGY Hop number µ(unit: µs) σ(unit: µs) 1 42.84 31.89 2 65.91 48.77 3 82.47 70.04 4 97.33 72.49 5 107.95 84.02 6 116.28 89.71 7 127.80 97.27 8 138.62 101.10
The linear topology is not representative. Since every node has only one son node in this topology, so in every single-hop area, the replier is fixed during the simulation. According to, the synchronization error is only related to the sender-receiver synchronization scheme and has no relation with the receiver-receiver synchronization scheme under this topology. Another topology is simulated, the simulation scenario involves 81 nodes deployed in a 9ⅹ9 grid in such way that each note can directly communicated with its 8 neighbours. So it is a network of 8 hops. The simulation parameters and statistical method are same to that of previous simulation. We list the detailed simulated results from 1 hop to 8 hops in Table IV. Fig. 6 illustrates the relation between the mean of synchronization error and hop number. It also illustrates the relation between the standard deviation of synchronization
error and hop number. We can see that both the mean and the standard deviation of the synchronization error increase linearly with the hop number. Average synchronization error increases at the rate of about 19.2 microseconds for one additional hop. According to Table IV, we can see that the synchronization error of BTS is about 61.86 microseconds in single-hop network. Both Fig. 5 and Fig. 6 show that the mean and the standard deviation of the synchronization error increase linearly with the hop number. Comparing Table III with Table IV, we can see that every item in Table III is smaller than the corresponding item in Table IV. This is caused by the inequality between the replier and the nonreplier in one synchronization cycle. For the linear topology, every node is the replier. 250
µ
Synchronization Error(µs)
200
σ
150 100 50 0 1
3
5
7 9 11 13 15 17 19 Hop number Fig. 5. The relation between synchronization error and hop number for linear topology
Synchronization Error(µs)
TABLE IV SIMULATED RESULTS OF MULTI-HOP BTS FOR NON-LINEAR TOPOLOGY Hop number µ(unit: µs) σ (unit: µs) 1 61.86 46.36 2 84.36 65.37 3 104.83 80.35 4 125.38 95.60 5 144.19 107.12 6 161.19 118.34 7 179.79 130.20 8 196.54 141.69
250 200
µ
150
σ
100 50 0 1
2
3
4
5
6
7
8
Hop number Fig. 6. The relation between synchronization error and hop number for nonlinear topology
VII. CONCLUSION AND FUTURE WORKS We have implemented a lightweight time synchronization algorithm named BTS. Based on packet exchange mechanism, it combines the sender-receiver synchronization scheme with the receiver-receiver synchronization scheme together. In single-hop network, it employs piggyback technique to reduce the number of packets necessary for time synchronization. It buffers time information of packets and employs the leastsquares linear regression technique on them to smooth jitter of synchronization error. The single hop synchronization error is about 61.86 microseconds in an 8-hop network where every
node has 8 neighbour nodes. Average synchronization error increases at the rate of about 19.2 microseconds for one additional hop. In a single-hop network, only 2 packets are transmitted in one synchronization cycle to synchronize all nodes. To synchronize a multi-hop network in one synchronization cycle, 2n packets are transmitted where n is the number of single-hop cell in the spanning tree. n is also the number of non-leaf node in the spanning tree. It overcomes the demerits of both RBS and HRTS, and it is a pretty trade-off between the synchronization precision and the energy consumption used for time synchronization. We conclude that its synchronization error is the sum of two parts. One part is caused by the sender-receiver synchronization scheme. The other part is caused by the receiver-receiver synchronization scheme. To prove our conclusions, we implement BTS and other two related algorithms on Simsync. The simulated result testifies our conclusions. To extent BTS from single-hop to multi-hop network, we propose a time transformation algorithm. It needs no additional packets. We also find that both the mean and the standard deviation of a node’s synchronization error increase linearly with its hop number to the time reference node. Our future works are to realize BTS on Mica2, we believe that in real environment, some unexpected phenomena may occur when the network is large enough. After all, to maintain the robustness and scalability of BTS is an important task. REFERENCES [1] J. Elson and K. Römer, “Wireless Sensor Networks: A New Regime for Time Synchronization”, ACM SIGCOMM Computer Communication Review, vol. 33, no. 1, pp. 149-154, Jan 2003. [2] M. L. Sichitiu and C. Veerarittiphan, “Simple, Accurate Time Synchronization for Wireless Sensor Networks”, in Proceedings of IEEE Wireless Communication and Networking Conference (WCNC 2003), New Orleans, LA, vol. 2, pp. 16-20, Mar 2003. [3] J. Elson, L. Girod, and D. Estrin, “Fine-Grained Time Synchronization using Reference Broadcasts”, in Proceedings of the fifth Symposium Operation System Design and Implementation (OSDI2002), Boston, MA, pp. 147-163, Dec 2002. [4] S. Ganeriwal, R. Kumar, and M. Srivastava, “Timing-Sync Protocol for Sensor Networks”. in Proceedings of the First ACM Conference on Embedded Networked Sensor Systems (SENSYS 2003), Los Angeles, CA, ACM Press, pp. 138-149, Nov 2003 [5] J. V. Greunen and J. Rabaey, “Lightweight Time Synchronization for Sensor Networks”, in Proceedings of the Second ACM International Workshop on Wireless Sensor Networks and Applications (WSNA 2003), San Diego, CA, pp. 11-19, Sept 2003 [6] Miklos Maroti, Branislav Kusy, Gyula Simon, and Akos Ledeczi, “The Flooding Time Synchronization Protocol”, in Proceedings of the Second ACM Conference on Embedded Networked Sensor Systems (SenSys), Baltimore, MD, ACM Press, pp. 39-49, Nov 2004 [7] Hui Dai, Richard Han, “TSync: A Lightweight Bidirectional Time Synchronization Service for Wireless Sensor Networks”, ACM Mobile Computing and Communications Review, vol. 8, no. 1, pp. 125-139, Jan 2004 [8] Chaonong Xu, Lei Zhao, Yongjun Xu, Xiaowei Li, “SimSync: An effective Time Synchronization Simulator for Sensor Networks”, in Proceedings of the First International Workshop on Sensor Networks and Applications (SNA’05), Beijing, China, pp. 2-5, Oct.2005. Available at: http://www.wsn.org.cn/wsnnb /subpages/simsync.pdf. [9] Hill, J., and Culler, D, “Mica: A Wireless Platform for Deeply Embedded Networks”, IEEE Micro archive, vol. 22, no. 6, pp. 12-24, Nov 2002 [10] Mica2 and Mica2Dot: http://www.xbow.com/Products/Wireless_Sensor_ Networks. htm [11] Fikret Sivrikaya and Bulent Yener, “Time Synchronization in Sensor Networks: A Survey”, IEEE Network vol. 18, no. 4, pp. 45-50, 2004.