SlideServe
Menu
Préférences
© SlideServe · v2026

Code Review Time Synchronization

ilund avatar
9 diapositives · 115 Views · Jan 06, 2020

This presentation discusses the code review of a time synchronization algorithm for sensor networks, covering clock, timer, global absolute timer, timestamping, and time synchronization.

Code Review 	Time Synchronization - slide 1
01 / 9Code Review Time Synchronization
1 / 17

Télécharger la présentation

Code Review Time Synchronization
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Code Review Time Synchronization Presented by Yong Chen Department of Computer Science University of Virginia

  2. Outline • Clock • Timer • GlobalAbsoluteTimer • TimeStamping • Time Synchronization

  3. Clock • Local time source • CPU clock: high resolution (7.37MHz), not stable, stops in power-down mode (SysTimeC) • External clock: low resolution, stable, keeps running in power-down mode • ClockC component • A high precision real time clock (with 1/32768 sec resolution) • The Clock interface (Clock.nc) has been extended to support the setting and retrieval of the current (actual) clock rate in 1/32768 second units.

  4. Timer • The new Timer component provides timers with 1/32768 sec resolution. • If two timers use the same timer id, timer["id"], only the later timer takes effect, the previous one would not work. so timer should be used like TimerC.Timer[unique("Timer")]; • Provide as many timers as needed • Change the setting of TIMER_NUM_TIMERS

  5. GlobalAbsoluteTimer • Triggered at the absolute time point instead of time interval as previous timer • The resolution is 1/1000 or 1/32768 second • If two timers use the same timer id, like GlobalAbsoluteTimer[id], only the later timer takes effect, the previous one would not work. so timer should be used like GlobalAbsoluteTimer[unique("AbsoluteTimer")] • Provide as many timers as needed • Change the setting of MAX_NUM_ABS_TIMERS

  6. TimeStamping • Time stamping is a time synchronization primitive: establishing time reference points between a sender and receiver(s) using a single radio message • Sender • Sender obtains timestamp when the message was actually sent in its own local time • The message can contain the local time of the sender at the time of transmission • Method addStamp() Adds a time stamp to the next message sent by the radio. This method must be called immediatelly after SendMsg.send() returns SUCCESS. • Receiver • Receiver obtains timestamp when the message was received in its own local time • Method getStamp() Returns the time stamp of the last received message. This method should be called when the ReceiveMsg.receive() is fired. The returned value contains the local time when the message was received.

  7. TimeSynchronization • Flooding Time Synchronization Protocol for Sensor Networks, VU • Each node maintains two time variables • Local Time • Represents the local physical time • Never reset or adjusted • Global Time • learns from its neighboring nodes. • Reflects the time of the network • Formula for Global Time and Local Time • globalTime = localTime + offsetAverage + skew* (localTime – localAverage) • variable offsetAverage, skew, and localAverage are decided by messages from neighboring nodes

  8. TimeSynchronization • Root • The network is synchronized to the root node • Sends out synchronization beacon messages periodically • Other nodes are synchronized to the root, after synchronized, it will send out synch beacons periodically • Who can be the root • The node Set isForceRoot = 1 • The node is set to be the root • The node Set isForceRoot = -1 • The node is never to be a root • The node Set isForceRoot = 0 • The node can be a root if it doesn’t receive any aynchronization message for a period of time • It is possible there are several roots simultaneously, if so, the root with smaller ID would dominate the network.

  9. TimeSynchronization • Comments • Actually, in the code, the isForceRoot is set to be either 1 or -1, so the code on isForceRoot == 0 can be eliminated. • some repeated statements • in command result_t StdControl.init() • outgoingMsg->rootID = 0xFFFF; • outgoingMsg->nodeID = TOS_LOCAL_ADDRESS; • in command result_t StdControl.start() • outgoingMsg->rootID = 0xFFFF; • outgoingMsg->nodeID = TOS_LOCAL_ADDRESS; • They can appear once in StdControl.init() only once