Skip to main content

Synchronization in 5G networks: a hybrid Bayesian approach toward clock offset/skew estimation and its impact on localization

A Correction to this article was published on 02 November 2021

This article has been updated


Clock synchronization has always been a major challenge when designing wireless networks. This work focuses on tackling the time synchronization problem in 5G networks by adopting a hybrid Bayesian approach for clock offset and skew estimation. Furthermore, we provide an in-depth analysis of the impact of the proposed approach on a synchronization-sensitive service, i.e., localization. Specifically, we expose the substantial benefit of belief propagation (BP) running on factor graphs (FGs) in achieving precise network-wide synchronization. Moreover, we take advantage of Bayesian recursive filtering (BRF) to mitigate the time-stamping error in pairwise synchronization. Finally, we reveal the merit of hybrid synchronization by dividing a large-scale network into local synchronization domains and applying the most suitable synchronization algorithm (BP- or BRF-based) on each domain. The performance of the hybrid approach is then evaluated in terms of the root mean square errors (RMSEs) of the clock offset, clock skew, and the position estimation. According to the simulations, in spite of the simplifications in the hybrid approach, RMSEs of clock offset, clock skew, and position estimation remain below 10 ns, 1 ppm, and 1.5 m, respectively.

1 Introduction

The Fifth Generation (5G) of mobile networks is expected to deliver a wide range of location-based services [1]. To pave the way for those services, a myriad of precise positioning techniques have been introduced in the literature, the majority of which rely on the cooperation between the Access Points (APs) serving the Mobile Users (MUs) [2]. In particular, to estimate the location, these techniques capitalize on the time measurements carried out between the agents, i.e., MUs and APs, requiring them to have a common time base [3]. Therefore, for the cooperative approaches to function, the APs need to be accurately synchronized among each other as well as with MUs [4, 5].

Considerable effort has been made to design fast, continuous, and precise synchronization algorithms across different networks, from Wireless Sensor Networks (WSNs) to wireless communication networks [6]. Generally, state-of-the-art synchronization algorithms adopt two main macroscopic approaches: (a) designing a network-wide synchronization algorithm from scratch [7,8,9,10], and (b) employing the existing pairwise synchronization protocols in a structural manner, e.g., layer-by-layer pairwise synchronization [11,12,13].

Network-wide synchronization in WSNs has been addressed in [7, 9, 10] by employing the Belief Propagation (BP) algorithm. Typically, BP runs on a Factor Graph (FG) corresponding to the network and calculates the marginals at each node by iteratively exchanging beliefs between neighboring nodes [14]. The algorithm is advantageous in the sense that it is fully distributed and estimates the clock offset and skew with high accuracy. However, the time required to compute the pairwise conditional probability distribution functions (pdfs) needed for FG, and then conducting the iterative message passing, can be considered as a potential drawback rendering its practical applicability limited.

Pairwise synchronization is mostly conducted by exchanging time-stamps between the nodes using the Precision Time Protocol (PTP) [15]. To perform network synchronization in a layer-by-layer manner, PTP is then combined with the Best Master Clock Algorithm (BMCA), whose role is to determine the Master Node (MN) in the network. While this combination operates sufficiently robust in tree-structured networks with medium time-sensitivity (sub-\(\mu\)s range), BMCA’s poor performance in networks with mesh topology on one hand, and uncertainty in time-stamping on the other hand, render the algorithm futile in highly time-sensitive (sub-hundred ns range) loopy networks.

Despite the attempts in [11, 16] to address the time-stamping uncertainty (or error) by the virtue of Kalman filtering, this approach is not optimal in the Bayesian sense since all the information available from time-stamps is not utilized. Instead, the Bayesian Recursive Filtering (BRF) utilized in [17] can be employed to capture all the available information in time-stamps, thereby optimally rectifying the time-stamping error. We have already revealed the outstanding merit of BRF in the mitigation of time-stamping error in [18].

Although all aforementioned techniques have made invaluable contribution, none of them alone can be expected to meet the global and local time precision aimed by 5G for accurate localization [19]. Instead, a combination of these algorithms is more likely to deliver a superior performance owing to diverse network typologies (mesh, tree, or a combination thereof) [16]. In particular, to successfully achieve precise network synchronization, it is suggested by [20] that the architecture of a large-scale network should consist of common synchronization areas and multiple synchronization domains. Therefore, equipping networks with different synchronization algorithms (or a combination thereof) appears to be a balanced approach, whereby each domain can, based on its topology and capabilities, leverage the most suitable algorithm. In this manner, it is easier to satisfy the requirement of the relative time error in the synchronization domains while keeping the absolute time error low. This is particularly of interest in applications where ultra-high time accuracy is required in a specific synchronization domain, e.g., positioning services.

In [16], we have introduced and thoroughly described the idea of hybrid synchronization, whereby clock offset can be precisely estimated and correspondingly corrected. The extension to incorporate the clock skew estimation was proposed in [18]. In this paper, we expand on [16, 18] and design a hybrid synchronization algorithm based on asymmetric time-stamp exchange to allow for accurate localization [21]. The merit of asymmetric time-stamp for localization has been revealed in [3, 22, 23]. Furthermore, the fine time measurement standard introduced in [24] allows for implementation of such time-stamp exchange mechanism. Given that, in addition to analysis of clock offset and skew estimation, we examine the impact of the proposed hybrid approach on a localization algorithm based on the technique presented in [22].

The contribution of this paper can then be briefly summarized as follows:

  • We present the principles of BP-based network-wide and BRF-based pairwise synchronization based on asymmetric time-stamp exchange.

  • We develop a hybrid statistical synchronization algorithm by combining the two above-mentioned Bayesian approaches.

  • We analyze the performance of the hybrid approach when estimating the clock offset and skew as well as its impact on a localization algorithm.

The rest of this paper is structured as follows: In Sect. 2, the system model is introduced. Section 3 deals with the estimation methods for network-wide, pairwise, and hybrid synchronization. We present and discuss the simulation results in Sect. 4. Section 5 is devoted to the impact of hybrid synchronization on MU localization. Finally, Sect. 6 concludes this work and points to the future work.

1.1 Notation

The boldface capital \({\varvec{A}}\) and lower case \({\varvec{a}}\) letters denote matrices and vectors, respectively. \({\mathbf {a}}(n)\) indicates the nth element of vector \({\mathbf {a}}\). \({\varvec{A}}^T\) represents the transposed of matrix \({\varvec{A}}\). \({\varvec{I}}_N\) denotes a N dimensional identity matrix. \({\mathcal {N}}({\mathbf {x}}|\varvec{\mu }, \varvec{\Sigma })\) indicates a random vector \({\mathbf {x}}\) distributed as Gaussian with mean vector \(\varvec{\mu }\) and covariance matrix \(\varvec{\Sigma }.\) diag\((x_1, \ldots , x_K)\)

denotes a diagonal matrix with the diagonal elements given by \((x_1, \ldots , x_K).\) The symbol \(\thicksim\) stands for “is distributed as,” and the symbol \(\propto\) represents the linear scalar relationship between two functions.

2 System model

In this section, we firstly present the clock model for each node in the communication network. Then, we explain the components constructing the clock offset in details. Finally, the time-stamp exchange mechanism is described comprehensively.

2.1 Clock model

The clock behavior for each node i is modeled as [25]

$$\begin{aligned}{}&c_i(t) = \gamma _i t + \theta _i, \end{aligned}$$

where \(c_i(t)\) shows the local time at each node, t represents the reference time, \(\gamma _i\) denotes the clock skew, and \(\theta _i\) is the clock offset. We consider the parameter \(\gamma _i\) as random and varying over time. However, it is common to assume that it remains unchanged in the course of one synchronization period [9, 11]. Moreover, \(\theta _i\) consists of several components, all thoroughly discussed in the following subsection. In light of above-mentioned points, time synchronization can be deemed equivalent to estimation of \(\gamma _i\) and \(\theta _i\) (or transformations thereof) for each node. Corrections are then applied such that, ideally, all the clocks show the same time as the reference time t.

Fig. 1
figure 1

Decomposition of delay into its constituent components

2.2 Clock offset decomposition

We decompose the clock offset \(\theta _i\) as shown in Fig. 1, thereby elaborating on its constituent components. The parameter \(t_i\)/\(t_j\) is the time it takes for a packet to leave the transmitter after being time-stamped (the term “time-stamp” is refered to hardware time-stamping hereafter), \(d_{ij}\)/\(d_{ji}\) denote the propagation delay, and \(r_i\)/\(r_j\) represents the time that a packet needs to reach the time-stamping point upon arrival at the receiver. Generally,

$$\begin{aligned} t_i + d_{ij} + r_j \ne t_j + d_{ji} + r_i, \end{aligned}$$

meaning that the packets sent from node i to node j do not experience the same delay as the packets sent from node j to node i. In particular \(T_{ij} = t_i + r_j,\) and \(R_{ij} = t_j + r_i\) are random variables due to multiple hardware-related random independent processes and can, therefore, be assumed i.i.d. Gaussian random variables distributed as \({\mathcal {N}}(\mu _T, \sigma ^2_T)\) and \({\mathcal {N}}(\mu _R, \sigma ^{2}_{R}),\), respectively [7, 9, 10]. Conversely, \(d_{ij}\) and \(d_{ji}\) are usually assumed to be deterministic and symmetric (\(d_{ij} = d_{ji}\)) [7]. Figure 2 depicts the histogram of the clock offset and its Gaussian fit for 5000 packet exchange between two Commercial Off-The-Shelf (COTS) street nodes.Footnote 1 In particular, the variance of offset turns out to be around 9 ns, what is crucial to know if we are to reduce the error in the clock offset/skew estimation.

Fig. 2
figure 2

Histogram of measured offset and its Gaussian fit for 5000 packet exchange

2.3 Time-stamp exchange mechanism

We employ the asymmetric time-stamping mechanism introduced in [21] and shown in Fig. 3. It functions as follows: node j transmits a sync message wherein the local time \(c_j(t_1^k)\) is incorporated. Node i receives the packet and records the local reception time \(c_i(t_2^k)\). After a certain time, the process repeats again with \(c_j(t_3^k)\) and \(c_i(t_4^k).\) Subsequently, at local time \(c_i(t_5^k)\), node i sends back a sync message to node j with \(c_i(t_2^k),\) \(c_i(t_4^k)\) and \(c_i(t_5^k)\) incorporated. Upon reception, node j records the local time \(c_j(t_6^k).\) Given that, the relation between local clocks can be written as:

Fig. 3
figure 3

Asymmetric time-stamp exchange between node i and node j

$$\frac{1}{\gamma _i}(c_i(t_{2}^k) - \theta _i)= \frac{1}{\gamma _j} (c_j(t_1^k) - \theta _j) + d_{ij} + T_{ij}^{k, 0} ,$$
$$\frac{1}{\gamma _i}(c_i(t_{4}^k) - \theta _i)= \frac{1}{\gamma _j} (c_j(t_3^k) - \theta _j) + d_{ij} + T_{ij}^{k, 1} ,$$
$$\frac{1}{\gamma _i}(c_i(t_{5}^k) - \theta _i)= \frac{1}{\gamma _j} (c_j(t_6^k) - \theta _j) - d_{ij} - R_{ij}^{k}\ ,$$

where \((t_1^k,\) \(t_3^k)\)/\(t_6^k\) and \(t_5^k\)/\((t_2^k,\) \(t_4^k)\) are the time points where neighboring nodes j and i send/receive the sync messages, respectively. Stacking the weighted sum of (2), (3) and (4) for K rounds of time-stamp exchange gives

$$\begin{aligned} {\mathbf {W}}_{ji}\varvec{\xi }_{i} + {\mathbf {W}}_{ij}\varvec{\xi }_{j} = {\mathbf {z}}_{ij}, \end{aligned}$$

where \({\mathbf {W}}_{ji}\) and \({\mathbf {W}}_{ij}\) are \(K\times 2\) matrices with the kth row being

$$\begin{aligned} \left[ \frac{1}{2}\left( c_i(t_{2}^k)+c_i(t_{4}^k)\right) +c_i(t_{3}^k), -2\right] , \end{aligned}$$


$$\begin{aligned} -\left[ \frac{1}{2}\left( c_i(t_{3}^k)+c_i(t_{4}^k)\right) + c_j(t_{4}^k), -2\right] , \end{aligned}$$

, respectively. Moreover, we introduce the vector variables \(\varvec{\xi }_{i}\triangleq \left[ \frac{1}{\gamma _i}, \frac{\theta _i}{\gamma _i}\right] ^T,\) and \(\varvec{\xi }_{j}\triangleq \left[ \frac{1}{\gamma _j}, \frac{\theta _j}{\gamma _j}\right] ^T\) with \(\frac{1}{\gamma _i},\) \(\frac{\theta _i}{\gamma _i},\) \(\frac{1}{\gamma _j},\) and \(\frac{\theta _j}{\gamma _j}\) being Gaussian distributed [3, 10]. Finally, \({\mathbf {z}}_{ij}\sim {\mathcal {N}}({\mathbf {z}}|{\mathbf {0}}, \sigma _{ij}^2{\mathbf {I}}_K),\) where \(\sigma _{ij}^2 = \frac{\sigma _{T_{ij}}^2}{2} + \sigma _{R_{ij}}^2.\) In concrete terms, what (5) implicitly states is that for given \(\varvec{\xi }_{i}\) and \(\varvec{\xi }_{j},\) the probability that we measure \({\mathbf {W}}_{ji}\) and \({\mathbf {W}}_{ij}\) is equal to \({\mathcal {N}}({\mathbf {z}}={\mathbf {W}}_{ji}\varvec{\xi }_{i} + {\mathbf {W}}_{ij}\varvec{\xi }_{j}|{\mathbf {0}}, \sigma _{ij}^2{\mathbf {I}}_N).\) This can be expressed as

$$\begin{aligned} p({\mathbf {W}}_{ji}, {\mathbf {W}}_{ij}|\varvec{\xi }_{i}, \varvec{\xi }_{j}) \sim {\mathcal {N}}({\mathbf {z}}={\mathbf {W}}_{ji}\varvec{\xi }_{i} + {\mathbf {W}}_{ij}\varvec{\xi }_{j}|{\mathbf {0}}, \sigma _{ij}^2{\mathbf {I}}_N). \end{aligned}$$

3 Methods of clock offset and skew estimation

In this section, first the principles of BP-based network-wide synchronization are described. Subsequently, we introduce the BRF-based pairwise synchronization. Lastly, we present an approach, where both techniques are employed in a hybrid manner.

3.1 Network-wide offset and skew estimation

In network-wide synchronization, we aim to synchronize each node with a global MN. Alternatively, we can restate the problem as estimation of parameters \(\gamma _i\) and \(\theta _i\) (or vector parameter \(\varvec{\xi }_{i}\)), based on the observation matrices \({\mathbf {W}}_{ji}\) and \({\mathbf {W}}_{ij}\). Mathematically, this is translated to the following marginal calculation:

$$\begin{aligned}{}&p(\varvec{\xi }_{i}|\{{\mathbf {W}}_{ji},{\mathbf {W}}_{ij}\}_{i=1:M, j\in {\mathcal {I}}_i}) \nonumber \\&\quad =\int \cdots \int p(\varvec{\xi }_{1}, \ldots , \varvec{\xi }_{M}|\{{\mathbf {W}}_{ji},{\mathbf {W}}_{ij}\}_{i=1:M, j\in {\mathcal {I}}_i})\nonumber \\&\qquad d\varvec{\xi }_{1}\cdots d\varvec{\xi }_{i-1}d\varvec{\xi }_{i+1}\cdots d\varvec{\xi }_{M}, \end{aligned}$$

where \({\mathcal {I}}_i\) denotes the set of neighboring nodes of node i and M is total number of the nodes in the network. Consequently, \(\varvec{\xi }_{i}\) can be estimated as

$$\begin{aligned} \hat{\varvec{\xi }}_i = \mathop {\hbox {arg\,max}}\limits _{\varvec{\xi }_{i}}p(\varvec{\xi }_{i}|\{{\mathbf {W}}_{ji},{\mathbf {W}}_{ij}\}_{i=1:M, j\in {\mathcal {I}}_i}). \end{aligned}$$

Unfortunately, the computation cost and complexity of the marginal pdf in (7) are extremely high. Instead, as a compromise, one can resort to approximating the integrand of (7). This is carried out in the sequel with the aid of variational methods.

3.1.1 Variational methods

The basic idea underpinning variational methods is to approximate an intractable complex distribution \(p({\mathbf {x}})\) by a straightforward tractable distribution \(q({\mathbf {x}})\). To this end, one can minimize the discrepancy measure Kullback–Leibler (KL) divergence between \(p({\mathbf {x}})\) and \(q({\mathbf {x}})\), given by [14]

$$\begin{aligned} D_{KL}(p\Vert q) = \int _{-\infty }^{+\infty }p({\mathbf {x}})\log \left( \frac{p({\mathbf {x}})}{q({\mathbf {x}})}\right) \mathrm{d}{\mathbf {x}}. \end{aligned}$$

The minimization is then achieved by drawing on the Bethe method, which imposes the following structure on \(q({\mathbf {x}})\) [26]:

$$\begin{aligned} q({\mathbf {x}}) \propto \prod _i q(x_i) \prod _{i,j} q(x_i,x_j), \end{aligned}$$

where \(x_j\) and \(x_i\) are neighboring nodes. The structure in (10) can be appropriately represented by FG. Furthermore, to efficiently infer the marginal beliefs, BP is typically run on the FG [14]. Therefore, in the sequel, we briefly describe FG and BP.

3.1.2 Factor graph

An FG is a bipartite graph that depicts a pdf with the factorized form, e.g., that of (10). In particular, an FG comprises several nodes known as variable nodes, and a number of factor nodes, each being a function of its neighboring variable nodes (Fig. 4).

We construct the graphical model in Fig. 4, where a number of APs are backhauled by a mesh network, each represented by \(\varvec{\xi }_{i}\). The main objective is then to compute the marginal illustrated in (7). Adopting the approximation outlined in Sect. 3.1.1, the conditional probability under the integral of (7) turns into

$$\begin{aligned}{}&p(\varvec{\xi }_{1}, \ldots , \varvec{\xi }_{M}|\{{\mathbf {W}}_{ji},{\mathbf {W}}_{ij}\}_{i=1:M, j\in \ ne(i)})\propto \nonumber \\&\quad \prod p(\varvec{\xi }_{i}) \prod p({\mathbf {W}}_{ij},{\mathbf {W}}_{ji}|\varvec{\xi }_{i}, \varvec{\xi }_{j}), \end{aligned}$$

where \(p(\varvec{\xi }_{i})\) indicates the Gaussian distributed prior knowledge on \(\varvec{\xi }_{i}\) and \(p({\mathbf {W}}_{ji},{\mathbf {W}}_{ij}|\varvec{\xi }_{i}, \varvec{\xi }_{j})\) is the pairwise conditional probability computed from (6). In the sequel, we briefly describe the principles of BP as an efficient algorithm to obtain the estimation in (8).

Fig. 4
figure 4

The FG corresponding to an exemplifying network. Note that, the FG is drawn only for the backhaul network to avoid unnecessary complexity. To draw the FG of the whole network, one can simply consider APs as variable nodes connected to their corresponding backhaul nodes via factor nodes

Fig. 5
figure 5

Message passing principles in BP

Fig. 6
figure 6

\(\lambda _{i\rightarrow j} = \lambda _{p_{ij}\rightarrow {\varvec{\xi }}_{j}}\) and \(\lambda _{j\rightarrow i} = \lambda _{p_{ij}\rightarrow {\varvec{\xi}}_{i}}\) are the BP messages exchanged between physical nodes in practice

3.1.3 Belief propagation

BP is a technique which relies primarily on the exchange of beliefs between neighboring nodes to infer the marginals. This inference is proved to be exact when the graphs are singly connected and approximate if they contain loops [14]. While generally there is no guarantee that the algorithm converges in the loopy graphs, [9, 10] have indicated that, if there exist at least one MN in the network, the convergence of BP is certain. Figure 5 depicts the principles of the message passing in BP for the nodes \(\varvec{\xi }_{i}\) and \(\varvec{\xi }_{j}\). For the sake of simplicity, we denote the factor \(p({\mathbf {W}}_{ji}, {\mathbf {W}}_{ij}|\varvec{\xi }_{i}, \varvec{\xi }_{j})\) with \(p_{ij}\). The message from a factor vertex \(p_{ij}\) to a variable vertex \(\varvec{\xi }_{i}\) in iteration l is then given by [14]

$$\begin{aligned}{}&\lambda _{p_{ij}\rightarrow \varvec{\xi }_{i}}^{(l)}(\varvec{\xi }_{i}) \nonumber \\&\quad =\int \ p({\mathbf {W}}_{ji}, {\mathbf {W}}_{ij}|\varvec{\xi }_{i}, \varvec{\xi }_{j}) \lambda _{\varvec{\xi }_{j}\rightarrow p_{ij}}^{(l)}(\varvec{\xi }_{j})\mathrm{d}\varvec{\xi }_{j}, \end{aligned}$$

where \(\lambda _{\varvec{\xi }_{j}\rightarrow p_{ij}}^{(l)}(\varvec{\xi }_{j})\) denotes the message from a variable node \(\varvec{\xi }_{j}\) to the variable vertex \(p_{ij}\) and is given by

$$\begin{aligned} \lambda _{\varvec{\xi }_{j}\rightarrow p_{ij}}^{(l)}(\varvec{\xi }_{j}) = p(\varvec{\xi }_{j})\prod _{k\in \{{\mathcal {I}}(j)\setminus i\}} \lambda _{p_{kj}\rightarrow \varvec{\xi }_{j}}^{(l-1)}(\varvec{\xi }_{j}). \end{aligned}$$


$$\begin{aligned} b^{(l)}(\varvec{\xi }_{i}) \propto p(\varvec{\xi }_{i}) \prod _{k\in {\mathcal {I}}i} \lambda _{p_{ik}\rightarrow \varvec{\xi }_{i}}^{(l)}(\varvec{\xi }_{i}), \end{aligned}$$

where \(b^{(l)}(\varvec{\xi }_{i})\) denotes the marginal belief of variable node \(\varvec{\xi }_{i}\) in the lth iteration. It is expected that the result of the integral in (12) is Gaussian distributed as its arguments are also Gaussian distributed. We note that, in practice, both (12) and (13) are locally computed at each node and only \(\lambda _{p_{ij}\rightarrow \varvec{\xi }_{i}}^{(l)}(\varvec{\xi }_{i})\) is transmitted from node j to node i as shown in Fig. 6.

Let \(\lambda _{j\rightarrow i}^{(l)}(\varvec{\xi }_{i}) \thicksim {\mathcal {N}}(\varvec{\xi }_{i}|\varvec{\mu }_{j\rightarrow i}^{(l)}, {\varvec{Q}}_{j\rightarrow i}^{(l)})\) denote the message sent from j to i. Considering (12) and (13), the covariance matrix \({\varvec{Q}}_{j\rightarrow i}^{(l)}\) can be calculated by [10, 18, 27]

$$\begin{aligned} {\varvec{Q}}_{j\rightarrow i}^{(l)} = \left[ {\mathbf {W}}_{ji}^T \left( \varvec{\Omega }_{j\rightarrow i}^{(l-1)}\right) ^{-1}{\mathbf {W}}_{ji}\right] ^{-1}, \end{aligned}$$


$$\begin{aligned}{}&\varvec{\Omega }_{j\rightarrow i}^{(l-1)} \nonumber \\&\quad =\sigma _{ij}^2{\mathbf {I}}_{N} + {\mathbf {W}}_{ij}{\left[ {\varvec{Q}}_{j}^{-1} + \sum _{k\in ne(j)\setminus i}\left( {\varvec{Q}}_{k\rightarrow j}^{(l-1)}\right) ^{-1}\right] ^{-1}}{\mathbf {W}}_{ij}^T, \end{aligned}$$

and \({\varvec{Q}}_{j}^{}\) is the covariance matrix of \(p(\varvec{\xi }_{j})\). Furthermore,

$$\begin{aligned} \varvec{\mu }_{j\rightarrow i}^{(l)} &= - {\varvec{Q}}_{j\rightarrow i}^{(l)}{\mathbf {W}}_{ji}^T\varvec{\Omega }_{j\rightarrow i}^{(l-1)}{\mathbf {W}}_{ij}\nonumber \\&\times \left[ {\varvec{Q}}_{j}^{-1} + \sum _{k\in ne(j)\setminus i}\left( {\varvec{Q}}_{k\rightarrow j}^{(l-1)}\right) ^{-1}\right] ^{-1} \nonumber \\&\times \left[ {\varvec{Q}}_{j}^{-1}\varvec{\mu }_j + \sum _{k\in ne(j)\setminus i}\left( {\varvec{Q}}_{k\rightarrow j}^{(l-1)}\right) ^{-1}\varvec{\mu }_{k\rightarrow j}^{(l-1)}\right] , \end{aligned}$$

where \(\varvec{\mu }_j\) represents the mean vector of \(p(\varvec{\xi }_{j}).\) It should be noted that \({\varvec{Q}}_{j}^{}\) and \(\varvec{\mu }_j\) remain unchanged during the message updating process.

The BP algorithm initializes the message from node j to node i as \(\lambda _{j\rightarrow i}^{(0)}(\varvec{\xi }_{i}) \thicksim {\mathcal {N}}(\varvec{\xi }_{i}|{\mathbf {0}}, +\infty {\mathbf {I}}_{2})\). Node j computes its outgoing message to node i according to (15) and (17) in iteration l with its available \({\varvec{Q}}_{k\rightarrow j}^{(l-1)}\) and \(\varvec{\mu }_{k\rightarrow j}^{(l-1)}\) (\(k\in ne(j)\setminus i\)). The belief of node i is then computed as

$$\begin{aligned} b^{(l)}(\varvec{\xi }_{i}) \thicksim {\mathcal {N}}(\varvec{\xi }_{i}|\varvec{\eta }_{i}^{(l)}, \varvec{\Gamma }_{i}^{(l)}), \end{aligned}$$


$$\begin{aligned} \varvec{\Gamma }_{i}^{(l)} = \left[ {\varvec{Q}}_{i}^{-1} + \sum _{j\in ne(i)}\left( {\varvec{Q}}_{j\rightarrow i}^{(l-1)}\right) ^{-1}\right] ^{-1}, \end{aligned}$$


$$\begin{aligned} \varvec{\eta }_{i}^{(l)} = \varvec{\Gamma }_{i}^{(l)}\left[ {\varvec{Q}}_{i}^{-1}\varvec{\mu }_i + \sum _{j\in ne(i)}\left( {\varvec{Q}}_{j\rightarrow i}^{(l-1)}\right) ^{-1}\varvec{\mu }_{j\rightarrow i}^{(l-1)}\right] . \end{aligned}$$

Finally, the clock skew and offset estimation can be computed by

$$\begin{aligned} {\hat{\gamma }}_i^{(l)} = \frac{1}{\varvec{\eta }_{i}^{(l)}(1)},&\ {\hat{\theta }}_i^{(l)} = \frac{\varvec{\eta }_{i}^{(l)}(2)}{\varvec{\eta }_{i}^{(l)}(1)}. \end{aligned}$$

3.2 Pairwise offset and skew estimation

In pairwise synchronization, one node is assumed to be the MN. In particular, in Fig. 3, instead of a global reference \(c(t)=t,\) we take node j as MN. We can then introduce the transformations

$$\begin{aligned}{}&\frac{1}{{\tilde{\gamma }}_i} = \frac{\gamma _j}{\gamma _i}, \end{aligned}$$
$$\begin{aligned}{}&{\tilde{\theta }}_i = \theta _i-{\tilde{\gamma }}_i\theta _j, \end{aligned}$$
$$\begin{aligned}{}&{\tilde{d}}_{ij} + {\tilde{T}}_{ij}^{k} = \gamma _j(d_{ij} + T_{ij}^{k}), \end{aligned}$$
$$\begin{aligned}{}&{\tilde{d}}_{ij} - {\tilde{R}}_{ij}^{k} = \gamma _j(d_{ij} - R_{ij}^{k}). \end{aligned}$$

For the sake of simplicity, as done in [28], we assume \({\tilde{d}}_{ij}=d_{ij},\) \({\tilde{R}}_{ij}^{k} = R_{ij}^{k},\) and \({\tilde{T}}_{ij}^{k}=T_{ij}^{k}.\) This is valid owing to \(\gamma _j\approx 1\) and the value of \(d_{ij} + T_{ij}^{k}\) and \(d_{ij} - R_{ij}^{k}\) being low. Finally, (2), (3) and (4) turn into

$$\begin{aligned} \frac{1}{{\tilde{\gamma }}_i}(c_i(t_{2}^k) - {\tilde{\theta }}_i)&= c_j(t_1^k) + d_{ij} + T_{ij}^{k, 0} , \end{aligned}$$
$$\begin{aligned} \frac{1}{{\tilde{\gamma }}_i}(c_i(t_{4}^k) - {\tilde{\theta }}_i)&= c_j(t_3^k) + d_{ij} + T_{ij}^{k, 1} , \end{aligned}$$
$$\begin{aligned} \frac{1}{{\tilde{\gamma }}_i}(c_i(t_{5}^k) - {\tilde{\theta }}_i)&= c_j(t_6^k) - d_{ij} - R_{ij}^{k}. \end{aligned}$$

By the end of the kth round of time-stamp exchange, each node is expected to have collected the time-stamps \({\mathbf {C}}_{ij}= \begin{bmatrix} {\mathbf {c}}_{ij}^1, \ldots , {\mathbf {c}}_{ij}^k \end{bmatrix}^{T},\) where

$$\begin{aligned} {\mathbf {c}}_{ij}^k = \left[ c_j(t_1^k), c_i(t_2^k), c_j(t_3^k), c_i(t_4^k), c_i(t_5^k), c_j(t_6^k)\right] . \end{aligned}$$
Fig. 7
figure 7

Bayesian representation of offset and skew estimation

Let \(\tilde{\varvec{\xi }}_i^{k}\) be the state of the vector variable \(\tilde{\varvec{\xi }}_{i} \triangleq \left[ \frac{1}{{\tilde{\gamma }}_i}, \frac{{\tilde{\theta }}_i}{{\tilde{\gamma }}_i}\right] ^T\) after kth round of time-stamp exchange (visualized in Fig. 7). Similar to (7) the pdf corresponding to the kth state can be written as

$$\begin{aligned} p(\tilde{\varvec{\xi }}_i^{k}|{\mathbf {C}}_{ij}) = \int p(\tilde{\varvec{\xi }}_i^{0},\ldots , \tilde{\varvec{\xi }}_i^{k}|{\mathbf {C}}_{ij})\ d\Theta ^{k-1}, \end{aligned}$$

where \(\Theta ^{k-1} = \left[ \tilde{\varvec{\xi }}_i^{0},\ldots ,\tilde{\varvec{\xi }}_i^{k-1}\right]\). Following the steps explained in “Appendix”, (29) can be simplified to

$$\begin{aligned} p(\tilde{\varvec{\xi }}_i^{k}|{\mathbf {C}}_{ij}) \propto p(\tilde{\varvec{\xi }}_{i}^{k}|{\mathbf {c}}_{ij}^{1:k-1})p({\mathbf {c}}_{ij}^{k}|\tilde{\varvec{\xi }}_{i}^{k}) \sim {\mathcal {N}}(\varvec{\mu }_i^k, {\mathbf {Q}}_i^k). \end{aligned}$$

The term \(p(\tilde{\varvec{\xi }}_{i}^{k}|{\mathbf {c}}_{ij}^{1:k-1})\) is known as prediction step, while the term \(p({\mathbf {c}}_{ij}^{k}|\tilde{\varvec{\xi }}_{i}^{k})\) is referred to as measurement update or correction step [29]. Considering the clock properties discussed in Sect. 2.1, it is typical in wireless networks to assume that \(\tilde{\varvec{\xi }}_{i}^k\) is Gaussian distributed [3, 9, 28]. Given this assumption, in the sequel, we show that the relation between the states is linear, implying that the marginal in (30) is also Gaussian distributed.

3.2.1 Prediction

Assuming constant skew in one synchronization period (\(=\) K rounds of time-stamp exchange), a reasonable prediction for \(\tilde{\varvec{\xi }}_{i}^k\) is given by [11]

$$\begin{aligned} \tilde{\varvec{\xi }}_{i}^k = {\mathbf {A}}\tilde{\varvec{\xi }}_{i}^{k-1} +{\mathbf {n}}^{k-1}_i, \end{aligned}$$

where \({\mathbf {A}}=\begin{bmatrix} 1 &{} 0 \\ c_j(t_{1}^{k})-c_j(t_{1}^{k-1}) &{} 1 \end{bmatrix},\) and \({\mathbf {n}}^{k-1}_i\) denotes the Gaussian noise vector. Given (31), the prediction term can be written as

$$\begin{aligned} p(\tilde{\varvec{\xi }}_{i}^{k}|{\mathbf {c}}_{ij}^{1:k-1}) \sim {\mathcal {N}}(\tilde{\varvec{\xi }}_{i}^k | \varvec{\mu }_{\text {p}}, \varvec{\Sigma }_{\text {p}}), \end{aligned}$$

where \(\varvec{\mu }_{\text {p}}= {\mathbf {A}}\varvec{\mu }_i^{k-1}\) and \(\varvec{\Sigma }_{\text {p}}= {\mathbf {A}}\varvec{\Sigma }^{k-1}_i{\mathbf {A}}^T + {\mathbf {Q}}_n\) where \({\mathbf {Q}}_n\) denotes the noise covariance matrix.

3.2.2 Correction

To obtain the correction term in (30), we conduct the following mathematical manipulations. Subtracting (26) from (27) leads to

$$\begin{aligned}{}&\frac{1}{{\tilde{\gamma }}_i}(c_i(t_{4}^{k}) - c_i(t_{2}^{k})) \nonumber \\&\quad = c_j(t_3^{k}) - c_j(t_1^{k}) + T_{ij}^{k, 1}-T_{ij}^{k, 0}, \end{aligned}$$

while weighted sum of (26)–(28) gives

$$\begin{aligned}{}&\frac{1}{{\tilde{\gamma }}_i}(\frac{c_i(t_{2}^k)+c_i(t_{4}^k)}{2} + c_i(t_{5}^k)-2{\tilde{\theta }}_i) \nonumber \\&\quad =\frac{c_j(t_1^k)+c_j(t_{3}^k)}{2} + c_j(t_6^k) + \frac{T_{ij}^{k, 0}+T_{ij}^{k, 1}}{2}-R_{ij}^{k}, \end{aligned}$$

where, given the assumptions in Sect. 2.2, \(\frac{T_{ij}^{k, 0}+T_{ij}^{k, 1}}{2}-R_{ij}^{k}\) and \(T_{ij}^{k}-T_{ij}^{k-1}\) are zero mean and have the variances \(\frac{\sigma ^2_{T_{ij}}}{2} + \sigma ^2_{R_{ij}}\) and \(2\sigma ^2_{T_{ij}},\), respectively. This is straightforward to observe since they are linear subtraction of independent random processes. Alternatively, we can write (33) and (34) in matrix form as

$$\begin{aligned} {\mathbf {B}}_{ij}\varvec{\xi }_{i} = {\mathbf {r}}_{ij} + {\mathbf {z}}_{ij}, \end{aligned}$$

where \({\mathbf {z}}_{ij}\sim {\mathcal {N}}({\mathbf {z}}|{\mathbf {0}},{\mathbf {R}}_{ij})\) with

$$\begin{aligned}{}&{\mathbf {R}}_{ij} = \text {diag}\left( [ 2\sigma ^2_{T_{ij}},\frac{\sigma ^2_{T_{ij}}}{2} + \sigma ^2_{R_{ij}}]\right) , \\&{\mathbf {B}}_{ij} = \begin{bmatrix} c_i(t_{4}^{k}) - c_i(t_{2}^{k}) &{} 0 \\ \frac{c_i(t_{2}^k)+c_i(t_{4}^k)}{2} + c_i(t_{5}^k) &{} -2 \end{bmatrix}, \end{aligned}$$

and \({\mathbf {r}}_{ij} = \left[ c_j(t_3^{k}) - c_j(t_1^{k}), \frac{c_j(t_1^k)+c_j(t_{3}^k)}{2} + c_j(t_6^k) \right] ^T.\)


$$\begin{aligned} p({\mathbf {c}}_{ij}^{k}|\varvec{\xi }_{i}^{k}) \sim {\mathcal {N}}(\tilde{\varvec{\xi }}_{i}^{k}|\varvec{\mu }_{\text {c}}, \varvec{\Sigma }_{\text {c}}), \end{aligned}$$

where \(\varvec{\mu }_{\text {c}}= {\mathbf {B}}_{ij}^{-1}{\mathbf {r}}_{ij}\) and \(\varvec{\Sigma }_{\text {c}}= {\mathbf {B}}_{ij}^{-1}{\mathbf {R}}_{ij}{\mathbf {B}}_{ij}^{-T}\).

3.2.3 Estimation

Considering (32) and (36), the estimated distribution in (30) is given by

$$\begin{aligned} p(\tilde{\varvec{\xi }}_{i}^{k}|{\mathbf {C}}_{ij})\sim {\mathcal {N}}(\tilde{\varvec{\xi }}_{i}^{k}|\varvec{\mu }_{\text {e}}, \varvec{\Sigma }_{\text {e}}), \end{aligned}$$


$$\begin{aligned}{}&\varvec{\mu }_{\text {e}}= \left[ \varvec{\Sigma }_{\text {p}}+ \varvec{\Sigma }_{\text {c}}\right] ^{-1}\left( \varvec{\Sigma }_{\text {c}}\varvec{\mu }_{\text {p}}+ \varvec{\Sigma }_{\text {p}}\varvec{\mu }_{\text {c}}\right) , \end{aligned}$$
$$\begin{aligned}{}&\varvec{\Sigma }_{\text {e}}= \left[ \varvec{\Sigma }_{\text {p}}^{-1} + \varvec{\Sigma }_{\text {c}}^{-1}\right] ^{-1}. \end{aligned}$$

The parameters in (32), (36), and (37) are calculated recursively and, in each iteration k,  the estimation of the clock skew and offset can be obtained by

$$\begin{aligned} {\tilde{\gamma }}_i^k = \frac{1}{\varvec{\mu }_{\text {e}}(1)}\ \text {and}\ {\tilde{\theta }}_i^k = \frac{\varvec{\mu }_{\text {e}}(2)}{\varvec{\mu }_{\text {e}}(1)}. \end{aligned}$$

Figure 8 summarizes this recursive process.

Fig. 8
figure 8

A summary of the BRF-based pairwise synchronization and joint sync&loc. The satellite information is used to initialize the joint sync&loc algorithm described in Sect. 5

3.3 Hybrid synchronization

Given Sects. 3.1 and 3.2, to ensure a low end-to-end synchronization error at the global level, BP can be run over the backhaul network. At the same time, we can employ the BRF algorithm to perform synchronization between the backhaul nodes and the APs at the edge of the network where fast and frequent synchronization is required to keep the relative time error small. This is, in particular, crucial to a number of applications such as localization as will be discussed in Sect. 5.

figure a

The steps of the hybrid synchronization are described in algorithm 1. Firstly, step 1 determines the network sections suitable for BP and BRF (they are labeled as BP-nodes and BRF-nodes, respectively). Then, step 2 initiates the time-stamp exchange mechanism (Fig. 3) and, correspondingly, the BRF algorithm at BRF-nodes. Step 3 triggers the time-stamp exchange among the BP-nodes, thereby collecting the required time-stamps to construct the matrices \({\mathbf {W}}_{ji}\) and \({\mathbf {W}}_{ij}\). Step 4 is where the BP iterations commence and continue until it converges, or the maximum number of iterations L is achieved. In step 5, the outgoing messages are computed by each BP-node using (15) and (17). They are then sent to their corresponding nodes. Step 6 updates each node’s belief. Lastly, in steps 7-10, we check for the convergence by comparing the difference between clock offset and skew estimation in iterations (l) and \((l-1)\) with a predefined small value \(\epsilon\). If the algorithm is converged, the clock offset and skew estimation are calculated by means of (18) and (21), respectively. Note that step 2 and steps 3-11 can run simultaneously.

Table 1 Simulation parameters
Fig. 9
figure 9

BP applied on the whole network

Fig. 10
figure 10

BP and BRF applied to the network in a hybrid manner

Fig. 11
figure 11

Impact of number of time-stamp exchanges K

3.3.1 Convergence analysis

Convergence of hybrid synchronization algorithm depends on the behavior of BRF, and BP. In particular, at the edge of the network where we aim to locally synchronize the APs using BRF the convergence is of no meaning. Nevertheless, as a measure to evaluate the estimator’s performance, given the set of linear equations presented in Sect. 3.2, we can refer to BRF with Gaussian parameters as minimum variance unbiased estimator [30]. Given that, convergence of Algorithm 1 depends solely on the convergence of BP which is of crucial importance for global synchronization.

While it is known that BP converges to the exact marginal on loop-free FGs, its convergence on loopy FGs is highly conditional. In the context of clock synchronization, detailed convergence analysis of loopy BP has been conducted in [7, 9, 10, 31]. For the set of message passing formulas presented in this paper, we can leverage on [10, Lemma 1] and [10, Lemma 2] to prove that the mean vector \(\varvec{\eta }_{i}^{(l)}\) in (20) and the covariance matrix \(\varvec{\Gamma }_{i}^{(l)}\) in (19) of the belief \(b^{(l)}(\varvec{\xi }_{i})\) in (18) converge to constant vector/matrix regardless of the network topology [10, Theorem 1], [10, Theorem 2]. The crucial point of this proof is that, regardless of the network topology, the belief parameters (mean vector and covariance matrix) converge as long as there is an informative prior, i.e., there exist at least one MN in the network.

4 Simulation results and discussion

In this section, we evaluate the performance of the hybrid synchronization algorithm proposed in this work. Detailed analysis of its impact on the achievable performance of the joint sync&loc algorithm at the edge of the network is left to the next section.

4.1 Network synchronization

Figure 4 exemplifies a wireless network where the algorithm proposed in this work can be applied. It comprises a number of APs, all backhauled by a wireless mesh network and delivering services to MUs. The following scenarios are simulated: a) synchronizing the whole network using only BP (the APs in Fig. 4 are assumed to be variable nodes connected to the mesh network via factor nodes), b) performing hybrid synchronization as described in Algorithm 1, where we synchronize the mesh backhaul network by means of BP and the APs at the edge of the network using BRF, and c) carrying out synchronization across the rounds of time-stamp exchange K. Scenario (a) is considered as the baseline for comparison with the hybrid approach. Furthermore, we compute the Root Mean Square Error (RMSE) of clock offset and skew estimation as a measure to evaluate the performance. For the sake of simplicity and without loss of generality, in (a), (b), and (c) we consider only the nodes \(\varvec{\xi }_{8}\) and \(\varvec{\xi }_{9}\) and their corresponding APs. Further simulation parameters can be found in Table 1.

Figure 9 shows the RMSEs of the clock offset and skew estimation versus the number of message passing iterations for scenario (a). The RMSEs of offset and skew are indicated in nanosecond (ns) and parts per million (ppm), respectively. As can be observed, BP converges after four iterations and achieves an offset and skew RMSE below 7 ns and 0.2 ppm, respectively. As shown in [7, 14], when there exist at least one MN in the network, the convergence is guaranteed. However, the value to which BP converges in loopy networks is deemed to be approximate. Note that, although this simulation setup reveals the potential performance of BP, the nodes, and particularly the APs, must wait at least four message passing iterations in addition to K rounds of time-stamp exchange (required for obtaining the conditional probabilities) to be fully synchronized. This is particularly unfavorable in certain synchronization-based services such as localization, where continuous time alignment is essential for accurate estimation of the MUs’ positions. Therefore, it is necessary that the APs synchronize themselves to the backhaul network more frequently to be able to deliver those services at an increased performance as required in 5G networks.

Figure 10 depicts the RMSEs of the clock offset and skew estimation versus the number of message passing and BRF iterations for scenario (b). We can observe a slight deterioration in performance (RMSE increases by 2–3 ns for the offset and 0.5–0.6 ppm for the skew) compared to scenario (a). In fact, this is the cost of economizing on the number of BP iterations as well as rounds of time-stamp exchange. To clarify, BP commences only when the nodes have already conducted K rounds of time-stamp exchange (to construct \({\mathbf {W}}_{ij}\) and \({\mathbf {W}}_{ji}\)). Even then, it takes four iterations, or n if there are n nodes between an AP and the MN, to estimate the clock parameters and correspondingly perform synchronization. Conversely, BRF is faster, as it is directly applied after each round of time-stamp exchange and runs independently (does not need any information from the other network sections as BP does). Therefore, it can conduct more iterations, thereby continuously fulfilling the requirement of very low relative time error on a local level. Given the above-mentioned properties for BP and BRF, the hybrid approach sacrifices a fraction of global accuracy to rapidly achieve synchronization at a local level, which is crucial to a number of applications such as MU localization.

Figure 11 presents the RMSEs of the clock offset and skew estimation versus the rounds of time-stamp exchange K. As can be observed, the RMSEs of both offset and skew estimation decrease as K grows, indicating that the higher number of time-stamp exchanges leads to a more accurate estimation. The gradient is, however, slightly smaller for the APs owing to the fact that their RMSEs comprises two components, i.e., the synchronization error of the backhaul mesh network and the error arising when synchronizing APs with their corresponding backhaul nodes. Although the former decreases as K grows, the latter remains constant resulting in a slower decline of RMSEs of clock offset and skew estimation at the APs.

We note that the network in Fig. 9 is only a random example picked to lucidly convey the fundamental concepts of hybrid synchronization introduced in this work. The intuitions obtained from above simulations are still valid even if we replace the network by any other network with arbitrary size. Nevertheless, while the size of the network, in particular the backhaul network, does not play a role when locally synchronizing adjacent APs, it can prolong the time of convergence for BP depending on the number of nodes between node i and the MN.

5 Impact of hybrid synchronization on localization

To evaluate the impact of hybrid synchronization on the localization accuracy, we draw on the idea of joint synchronization and localization (sync&loc) introduced in [22]. In particular, in this section we focus on the edge of the communication network, as shown in Fig. 12, where the APs, on one hand, synchronize themselves with the backhaul nodes, i.e., the serving Base Stations (BSs). On the other hand, they perform joint sync&loc by exchanging time-stamps with MUs to which they have Line-of-Sight (LoS) connection (Fig. 12). Each MU i is assumed to exchange time-stamps with two APs, i.e., j and l.Footnote 2 In the sequel, we briefly describe the principles of joint sync&loc.

Fig. 12
figure 12

An example where MU joint sync&loc can be carried out. In each position, e.g., \(\hbox {P}_1,\) \(\hbox {P}_2,\) or \(\hbox {P}_3,\) the MU is exchanging time-stamps with at least two APs based on the protocol described in Sect. 2.3

5.1 Joint MU synchronization and localization

The principles of Bayesian joint sync&loc are akin to those described in (30), (31), and (35). To incorporate the location estimation into the algorithm, we need to redefine \(\tilde{\varvec{\xi }}_{i}\) as

$$\begin{aligned} \tilde{\varvec{\xi }}_{i} \triangleq \begin{bmatrix}\frac{1}{{\tilde{\gamma }}_i}&\frac{{\tilde{\theta }}_i}{{\tilde{\gamma }}_i}&x_i&y_i&v_{x_i}&v_{y_i}\end{bmatrix}^T, \end{aligned}$$

where \(x_i\)/\(v_{x_i}\) and \(y_i\)/\(v_{y_i}\) denote the position/velocity of the MU i on the x and y axes, respectively. In particular, location-related parameters appear when expanding the propagation delay \(d_{ij}\) (or \(d_{ji}\)) as

$$\begin{aligned} d_{ij} = \sqrt{(x_i-x_j)^2+(y_i-y_j)^2}, \end{aligned}$$

where \(x_j\) and \(y_j\) represent the known position of the jth AP on the x and y axes, respectively. Furthermore, each AP is assumed to be equipped with an N-element Uniform Linear Array (ULA) antenna and is able to perform Angle of Arrival (AoA) estimation in each round of time-stamp exchange. This estimation is given by

$$\begin{aligned} \arctan {\frac{y_i-y_j}{x_i-x_j}} = \varphi _{ij} + n_{\varphi }, \end{aligned}$$

where \(\varphi _{ij}\) denotes the true AoA and \(n_{\varphi } \sim {\mathcal {N}}(0, \sigma _{\varphi }^2)\) is the zero mean Gaussian noise stemming from the AoA estimation algorithm. For the sake of simplicity, in our simulations we rely on the Cramer–Rao Bound (CRB) of AoA estimation, derived in [32], to calculate \(\sigma _{\varphi }\) while \(\varphi _{ij}\) is computed knowing the exact trajectory of MU i and the location of AP j. Moreover, the nonlinearity in (41) and (42) is dealt with by resorting to Taylor expansion. The details of the approximation can be found in (43)–(46), where \(v_c\) represents the speed of light and (\(x_i^k, y_i^k\)) denotes the position of MU i predicted by the prediction step in the kth round of joint sync&loc. We note that similar set of equations, i.e., (41)–(45), and (46), can be written for the second AP serving MU i,  i.e., AP l.

Given the new prediction and measurement equations, it is clear that \({\mathbf {A}},\) \({\mathbf {Q}}_n,\) in (31) and \({\mathbf {B}}_{ij},\) \({\mathbf {r}}_{ij},\) \({\mathbf {R}}_{ij}\) in (35) require adjustment to account for the location parameters added to \(\tilde{\varvec{\xi }}_{i}\). The former can readily be updated using motion equations [22, 33], while the latter is adapted with the aid of time-stamp exchange and AoA measurements. The adjusted matrices and vectors are given in (47)–(49), where \(\Delta\) represents the time between two consecutive rounds of joint sync&loc and \(c_i(t)^j\)/\(c_i(t)^l\) denotes the time-stamp of MU i when exchanged with AP j/l (this is to distinguish the time-stamps sent by MU i to its two serving APs).

5.2 Performance analysis

We perform our analysis for the pedestrian scenario shown in Fig. 12. In particular, in this scenario, a MU (the pedestrian) moves with a constant velocity of 2 m/s (\(\approx\) 7 km/h) and takes the turns randomly until it exits the map. During its journey, we assume that the MU exchanges time-stamps with two APs to which it has LoS connection. Each AP performs AoA estimation as well. Both time-stamps and the AoA estimations are then combined by means of the joint sync&loc algorithm, described in Sect. 5 and depicted in Fig. 8, to estimate the vector variable \(\tilde{\varvec{\xi }}_i^{}.\) The simulation is conducted for two cases: (1) the APs synchronize themselves with the backhaul network by means of BP, corresponding to scenario (a) in Sect. 4.1, and (2) using the hybrid approach proposed in this work, corresponding to scenario (b) in Sect. 4.1.

Figure 13 depicts the RMSEs of the clock offset and position estimation of the MU versus the uncertainty in time-stamping. As can be noticed, both RMSEs increase with growth of \(\sigma _T\). Although generally the RMSEs for (b) are larger, the difference in the rate of growth appears to be small, i.e., 0.05 m/ns for the RMSE of position and 0.3 for that of clock offset. This is a negligible cost at which we reduce the complexity of the algorithm by one BP iteration and K rounds of time-stamp exchange. Furthermore, the APs at the edge are able to perform localization immediately without waiting for the BP iterations. Consequently, as shown in Fig. 13, with only 3 more iterations of BRF, the gap between RMSEs can be halved (dotted curves lie in the middle of the solid ones).

$$\begin{aligned}{}&\frac{d_{ij}}{v_c} \approx a^k_{j,0} + a_{j,x}^k (x_i-x_i^{k}) + a_{j,y}^k (y_i-y_i^{k}), \end{aligned}$$
$$\begin{aligned}{}&\arctan (\frac{y_i-y_j}{x_i-x_j}) \approx b_{j,0}^k + b^k_{j,x} (x_i-x_i^{k}) \nonumber \\&\quad + b^k_{j,y} (y_i-y_i^{k}), \end{aligned}$$
$$\begin{aligned}{}&a^k_{j,0} = \frac{1}{v_c}\left( \sqrt{(x_i^{k} - x_{j})^2 + (y_i^{k} - y_{j})^2}\right) , \qquad a_{j,x}^{k} \nonumber \\&\quad = \frac{x_i^{k}-x_j}{v_c^2 a^k_{j,0}}, \qquad a_{j,y}^{k} = \frac{y_i^{k}-y_j}{v_c^2 a^k_{j,0}}, \end{aligned}$$
$$\begin{aligned}{}&b^k_{j,0} = \arctan (\frac{y^{k}_i-y_j}{x^{k}_i-x_j}), \qquad b_{j,x}^k\nonumber \\&\quad =- \frac{y_i^{k}-y_j}{v_c^2(a^k_{j,0})^2}, \qquad b_{j,y}^k = \frac{x_i^{k}-x_j}{v_c^2(a^k_{j,0})^2}. \end{aligned}$$
$$\begin{aligned} {\mathbf {B}}_{i, jl}&= \begin{bmatrix} \begin{array}{cc} B_{11}&{} 0 \\ B_{21} &{} -2 \end{array} &{} {\mathbf {0}}_2 &{} {\mathbf {0}}_2\\ \begin{array}{cc} B_{31} &{} 0 \end{array}&\begin{array}{cc} a^k_{j,x}-a^k_{l,x}&a^k_{j,y}-a^k_{l,y} \end{array}&\begin{array}{cc} 0 &{} 0 \end{array} \\ {\mathbf {0}}_2 &{} \begin{array}{cc} b_{j,x}^k &{} b^k_{j,y} \\ b_{l,x}^k &{} b^k_{l,y} \end{array} &{} {\mathbf {0}}_2 \\ {\mathbf {0}}_2 &{} -\frac{1}{\Delta }{\mathbf {I}}_2 &{} {\mathbf {I}}_2 \end{bmatrix}, \nonumber \\ B_{11}&= \frac{1}{2}\left( c_{i}(t_{4}^k)^j-c_{i}(t_{2}^k)^j+c_{i}(t_{4}^k)^l - c_{i}(t_{2}^k)^l\right) \nonumber \\ B_{21}&= \frac{1}{4}\left( c_{i}(t_{2}^k)^j+c_{i}(t_{4}^k)^j+2c_{i}(t_{5}^k)^j\right. \nonumber \\&\left. \quad +c_{i}(t_{2}^k)^l+c_{i}(t_{4}^k)^l+2c_{l}(t_{5}^k)^l\right) \nonumber \\ B_{31}&= c_{i}(t_{5}^k)^j - c_{i}(t_{5}^k)^l \end{aligned}$$
$$\begin{aligned} {\mathbf {r}}_{i, jl}&= \left[ r_1, r_2, r_3, r_4, r_5, -\frac{x_i^{k-1}}{\Delta }, -\frac{y_i^{k-1}}{\Delta } \right] ^T. \qquad \nonumber \\ r_1&= \frac{1}{2}\left( c_{j}(t_{3}^k)-c_{j}(t_{1}^k)+c_{l}(t_{3}^k)-c_{l}(t_{1}^k)\right) \nonumber \\ r_2&= \frac{1}{4}\left( c_{j}(t_{1}^k)+c_{j}(t_{3}^k)+2c_{j}(t_{6}^k) \right. \qquad \nonumber \\ r_3&= c_{j}(t_{6}^k) - a_{j, 0}^k + a_{j, x}^k x_i^k + a_{j, y}^k y_i^k \nonumber \\&\left. \qquad \qquad +c_{l}(t_{1}^k) + c_{l}(t_{3}^k) + 2c_{l}(t_{6}^k)\right) \qquad - \left( c_{l}(t_{6}^k) - a_{l, 0}^k + a_{l, x}^k x_l^k + a_{l, y}^k y_i^k \right) \nonumber \\ r_4&= \varphi _j^k - b_{j, 0}^k + b_{j, x}^k x_i^k + b_{j, y}^k y_i^k \nonumber \\ r_5&= \varphi _l^k - b_{l, 0}^k + b_{l, x}^k x_i^k + b_{l, y}^k y_i^k \end{aligned}$$
$$\begin{aligned} {\mathbf {R}}_{i, jl}&= \text {diag}\left( \left[ \frac{1}{2}\left( \sigma ^2_{T_{ij}}+\sigma ^2_{T_{il}}\right) ,\frac{1}{4}\right. \right. \nonumber \\&\left( \frac{\sigma ^2_{T_{ij}}+\sigma ^2_{T_{il}}}{2} + \sigma ^2_{R_{ij}}+\sigma ^2_{R_{il}}\right) ,\nonumber \\&\left. \left. \sigma ^2_{R_{ij}}+\sigma ^2_{R_{il}}, \sigma _{\varphi _j}^2, \sigma _{\varphi _l}^2, (\frac{\sigma _{x_i}^{k-1}}{\Delta })^2, (\frac{\sigma _{y_i}^{k-1}}{\Delta })^2 \right] \right) . \end{aligned}$$
Fig. 13
figure 13

Impact of hybrid synchronization on MU joint sync&loc. (a)/(b) denotes the algorithm used for network synchronization (Sect. 4.1). The numbers in the legend denote the number of iterations each algorithm runs

6 Conclusions and future work

We presented two Bayesian approaches toward clock offset and skew estimation in communication networks. In particular, Belief Propagation (BP) was employed to perform high-precision network-wide synchronization, albeit at the cost of a high number of time-stamp exchanges and message passing iterations. Additionally, Bayesian Recursive Filtering (BRF) was leveraged to carry out pairwise synchronization, delivering a superb performance at the edge of the network. Based on these two algorithms, a hybrid Bayesian approach was proposed to not only fulfill a low relative time error at a local level but also to maintain a high synchronization accuracy at a global level. Lastly, we analyzed the impact of the proposed hybrid approach on a joint synchronization and localization (sync&loc) algorithm. Simulation results show that the proposed hybrid approach achieves faster and more frequent synchronization at the cost of only a slight deterioration in performance, i.e., around 3 ns, 0.5 ppm, and 0.1 m in the RMSEs of the clock offset, clock skew, and position, respectively.

Given the promising results, our future work targets the implementation of the hybrid synchronization algorithm presented in this work using Commercial-Off-The-Shelf (COTS) millimeter wave hardware. This would then allow the implementation of the joint synchronization and localization at the edge of the network as well.

Availability of data and materials

The python code used for the evaluations and analysis in this study is available from the corresponding author on reasonable requests.

Change history


  1. The uncertainty in time-stamping is due to the precision of the devices as well as the manner of hardware time-stamping implementation. For the nodes in this experiment, the precision of time-stamping was 8 ns meaning that the time-stamps were always an integer of 8 ns.

  2. It is worth mentioning that in [22] each MU exchanges time-stamps with only one AP and the second AP passively listens to their exchange, which might not be implementable in practice. Therefore, in this work we have modified the algorithm as explained above.



Fifth generation


Access point


Mobile user


Wireless sensor network


Belief propagation


Factor graph


Probability density function


Precision Time Protocol


Best Master Clock Algorithm


Master node


Bayesian recursive filtering


Commercial off-the-shelf




Base Station




Synchronization and localization


Cramer–Rao Bound


Root mean square error


Standard deviation


  1. A. Kaloxylos, A. Gavras, R. De Peppe, Empowering vertical industries through 5G networks—current status and future trends. Zenodo (2020).

  2. J. Werner, M. Costa, A. Hakkarainen, K. Leppanen, M. Valkama, Joint user node positioning and clock offset estimation in 5G ultra-dense networks. In 2015 IEEE Global Communications Conference (GLOBECOM) (IEEE, 2015), pp. 1–7

  3. B. Etzlinger, F. Meyer, F. Hlawatsch, A. Springer, H. Wymeersch, Cooperative simultaneous localization and synchronization in mobile agent networks. IEEE Trans. Signal Process. 65(14), 3587–3602 (2017)

    Article  MathSciNet  Google Scholar 

  4. M. Koivisto, M. Costa, J. Werner, K. Heiska, J. Talvitie, K. Leppänen, V. Koivunen, M. Valkama, Joint device positioning and clock synchronization in 5g ultra-dense networks. IEEE Trans. Wirel. Commun. 16(5), 2866–2881 (2017)

    Article  Google Scholar 

  5. N. Maletic, V. Sark, M. Ehrig, J. Gutiérrez, E. Grass, Experimental evaluation of round-trip ToF-based localization in the 60 GHz band. In 2019 International Conference on Indoor Positioning and Indoor Navigation (IPIN). IEEE, pp. 1–6

  6. M. Lévesque, D. Tipper, A survey of clock synchronization over packet-switched networks. IEEE Commun. Surv. Tutor. 18(4), 2926–2947 (2016)

    Article  Google Scholar 

  7. M. Leng, Y.-C. Wu, Distributed clock synchronization for wireless sensor networks using belief propagation. IEEE Trans. Signal Process. 59(11), 5404–5414 (2011)

    Article  MathSciNet  Google Scholar 

  8. K.J. Zou, K.W. Yang, M. Wang, B. Ren, J. Hu, J. Zhang, M. Hua, X. You, Network synchronization for dense small cell networks. IEEE Wirel. Commun. 22(2), 108–117 (2015)

    Article  Google Scholar 

  9. B. Etzlinger, H. Wymeersch, A. Springer, Cooperative synchronization in wireless networks. IEEE Trans. Signal Process. 62(11), 2837–2849 (2014)

    Article  MathSciNet  Google Scholar 

  10. J. Du, Y.-C. Wu, Distributed clock skew and offset estimation in wireless sensor networks: asynchronous algorithm and convergence analysis. IEEE Trans. Wireless Commun. 12(11), 5908–5917 (2013)

    Article  Google Scholar 

  11. G. Giorgi, C. Narduzzi, Performance analysis of Kalman-filter-based clock synchronization in IEEE 1588 networks. IEEE Trans. Instrum. Meas. 60(8), 2902–2909 (2011)

    Article  Google Scholar 

  12. M. Leng, Y.-C. Wu, Low-complexity maximum-likelihood estimator for clock synchronization of wireless sensor nodes under exponential delays. IEEE Trans. Signal Process. 59(10), 4860–4870 (2011)

    Article  MathSciNet  Google Scholar 

  13. B. Lv, Y. Huang, T. Li, X. Dai, M. He, W. Zhang, Y. Yang, Simulation and performance analysis of the IEEE 1588 PTP with Kalman filtering in multi-hop wireless sensor networks. J. Netw. 9(12), 3445 (2014)

    Google Scholar 

  14. D. Barber, Bayesian Reasoning and Machine Learning (Cambridge University Press, Cambridge, 2012).

    MATH  Google Scholar 

  15. IEEE standard for a precision clock synchronization protocol for networked measurement and control systems. IEEE Std 1588-2019 (Revision of IEEE Std 1588-2008) (2020), pp. 1–499

  16. M. Goodarzi, D. Cvetkovski, N. Maletic, J. Gutiérrez, E. Grass, Synchronization in 5G: a Bayesian approach. In European Conference on Networks and Communications (EuCNC) (IEEE, 2020), pp. 194–199

  17. I.-K. Rhee, J. Lee, J. Kim, E. Serpedin, Y.-C. Wu, Clock synchronization in wireless sensor networks: an overview. Sensors 9(1), 56–85 (2009)

    Article  Google Scholar 

  18. M. Goodarzi, D. Cvetkovski, N. Maletic, J. Gutiérrez, E. Grass, A hybrid bayesian approach towards clock offset and skew estimation in 5G networks. In IEEE International Symposium on Personal, Indoor and Mobile Radio Communications (PIMRC) (IEEE, 2020).

  19. S. Ruffini, P. Iovanna, M. Forsman, T. Thyni, A novel SDN-based architecture to provide synchronization as a service in 5G scenarios. IEEE Commun. Mag. 55(3), 210–216 (2017)

    Article  Google Scholar 

  20. H. Li, L. Han, R. Duan, G.M. Garner, Analysis of the synchronization requirements of 5G and corresponding solutions. IEEE Commun. Stand. Mag. 1(1), 52–58 (2017)

    Article  Google Scholar 

  21. S.P. Chepuri, R.T. Rajan, G. Leus, A.-J. van der Veen, Joint clock synchronization and ranging: asymmetrical time-stamping and passive listening. IEEE Signal Process. Lett. 20(1), 51–54 (2012)

    Article  Google Scholar 

  22. M. Goodarzi, N. Maletic, J. Gutiérrez, E. Grass, Bayesian joint synchronization and localization based on asymmetric time-stamp exchange. In International Symposium on Networks, Computers and Communications (ISNCC) (IEEE, 2020). arXiv:2008.08481.pdf

  23. F. Meyer, B. Etzlinger, Z. Liu, F. Hlawatsch, M.Z. Win, A scalable algorithm for network localization and synchronization. IEEE Internet Things J. 5(6), 4714–4727 (2018)

    Article  Google Scholar 

  24. IEEE standard for information technology -telecommunications and information exchange between systems local and metropolitan area networks—specific requirements—part 11: wireless LAN medium access control (MAC) and physical layer (PHY) specifications. IEEE Std 802.11-2016 (Revision of IEEE Std 802.11-2012) (2016), pp. 1–3534

  25. B. Sundararaman, U. Buy, A.D. Kshemkalyani, Clock synchronization for wireless sensor networks: a survey. Ad Hoc Netw. 3(3), 281–323 (2005)

    Article  Google Scholar 

  26. L. Zdeborová, F. Krzakala, Statistical physics of inference: thresholds and algorithms. Adv. Phys. 65(5), 453–552 (2016)

    Article  Google Scholar 

  27. O. Shental, P.H. Siegel, J.K. Wolf, D. Bickson, D. Dolev, Gaussian belief propagation solver for systems of linear equations. In 2008 IEEE International Symposium on Information Theory (IEEE, 2008), pp. 1863–1867

  28. Y.-C. Wu, Q. Chaudhari, E. Serpedin, Clock synchronization of wireless sensor networks. IEEE Signal Process. Mag. 28(1), 124–138 (2010)

    Article  Google Scholar 

  29. A.L. Barker, D.E. Brown, W.N. Martin, Bayesian estimation and the Kalman filter. Comput. Math. Appl. 30(10), 55–77 (1995)

    Article  MathSciNet  Google Scholar 

  30. Y. Pei, S. Biswas, D.S. Fussell, K. Pingali, An elementary introduction to Kalman filtering. Commun. ACM 62(11), 122–133 (2019)

    Article  Google Scholar 

  31. B. Li, N. Wu, Y.-C. Wu, Distributed verification of belief precisions convergence in gaussian belief propagation. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) (IEEE, 2020), pp. 9115–9119

  32. D.A. Fittipaldi, M. Luise, Cramér-rao bound for DOA estimation with antenna arrays and UWB-OFDM signals for PAN applications. In 2008 IEEE 19th International Symposium on Personal, Indoor and Mobile Radio Communications (IEEE, 2008), pp. 1–5

  33. R. Khan, S.U. Khan, S. Khan, M.U.A. Khan, Localization performance evaluation of extended Kalman filter in wireless sensors network. Procedia Comput. Sci. 32, 117–124 (2014)

    Article  Google Scholar 

Download references


Not applicable.

Open Access

This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (, which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.


Open Access funding enabled and organized by Projekt DEAL. The research leading to these results has received funding from the European Union’s Framework Programme Horizon 2020 for research, technological development and demonstration under Grant Agreement Number 871428 (5G-CLARITY).

Author information

Authors and Affiliations



Meysam Goodarzi conducted the study presented in this work. All authors took part in the discussions, reviewed and edited this manuscript. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Meysam Goodarzi.

Ethics declarations

Competing interests

The authors declare that they have no competing interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.



Employing Bayes rule:

$$\begin{aligned} p(\tilde{\varvec{\xi }}_i^{k}|{\mathbf {C}}_{ij}) \propto \int p({\mathbf {C}}_{ij}|\tilde{\varvec{\xi }}_i^{0},\ldots , \tilde{\varvec{\xi }}_i^{k})p(\tilde{\varvec{\xi }}_i^{0},\ldots , \tilde{\varvec{\xi }}_i^{k})\ d\Theta ^{k-1}. \end{aligned}$$

Assuming the independent measurements and Markov property [29], the integrands in (50) can be rewritten as

$$\begin{aligned} \begin{aligned}{}&p({\mathbf {C}}_{ij}|\tilde{\varvec{\xi }}_i^{0},\ldots , \tilde{\varvec{\xi }}_i^{k}) = p({\mathbf {c}}_{ij}^{k}|\tilde{\varvec{\xi }}_{i}^{k})\cdots p({\mathbf {c}}_{ij}^{1}|\tilde{\varvec{\xi }}_{i}^{1}), \\&p(\tilde{\varvec{\xi }}_i^{0},\ldots , \tilde{\varvec{\xi }}_i^{k}) = p(\tilde{\varvec{\xi }}_{i}^{k}|\tilde{\varvec{\xi }}_{i}^{k-1})\cdots p(\tilde{\varvec{\xi }}_{i}^{1}|\tilde{\varvec{\xi }}_{i}^{0})p(\tilde{\varvec{\xi }}_{i}^0), \end{aligned} \end{aligned}$$

where \(p(\tilde{\varvec{\xi }}_{i}^0)\) denotes the prior knowledge on \(\tilde{\varvec{\xi }}_{i}.\) Plugging (51) into (50) leads to (30) where

$$\begin{aligned}{}&p(\tilde{\varvec{\xi }}_i^{k}|{\mathbf {c}}_{ij}^{1:k-1}) \nonumber \\&\quad ={\int p(\tilde{\varvec{\xi }}_i^{0})\left[ \prod _{r=1}^{k-1}p(\tilde{\varvec{\xi }}_i^{r}|\tilde{\varvec{\xi }}_i^{r-1})p({\mathbf {c}}_{ij}^{r}|\tilde{\varvec{\xi }}_{i}^{r})\right] p(\tilde{\varvec{\xi }}_{i}^{k}|\tilde{\varvec{\xi }}_{i}^{k-1})d\Theta ^{k-1}}, \end{aligned}$$

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Goodarzi, M., Cvetkovski, D., Maletic, N. et al. Synchronization in 5G networks: a hybrid Bayesian approach toward clock offset/skew estimation and its impact on localization. J Wireless Com Network 2021, 91 (2021).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: