Tri-Message: A Light-Weight Time Synchronization Protocol for High Latency and Resource-Constrained Networks

Tian Chen1 Liu Wenyu1 Hongbo Jiang2 Wang Yi1 1 Dept. of Electronics and Information Engineering, Huazhong University of Science and Technology 2 Division of Computer Science, EECS, Case Western Reserve University, Cleveland, OH 44106 {tianchen, liuwy, ywang}@mail.hust.edu.cn [email protected]

ABSTRACT - High precision time synchronization protocols location [10, 11]. In these networks, time synchronization are critical for many distributed systems. On the other hand, should be mind of energy/computation consumption due to for emerging resource-constrained applications such as sensor the limited resource capabilities, as well as precision [14]. networks, energy efficiency and computation simplicity could be as important as precision. Existing terrestrial Many time synchronization protocols have been synchronization protocols including RBS, FTSP, TPSN and proposed for sensor networks recently [2, 3, 4, 5]. By LTS have already achieved high precision in radio networks, complicated approaches to reducing uncertainty and but none of them perform well in high latency networks like accounting for various processing latencies in acoustic sensor networks. The reason is that they either communication, these protocols provide a high degree of assume instantaneous packet transmission between nodes, or precision as well as remain energy efficiency. Designed for ignore clock drift during synchronization process. By RF-based networks, however, these protocols either assume addressing these problems, the recent proposed TSHL protocol provides precise time synchronization for high that propagation latency is negligible, or ignore clock drift latency networks. However, due to its high energy and during the synchronization process. Accordingly, for many computation consumption, TSHL is still not practical in high latency networks like acoustic networks and space resource-constrained applications such as sensor networks exploration [7], none of abovementioned protocols work which have stringent constraints on system resources. A new well: their assumptions are not practical due to the high approach, both providing high precision and having small propagation delay in these networks. energy reservation, is prerequisite for those applications. In this paper, we present Tri-Message: a light-weight time Time Synchronization for High Latency networks synchronization protocol for high latency and resource- (TSHL) [6] is a dedicated synchronization protocol that constrained networks. As its name suggests, only three deliberately compensates for high-latency during the message exchanges are required in one synchronization synchronization communications. While it achieves a process. Meanwhile, Tri-Message utilizes very simple relatively high precision, the energy inefficiency and high mathematical operations to calculate the clock skew and computation complexity make TSHL inadequate in sensor offset. Specially, Tri-Message is feasible for many extremely networks: first, a typical synchronization process between long latency applications such as space exploration because it two nodes consists of 27 packets exchanges, and second, has an increasing synchronization precision with the increasement of distance. Our theoretical analysis and computational-heavy linear regression algorithm is required simulation results demonstrate that Tri-Message is able to in the first phase to get an accurate estimation of node achieve good performance of synchronization and outperform skew. existing protocols in terms of energy and computation cost. In this paper, we present Tri-Message: a light-weight Keywords - Time Synchronization, Packet Delay, Clock time synchronization protocol for high latency and Synchronization, Clock Drift, Sensor Networks. resource-constrained networks. The novelty of our work is that, only three messages in one Tri-Message 1. Introduction synchronization process are needed. In addition, Tri- Time synchronization is a critical piece for many Message utilizes some very simple mathematical operations distributed systems. Some distributed synchronization to calculate the clock skew and offset as well as provides a protocols, such as NTP [1], have been proposed and satisfactory estimation. Another advantage of Tri-Message investigated thoroughly for many years. Emerging is that synchronization precision of Tri-Message is resource-constrained applications such as sensor networks, increasing with the increased distance, which makes it however, are extreme cases where nodes often feasible for high latency applications such as space collaboratively process time-sensitive data like target exploration. Reference Node A Synchronizing Node B Reference Node A Synchronizing Node B Global Time Reference Node A Synchronizing Node B A1 A1 B1

P I3 P h { h I3 … { a a …

A1 s s e e 1 1 B1 B1 A2 I1{ I1{ t2 B2 B2 B2 A2 A2 P t2+d+δ2 P h h a a

s I2 s Bk = Ak + Offset e } e I2 } 2 t3 2 Phase Offset = [(B1-A1) – (A2-B2)]/2 A3 A3 Propagation Delay = [(A1-B1) + (B2-A2)]/2 t3+d+δ3 B3 B3

(a) (b) (c) Figure 1 (a) Sender-Receiver two-way synchronization (b) TSHL: Synchronization (c) TSHL: Synchronization with jitter The remainder of this paper is organized as follows. We clock readings in this paper. The subscript indicates the introduce the background and related works in Section 2. local clock reading index, for example, A1 is the first local Section 3 presents the basic idea behind Tri-Message, clock reading recorded at node A. followed by the mathematical framework and analysis. Table 1. Sources of non-determinism Section 4 provides a performance comparison of Tri- Message and TSHL. We conclude in Section 5. Appendix Source Side Details Message traversal delay from application constrains the proof of some theorems. Send Sender layer to MAC layer. Access Sender Channel contention delay in MAC layer 2. Background and Related Works Delay of CPU responding to an receive Interrupt Receiver interrupt, also maybe be affected by clock 2.1 Background Handling Boot at different times, there must be some way for granularity Can be deterministic if the speed of distributed network nodes to determine a common time propagation is assumed constant, and if Propagation None base, which we called the process of time synchronization. synchronization exchange is performed What are the obstacles of time synchronization? There are with assumption of path symmetry. Traverse up from MAC layer to the two quantities should be deal with: clock offset and clock Receive Receiver receiver application skew (clock drift speed). Clock skew is caused by variations in crystal oscillation frequency. Without skew, offset can be determined by a single pair of messages exchange if we can 2.2 Previous Protocols compensate for any sources of uncertain latencies in the There are just two fundamental schemes to synchronize path. When skew exists, already synchronized nodes would clocks: Sender-Receiver and Receiver-Receiver. As a eventually drift out of synchronization sooner or later, Sender-Receiver two-way scheme shown in Figure 1(a), hence a synchronization protocol should figure out both NTP works well over Internet paths with high latency and offset and skew. high variability and estimates both offset and skew [1]. Here we introduce the major causes of errors in time Because of its long-term bi-directional time information synchronization process itself. Deterministic delays like exchange, NTP is unsuitable for many other high latency Encoding and Decoding can be equivalent into propagation applications like acoustic sensor networks. delays. Those versatile sources of jitters of high non- Existing terrestrial sensor network synchronization determinism in the estimations of message delivery delay protocols achieve high precision in radio networks. are listed in Table 1 [6, 9]. Reference Broadcast Synchronization (RBS) [2] eliminate Due to different assumptions in which sources of transmitter side uncertainties by Receiver-Receiver style variation are dominant, existing protocols have adopted synchronization. Flooding Time Synchronization Protocol different approaches to eliminate one or several sources of (FTSP) [4] eliminates timestamp uncertainty by errors simultaneously (Section 2.2). Seldom have they timestamping in the MAC and PHY (radio) message layer taken propagation delay into consideration. In high latency and also account for byte alignment jitter. Both RBS and networks, clock drift continues just during the FTSP deal with skew, but they do not consider propagation synchronization process. An accurate time synchronization delay at all because RF signal travels at the speed of light. scheme must account for this source of error. Due to their assumptions, none of abovementioned protocols work well in high latency networks. Taking into Some notational conventions are given here. We refer to account propagation latency, Timing-sync Protocol for t as global clock times and node name to denote local Sensor Networks (TPSN) [3] performs better in high latency networks [6]. But, TPSN does not take clock skew of TSHL is proportional to the propagation delay d and effect during the synchronization process into can be expressed by consideration, which is also critical to achieve a reasonable synchronization precision and stableness for high latency tk  (2  3 )/ 2  a (  d  I2 / 2) (2) networks. The proof of the theorem is in the appendix. Time Synchronization for High Latency networks We argue that TSHL is not applicable for recourse- (TSHL) is the first protocol that takes into account both constrained networks in three-fold. First, while it achieves high propagation latency and process skew effect for high considerable high precision, the energy and computation latency networks [6]. Its procedure is shown in Figure 1(b). consumption of TSHL are significantly high: a typical Without loss of generality, we assign node A as the time synchronization between two-nodes costs 27 packets; base: an original anchor or a node already compensated its computation-heavy linear regression algorithm is required skew and offset thereafter serve as an anchor. Node B is supposed to be synchronized which has its skew a and for an accurate estimation of node skew. Furthermore,  a offset b . Let d refer to the standard propagation delay is affected by first phase beacon numbers and jitters. between nodes, and let I1 and I2 denote two transmission Finally, we found  a is sensitive to I3 , neglected by [6]. intervals between successive messages. We also let I3 3. Tri-Message represent total time span of the first phase, and Bk denote 3.1 Assumptions the clock reading of Node B at timetk . We have Many sources of non-determinism in message exchange B  at  b,t  (B  b) / a k k k k . can be removed by previous works like MAC/PHY layer TSHL splits time synchronization process into two timestamping. Consistent with [6], here we assume these phases. In the first phase, node A sends a group of errors had already been compensated, and all remain timestamp beacons to node B, enabling node B to estimate uncertainties can be treated as a time jitter, which follows its clock skew through linear regression to time base. Due Gaussian distribution, add to propagation delay d . The to size limitations, all deduction details are presented in second assumption is that clocks are short-term-skew- Appendix. In the second phase node B entered skew- stable. That is, clock skew maintains constant during the synchronized state, and a skew-compensated two-way synchronization process. Long term instability can be exchange is taken. The offset of node B is countered by resynchronization. b  (B  B )  a(A  A ) / 2  2 3 2 3  3.2 Overview (1) As its name suggests, only three message exchanges are However, time jitters during the synchronization process needed for a single Tri-Message synchronization process. will affect the synchronization accuracy. Here we analyze We focus on two nodes’ situation, one node and one impact of those errors on TSHL. Time deviations from d anchor, to illustrate its operation. We refer to the skew rate and clock offset of node B as  and    respectively. are represent byk , where k is correspondent to message index. Here we use a superscript on the timestamp to The reason why clock offset is denoted by    is that it can facilitate mathematical formulation later in Section 3.3. indicate an error-affected value. For example, B3' means The process is shown in Figure 2(a). First, the anchor real B3 value is polluted by jitter. As shown in Figure 1(c), node A sends a message to node B, at the same time

A2 and B3 deviate to A2 ' and B3 ' respectively. captures the transmit timestamp A1 in MAC/PHY layer Nevertheless, the calculated a' is different from real skew and put the timestamp in the message; node B captures its own receive timestamp B during the reception of the a . We refer  a to relative skew error and a' a(1 a ) . 1 message and, save the send timestamp A contained in the Let tk  t3  d   ,  denotes time passed since 1 first message. Second, two nodes swap their roles and B synchronization completed. Clock offset error t can be k saves the transmit timestamp B and A records the receive calculated according the following theorem. 2 timestamp A . Then they swap again. A sends the third Theorem 1: The long-term offset error of TSHL is 2 message and put the transmit timestamp A3 together with dominated by skew error a . The instant Offset error tk

A2 in the packet. At last, B receives the third message so that all 6 timestamps are known to B. Global Time Reference A Synchronizing B Global Time Reference A Synchronizing B

A1 A1 t1 t1 ( ( A1) A1) t1+d B1 t1+d+δ1 B1'

I1{ I1{ B2 B2 t2 t2

A2 A2' t2+d t2+d+δ2

I2 I2 A3 } A3 } t3 t3 (A2 (A2 A3) A3) t3+d B3 t3+d+δ3 B3'

(a) (b) Figure 2 (a) Tri-Message: Synchronization (b) Tri-Message: Synchronization with jitter After the message-exchanges, node B has 6 timestamps 3.4 Discuss and analysis enough to figure out its clock skew and offset. The In this subsection, we investigate the impact of jitters to mathematical formulation of Tri-Message is given in the synchronization performance of Tri-Message. By taking Section 3.3. Once clock skew and offset is known, B can into account time deviations  shown in Figure 2(b), the estimate its skew-offset-compensated “real clock” form its k clock readings. estimated skew  ' can be expressed by real   B 'B '    3.3 Mathematical formulation  ' 3 1   (1 1 3 )   (1 ) Assume that anchor A has no skew and offset error. B has    A3  A1 t3  t1 local clock skew and offset, for global clock tk , its clock      (1  3 )/(t3  t1) reading can be expressed as B   (t  ) . After three- k k (5) message exchanges, B has 6 timestamps where   is the relative skew error. We now have A1, A2 , A3, B1, B2 , B3. From the global clock view, we have 6 reference equations, and we can get Theorem 2: Tri-Message causes decreasing offset error with the increasement of propagation delay and this error is   B3  B1 /A3  A1  proportional to jitters, given by (3)   (B1  B2)/ 2  (A1  A2 )/ 2  4d  I1  2I2 tk  (  )(1  3 ) For a local clock reading Bk , node B estimate its skew- 2d  I1  I2 4d  2I1  2I2 (6) offset-compensated global time tk as  ( 2  1)/ 2 The proof of the theorem is in the appendix. This t  B /   (4) k k characteristic makes Tri-Message feasible for high latency Our algorithm draws the concept of skew modeling from applications like acoustic sensor networks and space RBS [2], skew compensation during the synchronization exploration networks, as we mentioned in Section 1. exchange from TSHL [6], and the mathematical formulation of local clock readings from PinPoint location 4. Performance Evaluation system [8]. As opposed to prior works, we synchronize a In this section we present some simulation results of Tri- node to a time base anchor by only three messages, which Message and the comparison with TSHL [6], which is the is extremely energy efficient. The computational closest one to our work, considering precision in high complexity is also tractable: no linear regression is needed latency networks. We compare two protocols under varying as in [6]. To our best knowledge, this is the most efficient configurations over parameters such as propagation delay and practical synchronization protocols for high latency and message intervals, under varying conditions such as networks. receive jitter and node clock skew. ( a ) ( b ) ( c ) 2 . 5 3 1 0 M e a n M e a n T S H L 9 V a r i a n c e V a r i a n c e T r i - M e s s a g e 2 . 5 2 8

7 )

) ) 2 c e m m s

p 1 . 5 p 6 u p p ( ( (

r r r o o o r r r 1 . 5 r 5 r r e e e

t n w w a e 1 e 4 t k k s S S n

1 I 3

0 . 5 2 0 . 5 1

0 0 0 0 . 5 1 1 . 5 2 2 . 5 3 3 . 5 0 5 1 0 1 5 2 0 2 5 3 0 3 5 0 1 0 2 0 3 0 4 0 5 0 6 0 B e a c o n t o t a l i n t e r v a l ( s e c o n d s ) B e a c o n n u m b e r J i t t e r ( u s e c )

( d ) ( e ) ( f ) 2 4 0 1 0 7 0 T S H L T S H L 2 2 0 9 T r i - M e s s a g e T r i - M e s s a g e 6 0 2 0 0 8

7 5 0

1 8 0 ) ) ) c c c e e e s s 6 s u u u

1 6 0 ( ( ( 4 0

r r r o o o r r r r

r 5 r e e 1 4 0 e

t t t n

e e 3 0 a s 4 s t f f f f

1 2 0 s n O O I 3 2 0 1 0 0 2 8 0 1 0 1 T S H L 6 0 T r i - M e s s a g e 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 0 2 4 6 8 0 2 4 6 8 J i t t e r ( u s e c ) P r o p a g a t i o n d e l a y ( s e c o n d s ) P r o p a g a t i o n d e l a y ( s e c o n d s )

Figure 3 (a) TSHL: Effect of beacon interval (b) TSHL: Effect of beacon number (c) instant error on varying jitters (d) offset error on varying jitters (e) instant error on varying propagation delays (f) offset error on varying propagation delays

4.1 Simulation setup Each data point shown in a graph is the mean value of 100 The Tri-Message and TSHL protocols are both simulated simulation runs. Error bars show standard deviations. in a custom event driven, packet level simulator designed Unless specifically mentioned, the following parameters for an acoustic networks with high latency. There are two are used in all experiments: Skew = 40 parts per million, nodes in the simulation scenario: node A is an anchor with Offset = 10μs, Propagation Delay = 1s, Receive Jitter = no skew and zero offset; Node B's clock has some skew and 5μs. offset relative to the global time. We modeled all Consistent with [3, 4, 6], three evaluation metrics are uncertainties in one message delivery process to a single used in our work:

k by introducing a Gaussian receive jitter, similar to that 1) Skew Error: the absolute value of skew estimation in FTSP [4] and TSHL [6]. In our simulations, granularity error is the most important metric. A small skew error is fixed because we consider error caused by granularity implies small future deviation after a particular delay from can be combined with error caused by interrupt handling. the time the final synchronization completed. The granularity of the clocks is set to 1μs, which is 2) Instant Error: here we measure the absolute difference common in sensor networks. We allow the following between the global time and the skew-offset-compensated adjustable parameters in our simulations: local time of the node at the instant time immediately after • Initial Node clock skew and offset. the final message exchange. These results represent the best case performance. • Jitter distribution. 3) Offset Error: here we measure the offset error of • Propagation delay calculated time of each scheme after a particular delay from • Message intervals the time the final synchronization exchange occurred. This is the most direct metric of algorithms. Usually we set this First, we investigate the receive jitter effect on the to 100 seconds. accuracy of both algorithms. We fix propagation delay to We distinguish the presentation of message intervals by be 1 seconds. The jitter is addictively incremented by 10μs. label them with protocol names for clarity. As shown in The result is shown in Figure 3(c) and (d). It is noted that, only mean value are presented in Figure 3(c)-(f) to be clear. Figure 2, Tri-Message has two intervals: and Tshl _ I1 Similar to our theoretical analysis, Both Tri-Message and

Tshl _ I2 . With an additional Beacon interval, intervals of TSHL offset error is directly proportional to the receive jitter in Figure 3(d). We also show the effect of receive TSHL are denoted as , and Tshl _ I Tshl _ I1 Tshl _ I2 3 jitter on instant error in Figure 3(c). We conclude that Tri- in Figure 1(b) and (c). Note that Tshl _ I3 is the total span Message is as sensitive as TSHL with respect to jitters. Tri- of beacons, and should be divided by beacon numbers to Message looks inferior to TSHL in this simulation because get per-message interval between successive beacons. The propagation delay is 1second only. If delay is longer, Tri- total synchronization time of Tri-Message can be presented Message can outperform TSHL, as we will demonstrate in next simulation. as 3d  Tri _ I  Tri _ I , and TSHL is 1 2 Next, we measure instant error and offset error as a 3d  Tshl _ I1  Tshl _ I2  Tshl _ I3 . function of propagation delay. Here jitter is set to be 5μs Simulations of [6] have shown that TSHL accuracy is constant. We expect that the increase in propagations will reduce the skew error of Tri-Message, as discussed in directly proportional to beacon message number, receive jitters or the granularity the clocks used. However, we Section 3. The delay is incremented by 0.5 second step. Figure 3(e) shows that, TSHL instant error is increased found that TSHL is also related to beacon interval. Before comparative evaluation, parameters are investigated to along with propagation delay, consistent with our theoretical analysis. Figure 3(f) demonstrates that offset figure out a proper parameter settings for TSHL. error using Tri-Message decreases along with propagation increases. On the contrary, TSHL is insensitive to 4.2 TSHL Parameters investigation propagation delay as proved in [6]. This characteristic First, we vary beacon interval Tshl _ I3 to investigate makes Tri-Message more applicable for extremely high its effect in terms of skew error. Beacon numbers are fixed latency networks. to 25. As shown in Figure 3(a), skew error decreases when Finally, we vary the node skew with respect to the global beacon interval increases. Although not mentioned in [6], clock. Since both protocols model the skew, they should be we believe this is reasonable because the longer delay adapted to any skew. Table 2 validates our expectation: the between successive data point, the better linear regression skew error of Tri-Message is considerably comparable to solution converge to real solution. For the rest simulations TSHL. in this paper, we fix Tshl _ I3 to 2 seconds to achieve a Table 2. Skew error relative precise skew. Skew TSHL Tri-Message Next, we vary the number of beacons in the first phase. 10ppm error mean 0.65153847 0.65152399 Shown in Figure 3(b), TSHL skew is sensitive to beacon 10ppm error variance 0.46749385 0.46169087 numbers, which is also verified by [6]. For the rest simulations, we use a constant 25 of beacon number for 100ppm error mean 0.65688778 0.65544851 TSHL. 100ppm error variance 0.46903175 0.46087955

4.3 Comparison of errors We now compare Tri-Message with TSHL in terms of 4.4 Energy and Computation evaluation three kinds of errors we mentioned before. Because In this subsection we compare the computation demand message intervals could affect both algorithms, we set their of two protocols. TSHL linear regression can be total process time to be equal. Since Tshl _ I1 and implemented by a mean-least-square (MLS) numerical solution introduced in [12]. Consider Multiplication as the Tshl _ I has little effect compared withTshl _ I3 , we let 2 dominant factor, we use packet number and Multiplication them be close to zero and set Tshl _ I3 to maximum hence number respectively to represent energy and computation optimize the performance of TSHL demand for two protocols. Let beacon number to be 25 in TSHL, the calculation is given in the appendix. Figure 4 Tri _ I1  Tri _ I2  Tshl _ I3  2 sec shows a per-synchronization-process comparison. (7) The significant difference shown in Figure 4 demonstrates that Tri-Message is a light-weight synchronization protocols compared with TSHL. It can Specialized Research Fund for the Doctoral Program of significantly reduce the energy consumption more that 85% Higher Education (Granted No. 20040487009). in terms of number of packets, as well as computational complexity more that 90% in terms of multiplication REFERENCES operations. Overall, Tri-Message shows a similar [1] D. Mills, “Internet time synchronization: the network time performance in shorter latency networks compared with protocol; RFC 1129,” Internet Request for Comments, no. TSHL, and outperforms TSHL in extremely long latency 1129, Oct. 1989. networks. [2] J. Elson, L. Girod, and D. Estrin, “Fine-grained network time synchronization using reference broadcasts,” in Proceedings of the Fifth Symposium on Operating Systems Design and Implementation (OSDI 002), Boston, MA, USA, December 2002, pp. 147–163. [3] S. Ganeriwal, R. Kumar, and M. B. Srivastava, “Timing-sync protocol for sensor networks,” in Proceedings of the First International ACM Conference on Embedded Networked Sensor Systems (SenSys). Los Angeles, California, USA: ACM Press, 2003, pp. 138–149. [4] M. Maroti, B. Kusy, G. Simon, and A. Ledeczi, “The flooding time synchronization protocol,” in Proceedings of the Second International ACM Conference on Embedded Networked Sensor Systems (SenSys).Baltimore, MD, USA: ACM Press, 2004, pp. 39–49. [5] J. V. Greunen and J. Rabaey, “Lightweight time synchronization for sensor networks,” in Proceedings of the Second ACM international conference on Wireless sensor Figure 4 Energy and Computation comparison networks and applications. San Diego, CA, USA: ACM Press, 2003, pp. 11–19. 5. Conclusion [6] A. Syed and J. Heidemann: Time synchronization for high Time synchronization is critical for many distributed latency acoustic networks. IEEE INFOCOM 2006 systems. None of the existing terrestrial synchronization [7] I. F. Akyildiz, D. Pompili, and T. Melodia: State-of-the-Art protocols are applicable for high latency networks. While in Protocol Research for Underwater Acoustic Sensor TSHL provides high precision time synchronization, it is Networks. in Proc. of ACM International Workshop on still not practical in some applications which have stringent UnderWater Networks (2006) constraints on system resources such as sensor networks [8] M. Youssef, A. Youssef, and C. Rieger. PinPoint: An due to high energy and computation consumption. In this Asynchronous Time-Based Determination System. paper, we have proposed Tri-Message, a light-weight time MobiSys’06, June 19–22, 2006, Uppsala, Sweden. synchronization protocol for high latency and resource- [9] M. Horauer. K. Schossmaier, U. Schmid, and T. Vienna, constrained networks which achieves high precision time PSynUTC—evaluation of a high precision time synchronization, as well as only impose very small energy synchronization prototype system for ethernet lans, in and computation cost. Another encouraging advantage is Proceedings of 34th Annual Precise Time and Time Interval that, Tri-Message has an increasing synchronization Meeting (PTTI), Reston, Virginia, USA, December 2002. precision with the increasement of distance, which makes it [10] S. Capkun, M. Hamdi, and J. P. Hubaux. GPS-free feasible for many high latency applications such as space positioning in mobile ad-hoc networks. Cluster Computing exploration. Journal, 5(2):118–124, April 2002. Future work includes further evaluating the multi-hop [11] J. Liu, Y. Zhang and F. Zhao. Robust Distributed Node performance of Tri-Message in other high latency Localization with Error Management. MobiHoc 2006, May networks, especially in jitter-distance correlated underwater 22–25, 2006, Florence, Italy. environment. [12] H. William, B. P. Flannery, S. A. Teukolsky, and W. T. Vetterling. Numerical Recipes in C: The Art of Scientific Computing. New York, NY: Cambridge University Press, 1992 6. ACKNOWLEDGMENTS The project is supported by The National Natural [13] R. J. Urick. Principles of Underwater Sound. McGraw-Hill, Science Foundation of China (Granted No.60572063) and 1983. [14] J. Elson and D. Estrin, Time Synchronization for Wireless Sensor Networks. IPDPS Workshop PDC, 2001.

Appendix The long-term offset error of TSHL is dominated by skew error  a . And, we set   0 to evaluate effect of d to instant Proof of Theorem 1: error. Skew a of TSHL can be deduced through linear regression. We can implement linear regression by mean- tk / d   a ,  0 least-square (MLS) solutions. Let n denotes received Therefore, it is reasonable to conclude that the instant Offset TSHL beacon numbers, we get a n -order super definition error of TSHL is proportional to the propagation delay. equations group. In MLS, we set L the left (n,2) matrix, R the right (n,1) matrix, and M the solution (2,2) matrix Proof of Theorem 2: L * M  R M  (LT L)1 *(LT R) After the Tri-Message message-exchanges, node B has 6 timestamps. From the global clock view, we have 6 (8) reference equations: Without jitter, offset b can be given by A1  t1 B1   (t1  d  )   A2  t2  d B2  at2  b A  t  d B   (t  )    2 2  2 2 A3  t3 B3  a(t3  d)  b   A3  t3 B3   (t3  d  ) (13) b  at2  b  a(t3  d)  b  a(t2  t3  d)/ 2  (B  B )  a(A  A )/ 2 We show how B could use these values to determine the 2 3 2 3    B  B / A  A (9) skew . Note that  3 1   3 1 , the next question is how to get . The deduction is similar. We first Next we analyze the effect of jitters. As stated above calculate I1 a' a(1 a ),1/ a' 1/ a(1 a ) , I1  t2  (t1  d)  (t2  )  (t1  d  ) we get  (B2  B1)/  b' (B2  B3 ')  a'(A2 'A3 )/ 2 Then we can get  [b  at2  a(t3  d  3 )  b

(10)   [ (t1  d  )]/   t1  d  a(1 a )(t2  2  t3  d)]/ 2  B1 /   A1 [(A2  A1)/ 2  (B2  B1) / 2 )] (14)  b  a(3  2 )  a a (t2  t3  d)/ 2  (B  B )/ 2  (A  A )/ 2 Let  denotes time passed since synchronization, we can 1 2 1 2 Next we analyze the effect of jitters. By taking deviations evaluate clock offset error tk of TSHL. k into consideration, we redefine reference equations set tk ' (Bk  b') / a' (atk  b  b') / a' (1 a )tk (13) as (11)  ( 2  3 )/ 2  a (t2  t3  d) / 2 A1  t1  tk  tk 'tk A2 ' t2  d  2  A2  2   ( 2 3 ) / 2  a[tk  (t2  t3  d) / 2] A3  t3 (12)  (  ) / 2  [t  d    (t  t  d) / 2] (15) 2 3 a 3 2 3 B1'  (t1  d  1  )  B1  1  (  ) / 2  (  d  I / 2)  2 3 a 2 B2   (t2  ) To prove Theorem 1, we fixed other parameters and  B3 '  (t3  d  3  )  B3  3 deduce differential coefficients of tk to  and d The estimated skew  ' can be expressed by real  as respectively

tk /    a In MLS, Let n denotes received TSHL beacon numbers,  B3 'B1' 1  3  '   (1 )   (1  ) we set L the left (n,2) matrix, R the right (n,1) matrix,  A3  A1 t3  t1  and M the solution (2,2) matrix.  1  3    (1  3 )/(t3  t1)  Table 3. TSHL linear regression complexity  2d  I1  I2 Step Multiplication Addition (16) T 4n 4n-4 By Maclaurin expansion, we can get L L LT R 2n 2n-2 1 1 T 1   (1  ) / ,    1 (L L) 14 8  ' (1  ) (LT L)1 *(LT R) 4 2 hence total 6n+18 6n+4

' (B1'B2 )/ 2 '(A1  A2 ')/ 2

(B1  1  B2 )(1  ) (A1  A2   2 )   (17) 2 2

   (1   2 )/ 2  (t1  t2  d  2)  / 2 we can evaluate clock offset error tk of Tri-Message

tk ' Bk /  ''  (tk  ) /  ''

 (tk  )(1  ) ' (18)

tk  tk 'tk  (tk  )    '

 (t3  d    )   (1  2 )/ 2

 (t1  t2  d  2)  / 2

 [  (4d  I1  2I2 )/ 2)]   (2  1) / 2

 4d  I1  2I2  (  )(1  3 ) 2d  I1  I2 4d  2I1  2I2

 (2  1) / 2 (19)

We use a new distribution 13 to represents (1  3 ) .To prove Theorem 2, we fixed other parameters and deduce differential coefficients of tk to 

13 tk /   2d  I1  I2 The long-tern offset error of Tri-Message is proportional to jitters 13 . With d in denominator, we conclude that Tri- Message causes decreasing offset error with the increasement of propagation delay.

Calculation of TSHL computational complexity: