This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

A Novel Rapid-flooding Approach with Real-time Delay Compensation for Wireless Sensor Network Time Synchronization

Fanrong Shi Simon X. Yang Xianguo Tuo Lili Ran Yuqing Huang Manuscript received Aug. 24, 2019; revised Mar. 16, 2020; accepted Apr. 8, 2020. This work was supported in part by National Natural Science Foundation of China Programs (61601383), in part by Key R&\&D projects of Sichuan Science and Technology Program (No. 20ZDYF2341), in part by Natural Science Foundation of Southwest University of Science and Technology (SWUST) (19zx7157) and Longshan academic talent research supporting program of SWUST (17LZX650, 18LZX633). (Corresponding author: Simon X. Yang.) Fanrong Shi, Lili Ran, and Yuqing Huang are with Robot Technology Used for Special Environment Key Laboratory of Sichuan Province, School of Information Engineering, SWUST, Mianyang 621010, China (e-mail: [email protected], [email protected], [email protected]).Simon X. Yang is with Advanced Robotics and Intelligent Systems (ARIS) Laboratory, School of Engineering, University of Guelph, Guelph, Ontario, N1G 2W1, Canada (email: [email protected]). Xianguo Tuo is with Sichuan University of Science and Engineering, Zigong 643000, China (e-mail:[email protected]).
Abstract

One-way-broadcast based flooding time synchronization algorithms are commonly used in wireless sensor networks (WSNs). However, the packet delay and clock drift pose challenges to accuracy, as they entail serious by-hop error accumulation problems in the WSNs. To overcome it, a rapid-flooding multi-broadcast time synchronization with real-time delay compensation (RDC-RMTS) is proposed in this paper. By using a rapid-flooding protocol, flooding latency of the referenced time information is significantly reduced in the RDC-RMTS. In addition, a new joint clock skew-offset maximum likelihood estimation is developed to obtain the accurate clock parameter estimations, and the real-time packet delay estimation. Moreover, an innovative implementation of the RDC-RMTS is designed with an adaptive clock offset estimation. The experimental results indicate that, the RDC-RMTS can easily reduce the variable delay and significantly slow the growth of by-hop error accumulation. Thus, the proposed RDC-RMTS can achieve accurate time synchronization in large-scale complex WSNs.

Index Terms:
Wireless Sensor Networks, Time Synchronization, Rapid Flooding, Real-time Delay Estimation, Networked and Distributed Control, Wireless Control Systems

I Introduction

Synchronization is the typical problem in distributed system, and it still remains a popular topic in smart grid [PDU_Grid], Internet of Things (IoT) [IoT1, IoT2], wireless sensor networks (WSNs) [WSN], networked synchronization control [DisControl2, DisControl4], and so on. Specifically, the time synchronization, which aims to correct the local time information on the distributed nodes and drive a common time notion network-wide, is an essential portion of some WSN/IoT applications, e.g., providing accurate time interval for distributed data acquisition and processing [DataSync, Sleep1], and scheduling [Scheduling]; measuring time delay in industrial wireless feedback control system [SyncCtrl]. However, the large-scale wireless network application imposes exceedingly strict requirements on time synchronization, for instance, they require an accuracy of about ±100\pm 100 µs and ±96\pm 96 µs in the industrial automation standards ISA100.11a [ISA-100.11a] and WirelessHART [WirelessHART], respectively; about 120 µs for the damage localization in the structural health monitoring [SHM_erro, SHM_S]. Considering WSN is being used in many applications, e.g., industrial automation, monitoring, and is resource-constrained, low-cost, large scale and unreliable connection, therefore its time synchronization problem is representative.

The early researches focused on developing novel synchronization structures, reducing the dependence of the algorithms on the network topology management, and improving the robustness of the algorithms in dynamic networks. As is known to all, due to the requirement of additional protocol to manage the topology of network, the RBS [RBS] and the TPSN [TPSN] are difficult to be deployed in a large-scale complex network, which has large diameter and dynamic topology. Many of the derived algorithms were expected to optimize the implementation complexity, e.g., the clustered-based algorithm [cluster-Conse-sync-1, PulseSS, cluster-Conse-sync-2, cluster-Conse-sync-3] and low-power interested approach in [CESP], the improved two-way message exchange time synchronization approaches in [TSync, Timing-sync, Star-Structure, Elsharief2017DensityTable, R-Sync, Q_TTME, TT_K, TT_W].

In recent years, the flooding time synchronization algorithms [FTSP, FCSA, PulseSync, RMTS] and the consensus-based approaches [ATS2007A, ATS, DCTS, GTSP] are widely studied to meet the accurate synchronization in the large-scale complex WSN. These time synchronization algorithms do not require any topology management, so the problems mentioned above are naturally avoided. Moreover, they are robust and scalable, and can adapt quickly to the changes in network connectivity and clock drifts. However, there are limitations to both of the flooding and the consensus-based methods. In other words, they are different from each other and can be used to meet the time synchronization requirements in different WSNs.

Considering a consensus-based time synchronization algorithm, it is easy to implement and robust in dynamic networks. However, its convergence rate is very slow due to the iteration. For instance, the convergence time is up to 120 rounds of synchronization intervals in ATS (5×75\times 7 grid network) [ATS], and studies in [CCS, EventDriven_ATS, MTS, DiStiNCT, HE2017C, MACTS] are interested in improving the convergence rate. However, It cannot to be synchronized by an external clock or the heterogeneous network [EGsync]. What it matters is not the value of the reference clock but the fact that all clocks converge to one common virtual reference, thus it cannot be synchronized with an external clock or the heterogeneous network [EGsync].

Fortunately, flooding time synchronization algorithm can easily avoid the problems in a consensus-based method. It employs a special node as the reference, meanwhile it distributes the reference’s time information network-wide and aims to synchronize all of the nodes to the reference. A number of line networks are automatically generated while the referenced time information is flooded. Therefore, a complex network is simplified as lines, and the distance of line is the main factor of network to affect the algorithm. The rapid-flooding protocol leads the algorithms to build a stable synchronization after a few synchronization intervals, e.g., about 3 rounds in RMTS (5×55\times 5 grid network) [RMTS]. Moreover, the rapid-flooding is a synchronous method in which the time interval of node transmission can be predicted, thus it is possible and easy to meet synchronous sleep/wake scheduling for low-duty cycle WSN [Chase, Splash]. Hence, the flooding time synchronization algorithm will be a very efficient solution for the time synchronization in the large-scale WSNs.

However, distance of flooding path, flooding latency, packet delay, and clock drift, which cause the unpredictable by-hop error accumulation problem, pose the main challenges to a flooding time synchronization algorithm. Such problems have been significantly improved by the previous studies, and most of the recent studies on flooding time synchronization focus on improving the accuracy, e.g., PulseSync [PulseSync_1, PulseSync], Glossy [glossy], FCSA [FCSA], RMTS [RMTS]. The improvements of flooding time synchronization are simple and effective, i.e., shortening the flooding latency and removing the delay, meanwhile compensating the clock drift. However, there is no better way to calculate packet delay in existing one-way broadcast-based synchronization protocols, but using the prior constant, e.g., the method used in PulseSync and RMTS. Hence, before deploying WSN, a lot of preliminary experiments are required to calculate the prior constant; actual delay may change due to hardware and environment changes.

In this paper, we are interested in a real-time and agile delay estimation to improve the rapid-flooding time synchronization. If the clock skew estimation is fast convergence and independent of the clock offset estimation, meanwhile if a two-way message exchange can be constructed in the one-way-broadcast model, then the real-time delay compensation can be implemented. It is worth mentioning that this strategy has been inspired by the two-way message exchange model based clock offset estimation in [DRJeskeMLE, KLNohMLE, QMChaudhariMLE]. To achieve the objective, the Maximum Likelihood Estimation (MLE) proposed in [MLE] is employed to generate an accurate clock skew estimation at the second round of synchronization; meanwhile an improved two-way message exchange model is constructed on one-way-broadcast model; then a joint clock skew-offset MLE is obtained , and the real-time delay estimation is also given. As a result, a new rapid-flooding multi-broadcast time synchronization with real-time delay compensation (RDC-RMTS) protocol is further developed. The main contributions of this work are as follows.

1) A novel two-way message exchange model is ingeniously designed in the one-way broadcast-based flooding time synchronization, which utilizes redundant broadcasting without any additional packet transmission.

2) The proposed joint clock skew-offset MLE provides the real-time delay estimations and the accurate clock offset estimation, which results in better scalability to RDC-RMTS.

3) An innovate implementation is developed for the RDC-RMTS, in which an adaptive clock offset estimation is designed to guarantee the accurate estimation over unreliable network.

Moreover, the actual performances of flooding time synchronization in a large-scale complex network are discussed. Basically, the performance evaluation indicate that the network mainly affect the time synchronization in a way of increasing the flooding path.

The rest of the paper is organized as follows. In Section II, the challenges to the flooding time synchronization is discussed in detail, and the motivation of this paper is provided. The system model is provided in Section III and the RDC-RMTS is proposed in Section IV. The implementation of RDC-RMTS is described in Section V. The RDC-RMTS is evaluated and discussed in Section VI, where the testbed is provided, and the experimental results in FTSP, FCSA, FloodPISync, PulseSync, PulsePISync, and RMTS are also reported. The discussions and simulations results in complex network are reported in Section VII. Finally, conclusions are drawn in Section VIII.

II Challenges and Motivation

Flooding time synchronization protocol is easy to implement, and does not require topology management. In addition, flooding operations decompose a complex network into multi-line networks, then the nodes on the line synchronize itself to the reference node (root). However, the time synchronization on a multi-hop node depends on the time information forwarded by relay nodes, thus relay node synchronization error will accumulate on a hop-by-hop basis, i.e., by-hop error accumulation problem [RMTS], which is the major challenge to flooding time synchronization.

A by-hop error accumulation is mainly caused by flooding latency, packet transmission delay, and clock drift. In addition, it is proportional to the distance of reference node and multi-hop node. Definition EE is the synchronization error of the node relative to the reference node, then the synchronization error on the kk-hop node E[k]E[k] which is derived in [RMTS], is given by

E[k]=h=1kD[h]+h=1kφhh1×Twait[h]106E[k]=\sum_{h=1}^{k}D[h]+\frac{\sum_{h=1}^{k}\varphi_{h}^{h-1}\times T_{wait}[h]}{10^{6}} (1)

where Twait[h]T_{wait}[h], which is less than the synchronization interval (periodperiod), is the flooding latency at the hh-hop node, and φhh1\varphi_{h}^{h-1} is the relative clock rate between hh-hop and (h1h-1)-hop.Variable D[h]D[h] is one-way broadcast packet transmission delay at the hh-hop node, which comprises variable portion DvarD_{var} and uncertain portion DuncD_{unc} [RMTS]. Moreover, Dvar=Dfixed+dD_{var}=D_{fixed}+d, where constant DfixedD_{fixed} is the mean of DvarD_{var}, and variable dN(0,σ2)d\sim N(0,\sigma^{2}) (σ\sigma is the standard deviation of DvarD_{var}). Hence, D=Dfixed+d+DuncD=D_{fixed}+d+D_{unc}. Because relative clock rate or clock frequency offset is usually described in parts per million (PPM), a multiplier 10610^{6} is used in (1).

Summaries of the existing flooding time synchronization algorithms are shown in Table I. It should be noted that, according to the [FCSA, PISync], although they don’t seems emphasize the use of D^fixed\hat{D}_{fixed} to compensate clock offset estimation, we prefer to do this in our experiments to get better experimental results. Moreover, D^fixed\hat{D}_{fixed} is calculated during the experimental phase based on the previous experimental results, and it is a constant when the algorithm is evaluated.

TABLE I:
Summary of the flooding time synchronization algorithms in comparison. Considering the pairwise timestamps TsT_{s} (created at sender) and TrT_{r} (created at receiver), clock offset estimations θ^1=TsTr=θ+D\hat{\theta}_{1}=T_{s}-T_{r}=\theta+D, θ^2=θ^1D^fixed\hat{\theta}_{2}=\hat{\theta}_{1}-\hat{D}_{fixed}, and θ^3=min{θ^1[n]}n=1ND^fixed\hat{\theta}_{3}=\min\{\hat{\theta}_{1}[n]\}_{n=1}^{N}-\hat{D}_{fixed}.
Protocol Clock Parameter Estimations
Clock Offset Clock Skew
FTSP Slow-flooding θ^1\hat{\theta}_{1} LR
FCSA Slow-flooding θ^2\hat{\theta}_{2} LR
FloodPISync Slow-flooding θ^2\hat{\theta}_{2} PI
PulseSync Rapid-flooding θ^2\hat{\theta}_{2} LR
PulsePISync Rapid-flooding θ^2\hat{\theta}_{2} PI
RMTS Rapid-flooding θ^3\hat{\theta}_{3} MLE

Lenzen et al. pointed out that, when the referenced time information is flooded network-wide, it will lose accuracy due to clock drift and flooding latency [PulseSync_1]. The PulseSync suggests to distribute time information as fast as possible, and is expected to adapt to fast change in clock drift. Unlike FTSP, which uses slow-flooding, PulseSync uses a rapid-flooding protocol. The Glossy and RMTS are also rapid-flooding approaches.

The FCSA tries to minimize the undesired effect of flood waiting times on the synchronization accuracy by using a clock rate agreement algorithm, and expects to force all nodes to agree on a common clock rate. Even so, the slight estimation error on clock skew estimation may cause serious interference to time synchronization accuracy. Especially, the FCSA use linear regression (LR) to estimate the clock skew, where the DD is directly introduced in observations. By using LR, the problem in FCSA also exists in FTSP and PulseSync. The PISync employs a Proportion Integration (PI) control method to optimize the clock skew estimation, however the delays in the observations are not optimized. Unlike that, the MLE in [MLE, RMTS] tries to minimize the delay and could obtain more accurate clock skew estimation than LR and PI method [MLE].

The existing flooding time synchronization algorithms use accurate clock parameter estimation methods and rapid-flooding protocol, and are expected to against the by-hop error accumulation problem. Considering the by-hop error accumulation model in (1), the FCSA tries to minimize φhh1\varphi_{h}^{h-1}, moreover, the PulseSync and RMTS are also to minimize TwaitT_{wait}. As discussed in [RMTS], the summary of the synchronization error in flooding time synchronization algorithms is shown in II. It is clear that, the accuracy is significantly improved in the existing flooding time synchronization algorithms.

TABLE II:
Summary of the synchronization error in flooding time synchronization algorithms, where D=Dfixed+d+DuncD=D_{fixed}+d+D_{unc}. The synchronization error in FloodPISync and PulsePISync are similar to FCSA and PulseSync, respectively.
Synchronization Error
Single-hop kk-hop
FTSP DD (1)
FCSA DD h=1kD[h]\approx\sum_{h=1}^{k}D[h]
PulseSync DDfixedD-D_{fixed} h=1k(D[h]Dfixed)\approx\sum_{h=1}^{k}(D[h]-D_{fixed})
RMTS dd h=1kd[h]\approx\sum_{h=1}^{k}d[h]

PulseSync and RMTS use a fixed delay estimation for clock offset estimate compensation that pose challenges to flexible deployment, as it entails that a lot of preliminary experiments need to be completed for the delay estimation. Testbed is needed to collect experimental results and calculate delay estimation, and the estimation cannot be changed after being deployed. Thus, the synchronization accuracy of algorithm may decrease results from the timely changes in delay.

In the light of the above discussion, the main motivation of this paper is to obtain a timely delay estimation, and then propose a new rapid-flooding time synchronization algorithm with real-time delay compensation against the by-hop error accumulation problem.

III System Model

The WSN is modeled as the graph 𝒢=(𝒩,)\mathcal{G}=(\mathcal{N},\mathcal{E}), where 𝒩={1,2,,n}\mathcal{N}=\{1,2,\ldots,n\} represents the nodes of the WSN and \mathcal{E} defines the available communications links. The set of neighbors for viv_{i} is 𝒩i={j|(i,j),ij}\mathcal{N}_{i}=\{j|(i,j)\in\mathcal{E},i\neq j\}, where nodes viv_{i} and vjv_{j} belong to 𝒩\mathcal{N}, and j𝒩ij\in\mathcal{N}_{i}. In our work, there are two time notions defined for the time synchronization algorithm, i.e. the hardware clock notion H(t)H(t) and logical clock notion L(t)L(t). Hardware clock H(t)H(t) is defined as

H(t)=0th(τ)𝑑τ+θ(t0)H(t)=\int_{0}^{t}h(\tau)d\tau+\theta(t_{0}) (2)

where H(t)H(t) is the hardware clock notion. Parameter h(τ)h(\tau) is the hardware frequency rate (clock speed) of the clock source, meanwhile it is the inherent attribute of crystal oscillator and cannot be changed or measured. Any node considers itself to have the ideal clock frequency (i.e. nominal frequency) and h(τ)=1h(\tau)=1. Variable t0t_{0} is the moment that node is powered on, and θ(t0)\theta(t_{0}) is the initial relative clock offset. It should be noticed that H(t)H(t) cannot be changed either, and the timestamps on H(t)H(t) are used to estimate the relative clock speed for the proposed algorithm.

The logical clock L(t)L(t) is defined as

L(t)=φ(t)×H(t)L(t)=\varphi(t)\times H(t) (3)

where φ(t)\varphi(t) is the logical relative clock rate and initialized as 1, it can be changed to speed up or slow down L(t)L(t). With respect to the reference node, φ(t)\varphi(t) is always set as 1. The timestamps on L(t)L(t) are used to estimate the relative clock offset for the proposed algorithm. Variable L(t)L(t) is used to supply the global time service for the synchronization applications.

Considering the arbitrary nodes viv_{i} and vjv_{j}, Li(t)L_{i}(t) and Lj(t)L_{j}(t) are the logical times respectively, and φij\varphi_{i}^{j} is the relative logical frequency rate which is

φij=1+θΔtΔ,tΔ>0\varphi_{i}^{j}=1+\frac{\theta_{\Delta}}{t_{\Delta}},t_{\Delta}>0 (4)

where, in consideration of arbitrary moments t1t_{1} and t2(t1<t2)t_{2}(t_{1}<t_{2}), tΔ=t2t1t_{\Delta}=t_{2}-t_{1}. The relative clock offset increment in tΔt_{\Delta} is θΔ=(Hj(t2)Hi(t2))(Hj(t1)Hi(t1))\theta_{\Delta}=(H_{j}(t_{2})-H_{i}(t_{2}))-(H_{j}(t_{1})-H_{i}(t_{1})). Parameter φij\varphi_{i}^{j} is the changing rate on the relative clock offset in tΔt_{\Delta}. It is common estimated by any two clock offset estimations and used to compensate the clock skew in the time synchronization algorithms.

IV Proposed RDC-RMTS Algorithm

Considering the one-way broadcast based time synchronization protocols, and assuming that the clock skew is fixed in a short time, the key idea of RDC-RMTS is that: the clock skew estimation is independent of clock offset estimation, and convergence fast and accurate, then; an improved two-way message exchange can be structured for the clock offset estimation based on the one-way broadcasts, and the delay can be estimated and compensated timely in the RDC-RMTS.

IV-A Proposed Synchronization Model of RDC-RMTS

In this part, an rapid-flooding synchronization model is proposed for the RDC-RMTS based on multiple one-way broadcast, which is illustrated in Fig. 1. There are two important portions in the proposed model, i.e. multi-broadcast clock skew estimation and two-way message exchange clock offset estimation. The main difference between the new proposed synchronization model and the previous ones is that a novel two-way message exchange model is structured in the one-way broadcast synchronization model.

Refer to caption
Figure 1: The multi-one-way broadcast model. Nodes broadcast nn time information packets in a short time, and n pairs of timestamps are generated, e.g. Tr[1,1]T_{r}[1,1] and T1[1,1]T_{1}[1,1] at nodes vRv_{R} and vjv_{j} respectively.

Considering the arbitrary vi𝒢v_{i}\in\mathcal{G} periodically broadcasts a group of NN synchronization packets to neighboring nodes over a broadcast period of TbT_{b}. Here we define {Tk[x,n]}n=1N\{T_{k}[x,n]\}_{n=1}^{N} as the set of timestamps at node k(k𝒢)k(k\in\mathcal{G}), its size is NN, and xx is its serial number. There are NN packets broadcasted in a short time, and NN pairs of timestamps are generated. When a node broadcasts a packets, the timestamp will be created at both of the sender and the receivers.

Clock skew MLE of the RDC-RMTS is developed based on the multi-broadcast clock skew estimation, and uses two groups of multi-broadcast process (e.g., UU and VV) to collect observations, e.g. {Tr[1,n]}n=1N,{T1[1,n]}n=1N\langle\{T_{r}[1,n]\}_{n=1}^{N},\{T_{1}[1,n]\}_{n=1}^{N}\rangle and {Tr[2,n]}n=1N,{T1[2,n]}n=1N\langle\{T_{r}[2,n]\}_{n=1}^{N},\{T_{1}[2,n]\}_{n=1}^{N}\rangle. Clock offset estimation of RDC-RMTS is developed based on the two-way message exchange model and the above clock skew estimation, e.g.{T3[2,n],T2[3,n]}n=1N\langle\{T_{3}[2,n],T_{2}[3,n]\}_{n=1}^{N} and {T2[5,n],T3[3,n]}n=1N\langle\{T_{2}[5,n],T_{3}[3,n]\}_{n=1}^{N}. Since that the time interval from the first broadcast to latest broadcast (e.g., Tr[1,N]Tr[1,1]T_{r}[1,N]-T_{r}[1,1], when N=5N=5, which is less than 12 microsecond in our experiments) is exceedingly short, we can assume that the relative clock offset is fixed at the phase of a multi-broadcast processing.

The RDC-RMTS is a rapid flooding time synchronization approach: the reference node vRv_{R} initializes an synchronization period and nodes forward the newly time information to its neighbors quickly (the message flooding latency TwaitT_{wait} is very short).

IV-B The Clock Skew Estimation

Assuming the actual delay is Gaussian distribution, the clock skew MLE is proposed in [MLE].

In this paper, the proposed synchronization model in Fig. 1 provides an reasonable implementation for the MLE, i.e. the multi-broadcast clock skew estimation model (synchronization process UU and VV). A group of timestamp observations is created in the multi-broadcast process, i.e., {Tr[1,n],T1[1,n]}n=1N\langle\{T_{r}[1,n],T_{1}[1,n]\}_{n=1}^{N}\rangle and {Tr[3,n],T1[3,n]}n=1N\langle\{T_{r}[3,n],T_{1}[3,n]\}_{n=1}^{N}\rangle, then the observations PP for the clock skew MLE likelihood function are

P:p[n]=v[n]u[n],n=1,2,,NP:p[n]=v[n]-u[n],n=1,2,\ldots,N (5)

where u[n]=T1[1,n]Tr[1,n]u[n]=T_{1}[1,n]-T_{r}[1,n], v[n]=T1[3,n]Tr[3,n]v[n]=T_{1}[3,n]-T_{r}[3,n].

Accordingly, the clock skew MLE φ^i(MLE)r\hat{\varphi}_{i(MLE)}^{r} is

φ^i(MLE)r=P¯τ^=n=1Np[n]Nτ^\hat{\varphi}_{i(MLE)}^{r}=\frac{\bar{P}}{\hat{\tau}}=\frac{\sum_{n=1}^{N}p[n]}{N\hat{\tau}} (6)

where τ\tau is the time interval of UU and VV, e.g., τ^=T1[3,1]T1[1,1]\hat{\tau}=T_{1}[3,1]-T_{1}[1,1].

It is worth mentioning that the φ^i(MLE)r\hat{\varphi}_{i(MLE)}^{r} is independent of clock offset estimation, and the timestamps for φ^i(MLE)r\hat{\varphi}_{i(MLE)}^{r} is generated at the hardware clock timer.

IV-C Proposed Joint Clock Skew-offset MLE

According to [TPSN], the clock offset estimation based on two-way message exchange model significantly optimizes the estimation error caused by delay, and more accurate than that of one-way broadcast model. Most of the previous clock offset MLEs, e.g., [DRJeskeMLE, KLNohMLE, QMChaudhariMLE], are developed based on two-way message exchange model. However, the traditional two-way message exchange model is implemented on a pair of nodes, thus the reference should synchronize the neighbors one by one, and it may fail to meet the efficient time synchronization over a large-scale network due to the pairwise message exchange and hierarchical management.

In this part, we employ the MLE clock skew to calculate the clock offset estimation, which is significantly different from the traditional method, e.g. the FTSP in which the linear regression is used to calculate clock skew estimations. It is worthy to note that, the MLE clock skew is independent of the clock offset estimation, therefore it is possible to use the accurate clock skew estimation to compensate the clock offset estimation.

According to the two-way message exchange clock offset estimation model that is shown in Fig. 1, for viv_{i} and vkv_{k}, the UplinkUplink timestamps are {T3[2,n],T2[3,n]}n=1N\langle\{T_{3}[2,n],T_{2}[3,n]\}_{n=1}^{N}\rangle, and the DownlinkDownlink timestamps are {T2[5,n],T3[3,n]}n=1N\langle\{T_{2}[5,n],T_{3}[3,n]\}_{n=1}^{N}\rangle. We define that {pu[n]}n=1N\{p_{u}[n]\}_{n=1}^{N} and {pd[n]}n=1N\{p_{d}[n]\}_{n=1}^{N} as

pu[n]=T2[3,n]T3[2,n]=Du[n]+θΔθd,p_{u}[n]=T_{2}[3,n]-T_{3}[2,n]=D_{u}[n]+\theta_{\Delta}-\theta_{d}, (7)
pd[n]=T3[3,n]T2[5,n]=Dd[n]+θdp_{d}[n]=T_{3}[3,n]-T_{2}[5,n]=D_{d}[n]+\theta_{d} (8)

where θd\theta_{d} is the relative clock offset in downlinkdownlink, and θΔ=φki×Tb\theta_{\Delta}=\varphi_{k}^{i}\times T_{b}, then the two-way message exchange clock offset estimation can be rewritten as

θ^d[n]=(pd[n]pu[n])(Dd[n]Du[n])+θΔ2,\hat{\theta}_{d}[n]=\frac{(p_{d}[n]-p_{u}[n])-(D_{d}[n]-D_{u}[n])+\theta_{\Delta}}{2}, (9)
D^d[n]=(pd[n]+pu[n])θΔ2.\hat{D}_{d}[n]=\frac{(p_{d}[n]+p_{u}[n])-\theta_{\Delta}}{2}. (10)

Considering that DD is variable value with fixed portion DfixedD_{fixed} and variable portion dd, and using the φ^k(MLE)i\hat{\varphi}_{k(MLE)}^{i} (i.e., θ^Δ=φ^k(MLE)i×τ\hat{\theta}_{\Delta}=\hat{\varphi}_{k(MLE)}^{i}\times\tau, the clock offset estimation MLE of clock offset θ^ki\hat{\theta}_{k}^{i} is

θ^ki=θ^d[n]=(pd[n]pu[n])(dd[n]du[n])+θ^Δ2.\hat{\theta}_{k}^{i}=\hat{\theta}_{d}[n]=\frac{(p_{d}[n]-p_{u}[n])-(d_{d}[n]-d_{u}[n])+\hat{\theta}_{\Delta}}{2}. (11)

According to [DRJeskeMLE], the MLE of joint clock skew-offset estimation is

θ^k(MLE)i=min{pd[n]}n=1Nmin{pu[n]}n=1N+θ^Δ2\hat{\theta}_{k(MLE)}^{i}=\frac{\min\{p_{d}[n]\}_{n=1}^{N}-\min\{p_{u}[n]\}_{n=1}^{N}+\hat{\theta}_{\Delta}}{2} (12)

where the DfixedD_{fixed} is removed from the clock offset estimation. The D^fixed\hat{D}_{fixed} is given by

D^fixed=min{pd[n]}n=1N+min{pu[n]}n=1Nθ^Δ2.\hat{D}_{fixed}=\frac{\min\{p_{d}[n]\}_{n=1}^{N}+\min\{p_{u}[n]\}_{n=1}^{N}-\hat{\theta}_{\Delta}}{2}. (13)

It is worth mentioning that the timestamps for θ^k(MLE)i\hat{\theta}_{k(MLE)}^{i} are generated at the logical clock timer.

IV-D Min function-based MLE

According to [RMTS], it is because DD in the observations u[n]u[n] and v[n]v[n] is always a positive value , i.e., D>0D>0, the min function-based MLE tries to find out the observation with minimal value of DD. For instance, the θ^j(MLE)r\hat{\theta}_{j(MLE)}^{r} given by

θ^j(MLE)r=min1nN{u[n]}n=1ND^fixed\hat{\theta}_{j(MLE)}^{r}=\min_{1\leq n\leq N}{\{u[n]\}_{n=1}^{N}}-\hat{D}_{fixed} (14)

where D^fixed\hat{D}_{fixed} is the delay estimation, which can be calculated by (13).

IV-E Error Analysis

According to (12) and (14), the DuncD_{unc} and DfixedD_{fixed} could be removed from the error link of the RDC-RMTS. Then the single-hop synchronization error ER[1]E_{R}[1] of RDC-RMTS is given by

ER[1]=DDfixedDuncd.E_{R}[1]=D-D_{fixed}-D_{unc}\approx d. (15)

By using the rapid-flood protocol and accurate clock skew compensation, the part h=1kφhh1×Twait[h]106\frac{\sum_{h=1}^{k}\varphi_{h}^{h-1}\times T_{wait}[h]}{10^{6}} in (1) is almost equal to 0 (Twait0T_{wait}\rightarrow 0), thus the by-hop error accumulation ER[k]E_{R}[k] in RDC-RMTS is given by

ER[k]h=1k(D[h]D^fixedDunc[h])h=1kd[h]E_{R}[k]\thickapprox\sum_{h=1}^{k}(D[h]-\hat{D}_{fixed}-D_{unc}[h])\thickapprox\sum_{h=1}^{k}d[h] (16)

which is the same as that in RMTS [RMTS].

V Implementation

The proposed RDC-RMTS removes the DfixedD_{fixed} from clock offset estimation based on the improved two-way message exchange model without any prior knowledge. It is well known that the two-way message exchange model based synchronization algorithms (e.g. TPSN) calculate the clock offset estimation and delay separately. In this part, we demonstrate an innovative implementation for the two-way message exchange based joint clock skew-offset MLE proposed in (12) and (14).

V-A The Structure Overview of RDC-RMTS

According to (6), it suggests larger observation interval τ\tau to obtain the more accurate clock skew estimation φ^\hat{\varphi}. Thus a sliding window is employed in RDC-RMTS, where τ\tau is several times the actual synchronization period TbT_{b}.

Figure 2 indicates the structure of implementation in RDC-RMTS. Considering viv_{i} and its neighbor vjv_{j}, it is mainly composed of three parts: sliding window, clock skew estimation, and clock offset estimation.

Refer to caption
Figure 2: The multi-one-way-broadcast model. Nodes broadcast nn time information packets in a short time, and n pairs of timestamps are generated, e.g. Tr(1,1)T_{r}(1,1) and T1(1,1)T_{1}(1,1) at nodes vRv_{R} and vjv_{j} respectively.

A WW-pages (W2W\geq 2) timestamp FIFO (first in first out) buffer is the key to the sliding window. It is designed to buffer multiple groups of timestamp, and the sliding window with specified width will be generated for φ^i(MLE)j\hat{\varphi}_{i(MLE)}^{j} by copying the timestamp of the corresponding position of the FIFO. The pages (WW) of FIFO should be larger than the maximal width of sliding window. The depth of the page is the same as the multiple number NN. If the sliding window length is set to be w(wW)w(w\leq W), then the φ^i(MLE)j\hat{\varphi}_{i(MLE)}^{j} is calculated based on the latest timestamp observations (Pg 11) and the ww-th from last (i.e.,Pg ww), and the τ\tau in (6) is (w1)(w-1) times of the synchronization period TbT_{b}, i.e., τ^=(w1)×Tb\hat{\tau}=(w-1)\times T_{b}.

1) The clock skew estimation

As discussed above, the DuncD_{unc} is inevitable in the one-way broadcast. Moreover, it is not Gaussian distribution and much larger than the DvarD_{var} (which is Gaussian variable). Thus, the observations need to be preprocessed to meet the assumption (the delay is Gaussian distribution) for φ^i(MLE)j\hat{\varphi}_{i(MLE)}^{j} in (6). The φ^i(MLE)j\hat{\varphi}_{i(MLE)}^{j} is implemented in three steps: the observation calculation in (5), outlier detector (Sort and 3σ3\sigma detector), and φ^i(MLE)j\hat{\varphi}_{i(MLE)}^{j} calculation in (6). Since the DuncD_{unc} has extremely low probability, one can assume that the possible DuncD_{unc} samples will be moved to the end of PP by the Sort. The σ^\hat{\sigma} can be calculated from the front observations, e.g., σ^[k]=\hat{\sigma}[k]=std({p[n]}n=1k1),N/2<kN(\{p[n]\}_{n=1}^{k-1}),N/2<k\leq N. Then the possible DuncD_{unc} observations will be recognized and removed from PP by outlier detector.

2) The adaptive clock offset estimation

Considering the large-scale complex WSN, the wireless channel collision probability will increase at uplinkuplink in the rapid-flooding. The rapid-flooding protocol requires the higher level nodes to forward the received time information immediately, then it will be a high probability that the adjacent nodes broadcast packets at the same moment. In other words, the low level nodes can not receive all of the uplinkuplink messages, and it will cause the θ^i(MLE)j\hat{\theta}_{i(MLE)}^{j} in (12) to be unachievable.

To solve this issue, an adaptive approach is developed based on double clock offset estimations, i.e., the joint clock skew-offset MLE, and the min function-based MLE.

Case Uplink\bm{Uplink} true: the RDC-RMTS employs the joint clock skew-offset MLE. The DownlinkDownlink of two-way message exchange model is the latest multi-broadcast process of vjv_{j}, and the UplinkUplink is the latest multi-broadcast process of viv_{i}, and τ^=Tb\hat{\tau}=T_{b}. parameter θ^i(MLE)j{\hat{\theta}_{i(MLE)}^{j}} is calculated by (12), and the D^fixed){\hat{D}_{fixed)}} is calculated by (13).

Case Uplink\bm{Uplink} false: the RDC-RMTS employs the min function-based MLE. The observations {u[n]}n=1N\{u[n]\}_{n=1}^{N} of DownlinkDownlink are used, and θ^i(MLE)j{\hat{\theta}_{i(MLE)}^{j}} is calculated by (14), D^fixed\hat{D}_{fixed} is the average of the valid value calculated by (13). The DownlinkDownlink of two-way message exchange model is the latest multi-broadcast process of vjv_{j}.

Therefore, when the UplinkUplink works, the D^fixed\hat{D}_{fixed} is calculated. The RDC-RMTS does not requires any prior experiments to set a fixed D^fixed\hat{D}_{fixed} just like RMTS, but uses a timely delay compensation. Moreover, the receiver calculates D^fixed\hat{D}_{fixed} separately for different nodes. Thus, the slight differences on delay caused by the hardware differences of nodes will be handled in RDC-RMTS, while they are directly ignored in PulseSync and RMTS.

V-B The Implementation of RDC-RMTS

In this Section, we discuss the implementation of the proposed RDC-RMTS algorithm in details. For ease of description, considering the pair of adjacent nodes in Fig. 1, the node that has the lower level is defined as father, and the higher one as son, e.g. viv_{i} is the father of vkv_{k}, and vjv_{j} is the father of viv_{i}. In addition, the sliding window length WW is set as 2.

The RDC-RMTS can use the specified node as the root (reference) in WSN applications, e.g., the sink node, or the gateway node (the interface of heterogeneous networks). The flooding time synchronization cannot maintain the network-wide synchronization without an active root. Hence the RDC-RMTS employs a simple root election protocol which is used in [FTSP, FCSA, RMTS] to find a new root when the current root is invalid.

According to the synchronization model (Fig. 1) and the implementation structure (Fig. 2) of RDC-RMTS, a root (reference) algorithm and non-root algorithm are designed for the RDC-RMTS protocol.

1) The root algorithm: The periodic synchronization is created at root, and the reference’s time information is embedded into the multi-broadcast packets and flooded in the network. Meanwhile, the root will listen for broadcast messages from neighbors and store the timestamps for the joint clock skew-offset estimation.

The pseudo-code of the root algorithm is presented in Algorithm 1, where φR\varphi_{R} is the multiplier of LR(t)L_{R}(t); parameter IDRID_{R} is an identifier of each synchronization process; buffer {bufR[m]}m=1M\{buf_{R}[m]\}_{m=1}^{M} is employed to store the corresponding timestamps when root’s neighbors forward its time information; the synchronization period is generated at root, i.e., TbT_{b}.

The φR\varphi_{R} is a constant, i.e., φR=1\varphi_{R}=1 (Line LABEL:alg1.2 in Algorithm 1). While, if an external clock LERL_{ER} (e.g., GPS ) is used , then the root can synchronize to LERL_{ER} (Algorithm 1, Lines LABEL:alg1.5 and LABEL:alg1.61), and then its logical time is LR(t+τ)=φR×(HR(t+τ)HR(t))+LER(t),τ0L_{R}(t+\tau)=\varphi_{R}\times(H_{R}(t+\tau)-H_{R}(t))+L_{ER}(t),\tau\geq 0, and change the logical clock rate by adjusting φR\varphi_{R}.

The root maintains a periodically-scheduled task to initialize the synchronization period and distribute the reference time information packets to neighbors, as Lines LABEL:alg1.9-LABEL:alg1.15 in Algorithm 1. The NN packets are sent to neighbors rapidly thus the clock offset is almost a fixed value during that interval, as Lines LABEL:alg1.9-LABEL:alg1.12 in Algorithm 1. After that, IDRID_{R} will be increased by 1 (Line LABEL:alg1.14 in Algorithm 1).

Two groups of timestamps are created and embedded to the corresponding packet over the phase of broadcasting, i.e., HR[n]H_{R}[n] (created on HR(t)H_{R}(t)) and LR[n]L_{R}[n] (created on LR(t)L_{R}(t)). The broadcast packets comprise of five parts: HR[n]H_{R}[n], LR[n]L_{R}[n], φR\varphi_{R}, IDRID_{R}, and bufRbuf_{R} (Line LABEL:alg1.11 in Algorithm 1).

Algorithm 1 The root algorithm pseudo-code for RDC-RMTS. vRv_{R} is the root, , j𝒩R,(R,j)𝒢j\in\mathcal{N}_{R},(R,j)\in\mathcal{G}. Parameter NN is the maximal number of multi-broadcast. Parameter MM is maximal numbers of neighbor.