洪泛时钟同步协议PPT课件
无线传感器网络课件:时钟同步
时钟同步
9.2 时钟同步协议
时钟同步
9.2.1 NTP协议 互联网中,NTP协议用于协调每个主机时钟晶振的频率,通过层次化的时间服务器结构 实现主机间的时钟同步。在该层次化结构中,根节点和UTC(世界标准时间)同步,各层中的 时间服务器与它们子网中的节点时钟同步。
NTP同步的精确度是毫秒级的,然而,NTP协议假设两台主机之间在两个方向上的传输 时延是相同的,这种假设在互联网中是合理的。在大规模网络中,尽管NTP协议能够提供很 好的时钟同步,但传感器网络的许多特征使得该协议不适合。使用NTP协议协调传感器节点 的时钟晶振很有用,但由于传感器节点的频繁故障,使得传感器节点与时间服务器的连接 可能存在问题。另外,由于环境干扰、感知区域不同部分间的时延差别较大等的影响,很 难要求同步所有传感器节点,并且传感器网络由于故障等影响,可能使网络断开连接而成 为多个小的感知区域。
时钟同步
2.同步阶段 同步阶段中,沿着层发现阶段建立的层次化树结构的边,TPSN使用成对同步,即每个 第i层上的节点用第i-1层上节点时钟同步自己的时钟。在t1时刻节点j发布包含节点层编号和 时间戳的同步脉冲,在t2时刻节点k收到该消息,并在t3时刻用确认消息响应,该响应消息包 含时间信息t1、t2、t3和节点k的层编号。最后,节点j在t4时刻收到节点k发送的消息。TPSN 假定传播时延为D,并且在同步期间时钟偏移没有改变,由于t1和t4是使用节点j的时钟测量 的,t2和t3是使用节点k的时钟测量的,所以这些时间满足下面的关系:
计算机网络通信原理同步技术课件
PPT文档演模板
计算机网络通信原理同步技术
2PSK的正频域频谱图
= A·AcSc(t) /2+ A·AcSc(t)/2+cos2cosωct+ ½ Ac2sin2ωct • 通过低通滤波器得到 A·AcSc(t)/2
• 如果用Accosωct时,得到 AcSc(t)/2+ Ac /2
注意:直流分量Ac /2对抽样判决有干扰。
PPT文档演模板
计算机网络通信原理同步技术
PPT文档演模板
计算机网络通信原理同步技术
SSB、DSB信号简介
• 假设无线电音频信号频率为500Hz,载波频率为10MHz, 那么调制后信号将产生的主要频率: 10MHz + 500Hz=10.0005MHz —— 上边带(USB) 10MHz - 500Hz= 9.9995MHz —— 下边带(LSB)
• 异步传输又称起止式传输,它采用独特的起始信号(起 始位)和终止信号(结束位)来限定每个字符,按位逐 次地传输,因此其传输效率较低。
PPT文档演模板
计算机网络通信原理同步技术
同步传输
• 在同步传输中以数据块为单位发送比特流。数据块加上前 缀、后缀和控制信息形成了帧。
• 为了防止时钟漂移,保证接收端接收的每一位数据都和发 送端准确地保持同步,常用的方式有内同步和外同步。
时域插入导频法接收端电路框图
PPT文档演模板
计算机网络通信原理同步技术
PTP及协议介绍PPT学习教案
PTP及协议介绍
会计学
1
PTP简介
在通信网络中,许多业务的正常运行 都要求 网络时 钟同步 ,即整 个网络 各设备 之间的 时间或 频率差 保持在 合理的 误差水 平内。 网络时 钟同步 包括以 下两个 概念: ➢ 时间同步(Phase synchronization) :也叫相位同步,是指信号之间的 频率和 相位都 保持一 致,即 信号之 间的相 位差恒 为零。 ➢ 频率同步(Frequency synchronization):也叫时钟同步 ,是指 信号之 间在频 率或相 位上保 持某种 严格的 特定关 系,信 号在其 对应的 有效瞬 间以同 一平均 速率出 现,以 保证通 信网络 中的所 有设备 都以相 同的速 率运行 ,即信 号之间 保持恒 定的相 位差。
5
第4页/共22页
PTP基本概念
图 2 基本时钟节点示意图
6
第5页/共22页
PTP基本概念
4. 主从关系 主从关系(Master-Slave)是相对而 言的, 对于相 互同步 的一对 时钟节 点来说 ,存在 如下主 从关系 : ➢ 发布同步时间的节点称为主节点,而 接收同 步时间 的节点 则称为 从节点 。 ➢ 主节点上的时钟称为主时钟,而从节 点上的 时钟则 称为从 时钟。 ➢ 发布同步时间的端口称为主端口,而 接收同 步时间 的端口 则称为 从端口 。
PTN时钟同步技术
同步以太网原理
分组网络中的同步以太网技术是一种采用以太网链路码流恢复时钟的技术。以太网物理层编码采用 4B/5B(FE)和8B/10B(GE)技术,平均每4个比特就要插入一个附加比特,这样在其所传输的数据码 流中不会出现连续4个1或者4个0,可有效地包含时钟信息。在以太网源端接口上使用高精度的时 钟发送数据,在接收端恢复并提取这个时钟,时钟性能可以保持高精度。
同步以太网原理
以上有不当之处,请大家给与批评指正, 谢谢大家!
14
基本概念
时间源:
为本地设备提供时钟信号的设备叫做时钟源,本地设备可以 有多个时钟源。
SSM:
同步状态信息SSM(Synchronization Status Message),也称 同步质量信息。在同步定时传递链路中,SSM直接反应同步 定时信号的等级。
为什么要进行时钟同步?
传送网中首先要解决的问题就是同步,因为只有保证 发送端在发送数字脉冲信号时将脉冲放在特定的时隙 中,并且接收端能够在特定的时隙将该脉冲提取出来, 才能保证发送端和接收端正常通信。而这种保证发送 端/接收端在某一特定时隙发送/提取信号的功能是通 过时钟实现的。
通过时钟板提供的时钟接口,跟踪更高级别的时钟。
线路时钟源
由时钟板从线路信号中提取时钟信号。
设备内部时钟源
使用本设备提供的基准时钟(如时钟板提供的时钟),作为 本端口的工作时钟。
同步状态信息编码
在SDH传输网中,SSM是通过SDH段开销中的S1字节的低四位b5~b8 来传送的;而在BITS设备中,SSM是通过2Mbit/s时钟信号的第一时隙 (TS0)的某个bit来传送的。可见,2MHz时钟信号不能携带SSM信息。
跟踪:
跟踪锁定上一级时钟提供的时钟源
洪泛时钟同步协议
Miklos等
什么是FTSP
O 泛洪时间同步协议(Flooding Time
Synchronization Protocol)由Vanderbilt大学 Miklos,Branislav等提出,目标是实现整个网络 的时间同步并且误差控制在微秒级。该算法使 用单个广播消息实现发送节点与接收节点之间 的时间同步。 O 多跳的FTSP协议采用层次结构,根节点为同 步源,可以适应大量传感器节点,对网络拓扑 结构的变化和根节点的失效有健壮性,精确度 较好。该算法通过采用MAC层时间戳和线性回 归偏差补偿弥补了相关的错误源。
FTSP时钟同步
O 1. 本地 和 全局 时钟
O 每个节点都包含一个本地时钟和一个全局时钟。过去和将来
的时间实体都被翻译为两种格式(可能是本地格式和全局格 式) O 本地时钟和全局时钟的时钟偏移(offset)和时钟脉冲相位差 (skew)都采用线性回归算法估算 O 优化的提高计算结果的数值精度的方式是将时钟脉冲相位差 规格化为0(对倾斜减去1有效) O 处理本地和全局时钟溢出(采用32位整数)
A
B
C
D
E
F
第一个基准点关闭 所有的节点 都开启
关闭50%节点 所有已关闭节点 重新打开
随机关闭一些节点
avg. error: 1.6 µs max. error: 6.1 µs per hop
与RBS和TPSN的对比
1. RBS 参考广播同步
O
未补偿的延迟:传播,解码,字节对齐,中断处理和接收时 间 O 网络常规费用:每个同步时期平均1.5个消息 O 层次结构: 时标变换聚合
洪泛时钟同步协议
运行时间) O 接收方获得时间戳并记录接收到消息的本地时间
O 算法:
O 多个时间戳(包括了发送方和接收方产生的)位于字节边界 O 时间戳被做规格化和统计地处理,并且发送方和接收方都会
差生一个时间戳 O 发送方的最终时间戳可以被嵌入到消息中
O 用法:
O 多个时间同步协议 O 声觉测距 O 射手本地化(路由时隐含时间同步)
cpu:
发送方
中断处理 radio: 编码 天线: 传播 天线: 解码
接收方
radio: 字节对齐 radio: 中断处理 cpu:
FTSP时间戳
O 时间同步原语:用单个无线电消息估算发送方和接收方之
间的时间参照点
O 发送方在消息发送时获取本地时间作为时间戳 O 消息可以包含发送方在传输时的本地时间(或者一个事件的
O 2. 层次
O 全局时间被同步为选定的基准点(elected leader)的本地时间 (elected leader) O 使用异步扩散:每个节点每30s发送一个同步消息,常数的网
络负载 O 每个消息都有一个序列号,这个序列号每次只能被基准点加1 O 持续操作,其启动时间是网络半径时间60s
O 3. 鲁棒性(健壮性)
O 2. TPSN 传感器网络定时同步协议
O O O O O O
未补偿的延迟: 编码,解码,中断处理时间 网络常规费用: 每个同步周期平均2个消息 层次结构:伸展树(生成树)
O 3. FTSP 洪泛时钟同步协议
为补偿的延迟: 传播时间 网络常规费用: 每个同步周期1个消息 端对端精确度: MICA2平台上每跳平均误差1.6微秒,最大 误差6.1微秒 O 鲁棒性: 节点可以随时进入和离开网络,链接可以失效, 节点可以移动 O 启动: 两倍的直径同步时期
FTSP 洪泛时钟同步协议
The Flooding Time Synchronization ProtocolMiklós Maróti Branislav Kusy Gyula Simon Ákos LédecziInstitute for Software Integrated SystemsVanderbilt University2015 Terrace Place, Nashville, TN 37203, USAPhone: (+1) 615-343-7472e-mail: {miklos.maroti, branislav.kusy, gyula.simon, akos.ledeczi}@ABSTRACTWireless sensor network applications, similarly to other distributed systems, often require a scalable time synchronization service enabling data consistency and coordination. This paper describes the Flooding Time Synchronization Protocol (FTSP), especially tailored for applications requiring stringent precision on resource limited wireless platforms. The proposed time synchronization protocol uses low communication bandwidth and it is robust against node and link failures. The FTSP achieves its robustness by utilizing periodic flooding of synchronization messages, and implicit dynamic topology update. The unique high precision performance is reached by utilizing MAC-layer time-stamping and comprehensive error compensation including clock skew estimation. The sources of delays and uncertainties in message transmission are analyzed in detail and techniques are presented to mitigate their effects. The FTSP was implemented on the Berkeley Mica2 platform and evaluated in a 60-node, multi-hop setup. The average per-hop synchronization error was in the one microsecond range, which is markedly better than that of the existing RBS and TPSN algorithms.Categories and Subject DescriptorsC.2 [COMPUTER-COMMUNICATION NETWORKS]: Network Architecture and Design, Network Protocols.General TermsAlgorithms, Design, Performance, Reliability, Experimentation. KeywordsSensor Networks, Time Synchronization, Clock Synchronization, Clock Drift, Multi-hop.1.INTRODUCTIONThe advances in micro electro-mechanical systems (MEMS) technology, in digital circuits design, integration and packaging, and in wireless communication are leading to smaller, cheaper and low-power sensing and computing devices. Cell phones and handheld computers already enjoy the increased popularity of the public. These trends point towards radically new systems of thousands or even millions of tiny computing devices interacting with the environment and communicating with each other. Research teams are working on incorporating sensing, processing and communication in a volume of less than one cubic millimeter [6], while devices of the size of a coin built from off-the-shelf components are commercially available already. The UC Berkeley Mica2 and Mica2Dot motes are popular research platforms of this emerging technology [19].Complex networks built from thousands of such devices are expected to affect many aspects of our lives. The potential applications of wireless sensor networks (WSN) include: •Monitoring applications: Non-intrusive and non-disruptive environmental monitoring helps biologists to study sensitive wildlife habitats and people with certain medical conditions can receive constant monitoring through sensors [12]. Sensor networks monitor the structural health of the Golden Gate Bridge in San Francisco and the microclimates on Great Duck Island, Maine [9].•Mobile commerce, inventory management: by measuring continuously changing conditions, WSN will influence the movement of commodities to locations where the need exists. •Smart office, kindergarten: systems containing wireless sensors will be an integral part of our office space. They would improve the education process by tailoring it to the individual needs of a child [14], adapt to context, and coordinate activities of multiple children.•Military applications: potential applications include surveillance, target tracking [15], countersniper systems [10] or battlefield monitoring that propagates information to the soldiers and vehicles involved in combat.WSN are large-scale distributed systems, yet their unique characteristics, especially the severe resource constraints, require the reevaluation of traditional distributed algorithms for problems once considered to be solved. One of the basic middleware services of sensor networks is time synchronization. Time synchronization is required for consistent distributed sensing and control. Furthermore, common services in WSN, such as coordination, communication, security, power management or distributed logging also depend on the existence of global time.In this paper, we describe the Flooding Time Synchronization Protocol (FTSP) for WSN in detail. When designing the FTSP, our goals were to achieve network-wide time synchronization with error in the micro-second range and scalability up toPermission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee.SenSys’04, November 3–5, 2004, Baltimore, Maryland, USA. Copyright 2004 ACM 1-58113-879-2/04/0011…$5.00.hundreds of nodes, while being robust to network topology changes and link and node failures. The proposed algorithm compensates for the relevant error sources by utilizing the concepts of MAC layer time-stamping [3], [7] and skew compensation with linear regression [2]. While these ideas have been utilized before, their unique combination and its effective implementation yield significantly better precision and somewhat lower communication overhead than existing approaches on the same platform. Finally, the implicit dynamic topology management of the FTSP provides rapid convergence and robustness.The algorithm was implemented on Mica/Mica2 platforms running the TinyOS operating system [4]. A short overview of the target platform is given in Section 2. We offer a survey of existing time synchronization algorithms, emphasizing the algorithms utilizing similar ideas as FTSP, in Section 3. The possible sources of errors of radio message based synchronization are described and analyzed in Section 4. We describe the proposed FTSP algorithm in details and evaluate it based on a large scale experiment in Section 5. In Section 6, we compare FTSP to existing algorithms. Finally, an application using FTSP is described in Section 7 and we offer our conclusions and plans for further improvements in Section 8.2.THE TARGET PLATFORMOne of the most widely used WSN platforms is the Berkeley Mica2 mote [19], [4]. The Mica2 mote has a 7.37 MHz processor, 4 kB of RAM, 128 kB of flash memory, 433 MHz wireless radio transceiver (38.4 kbps transfer rate, 500 feet maximum range), and is powered by two AA batteries. Pluggable sensor boards with temperature, light, magnetic and other sensors are available.The Berkeley motes run the TinyOS operating system [4], [17], an open source, event driven and modular OS designed to be used with networked sensors. TinyOS handles task scheduling, radio communication with error detection, clocks and timers, ADC, I/O and EEPROM abstractions, and power management. Application developers can select a subset of the modules implementing these functionalities, extend or override them if necessary, and statically compile them into the final executable.3.APPROACHES TO TIME SYNCHRONIZATIONTime synchronization algorithms providing a mechanism to synchronize the local clocks of the nodes in the network have been extensively studied in the past. The most widely adapted protocol used in the internet domain is the Network Time Protocol (NTP) devised by Mills [11]. The NTP clients synchronize their clocks to the NTP time servers with accuracy in the order of milliseconds by statistical analysis of the round-trip time. The time servers are synchronized by external time sources, typically using GPS. The NTP has been widely deployed and proved to be effective, secure and robust in the internet. In WSN, however, non-determinism in transmission time caused by the Media Access Channel (MAC) layer of the radio stack can introduce several hundreds of milliseconds delay at each hop. Therefore, without further adaptation, NTP is suitable only for WSN applications with low precision demands.Two of the most prominent examples of existing time synchronization protocols developed for the wireless sensor network domain are the Reference Broadcast Synchronization (RBS) algorithm [2] and the Timing-sync Protocol for Sensor Networks (TPSN) [3].In the RBS, a reference message is broadcasted. The receivers record their local time when receiving the reference broadcast and exchange the recorded times with each other. The main advantage of RBS is that it eliminates transmitter-side non-determinism. The disadvantage of the approach is that additional message exchange is necessary to communicate the local time-stamps between the nodes. To our best knowledge the algorithm has not been extended to large multi-hop networks.The TPSN algorithm first creates a spanning tree of the network and then performs pairwise synchronization along the edges. Each node gets synchronized by exchanging two synchronization messages with its reference node one level higher in the hierarchy. The TPSN achieves two times better performance than RBS by time-stamping the radio messages in the Medium Access Control (MAC) layer of the radio stack [3] and by relying on a two-way message exchange. The shortcoming of TPSN is that it does not estimate the clock drift of nodes, which limits its accuracy, and does not handle dynamic topology changes.4.UNCERTAINTIES IN RADIO MESSAGE DELIVERYNon-deterministic delays in the radio message delivery in WSN can be magnitudes larger than the required precision of time-synchronization. Therefore, these delays need to be carefully analyzed and compensated for. We shall use the following decomposition of the sources of the message delivery delays first introduced by Kopetz and Ochsenreiter [7], [8] and later extended in [3] and [5].(1)Send Time—time used to assemble the message and issue thesend request to the MAC layer on the transmitter side.Depending on the system call overhead of the operating system and on the current processor load, the send time is nondeterministic and can be as high as hundreds of milliseconds.(2)Access Time—delay incurred waiting for access to thetransmit channel up to the point when transmission begins.The access time is the least deterministic part of the message delivery in WSN varying from milliseconds up to seconds depending on the current network traffic.(3)Transmission Time—the time it takes for the sender totransmit the message. This time is in the order of tens of milliseconds depending on the length of the message and the speed of the radio.(4)Propagation Time—the time it takes for the message totransmit from sender to receiver once it has left the sender.The propagation time is highly deterministic in WSN and it depends only on the distance between the two nodes. This time is less than one microsecond (for ranges under 300 meters).(5)Reception Time—the time it takes for the receiver to receivethe message. It is the same as the transmission time. The transmission and reception times overlap in WSN as pictured in Figure 1.(6)Receive Time—time to process the incoming message and tonotify the receiver application. Its characteristics are similar to that of send time.Figure 1.Decomposition of the message delivery delay over a wireless link.The RBS approach completely eliminates the send and access times, and with minimal OS modifications it is also possible to remove the receive time uncertainty. This leaves the mostly deterministic propagation and reception time in wireless networks as the sole source of error. The main strength of RBS is its broad applicability to commodity hardware and existing software in sensor networks as it does not need access to the low levels of the operating system.As the authors of the TPSN protocol observed, on typical WSN platforms, such as the Mica2 mote, one has direct access to the MAC layer, and message time-stamping can be performed during message transmission and reception. This immediately eliminates the same three main sources of uncertainties as in RBS. With a two-way handshake of synchronization messages the TPSN protocol eliminates the unknown propagation time as well.Both the RBS and TPSN protocols suffer from the uncertainties of the overlapping transmission and reception times. To fully understand the constituents of this uncertainty we shall describe the message propagation in a typical wireless channel in more detail. We imagine an idealized point of the transmitted message, such as the end of a particular byte of the message. Then we follow the transmission of this idealized point through the software, hardware and physical levels of the wireless channel from the sender to the receiver.First, the message is transferred to the radio chip piece by piece, usually in a byte oriented fashion. The radio chip signals the microcontroller that it is ready to obtain the next piece. The radio chip then encodes the pieces and generates an electromagnetic wave through the antenna. This wave propagates through space and the receiver’s radio chip converts it back to binary representation. Then the radio chip on the receiver side signals the microcontroller that a new piece of data is ready and can be read through some protocol. Therefore, we have the following delivery delays of an idealized point of the message.(7)Interrupt Handling Time—the delay between the radio chipraising and the microcontroller responding to an interrupt.This time is mostly less than a few microsecond (waiting for the microcontroller to finish the currently executed instruction), however when interrupts are disabled this delay can grow large.(8)Encoding Time—the time it takes for the radio chip toencode and transform a part of the message to electromagnetic waves starting from the point when it raised an interrupt indicating the reception of the idealized pointfrom the microcontroller. This time is deterministic and is in the order of a hundred microseconds.(9)Decoding Time—the time it takes for the radio chip on thereceiver side to transform and decode the message from electromagnetic waves to binary data. It ends when the radio chip raises an interrupt indicating the reception of the idealized point. This time is mostly deterministic and is in the order of hundred microseconds. However, signal strength fluctuations and bit synchronization errors can introduce jitter.Some radio chips cannot capture the byte alignment of the transmitted message stream on the receiver side and the radio stack has to determine the bit offset of the message from the alignment of a known synchronization byte and then shift the message accordingly. Since the transmission time of the byte is a few hundred microseconds at 38.4 kbps, the delay caused by the incorrect byte alignment must be compensated for. This compensation is performed by the implementation of TPSN on the Mica2 platform, but it is not reported in [3].(10)Byte Alignment Time—the delay incurred because of thedifferent byte alignment of the sender and receiver. This time is deterministic and can be computed on the receiver side from the bit offset and the speed of the radio.Figure 2.The timing of the transmission of an idealized point in the software (cpu), hardware (radio chip) and physical (antenna) layers of the sender and the receiver.Figure 2 summarizes the decomposition of delivery delay of the idealized point of the message as it traverses over a wireless channel. Each line represents the time line of the layer as measured by an ideal clock. The dots represent the time instance when the idealized point of the message crosses the layers. The triangles on the first and last line represent the time when the cpu makes the time-stamps. Depending on the specific hardware the time stamp is usually recorded by the microcontroller when it handles the radio chip interrupts both on the sender and receiver sides. Alternatively, capture registers provided by some hardware can be employed to eliminate the interrupt handling time. We do not consider the effect of various coding techniques, such as Manchester or SECDEC coding or forward error-correction schemes, to the timing of message transmission. The codes usedin practice are block codes, and we can assume that the idealized point of the message is at a block boundary.On the Mica2 platform, the interrupt handling time is typically around 5µs depending on the length of the code path between the start of interrupt handler and the part that records the local time. However, we observed interrupt handling times as high as 30µs. The sum of encoding and decoding times is between 110µs and 112µs. The byte alignment time is between 0µs (for bit offset 0) and 365µs (for bit offset 7). In contrast, the propagation time is under 1µs. Table 1 summarizes the magnitudes and distribution of the various delays in message transmissions.Table 1.The sources of delays in message transmissions Time Magnitude DistributionSend and Receive 0 – 100 ms nondeterministic,depends on theprocessor loadAccess 10 – 500 ms nondeterministic,depends on thechannel contentionTransmission / Reception 10 – 20 ms deterministic,depends on messagelengthPropagation < 1µs for distancesup to 300 meters deterministic, depends on the distance between sender and receiverInterrupt Handling < 5µs in mostcases, but can be ashigh as 30µsnondeterministic,depends on interruptsbeing disabledEncoding plus Decoding 100 – 200µs,< 2µs variancedeterministic,depends on radiochipset and settingsByte Alignment 0 – 400µs deterministic, can becalculatedUsing our definitions we can properly express the sources of time-stamping errors of the RBS and TPSN algorithms. The RBS protocol is sensitive to the propagation, decoding and interrupt handling time differences between the two receivers. The main source of error here is the jitter in interrupt handling and decoding. The TPSN protocol is sensitive to the encoding, decoding and interrupt handling time differences between the sender and receiver. Note that although the propagation time has been eliminated, the encoding and decoding times are not because they might not be the same on the sender and receiver side. It is important to point out that both the RBS and TPSN protocols suffer from the two largest sources of uncertainty of MAC layer time-stamping: the jitter of interrupt handling and decoding time. On the other hand, as we will see in the next section, the FTSP time-stamping protocol effectively reduces all sources of time-stamping errors except for the propagation time.5.FLOODING TIME SYNCHRONIZATION PROTOCOLThe goal of the FTSP is to achieve a network wide synchronization of the local clocks of the participating nodes. We assume that each node has a local clock exhibiting the typical timing errors of crystals and can communicate over an unreliable but error corrected wireless link to its neighbors.The FTSP synchronizes the time of a sender to possibly multiple receivers utilizing a single radio message time-stamped at both the sender and the receiver sides. MAC layer time-stamping can eliminate many of the errors, as observed in [16] and [3]. However, accurate time-synchronization at discrete points in time is a partial solution only. Compensation for the clock drift of the nodes is inevitable to achieve high precision in-between synchronization points and to keep the communication overhead low. Linear regression is used in FTSP to compensate for clock drift as suggested in [2].Typical WSN operate in areas larger than the broadcast range of a single node; therefore, the FTSP provides multi-hop synchronization. The root of the network—a single, dynamically (re)elected node—maintains the global time and all other nodes synchronize their clocks to that of the root. The nodes form an ad-hoc structure to transfer the global time from the root to all the nodes, as opposed to a fixed spanning-tree based approach proposed in [3]. This saves the initial phase of establishing the tree and is more robust against node and link failures and dynamic topology changes.5.1Time-stampingThe FTSP utilizes a radio broadcast to synchronize the possibly multiple receivers to the time provided by the sender of the radio message. The broadcasted message contains the sender’s time stamp which is the estimated global time at the transmission of a given byte. The receivers obtain the corresponding local time from their respective local clocks at message reception. Consequently, one broadcast message provides a synchronization point (a global-local time pair) to each of the receivers. The difference between the global and local time of a synchronization point estimates the clock offset of the receiver. As opposed to the RBS protocol, the time stamp of the sender must be embedded in the currently transmitted message. Therefore, the time-stamping on the sender side must be performed before the bytes containing the time stamp are transmitted.Figure 3.Data packets transmitted over the radio channel. Solid lines represent the bytes of the buffer and the dashed lines are the bytes of packets.Message broadcast starts with the transmission of preamble bytes, followed by SYNC bytes, then with a message descriptor followed by the actual message data, and ends with CRC bytes. During the transmission of the preamble bytes the receiver radio synchronizes itself to the carrier frequency of the incoming signal. From the SYNC bytes the receiver can calculate the bit offset it needs to reassemble the message with the correct byte alignment. The message descriptor contains the target, the length of the data and other fields, such as the identifier of the application layer thatneeds to be notified on the receiver side. The CRC bytes are used to verify that the message was not corrupted. The message layout is summarized in Figure 3.The FTSP time-stamping effectively reduces the jitter of the interrupt handling and encoding/decoding times by recording multiple time stamps both on the sender and receiver sides. The time stamps are made at each byte boundary after the SYNC bytes as they are transmitted or received. First, these time stamps are normalized by subtracting an appropriate integer multiple of the nominal byte transmission time, the time it takes to transmit a byte. The jitter of interrupt handling time is mainly due to program sections disabling interrupts on the microcontroller for short amounts of time. This error is not Gaussian, but can be eliminated with high probability by taking the minimum of the normalized time stamps. The jitter of encoding and decoding time can be reduced by taking the average of these interrupt error corrected normalized time stamps. On the receiver side this final averaged time stamp must be further corrected by the byte alignment time that can be computed from the transmission speed and the bit offset. Note that, even though multiple time stamps are made, only the final error corrected time stamp is embedded into the message. The number of bytes put an upper limit on the achievable error correction using this technique. However, with only 6 time stamps, the time-stamping precision can be improved from tens of microseconds to 1.4µs on the Mica2 platform as measured by the following experiment.Four motes were sending time-stamped messages to each other for 10 minutes, each with a 5-second sending period. The time-stamps were recorded both on the sender and receiver sides, and the pairwise clock offset and skew values were determined off-line with linear regression. The time-stamping error is the absolute value of the difference of the recorded receiver side time stamp and the linearly corrected sender side time-stamp. The average and maximum time-stamping errors were 1.4µs and 4.2µs, respectively. Since the FTSP time-stamping employs a single radio message, it does not and cannot compensate for the propagation delay. This is not a major limitation of the approach in typical WSN, however, as the propagation delay is less than 1µs for up to 300 meters.5.2Clock drift managementIf the local clocks had the exact same frequency and, hence, the offset of the local times were constant, a single synchronization point would be sufficient to synchronize two nodes. However, the frequency differences of the crystals used in Mica2 motes introduce drifts up to 40µs per second. This would mandate continuous re-synchronization with a period of less than one second to keep the error in the micro-second range, which is a significant overhead in terms of bandwidth and energy consumption. Therefore, we need to estimate the drift of the receiver clock with respect to the sender clock.The offset between the two clocks changes in a linear fashion provided the short term stability of the clocks is good. We verified the stability of the 7.37 MHz Mica2 clock by periodically sending a reference broadcast message that was received by two different motes. The two motes time-stamped the reference message using the FTSP time-stamping described in the previous section with their local time of arrival and reported the time-stamp. For each transmitted message the offset of the two reported time-stamps was calculated. The offsets were further examined: linear-regression was used to find the line L best approximating the dataset and the errors were analyzed. For a data point (time,offset) and the regression line L, the error is offset-L(time). A one hour experiment produced the following results: the average value of the absolute errors was 0.95µs and the maximum absolute error was 4.32µs. The distribution of the errors, calculated off-line is shown in Figure 4. This off-line regression provides the best prediction that can possibly be achieved, provided the clocks can be considered stable during the experiment. Naturally this method cannot be used online; it is used here as a reference to evaluate online solutions.Figure 4.The distribution of the errors of linear-regression (LR): off_line refers to off-line LR, 30sec refers to time sync interval P=30s, query interval 18s, and 300sec refers to time sync interval P=300s, query interval 93s.We need to identify the trend of the global time relative to the local time from the data points received in the past. Furthermore, only a limited number of data points can be stored due to the memory constraints of the platform. The following scenario was used to test our Mica2 implementation: mote A maintains the global time and sends synchronization messages to mote B with a period of T. Mote B estimates the skew and offset of its local clock from that of A using linear regression on the past 8 data points. A reference broadcaster sends a query message with period t and both A and B respond to this query by time-stamping itsarrival with the global time and reporting it to the base station. Figure 5.Time synchronization error between two motes. The time synchronization was stopped after 30 minutes. The initial small error of the skew estimate results in increasing synchronization error over time.The linear regression prediction error is the difference between the global time given by A and the estimated global time given by B. Figure 4 shows the distribution of these prediction errors, for (a) T=30s, t=18s, and (b) T=300s, t=93s. The length of experiment (a) was 18 hours, the average absolute error was 1.48µs, and the maximum absolute error was 6.48µs. The length of experiment (b) was 8 hours, the average absolute error was 2.24µs and the maximum absolute error was 8.64µs.An important design parameter is the required resynchronization interval to reach the desired precision. As shown in Figure 4, the 30s resynchronization interval gave slightly better results than 300s. To further evaluate the behavior of the skew compensation, another experiment was carried out, the results shown in Figure 5. This result shows that the resynchronization period, depending on the accuracy requirements, can go up to several minutes.5.3Multi-hop time synchronizationIn practical WSN applications, the network radius is greater than one hop. If network-wide synchronization is required, the multi-hop FTSP protocol can be used, as described in this section. The only assumption the protocol makes is that every node in the network has a unique ID.Nodes in multi-hop FTSP utilize reference points to perform synchronization. A reference point contains a pair of global and local time stamps where both of them refer to the same time instant, as described in Section 5.1. Reference points are generated by sending and receiving periodic broadcast messages, which are either transmitted by the synchronization-root (root, for short), or any synchronized node in the network. The root is a special node, elected and dynamically reelected by the network, to which the whole network is being synchronized. A node that is in the broadcast radius of the root can collect reference points directly from it. Nodes outside the broadcast radius of the root can gather reference points indirectly through other synchronized nodes that are located closer to the root. When a node collects enough consistent reference points, it estimates the offset and skew of its own local clock, as described in Section 5.2, and becomes synchronized. The newly synchronized node can then broadcast synchronization messages to other nodes in the network. In the following subsections the most important aspects of the protocol will be presented.Synchronization Message Format: Each synchronization message contains three fields: the timeStamp, the rootID, and the seqNum. The timeStamp contains the global time estimate of the transmitter when the message was broadcasted. The rootID field contains the ID of the root, as known by the sender of the message. The seqNum is a sequence number set and incremented by the root when a new synchronization round is initiated. Other synchronized nodes insert the most recent (i.e. the largest) received seqNum into the synchronization messages they broadcast. This field is used to handle redundant synchronization messages.Managing Redundant Information: Since all synchronized nodes periodically transmit synchronization messages, in a dense network a receiver may receive several messages from different nodes in a short time interval. Due to limited resources, an appropriate subset of the messages must be selected to create reference points. In the Mica2 implementation an eight-element regression table stores the selected reference points used to calculate the regression line, and, thus, the drift of the local clock. To achieve more accurate offset and skew estimation using the limited amount of data that can be stored in the regression table, it is more beneficial to store reference points that are distributed over a longer period of time. To aid message filtering, each node maintains a highestSeqNum variable. Also each node has a myRootID variable, containing the root ID as known by the node.A received synchronization message is used to create a reference point only if the rootID field of the message is less than or equal to myRootID and the seqNum field is greater than highestSeqNum in the case when rootID = myRootID. The node’s variables are updated after storing a reference point, according to the respective fields in the message. This message filtering protocol guarantees that only the first message arrived will be used in the reference table for each rootID and seqNum pair (i.e. one per round), providing reference points distributed over a longer time period for more accurate skew and offset estimation. The pseudo-code describing this protocol is presented at lines 3–9 in Figure 6 and 11–16 in Figure 7.The root election problem: To perform global synchronization, obviously one and only one root is needed in the network. Since nodes may fail or the network can get disconnected, no dedicated node can play the role of the root. Thus a robust election process is needed to provide a root after startup, and also in case of root failure. FTSP utilizes a simple election process based on unique node IDs, as follows:Figure 6.The handling of new synchronization messages. When a node does not receive new time synchronization messages for ROOT_TIMEOUT number of message broadcast periods, it declares itself to be the root (myRootID := myID). Thus after a ROOT_TIMEOUT period, there will be at least one, but possibly multiple roots in the network. Whenever a node receives a message with a rootID field smaller than its myRootID variable, it updates the variable according to the received rootID field. This mechanism ensures that roots with higher IDs give up their status and eventually there will be only one root—the node with the smallest ID—in the whole network. The pseudo-code describing1 event Radio.receive(TimeSyncMsg *msg)2 {3 if( msg->rootID < myRootID )4 myRootID = msg->rootID;5 else if( msg->rootID > myRootID6 || msg->seqNum <= highestSeqNum )7 return;89 highestSeqNum = msg->seqNum;10 if( myRootID < myID )11 heartBeats = 0;1213 if( numEntries >= NUMENTRIES_LIMIT14 && getError(msg) > TIME_ERROR_LIMIT )15 clearRegressionTable();16 else17 addEntryAndEstimateDrift(msg);18 }。
时钟模拟课件
总结词
未来时钟模拟技术的发展将更加注重精度、速度和效率, 同时也将不断探索新的应用领域和发展方向。
要点二
详细描述
随着电子系统的发展和对时钟信号要求的不断提高,未来 时钟模拟技术将不断进步和完善。同时,新的应用领域和 市场也将不断涌现,为时钟模拟技术的发展提供更多的机 会和挑战。
06 时钟模拟的实际案例分析
在实时操作系统中,调度和 任务管理是非常关键的要素 。通过时钟模拟,研究人员 可以验证实时操作系统的调 度算法和任务管理的正确性 和可靠性,确保系统在实时 任务处理中能够高效运行。
实时操作系统仿真的时钟模 拟案例主要采用实时操作系 统(如RTLinux或VxWorks )和仿真软件(如RTEMS或 Wind)进行模拟。
在实时操作系统(RTOS)仿真中,时钟模拟也是一项关键 技术。RTOS是实时应用程序的核心,需要精确控制任务调 度和时间管理。
通过时钟模拟,可以模拟RTOS在不同时钟条件下的行为 ,对RTOS进行测试和验证。这有助于确保RTOS的正确性 和可靠性,提高实时应用程序的性能和稳定性。
通信系统仿真
通信系统仿真中,时钟模拟同样发挥着重要作用。通信系统通常需要高度同步的时钟信号来确保数据 传输的可靠性和性能。
02
时钟模拟可以模拟各种类型的时 钟信号,如晶体振荡器、石英振 荡器等,以及各种时钟源的特性 ,如频率、占空比、偏置等。
时钟模拟的重要性
时钟模拟在电子系统设计和测试中具有重要意义,特别是在数字电路和数字信号处 理中。
通过时钟模拟,工程师可以预测和验证电路的行为,以及在不同时钟源和时钟配置 下的性能。
详细描述
开发人员使用嵌入式操作系 统进行时钟管理和任务调度 ,然后通过仿真软件进行时 钟模拟。仿真软件能够模拟 嵌入式系统的运行环境和行 为,帮助开发人员发现系统 中的问题并进行优化。
时钟同步与时间同步讲座PPT课件
高稳晶振
5×10-12~~ 10-10量级 5×10-13
频率老化率 10-8量级
铷钟
1×10-10~~ 10-12量级 1×10-11
10-10量级~无
铯钟
5×10-12~~ 10-14量级~10- 无
6×10-11
15量级
CHENLI
6
时钟同步网基础理论--卫星系统
GPS(全球卫星定位系统) 美国
7
时钟同步网基础理论--卫星系统
GLONASS(全球卫星导航系统) 俄罗斯 空间部分由24颗卫星(SV)组成。 分布在三个轨道平面上。 卫星寿命3-5年。
CHENLI
8
时钟同步网--分类
时钟同步网基础理论 时钟同步网组网方式 时钟同步网主流产品介绍 上海欣泰时钟同步网网管系统-SNNM
CHENLI
9
时钟同步网组网方式
主从同步 互同步方式 准同步方式 主从同步+准同步
多基准钟,分区等级主从同步
CHENLI
10
时钟同步网组网方式--规划原则
网络满足滑动性能指标的分配原则。 在同步网内不应存在环路。 节点中心时钟应从不同路由获得主用和备用基准。 节点中心时钟可以从其他同级或高一级设备获得基准。 选择可用性最高的传输系统传输基准定时信号。 对重要的被同步设备的同步情况进行检测。
CHENLI
16
上海欣泰时钟同步网网管系统SNNM--作用
及时发现网上的同步问题(包括BITS设备问题、卫星定时 系统问题、被同步设备问题、定时传输链路问题等),并 协助迅速解决。
对整个网络的网络性能、同步传输链路、BITS设备的可靠 性和性能质量进行全面的定量评估。
可以领导和协调各地区的维护管理,并对各地区的维护质 量进行定量评估。
时间同步技术ppt课件
传统同步:NTP与GPS
NTP:网络时间协议 GPS:全球定位系统
NTP(Network Time Protocol )
体系结构(网络)
NTP(Network Time Protocol )
体系结构(单机)
NTP(Network Time Protocol )
可扩展性(Scalability)
在大规模网络中尤为重要 是大规模无线传感器网络软硬件设计中
非常重要的问题 满足不同的网络类型、网络规模 满足不同的应用需求
健壮性
外部环境复杂,搞毁能力 需要应对安全性挑战 无线传感器网络拓扑动态性较强 网络规模变化、需求变化 影响:数据融合和休眠唤醒方式节能
软硬件都要受到该限制 TPSN (Timing-sync Protocol for Sensor Networks)
FTSP (Flooding Time Synchronization Protocol) 单个报文中包括多个时间戳(在报文的不同位置)
存储与计算能力均比较小 确定,依赖报文长度和发送速率。
Encoding time & Decoding time
Byte alignment time
典型值
特性
0~100ms
10~500ms 10~20ms
<1μs(距离<300米)
在大多数情况下<5μs,在重 负载下,可达30μs
100~200μs,<2μs的抖动
0~400μs
不确定,依赖处理器负载、操 作系统系统调用开销
软件虚拟时钟 不同节点晶振不同,时间长了存在偏差
GPS(Global Position System)
跨时钟域信号同步方法6种
跨时钟域信号同步方法6种ASIC中心1 引言??? 基于FPGA的数字系统设计中大都推荐采用同步时序的设计,也就是单时钟系统。
但是实际的工程中,纯粹单时钟系统设计的情况很少,特别是设计模块与外围芯片的通信中,跨时钟域的情况经常不可避免。
如果对跨时钟域带来的亚稳态、采样丢失、潜在逻辑错误等等一系列问题处理不当,将导致系统无法运行。
本文总结出了几种同步策略来解决跨时钟域问题。
2 异步设计中的亚稳态??? 触发器是FPGA设计中最常用的基本器件。
触发器工作过程中存在数据的建立(setup)和保持(hold)时间。
对于使用上升沿触发的触发器来说,建立时间就是在时钟上升沿到来之前,触发器数据端数据保持稳定的最小时间。
而保持时间是时钟上升沿到来之后,触发器数据端数据还应该继续保持稳定的最小时间。
我们把这段时间成为setup-hold时间(如图1所示)。
在这个时间参数内,输入信号在时钟的上升沿是不允许发生变化的。
如果输入信号在这段时间内发生了变化,输出结果将是不可知的,即亚稳态 (Metastability)?图1??? 一个信号在过渡到另一个时钟域时,如果仅仅用一个触发器将其锁存,那么采样的结果将可能是亚稳态。
这也就是信号在跨时钟域时应该注意的问题。
如图2所示。
???? 信号dat经过一个锁存器的输出数据为a_dat。
用时钟b_clk进行采样的时候,如果a_dat正好在b_clk的setup-hold时间内发生变化,此时b_ dat就既不是逻辑"1",也不是逻辑"0",而是处于中间状态。
经过一段时间之后,有可能回升到高电平,也有可能降低到低电平。
输出信号处于中间状态到恢复为逻辑"1"或逻辑"0"的这段时间,我们称之为亚稳态时间。
???? 触发器进入亚稳态的时间可以用参数MTBF(Mean Time Between Failures)来描述,MTBF即触发器采样失败的时间间隔,表示为:?其中fclock表示系统时钟频率,fdata代表异步输入信号的频率,tmet代表不会引起故障的最长亚稳态时间,C1和C2分别为与器件特性相关的常数。
时间同步和时钟同步原理及配置方法介绍 ppt课件
13
13
时间同步实现机制---1PPS+TOD
1)1pps:秒脉冲信息,脉冲的上升沿标记一秒的开始; 2) TOD:绝对时间信息;按照GPS时钟格式表示,记时起点是1980年1月1日00:00: 00;TOD消息分为时间信息消息和时间状态消息两种。 TOD帧格式定义:
2字节
0x43
0x4d
帧头
主钟表
Tri: 各中间节点的驻留时间
从钟表
10
10
1588V2时钟模型
PON系统的1588V2时钟模型? 总体来看OLT+ONU为BC时钟模型 单独来看OLT或者ONU其时钟模型都为OC
11
11
提纲
同步概念 1588v2时钟模型 1588v2同步实现机制 时间同步网管参数配置 1588v2同步典型应用方案
2. 时钟同步几种方式
● 同步以太网SYNCE ●1588V2恢复出时钟
4
4
同步概念
在IEEE1588v2建议中定义了频率同步技术。该技术通过从节点与主节点快 速交换报文,获取时间戳。再计算相邻同步周期时间戳(t2-t1)值的相对差值 来计算同步周期内从时钟相对主时钟频率的漂移值,通过这个值调整本地时钟, 从而实现频率恢复。
各节点自行测 T1 量链路时延
correctionField= correctionField+TR1
correctionField= correctionField+TR3 T2
correctionField= correctionField+TR2 correctionField= correctionField+TR4
边界时钟
IEEE1588协议基础ppt版
IEEE1588协议基础ppt版
2.4 Follow_Up消息
2.4.1 preciseOriginTimestamp(Timestamp) Follow_Up消息的preciseOriginTimestamp是与对应的Sync 消息的<syncEventEgressTimestamp>,Follow_Up消息和 Sync消息的correctionField
来以太网的数据线传送时钟信号,使组网连接简化和 降低成本。
1.1 PTP消息类型 分为两类:事件消息、普通消息。事件消息是在发 送和接收端都要打精
确的时间戳,普通消息不需要打时间戳。
(1)事件消息:SYNC、Delay_Req、Pdelay_Req、
Pd l R
IEEE1588协议基础ppt版
1.2 消息时间戳的产生 当发送和接收任何事件消息时,都会产生时间戳。 当消息的时间戳点经
简单的主从层次如下图所示:
只有普通和边界时钟维持这种状态形式,同时也只有边界时钟能在主从层次中建立分 支点。
IEEE1588协议基础ppt版
二、消息字段
PTP协议根据发送和接收到的消息来计算时间偏 差和延迟,每个消息都 由一个消息头(header),消息体(body)和消息 后缀(suffix)组成。
< meanPathDelay >= (t2 t1) + (t4 t3) 2
IEEE1588协议基础ppt版
1.4 设备类型
有5中基本的设备类型 (1)普通时钟(Oridinary clock) (2)边界时钟(Boundary clock) (3)端到端透明时钟(End-to-end transparent clock) (4)对等透明时钟(Peer-to-Peer transparent clock) (5)管理节点(Management node) 普通和边界时钟的端口,两种机制都可以使用,端到 端透明时钟与这两个 机制无关,对等透明时钟使用对等延时机制。
时钟同步教程ppt课件
7
NTP工作模式
内部文件,严格保密.
§主/被动对称模式
✓ 一对一的连接,双方均可同步对方或被对方同步,先发出申请建立 连接的一方工作在主动模式下,另一方在被动模式下。此方式适合 配置冗余的时间服务器
§客户/服务器模式
✓ 与主/被动模式基本相同。唯一区别在于,客户方可被服务器同步, 但服务器不能被客户同步
甘肃省公安厅
21
Windows 2000配置说明
内部文件,严格保密.
采用Microsoft公司的W32Time工具包作为客户端。
1、停止W32Time服务
在命令行格式下停止W32Time服务:使用命令 net stop w32time
2、配置W32Time服务
方法1:在命令行格式下运行:net time /setsntp: NTP服务器的IP地址
server 127.0.0.1 local clock
fudge 127.0.0.1 stratum 10
3) 敲击a键进入vi编辑方式:键入NTP服务器的IP地址,修改成如下显示(假 设XX.XX.XX.XX是所要使用的 NTP服务器IP地址):
server XX.XX.XX.XX prefer #(主时钟服务器地址) server Xx.Xx.Xx.Xx #(备份时钟服务器地址)
✓ ntpdate NTP客户端用来连接NTP服务器命令。
甘肃省公安厅
9
公安部配置方法—Linux配置
内部文件,严格保密.
1、登录客户端机器Linux系统(登录方法如
下),使用shell进行配置:
1) 在本机登录提示符下进入Linux系统。采用root用户登陆,输入用户口 令。每个Linux系统都有一个根(root)用户,root用户能够运行程序 、使用文件、以任何方式改变计算机的设置;
分布式系统 时钟同步52页PPT
➢ 服务器主动定期询问每台机器的时间 ➢ 服务器基于客户的回答,告知它们拨快或者拨 慢时间
时钟同步算法:Berkeley算法
实现方法
时间守卫程序
a)
b)
a) 时间守卫程序向所有 其他机器询问时钟值
b) 其他机器做出应答 c) 时间守卫程序通知每
台机器如何调整他们 的时钟
c)
时钟同步算法:Berkeley算法
时钟同步算法
• 系统基础模型
时钟同步算法
•
系统基础模型
时钟同步算法
时钟同步算法
1. Cristian算法 2. Berkeley算法 3. 平均值算法
时钟同步算法:Cristian 算法
基本思想
➢一台机器设为时间服务器(带有卫星接收器) ➢其他的每一台机器周期性地向时间服务器发送 请求消息已获得当前标准时间。 ➢时间服务器在短时间内将包含当前时间的消息 发送给请求时间机器。
SUMMER TEMPLATE
分布式系统 时钟同步
同步
寇迦南
1.时钟同步
引入 时钟同步
例子:UNIX中make程序的调用问题。
引入 时钟同步
例子:UNIX中make程序的调用问题 Make程序的作用是什么?
➢ 可以自动完成对源文件的编译。
引入 时钟同步
UNIX系统会把较大的程序分成多个源程序,当 一个源文件发生变化时(比如被修改后),只 需编译一个文件即可,不需要对所有的文件进 行编译。
input.c必须被5重151新编译。5155 t
input.o
input.c
引入 时钟同步
例如:如果源文件output.c的修改时间为5144且 对应目标文件output.o的修改时间为5145,那么, 不需要对output.c进行重新编译。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
电磁波的耗时 O 传播时间: 电磁波从发送者传播到接收者的耗时 O 解码时间: 接收方将电磁波转换并解码为二进制形式
的耗时 O 字节对齐时间: 由于接收方和发送方的不同的字节校
准导致的延迟
接收方Biblioteka 发送方cpu: radio: 天线: 天线: radio: radio:
O 用单个无线电消息来同步发送者和接受者 O 最基础的时间同步原语 O 在MICA2上平均1.4us,最大4.2us的误差 O 在MICA2,MICA2DOT以及MICAZ上都已实现
贡献
O FTSP多跳时间同步
O 将所有节点与选定的leader节点同步 O 常数的网络负载:每个节点每30S一个消息 O 连续操作,启动时间是网络直径60S O 容错性:任何节点可以进入或者离开网络,
O 多跳的FTSP协议采用层次结构,根节点为同 步源,可以适应大量传感器节点,对网络拓扑 结构的变化和根节点的失效有健壮性,精确度 较好。该算法通过采用MAC层时间戳和线性回 归偏差补偿弥补了相关的错误源。
贡献
O 对无线电消息交付不确定性的更深入理解,以及 减小其影响的新技术
O FTSP时间戳(单跳时间同步)
50
50%
40
`
40%
30
30%
20
20%
10
10%
0:00 0:10 0:20 0:30 0:40 0:50 1:00 1:10 1:20 1:30 1:40 1:50 2:00 2:10 2:20 2:30 2:40 2:50 3:00 3:10 3:20 3:30 3:40 3:50 4:00
时钟同步
O 以前的研究
O NTP 网络时间协议 O RBS 参考广播同步 O NTSP 传感器网络定时同步协议等等
O 测量指标:
O 不光是端对端的精确度 O 网络负载(每个同步时期的消息数量) O 启动时间(直径的函数) O 容错性:节点增减,错误或者不稳定的本地时钟 O 可扩展性
无线消息传播
O 接入时间:链路层协议等待信道空闲的事件 O 中断处理时间:从无线电芯片接收信号到微处理器响
链接可以失败,节点可以移动,拓扑可改变 O 平台实现:使用时间戳模块
时钟同步
O 时钟同步需求:
O 邻居节点有公共的参考点 O 传感时获取一个全局的时间戳 O 同步的传感和行动 O 本地和全局的时间计算
时钟同步
O 算法类别
O 全局时间源 O 生命期 O 规模范围 O 时间转换 O 时钟偏移 O 本地时钟 O 方法:发送者-接收者,接收者-接收者 O 时间戳:MAC层 vs. 用户空间
min
receiver
MICA2: 1.4 μs average error, 4.2 μs maximum error
average
MICA2DOT: 4 μs average, 12 μs maximum error
FTSP时钟同步
O 1. 本地 和 全局 时钟
O 每个节点都包含一个本地时钟和一个全局时钟。过去和将来 的时间实体都被翻译为两种格式(可能是本地格式和全局格
式)
O 本地时钟和全局时钟的时钟偏移(offset)和时钟脉冲相位差
(skew)都采用线性回归算法估算
O 优化的提高计算结果的数值精度的方式是将时钟脉冲相位差 规格化为0(对倾斜减去1有效)
O 处理本地和全局时钟溢出(采用32位整数)
O 2. 层次
O 全局时间被同步为选定的基准点(elected leader)的本地时间 O 使用异步扩散:每个节点每30s发送一个同步消息,常数的网
O 接收到发送方的时间 戳后,接收者对自己 的时钟进行调整,红 色部分为时间戳误差
R1
R3
S
R2
transmission / reception event S elapsed time since event R1 R2
R3
time stamping error
O MICA2平台上的时间戳
header
O 4. 平台实现: 使用时间戳模块
100
90
average pairwise error (μs)
80
maximum pairwise error (μs)
synchronized motes (%)
70
100% 90% 80% 70%
拓扑图:
microseconds percentage
60
60%
data
sender
sync 0 1 2 3 4 5 … time stamp
hw and sw delay (~1386 μs) bit-offset (~0-365 μs)
byte (~417 μs)
handling delay (95% 0-1 μs) (5% 1-20 μs)
01 min
2345 hw interrupt sw interrupt
洪泛时钟同步协议 The Flooding Time Synchronization Protocol
Miklos等
什么是FTSP
O 泛洪时间同步协议(Flooding Time Synchronization Protocol)由Vanderbilt大学 Miklos,Branislav等提出,目标是实现整个网络 的时间同步并且误差控制在微秒级。该算法使 用单个广播消息实现发送节点与接收节点之间 的时间同步。
cpu:
中断处理 编码 传播
解码 字节对齐 中断处理
FTSP时间戳
O 时间同步原语:用单个无线电消息估算发送方和接收方之 间的时间参照点
O 发送方在消息发送时获取本地时间作为时间戳 O 消息可以包含发送方在传输时的本地时间(或者一个事件的
运行时间) O 接收方获得时间戳并记录接收到消息的本地时间
O 算法:
络负载
O 每个消息都有一个序列号,这个序列号每次只能被基准点加1 O 持续操作,其启动时间是网络半径时间60s
O 3. 鲁棒性(健壮性)
O 如果一个基准点失效,新的基准点会被自动选出。新的基准 点保持就的全局时钟的时钟偏移和倾斜
O
容错性:节点可以自由出入网络,链接可以失效,节点可以 移动,拓扑可以改变
O 多个时间戳(包括了发送方和接收方产生的)位于字节边界 O 时间戳被做规格化和统计地处理,并且发送方和接收方都会
差生一个时间戳 O 发送方的最终时间戳可以被嵌入到消息中
O 用法:
O 多个时间同步协议 O 声觉测距 O 射手本地化(路由时隐含时间同步)
O 右图所示
O S为基准点leader
O 一个时间开始到各个 接收者收到这个时间, 开始进入发送传输/ 接收阶段