CN101692743A - Method for realizing time synchronization in wireless sensor network - Google Patents

Method for realizing time synchronization in wireless sensor network Download PDF

Info

Publication number
CN101692743A
CN101692743A CN200910176914A CN200910176914A CN101692743A CN 101692743 A CN101692743 A CN 101692743A CN 200910176914 A CN200910176914 A CN 200910176914A CN 200910176914 A CN200910176914 A CN 200910176914A CN 101692743 A CN101692743 A CN 101692743A
Authority
CN
China
Prior art keywords
node
cycle
counter
wireless sensor
packet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN200910176914A
Other languages
Chinese (zh)
Inventor
安竹林
李晓维
徐勇军
姜鹏
郑哲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NINGBO GAOXIN SHENLIAN SCIENCE AND TECHNOLOGY Co Ltd
Original Assignee
NINGBO GAOXIN SHENLIAN SCIENCE AND TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NINGBO GAOXIN SHENLIAN SCIENCE AND TECHNOLOGY Co Ltd filed Critical NINGBO GAOXIN SHENLIAN SCIENCE AND TECHNOLOGY Co Ltd
Priority to CN200910176914A priority Critical patent/CN101692743A/en
Publication of CN101692743A publication Critical patent/CN101692743A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a method for realizing the time synchronization in a wireless sensor network, which comprises the following steps: initializing a counter; starting the counter, opening an interrupt and starting a message queue; and calculating the increment of the counter according to a received data packet and modifying the value of the counter according to the increment. The method for realizing the time synchronization in the wireless sensor network achieves the aim of time synchronization in the wireless sensor network by periodically modifying a counting value of a linear oscillator and solves the problem of loss of synchronization in network node time due to the timing rate error of nodes in the network caused by that a crystal oscillator is susceptible to the influences of external factors during operation.

Description

Realize the method for wireless sensor network time synchronized
Technical field
The present invention relates generally to areas of information technology, relates in particular to a kind of method that realizes the wireless sensor network time synchronized.
Background technology
The application of wireless sensor network more and more widely, at characteristics such as the uncertainty of challenge-transmission delay that the wireless sensor network time synchronized faced, low-power consumption, low cost, extensibilities, some typical time synchronization protocols have appearred in the wireless sensor network field.Typical wireless sensor network event synchronization agreement can be divided into synchronous and synchronous two classes of recipient-recipient of sender-recipient.TPSN (TimeProtocol for Sensor Networks) agreement is typical sender-recipient's synchronous protocol, and it suppresses by MAC layer timestamp technology and bi-directional switching method and reduces transmission delay and postpone uncertain influence.RBS (Reference Broadcast Synchronization) agreement is typical recipient-recipient's synchronous protocol, except directly the time migration between the recipient being estimated, it further reduces synchronous error by dynamic estimation is carried out in recipient's clock drift (clock skew).In the time synchronization protocol of multihop network, " time route " method that proposes in the RBS agreement, representative work also has LTS (Lightweight Tree-based Synchronization) agreement, HRTS (HierarchyReferencing Time Synchronization) agreement, FTSP (Flooding Time SynchronizationProtocol) agreement and GCS (Global Clock Synchronization) agreement.These typical time synchronized algorithms stress the demand of synchronization accuracy and synchronous energy consumption.
The distributed system that described wireless sensor network is made up of sensor node.Separate and between the node with wireless mode communication, local clock of each node maintenance.The timing signal of local clock is generally provided by crystal oscillator (abbreviation crystal oscillator).
In implementing process of the present invention, the inventor finds the restriction owing to the crystal oscillator manufacturing process, and crystal oscillator is subject to the extraneous factor influence in running, and then causes the deviation of the clocking rate of node in the network, has caused the step-out of network node time.Therefore, time synchronization problem is the major issue that wireless sensor network will solve.
At present, in the location, nearly all occasion such as range finding, data fusion, mac-layer protocol, sleep scheduling, Routing Protocol, cooperation transmission, database synchronization all has clear and definite requirement to time synchronized.Different with the time synchronized of traditional distributed system, the time synchronized of wireless sensor network not only has high-precision requirement, but also is faced with new challenges such as energy consumption, extensibility, wireless transmission unreliability.
Summary of the invention
The object of the present invention is to provide a kind of method that realizes the wireless sensor network time synchronized, prior art is because the influence of crystal oscillator causes the problem of network node time step-out.
A kind of method that realizes the wireless sensor network time synchronized of the present invention may further comprise the steps: the count initialized device; The enabling counting device is opened interruption, the initiation message formation; Revise the count value of linear oscillator according to the packet of receiving.
The method of realization wireless sensor network time synchronized of the present invention reaches the purpose of wireless sensor network time synchronized by the count value of revising linear oscillator, solved in the prior art, because crystal oscillator is subject to the extraneous factor influence in running, and then cause the deviation of the clocking rate of node in the network, caused the problem of the step-out of network node time.
Description of drawings
Fig. 1 is the flow chart of the method for the described realization wireless sensor network of specific embodiment of the invention time synchronized;
Fig. 2 is for receiving the process chart of packet in the method for the described realization wireless sensor network of specific embodiment of the invention time synchronized;
The process chart that Fig. 3 overflows for counter in the method for the described realization wireless sensor network of specific embodiment of the invention time synchronized;
Fig. 4 is T described in the method for the described realization wireless sensor network of specific embodiment of the invention time synchronized 0The standard deviation of synchronized result is with the situation of change of d when getting 2T, 4T, 8T, 16T;
Fig. 5-7 got respectively 1/8,1/4,1/2 o'clock for ε described in the method for the described realization wireless sensor network of specific embodiment of the invention time synchronized, and the standard deviation of synchronized result is with the situation of change of d.
Embodiment
For making the present invention clearer, below in conjunction with specific implementation process and the result of the present invention in wireless sensor network, and with reference to accompanying drawing, the present invention is described in more detail.
Following implementation process is to realize on the wireless sensor network test envelope based on the GAINS-3 node.Described GAINS-3 node mainly is made up of an ATMega128 single-chip microcomputer and a CC1000 wireless transceiver, also has a serial ports simultaneously, is responsible for the reliable transmitting-receiving of programming and data.The serial ports of all nodes all is connected in the Ethernet by the modular converter of serial ports to Ethernet, and a Web server in this Ethernet is responsible for the programming to node, to the data that the node transmission is ordered and receiving node returns.In addition, sample for the clock (counter) to all nodes simultaneously, the INT4 pin of ATMega128 is joined together on all nodes, and the trailing edge on this pin can trigger all nodes and send sampled result to Web server.
When implementing, with oscillator phase φ from [0,1] interval is amplified to [0, T], the phase place that is about to oscillator uses 32 counter to represent, this counter dullness be increased to T (being the cycle), send a packet then, described packet comprises serial number, node number and period T, and the node that receives this packet uses the formula mistake according to the T in the packet! Do not find Reference source.Calculate the coupling increment, the phase place that then this increment is added to oneself gets on.Below in conjunction with specific embodiment, and with reference to accompanying drawing, the present invention is described in more detail.
As mistake! Do not find Reference source.Shown in, the method for realization wireless sensor network time synchronized of the present invention comprises following steps:
Step 101, the count initialized device comprises:
Mode of operation, the maximum count value (being T) of counter are set;
Node number and period T and stiffness of coupling are set.
In implementation process with the period T of node i iBe made as:
T i=T 0+(i-1)*d
Wherein, T 0Radix for the cycle; D describes the cycle differentiation of adjacent numbered node.
Step 102, enabling counting device begin counting, open interruption, allow counter to overflow, and the interruptions such as reception of packet, last initiation message formation.
Node is after receiving packet, and according to the data computation phase increment that excites node that is comprised in the packet, the phase place that then this increment is added to oneself gets on.Next judge whether oneself excites, and carry out corresponding processing procedure.As shown in Figure 2, concrete steps are as follows:
Step 201: from the packet that receives, obtain the period T excite the node number of node and to excite node.
Step 202: whether judge phase place greater than a certain threshold value L, if just calculate phase increment greater than this threshold value.The reason that threshold value L is set is, when certain node A sends packet and Node B is excited, node A can receive the excitation data bag that B sends, and can not cause the phase place of A to increase because of exciting of B if this threshold value is not set.Therefore, the generation that threshold value can prevent this situation is set.
A step 203: by the cycle that excites node that step 201 obtained, according to the formula mistake! Do not find Reference source.Calculate phase increment.Stop counter then, phase increment is increased to counter gets on, at last enabling counting device once more.
Step 204: judge whether the counter after increasing through step 203 overflows, if overflow then illustrate that this node excites, invocation step 3 is correlated with overflows processing.Otherwise processing procedure finishes.
When counter overflows, need counter reset, tissue comprises the packet of serial number, node number and period T, then this packet is sent.Concrete steps are as follows as shown in Figure 3:
Step 301: stop counter, the count value of counter is made as 0, restart counter then.
Step 302: serial number from adding 1, then with itself and node number, period T and be saved in the packet related data structure, is broadcasted away this packet then.
Because wireless senser adopts the processor of low-cost low-power consumption, therefore can't carry out complicated function calculation.The linear oscillator of Shi Yonging when guaranteeing precision, has been avoided a large amount of NONLINEAR CALCULATION in the present invention, has saved synchronous energy consumption.
Simultaneously, this method has been avoided identical this hypothesis of oscillator crystal oscillator frequency, and particularly for large-scale wireless sensor network, this point seems particularly important.
In addition, this method only needs a counter in synchronous process, do not need to preserve other state information, also need be based on any topology information, therefore compare with the method for synchronous of classics and saved computing time and memory space, also have autgmentability preferably simultaneously.
For the validity of this method is described, and further discuss how to choose parameters in actual applications, we have carried out actual test to this method on the wireless sensor network test envelope of being made up of 15 nodes.Frequency (the T of node oscillator Counter) be 115200Hz.No. 0 node can send an interrupt signal when the cycle is carried out roughly half makes all nodes send the counter values of oneself simultaneously to Web server.The standard deviation of the counter of all nodes of calculating except No. 0 node is weighed the precision of these group data, and after having collected all data, the arithmetic mean value of calculating all standard deviations again is as final result.In addition, when calculating last arithmetic mean, some groups of maximins are taken out from the result, to avoid stochastic factor.
At first, discuss how to influence synchronous precision experimental period.ε is fixed as 1/4, for each group T 0, make d with step-length 500 traversals interval [500,40000], when calculating final result, cast out 5 groups of minimum and maximum data.Fig. 4 is T 0Get T respectively Counter2,4,8,16 times, the standard deviation of synchronized result is with the situation of change of d.As can be seen from the figure, for T 0Each value, change procedure is divided into three phases.When d was very little, standard deviation was with T 0Very little with the correlation of d, along with the increase synchronization criterion difference of d at first is stabilized in a certain fixed value, increase along with the increase of d then.This be because, when d was very little, the cycle of each node was very approaching, because the effect of threshold value L can make counter enter the state of a kind of lock-step (phase-locked); Along with the increase of d, enter normal synchronous phase between node; And it is excessive to work as d, and makes synchronous conservation condition mistake! Do not find Reference source.When can't be satisfied, the synchronization criterion difference then can significantly increase.In this experiment, have
T min=T 0,T max=T 0+14d?andε=1/4
A substitution mistake! Do not find Reference source.In, can get
T 0 T 0 + 14 d ( 1 + 1 4 ) ≥ 1
Solve
d ≤ T 0 56
Work as T 0Equal 2T respectively Counter, 4T Counter, 8T CounterAnd 16T CounterThe time, the d that is calculated by following formula is respectively: 4114,8228,16457 and 32914.It is very good that these results and Fig. 4 coincide.
In order further to study T 04 kinds of values at the synchronization accuracy in above-mentioned synchronism stability stage.We have carried out further experiment.The relevant parameter of experiment is identical with a last experiment, and just d is with step-length 10 traversals interval [3000,3500], and more stable in order to make the result, we have removed 15 minimum and maximum results.Experimental result as shown in Figure 5, as can be seen from the figure less T 0Can obtain higher precision, this is that it is frequent more that node is adjusted own phase place because the cycle is short more, thus can be fast more reach synchronous.
Next, the influence of stiffness of coupling ε to synchronization accuracy is discussed.In this experiment, with T 0Be fixed on 2T Counter, for different ε, make d with step-length 100 traversals interval [100,10000], when calculating final result, cast out 15 groups of minimum and maximum data.Fig. 6 got respectively 1/16,1/8,1/4,1/2 o'clock for ε, and the standard deviation of synchronized result is with the situation of change of d.Similar with first experiment, the change procedure of standard deviation is divided into three phases.But two, the calculating of triphasic intersection point difference slightly, have for above-mentioned experiment condition
T min=2T counter=230400,T max=T 0+14d=230400+14d
A substitution mistake! Do not find Reference source.In, can get
230400 230400 + 14 d ( 1 + ϵ ) ≥ 1
Solve
d ≤ 115200 7 ϵ
When ε was respectively 1/16,1/8,1/4,1/2, the d that is calculated by following formula was respectively 1028,2057, and 4114,8228.This and experimental result are also coincide.
As shown in Figure 7, under same experiment condition, with the experimental result of step-length 10 traversals [1000,2000].For the displaying that makes the result clearer, ε=1/2, ε=1/4 and ε=1/8 is drawn in a) respectively, b) and c) in these three subgraphs.In this three width of cloth figure relatively, can find that the result is more stable when ε=1/4.Reason may be, when ε is very little, and a little less than the coupling too between two nodes, therefore can be destroyed easily; Therefore and when ε was too big, it is synchronous with other node that node is more prone to, and the coupling between two nodes can be influenced by other node again easily.Therefore, a stable synchronized result be obtained, a suitable ε value must be selected.
T has been discussed in above-mentioned experiment 0If ε and d influence the precision of synchronized result.Analysis by to experiment can draw as drawing a conclusion:
Not too little at d, and under the situation that synchronously conservation condition also can be satisfied, by can well be synchronous, best precision 100 delicate about.
T 0Determine the synchronous cycle, less T 0Can obtain the higher synchronous precision.The size of selection ε that must be careful, less and bigger ε can reduce synchronization accuracy.In sum, verified that by experiment this method can carry out obtaining synchronized result preferably synchronously to wireless sensor network node.

Claims (7)

1. a method that realizes the wireless sensor network time synchronized is characterized in that, may further comprise the steps:
The count initialized device;
The enabling counting device is opened interruption, the initiation message formation;
Revise the count value of linear oscillator according to the packet of receiving.
2. method according to claim 1 is characterized in that, described count initialized device comprises:
Mode of operation, the maximum count value of counter are set;
Node number and period T and stiffness of coupling are set.
3. method according to claim 1 and 2 is characterized in that, the period T of node i is set iFor:
T i=T 0+(i-1)*d
Wherein, T 0Radix for the cycle; D describes the cycle differentiation of adjacent numbered node.
4. according to the method described in the claim 1, it is characterized in that, also comprise:
Counter linear counting on the node sends one when count value arrives T and has comprised the packet that changes the node cycle, then counter is put 0, repeats this process;
Receiving node is received after the described packet that comprises the cycle, is used following formula to obtain the new count value of oneself
φ j ′ = φ j + T i T j ϵ
Wherein: φ ' jBe new count value; φ jBe the count value of receiving node counter before receiving packet; T iBe the cycle of sending node; T jBe the cycle of receiving node; ε is a stiffness of coupling.
5. method according to claim 4 is characterized in that: if described φ ' jResult of calculation exceed the periodic quantity of described receiving node, described receiving node is got back to initial value and is sent a packet that comprises the described receiving node cycle.
6. according to the method described in the right 1, it is characterized in that: the probability density function bounded in the cycle of described linear oscillator.
7. method according to claim 6 is characterized in that: the cycle of described linear oscillator satisfies
T min T max ( 1 + ϵ ) ≥ 1
Wherein: T MinMinimum value for the described linear oscillator cycle; T MaxMaximum for the described linear oscillator cycle; ε is a stiffness of coupling.
CN200910176914A 2009-09-24 2009-09-24 Method for realizing time synchronization in wireless sensor network Pending CN101692743A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910176914A CN101692743A (en) 2009-09-24 2009-09-24 Method for realizing time synchronization in wireless sensor network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910176914A CN101692743A (en) 2009-09-24 2009-09-24 Method for realizing time synchronization in wireless sensor network

Publications (1)

Publication Number Publication Date
CN101692743A true CN101692743A (en) 2010-04-07

Family

ID=42081392

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910176914A Pending CN101692743A (en) 2009-09-24 2009-09-24 Method for realizing time synchronization in wireless sensor network

Country Status (1)

Country Link
CN (1) CN101692743A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102811480A (en) * 2012-06-19 2012-12-05 中国科学院计算技术研究所 Wireless sensor network time synchronization method based on physical pulse coupling
CN104411008A (en) * 2014-10-24 2015-03-11 安徽理工大学 Consistency clock synchronization method for wireless sensor network event trigger
CN107995681A (en) * 2017-11-16 2018-05-04 全球能源互联网研究院有限公司 A kind of wireless sense network method for synchronizing time and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102811480A (en) * 2012-06-19 2012-12-05 中国科学院计算技术研究所 Wireless sensor network time synchronization method based on physical pulse coupling
CN102811480B (en) * 2012-06-19 2015-04-22 中国科学院计算技术研究所 Wireless sensor network time synchronization method based on physical pulse coupling
CN104411008A (en) * 2014-10-24 2015-03-11 安徽理工大学 Consistency clock synchronization method for wireless sensor network event trigger
CN104411008B (en) * 2014-10-24 2020-09-18 安徽理工大学 Event trigger consistency clock synchronization method for wireless sensor network
CN107995681A (en) * 2017-11-16 2018-05-04 全球能源互联网研究院有限公司 A kind of wireless sense network method for synchronizing time and device

Similar Documents

Publication Publication Date Title
CN102104475B (en) IEEE 1588-based synchronization system and synchronization method thereof
CN103281772B (en) A kind of method for synchronizing time of wireless sensor network and system
Kusy et al. Elapsed time on arrival: a simple and versatile primitive for canonical time synchronisation services
CN104737490B (en) Communicator, communication system and method for synchronizing time
CN102547969B (en) High-accuracy wireless clock synchronization system for power system
US11522627B2 (en) TSN enabled controller
CN101262330B (en) A quick high-precision time synchronization method for wireless sensor network with belt feature
CN104519563B (en) One kind layering wireless sensor network time synchronization method
CN101252404A (en) Distributed network clock synchronizing system and method based on FPGA
CN103067112B (en) Clock synchronizing method, device and the network equipment
CN101977104A (en) IEEE1588 based accurate clock synchronization protocol system and synchronization method thereof
CN104837197A (en) Method for synchronizing two-way time of wireless sensor network
CN108900292B (en) Error accumulation-free clock synchronization system applied to wireless sensor network
CN101902370A (en) Device, system and method for measuring frame delay
CN102811480A (en) Wireless sensor network time synchronization method based on physical pulse coupling
WO2019169820A1 (en) High-precision time synchronization method
CN101692743A (en) Method for realizing time synchronization in wireless sensor network
CN102412954B (en) Clock frequency synchronization method in packet based network
CN101719858B (en) Synchronous processing method of bit timing of control area network (CAN) controller
CN101257361A (en) Method and net element for performing accurate time transmission through synchronous digital system network
Kosanovic et al. Delay compensation method for time synchronization in wireless sensor networks
CN104735772B (en) A kind of device and method of Timing Synchronization
Capriglione et al. A step forward the on-line minimization of the synchronization events in TPSN
CN102394808A (en) Method and apparatus for phase adaption and frame alignment of serial media independent interface of ethernet network
CN107995681B (en) Time synchronization method and device for wireless sensor network

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20100407