An Improved Time Synchronization Algorithm for
Wireless Sensor Networks
https://doi.org/10.3991/ijoe.v13i05.7049
Ji-hong Sun
Luohe Vocational College of Food, Luohe, China [email protected]
Huanzheng Shao
Luohe Vocational College of Food, Luohe, China [email protected]
Abstract—Wireless sensor network (WSN) has been paid more and more attention to by the international academic and industrial fields. What’s more, it has become a hot research topic with great attention and expectations. There are a lot of technical problems involved in wireless sensor networks, among which, time synchronization technology is one of the supporting technologies in wire-less sensor networks. And it is rather essential for the application of wirewire-less sensor network. Two classical time synchronization algorithms are introduced and their advantages and disadvantages are compared. Based on the existing al-gorithms, an improved time synchronization algorithm is put forward. The im-proved algorithm was simulated by NS2. The results showed that the proposed algorithm had better time synchronization accuracy and lower network cost than RBS and TPSN algorithm. In summary, the improved time synchroniza-tion algorithm has a rather good performance.
Keywords—Wireless sensor, time synchronization algorithm, TPSN algorithm
1
Introduction
the data collected by the other sensor nodes. Data fusion and collaborative processing often require that the data collected by different nodes is uniform in time, so time synchronization is essential [2-3].
In this paper, we introduced two classical time synchronization algorithms and compared their advantages and disadvantages. The improved algorithm was simulated by NS2. The results showed that the proposed algorithm had better time synchroniza-tion accuracy and lower network cost than RBS and TPSN algorithm.
2
State of the art
In August 2002, J. Elson and K.Romer first presented a wireless sensor network at the Hot Nets-I International Conference. J.Elson and K.Romer first described the importance of time synchronization to wireless sensor networks, and proposed RBS (Reference-Broadcast Synchronization) algorithm. The algorithm is intended to pro-vide a synchronization algorithm based on the receiver-receiver mechanism. In 2011, Luca Schenato et al. proposed the ATS (Average Time Sync) algorithm, which used two cascaded consistency algorithms to adjust the compensation parameters. The average node virtual clock has a consistent settling time. In 2012, Michael Kevin Maggs proposed CCS (Consensus Clock Synchronization) algorithm. The algorithm uses the averaging algorithm to compensate for the offset of the node time. In 2013, Zhao Dengchang et al. proposed TSMA (Time Synchronization using Max and Aver-age Consensus) algorithm. Based on the ATS algorithm and the CCS algorithm, the algorithm uses the maximum coincidence algorithm to achieve the compensation of the drift, and obtains the faster drift rate. At the same time, TSMA algorithm uses MAC layer timestamp to get higher synchronization accuracy. In 2015, through the study of RBS time synchronization algorithm (RBS) for wireless sensor networks, such as time synchronization problem of multi-hop network, ZhouYa et al. proposed RBS ring algorithm based on ring network topology (References Broadcast Bing Synchronization, RBRS). On the basis of RBS, the algorithm adopts the method of broadcast packet and least squares linear regression to realize the whole network time synchronization. The algorithm is compared with the existing RBS optimization algo-rithm from the aspects of synchronization error and overhead. It is found that the algorithm has the advantages of small accumulation of errors and a significant reduc-tion in synchronizareduc-tion overhead compared with the initial algorithm. In addireduc-tion, it can realize the time synchronization of the whole network. In 2016, Yang Zhiqiu et al. proposed a low-power time synchronization algorithm and fault-tolerant time syn-chronization algorithm based on the traditional time synsyn-chronization algorithm. By setting up the time synchronization test platform, the low power time synchronization algorithm is validated from the aspects of algorithm precision, correctness and ro-bustness. It is shown that the low-power time synchronization algorithm of cluster structure is more stable than traditional algorithm.
"criti-cal path" that may cause synchronization errors. (2) To study energy efficient syn-chronization algorithm from the perspective of energy consumption. Various algo-rithms are designed for a particular environment. Although a number of good time synchronization algorithms are proposed, they are designed to improve the perfor-mance and ignore some other perforperfor-mance. There is a gap with the practical applica-tion. It needs to further improve the original algorithm or design a new algorithm, so that the network has better scalability and stronger network topology to adapt. In this paper, two classical time synchronization algorithms are introduced and their ad-vantages and disadad-vantages are compared. Based on the existing algorithms, an im-proved time synchronization algorithm is put forward. At last, the imim-proved algorithm was simulated by NS2.
3
Typical time synchronization algorithm
3.1 RBS time synchronization algorithm
RBS (Reference broadcast synchronization) algorithm is a classical algorithm of time synchronization. It is not complicated in the realization method, and the re-quirements on the storage space is not harsh, so it can meet most of the precision requirements on time synchronization and the application requirements are not strict.
NIC
Fig. 1. Schematic diagram of RBS algorithm
3.2 TPSN time synchronization algorithm
TPSN (Timing-sync Protocol for Sensor Networks) synchronization algorithm is based on pair-wise mechanism, which can provide a wide range of wireless sensor network time synchronization.
TPSN algorithm is an algorithm for global time synchronization, which will bring a lot of energy consumptions after the completion of each global time synchroniza-tion. In addition, if the root node fails, the algorithm will select a new root node and run the TPSN algorithm, then the system burden increases.
0
1 1
2 2 2
n-1
n n
Fig. 2. Schematic diagram of TPSN layering
T1
T2 T3
T4
T2 and T3 are clocked by the node R
T1 and T4 are clocked by the node S
Fig. 3. Schematic diagram of TPSN algorithm
request packet at the moment of
T
2. There areT
2=
(
T
1+
d
+
!
)
and R node send-ing a response packet in the time ofT
3, and the packet contains the level of node R. In addition, it also contains the previous time,T
1,T
2, andT
3. The time for S to receive a response message isT
4, then there isT
4=
(
T
3+
d
-
!
)
, and we can knowthat:
(
) (
)
2
T
T
T
T
2!
1!
4!
3=
"
(1)(
) (
)
2
T
T
T
T
d
=
2!
1+
4!
3 (2) Finally, the node S modifies the local clock by calculating the time offset between it and the node R, to achieve time synchronization with the node R.4
Improved time synchronization algorithm
4.1 Algorithm description
In wireless sensor networks, the idea of clustering is widely used in data fusion, routing and network cost reduction. Clustering idea has its own cluster head election strategy [6] so that the cluster head manages the network, to make the topology easy to be managed, and the use of data fusion compresses the amount of data transmis-sion, and saves the energy costs. Based on the classic wireless sensor network time synchronization algorithm, we summarize the synchronization error and energy con-sumption factors, and design an improved time synchronization algorithm, that is, clustering-based low energy consumption time synchronization (CLECTS). The algo-rithm requirements that wireless sensor network first of all generates the cluster to-pology, and then makes the base station and cluster to achieve time synchronization, and then realizes the cluster node time synchronization, so as to achieve the ultimate goal of the whole network synchronization.
The election of cluster head uses LEACH protocol, LEACH protocol divides the whole wireless sensor network into several clusters, and the cluster head uses cycle random mode [7]. In this way, the load of wireless sensor network is relatively aver-age to all the sensor nodes, and then, it reduces the energy consumption of the net-work, and improves the network lifetime. The most important thing in the process is to choose a cluster head. LEACH requires that all sensor nodes randomly choose a number between 0-1, and once the value of a chosen node is less than a fixed thresh-old, then the node is selected as the cluster head node [8].
( )
!
!
"
!
!
#
$
%
&&
'
(
))
*
+
,
=
other
0
G
n
p
1
r
p
1
p
n
T
*mod
(3)The algorithm consists of three steps, namely cluster head selection, cluster mem-bership adding and information transmission. The first two steps are continuously cycling, followed by a series of information transmission processes. The first step of the algorithm is to select the cluster heads and the selected cluster heads can select the cluster head nodes of the next cluster. For example, in the zeroth layer, the root node selects the first I node in its next layer node group as the cluster head node of the next layer of cluster and continues to broadcast the message. The energy consumed by the sending message is determined by the distance between the root node and the node for its communication.
The stage after the cluster head selection is the cluster member node adding stage. When the cluster head node is selected, all the cluster heads broadcast the message to all other nodes with the maximum power. The node selects a signal with the strongest signal and replies to a message, which means that the cluster head is added to the cluster, that is to say, the cluster node closet to the node.
The last stage of multi layer cluster network is the process of information transmis-sion. In the process of signal transmission for a round, each member node sends sen-sor data to its cluster head node.
In this way, a highly correlated tree diagram is formed in the network, and the data of the sensor node can be transmitted from the far distance to the root node.
4.2 Algorithm energy model
The energy consumption model of transmitting and receiving 1 bit is given when the distance is d. In the range of the received signal and noise ratio, the transmission of L bit with the distance of d, the energy
E
Tx consumed by the message sending and the energyE
Rx consumed by the receiving message are:( )
!"
!
#
$
%
&
+
%
&
+
=
0 4 mp elec 0 2 fs elec Txd
d
d
l
E
l
d
d
d
l
E
l
d
l
E
* * ** * *
,
(4)elec
Rx
l
E
E
=
* 5By using the algorithm proposed in this paper, we consider such a two-layer net-work: the total number of nodes is N, the number of cluster heads is k, the number of the first cluster heads is
k
1, and the total number of membership nodes isN
-
k
.consumption of the nodes in the two-layer network, we adopt the top-down method, and set the energy consumed of the first layer:
(
)
(
)
[
2]
toCH fs elec 1 4 toBS mp elec elec 1 1 CL Total
d
l
lE
k
k
2
d
l
lE
lE
k
3
E
* * * * ,!
+
"
+
!
+
+
=
(5)The energy consumption of the second layer:
(
)
[
]
(
)
[
2]
toCH fs elec 2 toCH fs elec 1 elec 1 2 CL Total
d
l
lE
k
N
2
d
l
lE
k
lE
k
k
3
E
* * * * ,!
+
"
+
!
+
+
"
=
(6)The total energy consumption for
N
-
k
sensor nodes sending and receiving 1 bit message:(
)
(
)
[
2]
toCH fs elec 1 elec CH NON
Total
2
N
k
lE
k
k
lE
l
d
E
* *, "
=
"
+
"
+
!
(7)The total energy consumed for the two-layer network to make time synchroniza-tion is: CH NON Total 2 CL Total 1 CL Total
TOTAL
E
E
E
E
=
,+
,+
, ! (8)(
)
(
)
4toBS mp 2 toCH fs elec
TOTAL
4
N
l
l
E
2
N
k
l
d
l
d
E
=
+
*+
"
*!
*+
*!
* (9)Through the above analysis, we can know that the wireless sensor network cluster-based low energy consumption time synchronization algorithm CLECTS described in this paper can effectively reduce the energy consumption, which is mainly achieved by reducing the transmission of data packets. According to the algorithm description, it can be seen that in the process of synchronization between the cluster head and the base station, only 3 data need to be transmitted at the beginning, and then the data exchange in the synchronization process is completed by continuing to transmit 1 data. In the process of synchronization of the members of a cluster, it only needs to transmit 3 packets, so the whole synchronization process only needs to transmit 6 packets. Some traditional synchronization algorithms, such as TPSN and RBS, we assume a network composed of n sensor nodes, then in order to achieve time synchro-nization, it is necessary to transmit
2
*(
n
!
1
)
packets.5
Simulation experiments and results
5.1 Simulation platform
start
Do you want to add or modify a C++ class
Add or modify C++ class
Edit NS2
Writing OTcl scripts
NS2 simulation
Analysis of simulation results
Whether the experiment is completed
end Yse
Yse
No
No
Fig. 4. NS2 simulation flow chart
Specifically divide into the following steps:
(1) According to the needs of the users, the NS2 is extended to modify or add new modules to the NS2 module;
(2) For the writing of script, make use of OTcl language. Scripting is mainly used to configure the user settings network environment structure and communication link attributes;
(3) To establish agency of Agent protocol, which are used to determine the com-munication model and to bind protocol for the equipment;
(5) To determine the total time of simulation, and then also involve the writing of some preparation information so that we have completed the preparation of the OTcl script;
(6) To write the completed OTcl script using the ns command to implement and get the trace file;
(7) To analyze the obtained trace file, get the data we need and analyze it.
5.2 Simulation parameters
The performance of the improved algorithm is compared with the RSB and TPSN algorithms. The performance of the algorithm is mainly reflected in two aspects: en-ergy consumption and synchronization accuracy [10]. In the simulation experiment, first of all, node is deployed in the area of 100m*100m, the transmission distance is 30m in the simulation, and the RxThresh value for wireless transmission range of 30m calculated by the threshold tool is 2.13643e-07. The simulation scene is arranged as follows:
In the scope of the 100m*100m network simulation, randomly deploy 100 static nodes, the node uses omni-directional antenna, the antenna transmission range is 30m, and the wireless transmission is two-way error-free transmission. Among them: the initial energy of the node is 1 J; the energy loss of the transmitting and receiving data is 50nJ/bit; the energy consumption of the data fusion is 5nJ/bit; the size of the data packet is 500bit, and the setting of the property is implemented in the OTcl script.
It can be very clearly displayed in Table 1:
Table 1. Simulation parameters
Parameters Parameters value
Total number of nodes 100
Area for the network 100m*100m Base station location [50,175] Length of data packets 500bits
Initial energy of nodes 1J
Eelec 50 nJ(bit)-1
!fs 10pJ/bit/m2
"mp 0.0013pJ/bit/m4
5.3 Simulation result
In order to make the simulation results more accurate, it is necessary to carry out several simulations to simulate different scenarios for 40 times, and the final results are statistically analyzed and the mean value is used as the final result. Finally, the number of nodes is increased, and several experiments are carried out and recorded.
50 100 150 200 250 300 350 50
100 150 200
Sy
nc
hr
onous
de
la
y (
us
)
Number of nodes RBS
TPSN CLECTS
Fig. 5. Synchronous delay
Figure 6 shows the relationship of the message transmission amount with the in-crease of the number of nodes. The horizontal coordinate refers to the number of nodes, and the vertical coordinate indicates the energy consumption of message transmission.
50 100 150 200 250 300 350 50
52 54 56 58 60
Ene
rgy c
ons
um
pt
ion (
J)
Number of nodes RBS
Through the analysis of simulation results of the above image, it can be obtained that the improved time synchronization algorithm is better than RBS and TPSN algo-rithm in synchronous time, and with the increase of the number of nodes in the net-work, the difference in the network overhead shows an increasing trend, which is an obvious advantage. This is because the consumption transmission distance of network node cluster in the improved synchronization algorithm is short. In addition, in the synchronization process, it reduces the number of message exchanges, and reduces the network synchronization overhead. As can be seen in the figure, compared to RBS and TPSN algorithm, the more the number of nodes, the more obvious the advantages of this algorithm. In addition, the improved algorithm has low complexity, and the calculation is not complicated, so the requirement of CPU in the network is relatively low, suitable for being applied in wireless sensor networks.
6
Conclusion
Based on the comparison of the existing time synchronization algorithms, we pro-posed an improved time synchronization algorithm for wireless sensor nodes in the network, and for node clustering in the network and the selection of cluster head, we used popular LEACH protocol, which can reduce the energy consumption of cluster head node. The network synchronization is divided into cluster head synchronization and cluster inside synchronization two processes, finally achieving the time synchro-nization of the whole network, and through the analysis, deriving the advantages of the algorithm, compared with RBS and TPSN algorithm, in saving network overhead advantages. In addition, the method of time marking in MAC layer is adopted, which eliminates the uncertain delay in the process of message passing and improves the precision of network time synchronization. In this algorithm, the amount of message exchange is less in the process of synchronization, which is the main reason to save the energy consumption and improve the synchronization accuracy. The NS2 platform is used to simulate the algorithm, and the results show that the algorithm has better time synchronization accuracy and lower network overhead compared with RBS and TPSN algorithm. In practical applications, the security of wireless sensor networks must be considered. The researches on the security of the algorithm are still little, needed to be further strengthened to increase the stability of the system.
7
References
[1]Benzaid, C., Saiah, A., & Badache, N. (2014). Secure pairwise broadcast time synchroni-zation in wireless sensor networks. Euromicro International Conference on Ieee, parallel, Distributed and Network-Based Processing (pp.1-6). IEEE.
[2]Dutta, R., Gupta, S., & Das, M. K. (2014). Low-energy adaptive unequal clustering proto-col using fuzzy c-means in wireless sensor networks. Wireless Personal Communications, 79(2), 1187-1209. https://doi.org/10.1007/s11277-014-1924-7
Transac-tions on Control Systems Technology,23(3), 1041-1051. https://doi.org/10.1109/TCST. 2014.2360913
[4]Jothi, S., & Chandrasekaran, M. (2014). Fuzzy based optimal clustering protocol for max-imizing lifetime in wsn. Research Journal of Applied Sciences Engineering & Technology, 8(6), 714-725. https://doi.org/10.19026/rjaset.8.1027
[5]Kalaiselvi, T., & Murugan, T. S. (2016). An improved load balanced connection aware clustering hierarchy protocol for military application in mobile ad hoc network. Research Journal of Applied Sciences Engineering & Technology, 12(6), 658-667. https://doi.org/10.19026/rjaset.12.2714
[6]Kumari, S., Das, A. K., Wazid, M., Li, X., Wu, F., & Choo, K. R., et al. (2016). On the de-sign of a secure user authentication and key agreement scheme for wireless sensor net-works. Wireless Personal Communications, 1-18.
[7]Mostefaoui, A., Boukerche, A., Merzoug, M. A., & Melkemi, M. (2015). A scalable ap-proach for serial data fusion in wireless sensor networks. Computer Networks, 79, 103-119. https://doi.org/10.1016/j.comnet.2014.12.008
[8]Ranjan, R., Wang, M., Perera, C., Jayaraman, P. P., Zhang, M., & Strazdins, P., et al. (2015). City data fusion: sensor data fusion in the internet of things. International Journal of Distributed Systems & Technologies, 7(1), 15-36.
[9]Rathi, & Viswanathan. (2014). Two phase clustering method for leach protocol for effec-tive cluster head selection. Journal of Computer Science, 10(3), 366-375. https://doi.org/10.3844/jcssp.2014.366.375
8
Authors
Ji-hong Sun is Associate Professor at the Department of Computer Science, Luohe Vocational College of Food, Luohe, China ([email protected]).
Huanzheng Shao is Associate Professor at the Department of Computer Science, Luohe Vocational College of Food, Luohe, China ([email protected]).