1. Introduction
Accurate time synchronization is a key enabler of real-time Industrial IoT applications [
1,
2,
3,
4], and numerous applications are available [
1,
5,
6,
7,
8,
9,
10]. It permits the coordination in time between sensors and actuators equipping Smart Objects (SOs) [
8,
9,
11] different SOs allowing the modelling of the system, and the design of the control systems [
6,
12,
13,
14]. Moreover, the collection of the measurements of a big number of SOs (Big Data) allows data retrieval [
15,
16,
17] if their sampling time is accurately defined.
In recent years, low-power wireless SOs have gained popularity [
18]. They interact to form large networks such as Machine to Machine (M2M) networks and Wearable Computing. In these contexts, the major challenge is to guarantee robust communication between elements while keeping the whole network energy efficient. The time synchronization permits them to coordinate communication slot for the SOs [
4], implementing a time division multiple access communication protocols, i.e., the SO has to forward messages to its neighbors in only a short wakeup period.
The time synchronization of the measurements requires that all the network SOs share the common sense of time. The synchronization accuracy σ among SOs affects the efficacy of the data retrieval, while the time interval required to synchronize all the SOs (∆TIS), i.e., the time interval starting with the execution of the synchronization algorithm and ending when the delay between any couple of SOs is lower than the admissible delay range, affects the “warm-up” time of the system. In the time interval ∆TIS, no action should be performed, because the achieved data can refer to different time instants.
These days, time synchronization in IoT wireless network must take into account that several SOs can be Mobile SOs (MSOs). For example, moving robots are used in a warehouse to move goods [
19,
20] autonomous unmanned aerial vehicles (drones) [
21,
22] coordinate among themselves to achieve a common task, wearables are used to monitor health parameters [
23,
24,
25], and so on.
The MSO makes the topology of the network varying in time. In this context, promising solutions are the consensus approaches since they are based on the local exchange of messages among SOs [
26,
27]. In [
26], the MSO navigates toward each SO deployed on a straight-line route, bringing the sense of time of the previous visited SO. In [
27], a bidimensional deployment of the SOs is considered, and the MSO moves on a straight-line route. The research proposed in [
26,
27] highlights that the MSO reduces ∆
TIS [
28].
The novelties of this paper consist in: (i) proofing the convergence of the proposed synchronization method, (ii) considering that the MSO can move on a bidimensional route (that is a typical scenario), and (iii) detecting the update condition that MSO has to satisfy to promote the SOs’ synchronization, in the case it executes for the first time the synchronization procedure.
Moreover, in the paper, it is proved that the increased number of paths not only reduce ∆TIS but could increase the synchronization accuracy σ. This is conceptually justified by the fact that, during the synchronization, the MSO visit a SO, and it is connected with it and all SOs in its Broadcast Range (BR). The MSO (i) takes part to the network synchronization and (ii) increases the number of connections among the set of SOs in its BR and, consequently, the number of paths among SOs. If the MSO makes higher the number of paths among SOs, faster is the propagation of the common sense of time: the influence of the sense of time of a SO on all the others occurs in a lower time interval. As a consequence, the effect of the connections introduced by the new time-varying paths on σ and ∆TIS is analyzed. In particular, to link the MSO’s route to the improvement of the two synchronization parameters ∆TIS and σ, two statistical indexes are defined: the average of the minimum number of connections in the path between any couple of SOs μcon, and its variation σcon versus the time. Based on such approach, the criteria to select more convenient MSO route are given.
The paper is organized as follows: In
Section 2, the hardware and software architectures of both SO and MSO and the synchronization procedure are abstracted. In
Section 3, the effect of the MSO on the synchronization is analyzed. In
Section 4, numerical tests are executed to evaluate the effect of the MSO route on ∆
TIS and
σ together with
μcon and
σcon to detect the more convenient criteria for the MSO route selection. In
Section 5, experimental results are presented to assess the theoretical and numerical results in a real-world scenario. The conclusions follow.
2. SO and MSO Architecture and Synchronization Procedure
Concerning the synchronization purpose, both the architectures of the SO and MSO can be related to the node architecture of [
29] and can be modeled by three sections: clock, μ-processor, and radio. With respect to the SO, the MSO’s architecture also includes the hardware and software allowing the movement along the route.
The clock is typically composed of a nontunable crystal oscillator [
30] driving a counter. The output of this counter is used as a hardware clock. For the
i-th SO, SO#i, at time
t, the hardware clock value
τi is:
where
is the round toward negative infinity operator,
Nc is the number of SOs in the IoT network,
αi is the frequency, and
βi the offset of the clock.
Since
αi and
βi vary according to the actual realization of the crystal oscillator and the starting condition of the SO#i, respectively, the μ-processor acts as clock-servo, evaluating the correction parameters for frequency
and offset
, respectively. The μ-processor computes the software time
according to:
The correction parameters , and are evaluated by each SO on the basis of synchronization messages (SynMsg) exchanged among the communicating SOs by the radio section.
The radio section is in charge of receive SynMsgs from communicating SOs and to send, in broadcast modality, the SynMsg each , where TP is the synchronization time period. The message SynMsgji, sent at by SO#j and received by SO#i, includes: , where is the SO identifier that is unique for each SO.
At the reception of the SynMsg
ji, the radio section communicates this event to the μ-processor that starts the synchronization procedure of the block scheme of
Figure 1.
In
Figure 1,
is the number of clock impulse of SO#i at the reception of SynMsg
ij. The variables
and
refer to the previous reception of SynMsg
ij,
and
are design parameters (memory factors) that can be set in the range [0, 1], and
indicates the upgraded value of the time dependent variables
, and
, respectively [
31]. In particular, if
= 0 and
= 0, the node will correct its
and
on the basis of the time values of its neighbors only, and vice-versa: if
= 0.9 and
= 0.9, the upgrade of
and
will mainly depend on its own value.
The MSO is used to bring the sense of the time from one SO to another. If it executes the synchronization procedure for the first time, the SOs ignore its message. This condition is checked by the and values in the message received from the MSO and verified that they are equal to the initialization values.
In order to speed up the convergence of the MSO to the common sense of time of the network and to avoid that it could perturb the network synchronization, at the first synchronization time instant (tk, with k = 1), the MSO takes the sense of time of the first received message. This condition is checked by the MSO by its own and values and verified that they are equal to the initialization values. At the end of the first synchronization time instant (tk+, with k = 1), MSO will have bounded by the maximum and minimum values of the of the SOs in its BR, because it: (i) is in the same neighborhood of the visited SO, (ii) receives the same synchronization messages, and (iii) executes the same upgrade of and . In the successive synchronization time instants (tk, with k > 1), MSO will have bounded by the maximum and minimum values of the of the SOs.
The number of connections in the paths among SOs influences the time with whom the information of frequency and offset of each SO clock is shared among all SOs. In particular, the fully connected topology represents the best case, because each SO is directly connected to all others. The worst case is if a nonconnected SO is present. The isolated SO cannot be synchronized, because no information is shared with it.
Because the MSO moves, it increases the number of paths among SOs, creating new connections, but these connections vary in time according with the MSO route.
In the following
Section 3, the conditions making the synchronization procedure success are investigated, and the effect of the MSO route on
σ and ∆
TIS is analyzed.
4. Evaluation of the Effect of MSO on the IoT Network Synchronization
In order to evaluate the effect of the MSO on the synchronization, it is necessary to evaluate not only the increasing number of connections due to the newly introduced paths but also how such connections are spatially distributed. Indeed, in the extreme case that a SO is not linked to the network, if it is periodically visited by the MSO, as in [
34], the synchronization of the whole network is achieved. If the MSO visits only the connected SOs, it is still not possible to achieve the synchronization of all the SOs.
To evaluate the effect of the MSO route on the network connections, a lattice network topology is considered. In this topology, all the SOs (except the ones on the boundary) have the same number of connections. In this case, the MSO effect on the connections is evaluated by two statistical parameters: the mean and standard deviation of the minimum number of connections among any couple of nodes on the observing time window. In the following, node refers to both SOs and MSO. In particular, because the nodes exchange the SynMsg each
TP, the effect of the MSO on the connections among nodes is evaluated at each synchronization time
tk. By considering at
tk the network connection’s adjacency matrix
A(
tk), with dimension (
Nc + 1) × (
Nc + 1), the average minimum number of connection among nodes
μcon, activated from the start of the synchronization procedure up to
tk, is:
The standard deviation is:
The element of the matrix is the number of connections between node#i and node#j at as a consequence, the element in position i,j of the matrix is the number of connections between node#i and node#j available from the start of the synchronization procedure up to .
The operator DST( ) of Equations (10) and (11) receives as input the adjacency matrix and returns the matrix where the element dstij is the minimum distance between node#i and node#j. The operator mean( ) of Equation (10) returns the mean value of all the element of the matrix. The operator st.dev.( ) of Equation (11) returns the standard deviation of all the element of the matrix.
Because the synchronization parameters ∆
TIS and
σ depend on (i) the network topology, (ii) the number of SOs, and (iii) the MSO’s routes, numerical tests are designed to assess the theory in
Section 3. In this way, the relationships among ∆
TIS,
σ , and
[
28] are highlighted. These relationships allow the establishment of the more convenient criteria in the design of the MSO route.
In the tests, the MSO visits the SOs in the predefined route. Since the MSO propagates the common sense of time at
, it estimates
according to the synchronization parameters of the last visited SOs (see
Section 2). It is assumed that, at
, the MSO (dashed node in
Figure 2) is directly connected with the visited SO and the SOs are directly connected to the visited SO. Both MSO and SOs communicate in wireless broadcasting mode.
In order to easily understand the effect of the MSO on the SO connections, a square lattice topology with different values of Nc is considered.
The
Tclk and
values are selected, respectively, according to the hardware realization of the clock typically equipping commercial MSO and SO [
30] and the time required to power-on all the SOs and the MSO. In particular,
Tclk is selected equal to 1 ms with variation in the range [0.999980, 1.000020]
Tclk,
in the range [0, 30] × 10
7 Tclk. The observation time interval of each test is set equal to 10,000 s, and each node collects its own time interval each
T = 2
σ and sends a SynMsg each
TP = 10 s.
To evaluate the effect of the MSO, different MSO’s routes are considered. Among all these routes, in the following, particular interest is devoted to two different sets.
One set that includes straight-line routes, the main diagonal (Route#1–3 of
Figure 2), is selected, because it splits symmetrically the network. The selection of the second diagonal or the central row or central column would not give further information, since they are a rotation of the main diagonal respect to the center of the matrix. Therefore, the results referred to these routes are not reported. Another set includes the routes selected with the following two criteria (Route#4–6 of
Figure 2): (i) peripheral nodes of the network are visited, and (ii) the number of the node connections at each
tk is maximized.
Random topologies of the network are not considered in this research, because they make difficult to understand the relationship between the MSO’s route and ∆TIS, since ∆TIS depends not only on the number of the visited nodes but also on their position in the network and the order with which MSO visits the nodes.
Let Ni,j, i, j = 1, …, n, the node of the square lattice topology, where n = sqrt(Nc). Imposing that at time tk, MSO is on Ni,j, the following routes are selected:
Route#1:
Route#2:
Route#3:
Route#4:
Route#5:
Route#6:
Figure 2 shows the routes in the case
Nc = 25 and the SOs visited by MSO. The dashed arches are the temporary connections created by the MSO in the route.
To evaluate ∆TIS, the admissible delay range equal to 100 Tclk, is imposed; σ is evaluated on the last 1000 s of the observation time interval. This time interval is selected on the basis of preliminary tests to guarantee that σ is evaluated when the common sense of time among the SOs is achieved.
Figure 3 shows the percentage improvement of ∆
TIS and
σ and percentage variation of
μcon and
σcon, with respect to the case of static topology.
The numerical results show that, in all cases, the MSO increases the number of connections among SOs. Lower σcon% corresponds with higher improvement in σ. Concerning ∆TIS, according to the theory, the MSO improves its values, but the quantitative analysis is still an open challenge, and it will be studied in future research.
Figure 4 shows the trend of the delay between node#25 taken as a reference and all the others in the case
Figure 4a static topology and
Figure 4b MSO moving according to route#4.
By analyzing the numerical data, ∆TIS and σ are reduced of the 35% and 36%, respectively.
For sake of completeness, a random movement of the MSO is considered, and
Figure 5 shows the trend of the delay among nodes in the case
Nc = 49 and (a) static topology, and (b) MSO is randomly moving. In particular, the position of the MSO is established, time by time, by extracting an integer number in the range 1–49. As shown in
Figure 5, as foreseen from theory, this random path gives better results with respect the other paths. In particular, ∆
TIS is equal to 1400 s, and
σ is equal to 10
Tclk. Such result is justified by the fact that the probability that the MSO links far nodes is increased.
5. Experimental Tests and Discussion
Experimental tests were carried out to evaluate the effect of MSO in a real scenario.
The experimental testbed consisted of 23 Crossbow TelosB nodes, 30 xm1000 nodes and a PC. In particular, 21 TelosB nodes (indexed from 1 to 21) and all the xm1000 nodes were used to implement the synchronization algorithm. The TelosB node (indexed as 101) was plugged into the PC and used as ZigBee/USB protocol converter. The MSO is implemented in a xm1000 node indexed as 50. The TelosB node (indexed as 102) was used to trigger the 50 nodes to send the service messages containing their identification number
idi, the software clock frequency
, the software clock offset
, and the hardware clock
τi value to the ZigBee/USB protocol converter (and, in turn, to the PC) at sampling period
T = 2 s. The data collected by the PC was used to evaluate the synchronization accuracy in terms of discrepancy among the software clocks
for all
i ∈ [1, 50].
Figure 6 shows the actual realization of the testbed.
In the TelosB [
32] and xm1000 [
35], the microcontroller is a TIMSP430 featuring a Digitally Controlled Oscillator (DCO) running at 8 MHz with a clock period
TDCO = 0.125 μs and 10 kbyte of RAM.
Furthermore, it also features an External Crystal Oscillator (ECO) running at 32,768 Hz. Regarding the radio equipment, the nodes feature the IEEE 802.15.4/ZigBee-compliant module equipped with a RF transceiver operating within the range 2.4000–2.4835 GHz, compatible with ISM band, which allows a data rate of 250 kbps. An important feature of the radio chip CC2420 is the MAC-layer timestamp capability. This allows each node to read the local clock at the beginning of the transmission or reception of the start frame delimiter (SFD) of a message. This mechanism strongly reduces the random delays introduced by the transmission and the readings of the synchronization messages. Indeed, this mechanism was used in [
36] to support their major assumption, i.e., communication delays are negligible with respect to
Tclk. The adoption of the precision tag “TMilli” giving a millisecond resolution of
Tclk was not cosmetic, as there are several hardware platforms, such as the Memsic’s IRIS mote [
37], for which this represents the only option available. Thus, this reflects a realistic operating condition in several application contexts.
TelosB and xm1000 motes have been programmed by TinyOS, an open-source operating system specifically designed for WSN [
38].
In order to allow SOs and MSO to periodically send their clock time values to Node#101 and then to the PC, all them must be in the Node#101 BR [
28,
31,
36]. To this aim, the nodes were deployed in a region of approximately one square meter. The high spatial density of nodes was chosen to evaluate the effectiveness of the proposed algorithm in a saturated spectrum network. For each node
i-th, the neighborhood was predefined in order to achieve a lattice topology.
As a consequence, the lattice topology and the movement of the MSO are realized by defining in each SOs and in the MSO a time variant Boolean vector NDi(tk) of the neighbors with i = 1…(Nc + 1). If NDi(tk)[j] = 1, the j-th node, at time tk, is in the neighborhood of the i-th node. The MSO routes are implemented by changing the update rules of NDi(tk).
The following parameters were used:
ρv = 0.9 and
ρo = 0.9. These are memory factors [
36], and then their values influence the speed with which the whole network converges to a common sense of time. In order to compare numerical and experimental tests,
ρv and
ρo are the same for all the tests.
Figure 7 shows the trend of the delay between SO#25 as reference and all other nodes of the network in the case (a) static topology, and (b) MSO moves according to the route#4.
By comparing
Figure 7 with
Figure 4, the same trend of the delay among SOs can be noted. The reduction of the delay among nodes shows the robustness of the consensus to the packet loss, as proved in [
28,
36].
By analyzing the experimental data, ∆TIS and σ are reduced of the 28% and 38%, respectively.