Movatterモバイル変換


[0]ホーム

URL:


WO2008101394A1 - Real-time synchronous method and synchronous network based on the standard ethernet - Google Patents

Real-time synchronous method and synchronous network based on the standard ethernet
Download PDF

Info

Publication number
WO2008101394A1
WO2008101394A1PCT/CN2008/000268CN2008000268WWO2008101394A1WO 2008101394 A1WO2008101394 A1WO 2008101394A1CN 2008000268 WCN2008000268 WCN 2008000268WWO 2008101394 A1WO2008101394 A1WO 2008101394A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
slave node
slave
message
data
Prior art date
Application number
PCT/CN2008/000268
Other languages
French (fr)
Chinese (zh)
Inventor
Chengrui Zhang
Jinjiang Wang
Original Assignee
Shan Dong University
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
Priority claimed from CN200710013313Aexternal-prioritypatent/CN101018115B/en
Priority claimed from CNB2007100144192Aexternal-prioritypatent/CN100561904C/en
Application filed by Shan Dong UniversityfiledCriticalShan Dong University
Publication of WO2008101394A1publicationCriticalpatent/WO2008101394A1/en

Links

Classifications

Definitions

Landscapes

Abstract

A real-time synchronous method and a synchronous network based on the standard Ethernet are disclosed. The synchronous network solves the problem that when the Ethernet is used for live communication system, the real-time communication performance of the network nodes communication and accurate synchronous performance of the system can't be ensured. Due to adding special hardware the cost will be increased, and the opening capability will be reduced. And the present invention has the advantages of simple configuration, low cost, and the usability of the existing ordinary standard network card etc.. The configuration of the synchronous network is that: it includes at least one master node and at least one slave node, data is transmitted between the nodes by a transmission protocol, the network may be a link network or a ring network, a randomly selected node from the nodes may be the synchronous resource, so that real-time synchronous full duplex communication can be performed.

Description

一种基于标准以太网的实时同步方法及同步网络 技术领域 Real-time synchronization method based on standard Ethernet and synchronous network
本发明涉及一种用于工业现场级通信的实时同步通信网络, 尤其涉及一种基于标准以太 网的实时同步方法及同步网络, 用于解决现场级通信系统中通信问题, 即如何解决以太网用 于现场级通信系统时, 实现通信的实时性和以及系统的精确同歩性。 The invention relates to a real-time synchronous communication network for industrial field level communication, in particular to a real-time synchronization method based on standard Ethernet and a synchronization network, which is used for solving communication problems in a field-level communication system, that is, how to solve Ethernet Real-time communication and accurate homology of the system when the field-level communication system is used.
背景技术Background technique
目前在工厂自动化和过程自动化领域中 ,现场总线是现场级通信系统中的主流解决方案。 不过, 随着技术的不断进步和发展, 传统现场总线越来越多地表现出了其本身的局限性。 ― 方面, 随着现场设备智能程度的不断提高, 控制变得越来越分散, 分布在工厂各处的智能设 备之间以及智能设备和工厂控制层之间需要连续地交换控制数据, 这使得现场设备之间数据 的交换量飞速增长; 另一方面, 随着计算机技术的发展, 企业希望能够将底层的生产信息整 合到统一的全厂信息管理系统中, 于是企业的信息管理系统需要读取现场的生产数据, 并通 过工业通信网络实现远程服务和维护, 因此, 纵向一致性也成为热门的话题, 用户希望管理 层和现场级能够使用统一的、 与办公自动化技术兼容的通信方案, 这样可以大大简化工厂控 制系统的结构, 节约系统实施和维护的成本。. Fieldbus is currently the mainstream solution in field-level communication systems in the field of factory automation and process automation. However, with the continuous advancement and development of technology, traditional fieldbus has increasingly shown its limitations. ― On the other hand, as the intelligence of field devices continues to increase, control becomes more and more dispersed, and control data needs to be continuously exchanged between smart devices distributed throughout the plant and between smart devices and plant control layers. The exchange of data between devices is growing rapidly. On the other hand, with the development of computer technology, enterprises hope to integrate the underlying production information into a unified plant-wide information management system, so the enterprise information management system needs to read the site. Production data, and remote service and maintenance through industrial communication networks, therefore, vertical consistency has also become a hot topic, users want management and field level to be able to use a unified communication solution compatible with office automation technology, which can greatly Simplify the structure of the plant control system and save the cost of system implementation and maintenance. .
基于这样的需求, 以太网技术开始逐渐从工厂和企业的信息管理层向底层渗透, 以太网 技术开始广泛地应用于工厂的控制级通信。 在自动化世界中使用以太网解决方案有几方面显 著的优势: 统一的架构、 集成的通信以及强大的服务和诊断功能。 从目前工业自动化控制领 域的情况来看, 以太网技术取代现场总线是工业控制网络发展的必然趋势。 ' Based on this demand, Ethernet technology began to penetrate from the information management layer of factories and enterprises to the bottom layer, and Ethernet technology began to be widely used in the control level communication of factories. There are several significant advantages to using an Ethernet solution in the automation world: a unified architecture, integrated communications, and powerful service and diagnostic capabilities. From the current situation of industrial automation control, the replacement of fieldbus by Ethernet technology is an inevitable trend of industrial control network development. '
基于总线的控制是当前控制系统的发展方向, 而工业以太网总线被人们普遍认为是未来 控制网络的最佳解决方案, 工业以太网取代现场总线是工业控制网络发展的必然趋势。 工业 以太网的推广应用将大大简化工厂控制系统的结构, 节约系统实施和维护的成本。 Bus-based control is the development direction of current control systems, and industrial Ethernet bus is widely regarded as the best solution for future control networks. The replacement of fieldbus by industrial Ethernet is an inevitable trend in the development of industrial control networks. The promotion and application of industrial Ethernet will greatly simplify the structure of the plant control system and save the cost of system implementation and maintenance.
在将以太网技术引入到控制级通信的过程中, 为了满足工业控制系统的特殊需求, 如现 场环境、 拓扑结构、 可靠性等要求, 必须对普通的办公室以太网做出调整和补充, 以保证以 太网技术在工业现场应用的可靠性, 即我们常说的工业以太网。 目前, 在控制级通信网络领 域中, 工业以太网解决方案已经得到了广泛的认可和接受, 企业和工厂也充分享受到了高性 能通信网络带来的便利和收益。 尽管如此, 工业以太网技术在向最底层的现场级控制系统渗 透时遇到了难以克服的障碍——通信的实时性和确定性。 由于以太网采用 CSMA/CD碰撞检测 方式, 即: 当一个网络上的某一个从节点需要发送数据时, 它首先监听信道, 若信道忙就持 续等待, 直到它一旦监听到信道空闲时, 就将数据发送出去。 如果两个或多个从节点都在监 听和等待发送数据, 当监听到信道空闲时, 各从节点就立即 (几乎同时)开始发送数据, 这 时就发生冲突。 如果一个从节点在传输期间检测到冲突, 就立即停止传输, 并向信道发出一 个 "拥挤"信号, 以确保网络上的所有其它从节点也发现冲突。 在基于以太网的通信中, 为 避免冲突, 各从节点采用二进制指数退避 (BEB, Binary Exponential Back-Off)算法处理 冲突, 但该方法具有冲突时延不确定性的缺陷。 当网络负荷较大时, 网络传输的不确定性不 能满足工业控制的实时性要求, 因此传统以太网技术难以满足控制系统要求准确定时通信的 实时性要求, 一直被视为非确定性网络。 In the process of introducing Ethernet technology into control-level communication, in order to meet the special requirements of industrial control systems, such as field environment, topology, reliability, etc., it is necessary to adjust and supplement the ordinary office Ethernet to ensure The reliability of Ethernet technology in industrial field applications, which is what we often call Industrial Ethernet. At present, in the field of control-level communication networks, industrial Ethernet solutions have been widely recognized and accepted, and enterprises and factories have fully enjoyed the convenience and benefits brought by high-performance communication networks. Despite this, Industrial Ethernet technology encounters an insurmountable obstacle to seeping through the lowest-level field-level control systems—the real-time and deterministic nature of communications. Since Ethernet uses CSMA/CD collision detection, that is, when a slave node on a network needs to send data, it first listens to the channel, and if the channel is busy, it waits until it hears that the channel is idle. The data is sent out. If two or more slave nodes are listening and waiting to transmit data, when the channel is idle, the slave nodes start transmitting data almost immediately (almost simultaneously), and a collision occurs. If a slave detects a collision during transmission, it stops transmitting immediately and sends a "crowded" signal to the channel to ensure that all other slaves on the network also find a collision. In Ethernet-based communication, in order to avoid collisions, each slave node uses the Binary Exponential Back-Off (BEB) algorithm to handle collisions, but this method has the drawback of conflicting delay uncertainty. When the network load is large, the uncertainty of network transmission can not meet the real-time requirements of industrial control. Therefore, traditional Ethernet technology is difficult to meet the real-time requirements of the control system for accurate timing communication, and has been regarded as a non-deterministic network.
工业控制网络是一种典型的实时应用系统, 其中的任务 (如功能块的执行) 通常按照一 定的时间间隔出发, 并且对任务的执行时间具有截止性要求, 这种任务称为周期性任务。 实 时应用系统中还有一种任务, 这种任务只有在特定的事件触发下才出现, 例如设备配置、 故 障诊断、 程序的上载 /下载、运行记录、报警处理等, 这种任务称为非周期性任务, 非周期性 任务是随机触发的。 这两种任务反映在工业控制网络通信中, 就是两类通信信息: 周期性通 信信息和非周期性通信信息。 周期性通信信息和非周期性通信信息具有不同的时间特性。 周 期性通信信息是实时信息, 一旦系统组态完成, 周期性通信信息的发送就具有时间确定性。 The industrial control network is a typical real-time application system in which tasks (such as the execution of function blocks) usually start at a certain time interval and have a deadline for the execution time of the task. This task is called a periodic task. There is also a task in the real-time application system, which can only be triggered by specific events, such as device configuration, fault diagnosis, program upload/download, operation record, alarm processing, etc. This task is called aperiodic. Tasks, non-periodic tasks are randomly triggered. These two tasks are reflected in industrial control network communication, which is two types of communication information: periodic communication information and aperiodic communication information. The periodic communication information and the aperiodic communication information have different time characteristics. Periodic communication information is real-time information. Once the system configuration is completed, the transmission of periodic communication information is time-deterministic.
确认本 而非周期性通信信息往往是突发信息, 在时间上是不确定的。Confirmation Non-periodic communication information is often bursty information and is uncertain in time.
为了提高以太网的实时性和确定性, 人们作了不少研究, 提出各种方法来改进 CS A/CD, 按照对 CSMA/CD的改进方法划分, 主要有: 改进以太网 MAC协议、 在以太网上层增加传输控 制机制等。 C§MA/DCR (Deterministic Collision Resolution) 是最具有代表性的一种 MAC '协议改进方法。 当冲突发生时, 采用确定性的二叉树寻址方法, CSMA/DCR依照从节点地址采 取先序遍历的方式解决冲突。 当冲突发生时, 低优先级的从节点停止对信道的竞争, 而高优 先级的从节点继续竞争信道, 直到成功传输。 这种修改以太网 MAC协议的方式虽然可以极大 的改善以太网通信确定性的问题, 却是以更改以太网固件(以太网主节点硬件和软件) 为代 价的, 很难与标准的商用以太网兼容, 并且增加了开发成本。 In order to improve the real-time and certainty of Ethernet, many researches have been done to propose various methods to improve CS A/CD. According to the improved method of CSMA/CD, the main ones are: Improved Ethernet MAC protocol, in Ethernet The network layer increases the transmission control mechanism. C§MA/DCR (Deterministic Collision Resolution) is the most representative MAC 'protocol improvement method. When a collision occurs, the deterministic binary tree addressing method is used, and the CSMA/DCR resolves the collision according to the pre-order traversal from the node address. When a collision occurs, the low priority slave node stops competing for the channel, while the high priority slave node continues to contend for the channel until successful transmission. Although this method of modifying the Ethernet MAC protocol can greatly improve the deterministic problem of Ethernet communication, it is at the cost of changing Ethernet firmware (Ethernet master node hardware and software), and it is difficult to communicate with standard commercial Ethernet. Network compatible and increased development costs.
在以太网上层增加传输控制机制中最典型的一种方法是时分多路获取(TDMA)策略, TDMA 为每个从节点分配一定的带宽, 每个从节点在固定的时间片内发送信息, 以保证每个从节点 的信息具有确定的发送时间。由于 TDMA不需要传输额外的控制信息,使得网络带宽得使用率 比较髙。但 TDMA是基于从节点的方法, 不能反映每个从节点的实际带宽要求, 无法保证非周 期信息及时发送。 另^一种在以太网上层增加传输控制的方法是主从式传输控制方式, 这是 一种集中式的传输控制方式, 网络中至少有一个主节点和多个从节点, 从节点只有在收到来 自主节点的控制报文之后, 才可以发送敎据。 这种主从式传输控制方式的优点是可以保证每 个从节点都有发送数据的机会, 但缺点是无法处理工业控制网络中的突发性通信, 例如工业 控制网络中的报警信息。 One of the most typical ways to increase the transmission control mechanism in the upper layer of Ethernet is the Time Division Multiple Access (TDMA) strategy. TDMA allocates a certain bandwidth for each slave node, and each slave node sends information in a fixed time slice to The information of each slave node is guaranteed to have a certain transmission time. Since TDMA does not need to transmit additional control information, the network bandwidth usage is relatively low. However, TDMA is based on the slave node method and cannot reflect the actual bandwidth requirements of each slave node. It cannot guarantee the timely transmission of non-cycle information. Another method to increase transmission control in the upper layer of Ethernet is the master-slave transmission control mode. This is a centralized transmission control method. There is at least one master node and multiple slave nodes in the network, and the slave nodes only receive After the arrival of the control message of the autonomous node, the data can be sent. The advantage of this master-slave transmission control method is that each slave node has the opportunity to transmit data, but the disadvantage is that it cannot handle bursty communications in industrial control networks, such as alarm information in industrial control networks.
囟此, 尽管上述方法都在一定程度上提高了以太网传输的实时性和确定性, 却是以改变 以太网结构为代价(如 CSMA/DCR), 或者在较低的网络层次 (如 MAC层的上层)实现, 这些 方法的最大不足是实现难度大, 往往涉及到硬件, 无法与传统标准的以太网相互兼容, 并且 无法满足工业控制网络中对两类信息一周期信息 (即实时信息)和非周期信息 (通常为非实 时信息).进行同时处理的特殊要求。 Therefore, although the above methods all improve the real-time and certainty of Ethernet transmission to a certain extent, it is at the cost of changing the Ethernet structure (such as CSMA/DCR), or at a lower network level (such as the MAC layer). The upper layer) implementation, the biggest shortcoming of these methods is that it is difficult to implement, often involves hardware, is not compatible with traditional standard Ethernet, and cannot meet the two-cycle information (ie real-time information) in the industrial control network. Acyclic information (usually non-real-time information). Special requirements for simultaneous processing.
快速以太网与交换式以太网技术的发展, 给解决以太网的非确定性问题带来了一种解决 方案, 使这一应用成为可能。首先, Ethernet的通信速率从 10M、 100M增大到如今的 1000M、 10G,在数据吞吐量相同的情况下,通信速率的提高意味着网络负荷的减轻和网络传输延迟的 减小, 即碰撞几率大大下降。其次釆用星形网络拓扑结构, 交换机将网络划分为若干个网段。 Ethernet交换机由于具有数据存储、转发功能, 使各端口之间输入和输出的数据帧能够得到 缓冲, 不再发生碰撞, 同时交换机 可对网络上传输的数据进行过滤, 使每个网段内从节点 间数据的传输只限在本地网段内进行, 而不再需要经过主干网, 也不再占用其他网段内的带 宽, 从而降低了所有网段和主干网的网络负荷。 再次, 全双工通信又使得端口间两对双绞线 (或两对光纤)上分别同时接收和发送报文帧, 也不会发生冲突。 因此, 采用交换式集线器 和全双工通信,可使网络上的冲突域不复存在(全双工通信),或碰撞几率大大降低(半双工), 因而使 Ethernet 通信确定性和实时性大大提高。 但是采用全双工交换式以太网, 改变了 CSMA/CD机制, 网络的通信速度和效率将取决于交换机。 为了减少交¾机对整个网络速度和 效率的影响,组网时要尽量避免跨多个交换机通信, 将经常交换数据的设备放在一个网段内, 这将给组网增加难度, 也不利于以^系统的扩展。 The development of Fast Ethernet and switched Ethernet technology has brought a solution to the problem of non-determinism in Ethernet, making this application possible. First, the communication rate of Ethernet increases from 10M, 100M to 1000M and 10G today. In the case of the same data throughput, the increase of communication rate means the reduction of network load and the reduction of network transmission delay, that is, the probability of collision is greatly increased. decline. Secondly, using a star network topology, the switch divides the network into several network segments. Because the Ethernet switch has the function of data storage and forwarding, the data frames input and output between the ports can be buffered, no collision occurs, and the switch can filter the data transmitted on the network to make the slave nodes in each network segment. The transmission of data between the network segments is limited to the local network segment, and no longer needs to pass through the backbone network, and the bandwidth in other network segments is no longer occupied, thereby reducing the network load of all network segments and the backbone network. Again, full-duplex communication allows two pairs of twisted pairs (or two pairs of fibers) to receive and transmit message frames simultaneously between ports without conflict. Therefore, the use of switching hubs and full-duplex communication can make the collision domain on the network no longer exist (full-duplex communication), or the collision probability is greatly reduced (half-duplex), thus making the Ethernet communication deterministic and real-time greatly improve. However, with full-duplex switched Ethernet, the CSMA/CD mechanism is changed, and the communication speed and efficiency of the network will depend on the switch. In order to reduce the impact of the traffic on the overall network speed and efficiency, it is necessary to avoid communication across multiple switches when networking, and to place devices that frequently exchange data in a network segment, which will increase the difficulty of networking and is not conducive to With the extension of the ^ system.
有的系统对通信从节点的同步性也有严格的要求, 比如在运动控制中, 各轴的同步性也 是一个非常重要的因素。 现有的解决方案为网络上的所有站点必须通过精确的时钟同步以实 现同步实时以太网。 例如: Internet网络时间协议 NTP (Network Time ProtocaD、 简单时 间网络协议 SNTP (Simple Network Time Protocal ) , IEEE1588 标准精确时间协议 PTP (Precision Time Protocal ), 周期性的通过发送带有时间戳协议的同步数据包实现通信循 环的同步。 在要求同步精度为微秒级的场合, 想要获得如此高的同步定时, 单纯靠软件是无 法实现的, 必须依靠网络第二层 (数据链路层)中硬件的支持, 即等时实时 ASIC芯片。 Some systems also have strict requirements on the synchronization of communication slave nodes. For example, in motion control, the synchronism of each axis is also a very important factor. The existing solution is that all sites on the network must achieve accurate synchronous real-time Ethernet through precise clock synchronization. For example: Internet Time Protocol NTP (Network Time ProtocaD, Simple Network Time Protocal), IEEE1588 Standard Time Protocol (PTP), periodic transmission of synchronous packets with timestamp protocol Synchronization of communication loops. In the case where the synchronization accuracy is required to be in the microsecond range, it is impossible to achieve such high synchronization timing by software alone, and must rely on hardware support in the second layer (data link layer) of the network. , that is, an isochronous real-time ASIC chip.
现在很多使用以太网作现场级通信的厂商, 上位机都是自己幵发的专用控制网卡, 以实 现以太网的实时通信。 很难与标准以太网兼容, 也很难与别的厂商开发的设备互换, 形成各 自独立的一套通信系统。Nowadays, many manufacturers who use Ethernet for field-level communication, the upper computer is a dedicated control network card that is bursting out by itself. Real-time communication of Ethernet. It is difficult to be compatible with standard Ethernet, and it is difficult to interchange with devices developed by other manufacturers to form a separate communication system.
国际上主要有几个比较流行的工业以太网络,分别是 PR(MNET、Ethernet/IP、PowerLink、 EtherCAT、 SY瞎 T、 SERCOS III等。There are several popular industrial Ethernet networks in the world, namely PR (MNET, Ethe rnet/IP, PowerLink, EtherCAT, SY瞎T, SERCOS III, etc.).
PROFINET: 是一种典型的交换式以太网络, 交换机采用的是一种基于地址的信息转发机 制, 网络的通信速度和效率将取决于交换机。为了减少交换机对整个网络速度和效率的影响, 组网时要尽量避免跨多个交换机通信, 将经常交换数据的设备放在一个网段内, 这将给组网 增加难度, 也不利于以后系统的扩展。 同时系统也无法枚举和配置各设备。 PROFINET通过精 确的时钟同步以实现同步实时以太网, 通过规律的同步数据实现通信循环的同步, 其精度可 以达到微秒级, 这么高的同步水平单纯靠软件是无法实现的, 想要获得这么高精度的同步实 时,必须依靠网络第二层中硬件的支持,即西门子 IRT等时实时 ASIC芯片,增加了系统成本。 PROFINET: is a typical switched Ethernet network. The switch uses an address-based information forwarding mechanism. The communication speed and efficiency of the network will depend on the switch. In order to reduce the impact of the switch on the speed and efficiency of the entire network, it is necessary to avoid communication across multiple switches when networking, and put devices that frequently exchange data in a network segment. This will increase the difficulty of networking and is not conducive to future systems. Extension. At the same time, the system cannot enumerate and configure each device. PROFINET realizes synchronous real-time Ethernet through precise clock synchronization, and realizes synchronization of communication loops through regular synchronous data. Its precision can reach microsecond level. Such high synchronization level cannot be realized by software alone. Accurate synchronization in real time, must rely on the hardware support in the second layer of the network, namely Siemens IRT isochronous real-time ASIC chip, increasing the system cost.
Ethernet/IP: Ethernet/IP的协议由 IEEE 802. 3物理层和数据链路层标准、 TCP/IP协 议组和控制与信息协议 CIP(Control Information Protocol)等 3个部分组成, 前面两部分 为标准的以太网技术,其特色就是被称作控制和信息协议的 CIP部分。 Ethernet/IP网络采用 商业以太网通信芯片、 物理介质和星形拓扑结构, 也是采用以太网交换机实现各节点间的点 对点连接, 系统也无法枚举和配置各设备。 最新版本的 Ethernet/IP技术规范中包含了 CIP Sync, CIP Sync时间同步方案基于 IEEE1588标准, 通过主处理器(或从站) 周期性的发送 一个实时的时钟同步报文信号, 以便其它的从处理器 (或从站)能够准确地同步。 这种方式将 增加网络的负担, 同样需要硬件的支持, 即等时实时 ASIC芯片。这种方式, 所有站点都必须 自带高精度时钟, 成本较高, 用这样的通信机制对系统的编程带来很大的影响, 因为控制任 务必须通过时间触发的方式来启动, 这提高了编程的难度, 而且不符合工控工程人员的编程 习惯。 Ethernet/IP: The protocol of Ethernet/IP consists of three parts: IEEE 802. 3 physical layer and data link layer standard, TCP/IP protocol group and Control Information Protocol (CIP). The first two parts are standards. The Ethernet technology is characterized by the CIP part called the Control and Information Protocol. Ethernet/IP networks use commercial Ethernet communication chips, physical media, and star topologies. Ethernet switches are used to implement point-to-point connections between nodes. The system cannot enumerate and configure devices. The latest version of the Ethernet/IP specification includes CIP Sync. The CIP Sync time synchronization scheme is based on the IEEE1588 standard. The main processor (or slave) periodically transmits a real-time clock synchronization message signal for other slave processing. The device (or slave) can be accurately synchronized. This approach will increase the burden on the network, as well as hardware support, ie, isochronous real-time ASIC chips. In this way, all sites must have their own high-precision clocks, which are costly. The communication mechanism has a great influence on the programming of the system, because the control tasks must be started in a time-triggered manner, which improves the programming. Difficulty, and does not meet the programming habits of industrial engineers.
PowerLink: 通过使用 Hub来实现任意的网络拓扑结构, 通过 Hub来组网, 使得系统很难 枚举和配置各设备。 为了避免冲突, PowerLink尽量利用带宽, 在时间上重新组织了网络中 站点信息交互机制, 在 CSMA/CD基础上引入时间槽管理机制, 网络上一个站点充当管理站管 理网络通信 对其他站点给定同步节拍, 分配给各站发布权限, 各站只能在得到发布权限之 后才可以发布信息。 这种时间槽管理机制, 虽然避免了网络上通信冲突, 但也使各设备的非 周期实时数据 (如报警等) 无法及时通知到系统。 PowerLink: By using the Hub to implement any network topology, networking through the Hub makes it difficult to enumerate and configure each device. In order to avoid conflicts, PowerLink tries to use bandwidth to reorganize the site information interaction mechanism in the network, and introduces a time slot management mechanism based on CSMA/CD. One site on the network acts as a management station to manage network communication and gives synchronization to other sites. Beats, assigned to each station to publish permissions, each station can only post information after getting the publishing permission. This time slot management mechanism avoids communication conflicts on the network, but also prevents non-cyclical real-time data (such as alarms) of each device from being notified to the system in time.
EtherCAT: 突破了接收以太网数据包, 将其解码之后再将过程数据复制到各个设备的技 术。 EtherCAT从站设备在报文经过从节点时读取相应的编址数据。 同样输入数据也在经过时 插入到报文中。 整个过程只有几纳秒的时间延迟。 所以与其他以太网解决方法相比, 性能得 到了提高。 在网络段的最后一个模块结束了整个数据传输工作, 形成一个逻辑和物理环形结 构。 所有传输数据与以太网的协议相兼容, 工作于全双工传输, 提高了传输的效率。 每个装 置又将这些以太网协议转换为内部的总线协议。 EtherCAT 是用于过程数据的优化协议 EtherCAT协议可包括几个 EtherCAT报文, 每个报文都服务于一 ±夬逻辑过程映像区的特定内 存区域,数据顺序不依 于网络中以太网端子的物理顺序,可任意编址。 EtherCAT支持线形、 树形、星形等拓扑类型, EtherCAT采用分布式时钟技术来实现精确同歩,与工厂等外部同步, 釆用 IEEE1588标准。 EtherCAT: Breaks through the technology of receiving Ethernet packets, decoding them and then copying the process data to each device. The EtherCAT slave device reads the corresponding addressing data as it passes through the slave node. The same input data is also inserted into the message as it passes. The entire process is only a few nanoseconds of time delay. So performance is improved compared to other Ethernet solutions. The last module in the network segment ends the entire data transfer operation, forming a logical and physical ring structure. All transmission data is compatible with Ethernet protocols and works in full-duplex transmission, improving transmission efficiency. Each device converts these Ethernet protocols into an internal bus protocol. EtherCAT is an optimized protocol for process data. The EtherCAT protocol can include several EtherCAT messages. Each message serves a specific memory area of a ± 过程 process image area. The data order does not depend on the physical order of the Ethernet terminals in the network. , can be arbitrarily addressed. EtherCAT supports topological types such as line, tree, and star. EtherCAT uses distributed clock technology to achieve accurate synchronization, and external synchronization with the factory, using the IEEE1588 standard.
SYNQNET: 是一种环形网络结构, 具有容错功能, 主节点通过自己开发的一种专用控制网 卡来实现实 Bf同步网络, 并修改了数据链路层 MC协议,实现了一种高性能的同步运动网络, 由于是自己专用的控制网卡和修改了数据链路层 MAC协议, 使其很难与别的厂商和标准的以 太网兼容。 SYNQNET: It is a ring network structure with fault tolerance. The master node implements a real Bf synchronization network through a dedicated control network card developed by itself, and modifies the data link layer MC protocol to achieve a high-performance synchronous motion. The network, because it is its own dedicated control network card and modified the data link layer MAC protocol, makes it difficult to be compatible with other vendors and standard Ethernet.
SERCOS III :是一种环形或线型拓扑结构, 主节点通过自己开发的专用控制网卡来实现实 时同步网络, 通信协议分为实时通信通道和非实时通信通道。 实时通信通道传送用于显示和 输入所有的控制内部参数、 数据和诊断信息等实时数据。 非实时通道使用标准的以太网帧来 传送非实时数据。 伹并未提出系统中枚举和配置各设备的方法。SERCOS III: It is a ring or line topology. The master node realizes real-time synchronization network through its own dedicated control network card. The communication protocol is divided into real-time communication channel and non-real-time communication channel. The real-time communication channel transmits real-time data for displaying and inputting all control internal parameters, data and diagnostic information. Non-real-time channels use standard Ethernet frames Transfer non-real time data. I did not suggest ways to enumerate and configure each device in the system.
由上述可知, 实时性和同步性是许多控制系统(特别是运动控制系统)的两个基本特征, 而以太网本身不具备这两个特性。 在总线网络的主从控制系统中, 人们的习惯思维都是设法 从主节点端解决实时同步问题。 解决的方法包括采用实时操作系统和硬件中断的方法, 但目 前性能最好的实时扩展的系统中断延迟不确定性也需要几个微秒, 这对于高精度的实时同步 要求来说也还是达不到要求。 在以太网链状或环状网络中, 目前实时同步的解决方法是在主 节点端由硬件发起一个同步广播通讯来完成同步, 因此主节点端需采用专用网卡或精确时钟 同步协议, 需有专有硬件支持。 As can be seen from the above, real-time and synchronicity are two basic features of many control systems (especially motion control systems), and Ethernet itself does not have these two features. In the master-slave control system of the bus network, people's habitual thinking is to solve the real-time synchronization problem from the master node. The solution includes real-time operating system and hardware interrupts, but the current best-performing real-time extended system interrupt latency uncertainty also takes a few microseconds, which is still not high-precision for real-time synchronization requirements. To the request. In the Ethernet chain or ring network, the current real-time synchronization solution is to initiate a synchronous broadcast communication by the hardware at the master node to complete the synchronization. Therefore, the master node needs to use a dedicated network card or an accurate clock synchronization protocol. Have hardware support.
发明内容Summary of the invention
本发明的目的就是为了解决目前将以太网用于现场级通信系统时, 现有网络设备通信的 实时性以及系统的精确同步性难以保障, 而添加专用硬件, 又造成成本增加、 开放性降低等 问题, 提供一种具有结构简单, 成本较低, 采用现有普通的标准网卡即可实现实时同步的基 于标准以太网的实时同步方法及同步网络。 The purpose of the present invention is to solve the problem that when the Ethernet is used in a field-level communication system, the real-time communication of the existing network equipment and the accurate synchronization of the system are difficult to guarantee, and the addition of dedicated hardware causes cost increase and openness reduction. The problem is to provide a real-time synchronization method based on standard Ethernet and a synchronous network with simple structure and low cost, real-time synchronization using existing common standard network cards.
为实现上述目的, 本发明采用了如下技术方案: In order to achieve the above object, the present invention adopts the following technical solutions:
一种基于标准以太网的实时同步网络, 包括至少一个主节点和至少一个从节点, 各节点 通过传输协议传送数据, 所述网络可以是链状网络或环形网络, 在从节点中任选一个为同步 信号源; A real-time synchronization network based on standard Ethernet, comprising at least one master node and at least one slave node, each node transmitting data through a transmission protocol, the network may be a chain network or a ring network, and one of the slave nodes is selected Synchronization signal source;
当所述网络为链状网络时, 主节点上有至少一个数据线接口, 每个从节点有至少两个数 据线接口, 连接时彼此串行连接, 即主节点的数据线接口通过数据线连接到从节点的一个数 据线接口上,&从节点的另一个数据接口通过数据线连接到下一个从节点的一个数据接口上, 依次连接构成链状网络, 进行实时同步的全双工通信;When the network is a chain network, the master node has at least one data line interface, and each slave node has at least two data line interfaces, and is connected to each other in series, that is, the data line interface of the master node is connected through the data line. from a data line to the interface node, and connected via a data line& another data from the interface node to the next node data interface from a sequentially connected to form a chain network, real-time synchronization of full duplex communication;
当所述网络为环形网络时, 所述各主节点有至少两个数据线接口, 各从节点有至少两个 数据线接口, 主节点的一个数据线接口通过数据线连接到从节点的一个数据线接口上, 从节 点的另一个数据线接口通过数据线连接到下一个从节点的一个数据接口上, 这样级联下去, . 一直连到最后一个从节点的数据线接口上, 最后一个从节点的另一个数据线接口通过数据线 连接到主节点的另一个数据线接口上, 构成环形网络, 进行实时同步的全双工通信。 When the network is a ring network, each of the master nodes has at least two data line interfaces, each slave node has at least two data line interfaces, and one data line interface of the master node is connected to one data of the slave node through the data line. On the line interface, another data line interface of the slave node is connected to a data interface of the next slave node through the data line, so that the cascade is continued, and the last slave node is connected to the data line interface of the last slave node. Another data line interface is connected to another data line interface of the master node through the data line to form a ring network for real-time synchronous full-duplex communication.
所述从节点内设有两个定时器, 分别为周期定时器和延迟定时器; 主节点为标准网卡, 其发送的控制报文为标准以太网传输协议 IEEE802.3协议规范的报文结构;各从节点采用标准 PHY芯片和带 MAC IP核心的 FPGA作为网络通信接口 (或可做成专用 ASIC) ; 在各从节点内均 设有一个 PLL电路, 各晶振信号经过该 PLL电路后再产生时钟信号; 其中 IEEE802.3帧协议的 数据段中包括周期数据和非周期数据, 周期数据是工业控制中, 任务通常按照一定的时间间 隔发出, 并且对任务的执行时间具有截止性要求的数据; 非周期数据是只有在特定的事件触 发下才出现; 控制报文还可适用于用户自定义的或其他公知的传输协议形式。 The slave node is provided with two timers, which are a periodic timer and a delay timer respectively; the master node is a standard network card, and the control message sent by the slave node is a packet structure of a standard Ethernet transmission protocol IEEE802.3 protocol specification; Each slave node adopts a standard PHY chip and an FPGA with a MAC IP core as a network communication interface (or can be made into a dedicated ASIC); each PLL has a PLL circuit, and each crystal oscillator signal passes through the PLL circuit to generate a clock. Signal; wherein the data segment of the IEEE802.3 frame protocol includes periodic data and non-periodic data, and the periodic data is data in industrial control, the task is usually issued at a certain time interval, and the execution time of the task has a cutoff requirement; The periodic data is only generated when a specific event is triggered; the control message can also be applied to user-defined or other well-known transport protocol forms.
所述同步信号源是在从节点中任选一个,同步信号源负责严格的定时和同步报文的发送, 其他从节点负责接收同步报文, 各从节点中设有一个同步报文延迟参数寄存器(也可为延迟 定时器),用于设定同步报文在传输线上的时间延迟,这个同步报文延迟参数通过主节点发送 延时测量命令报文, 各从节点自动测量该时间延迟的形式来设定; 同步信号源周期性地发送 同步报文,备从节点收到该同步报文后延迟一定时间再工作, 实现各从节点间动作的同步性; 同步方式还可釆用安装同步信号线将同步信号源与其余从节点连接来实现; The synchronization signal source is any one of the slave nodes, the synchronization signal source is responsible for strict timing and synchronization message transmission, the other slave nodes are responsible for receiving synchronization messages, and each slave node is provided with a synchronization message delay parameter register. (Also a delay timer), used to set the time delay of the synchronization message on the transmission line. The synchronization message delay parameter sends a delay measurement command message through the master node, and each slave node automatically measures the form of the time delay. The synchronization signal source periodically sends the synchronization message, and the slave node receives the synchronization message and delays the operation for a certain period of time to realize the synchronization of the actions between the slave nodes; the synchronization mode can also use the installation synchronization signal. The line connects the sync signal source with the remaining slave nodes;
同步信号源设定时, 可根据主节点发送命令报文的形式利用软件任意指定一个从节点为 同步信号源, 或者通过在任意一个从节点上设定拨码开关装置或其他公知的方式确定一个从 节点为同步信号源。 When the synchronization signal source is set, the slave node may be arbitrarily designated by the software as a synchronization signal source according to the manner in which the master node sends a command message, or may be determined by setting a dial switch device or any other known manner on any one of the slave nodes. The slave node is the sync signal source.
所述数据线既包括数据发送线, 也包括数据接收线, 相邻的两个节点之间通信时没有冲 突, 实现全双工通信, 数据线的传输介质既可为双绞线, 也可为光纤; The data line includes a data transmission line and a data receiving line, and there is no conflict between two adjacent nodes to achieve full-duplex communication, and the transmission medium of the data line can be either a twisted pair or a Optical fiber
全双工通信时, 每个从节点有存储转发数据和直接转发数据的功能, 主节点同从节点进 行通信时, 客从节点转发主节点的信息, 整个系统通信没有冲突, 各从节点同主节点进行通 信时, 从节点如果有发送给主节点的数据, 将先发送自己的数据给主节点, 同时接收并存储 后面一个从节点发送给主节点的数据, 等待自己给主节点的数据发送完成后, 再转发已存储 的后一个从节点发送给主节点的数据, 从节点如果没有发送给主节点的数据, 将直接转发后 面一个从节点发送给主节点的数据, 避免了通信冲突, 实现了整个系统的全双工通信。In full-duplex communication, each slave node has the function of storing and forwarding data and directly forwarding data. The master node and the slave node enter When communicating, the guest slave node forwards the information of the master node, and the whole system communication does not conflict. When each slave node communicates with the master node, if the slave node has data sent to the master node, it will first send its own data to the master node. At the same time, the data sent by the latter slave node to the master node is received and stored, and after waiting for the data transmission to the master node to complete, the stored data of the slave node is sent to the master node, and the slave node is not sent to the master node. The data will directly forward the data sent by the latter slave node to the master node, avoiding communication conflicts and realizing full-duplex communication of the entire system.
一种基于标准以太网的实时同步方法, A real-time synchronization method based on standard Ethernet,
( 1 )系统上电后, 对于链状网络, 主节点对各从节点进行自检, 主节点发送一个査询报 文, 第一个从节点首先接收到此査询报文, 然后转发此查询报文, 并发送自己的应答报文, 将自己的节点号初始化为 0; 各从节点在收到査询报文后依次转发此查询报文, 并发送自己 的应答报文和将自己的节点号初始化为 0, 直到最后一个从节点; 最后一个从节点可以通过 拨码开关或者其他的装置来确定, 该最后一个从节点收到此査询报文后, 发送自己的应答报 文, 包含为最后一个从节点的信息, 并将自己的节点号初始化为 0, '主节点收到最后一个从 节点的应答报文后, 说明系统连接可靠和各节点正常工作; 若主节点在发送完査询报文后, 在设定时间内收不到最后一个从节点的应答报文, 将报告错误, 说明有故障; (1) After the system is powered on, for the chain network, the master node performs a self-test on each slave node, and the master node sends a query message. The first slave node first receives the query message, and then forwards the query. The message, and send its own response message, initialize its own node number to 0; each slave node forwards the query message in turn after receiving the query message, and sends its own response message and its own node. The number is initialized to 0 until the last slave node; the last slave node can be determined by a DIP switch or other device. After receiving the query message, the last slave node sends its own response message, including The last slave node information, and initialize its own node number to 0, 'The master node receives the response message of the last slave node, indicating that the system connection is reliable and each node works normally; if the master node sends the query After the message, the response message of the last slave node will not be received within the set time, and an error will be reported, indicating that there is a fault;
对于环 网络, 主节点发送一个査询报文,第一个从节点收到之后转发到下一个从节点, 同时将自己的节点号初始化为 0,各从节点依次转发并将自己节点号初始化为 0,直到最后一 个从节点, 最后一个从节点再转发此查询报文到主节点, 并初始化自己节点号为 0; 主节点 在收到此査询报文后, 说明系统连接可靠和各节点工作正常; 若主节点在设定时间内仍然接 收不到此査询报文, 说明系统连接不可靠或某个节点不正常工作; For the ring network, the master node sends a query message. After the first slave node receives it, it forwards it to the next slave node, and initializes its own node number to 0. Each slave node forwards it in turn and initializes its own node number to 0, until the last slave node, the last slave node forwards the query message to the master node, and initializes its own node number to 0. After receiving the query message, the master node indicates that the system connection is reliable and each node works. Normal; if the master node still cannot receive this query message within the set time, it indicates that the system connection is not reliable or a node is not working properly;
(2) 自检通过后, 主节点对各从节点进行枚举和配置; (2) After the self-test is passed, the master node enumerates and configures each slave node;
( 3 )然后, 主节点发送一个测量网络时间延迟的控制报文通知各从节点, 第一个从节点 发送一个特定的报文, 各从节点转发该特定报文, 测量自己与最后一个从节点间的网络时间 延迟; (3) Then, the master node sends a control message measuring the network time delay to each slave node, and the first slave node sends a specific message, and each slave node forwards the specific message, and measures the self and the last slave node. Network time delay between;
(4 )进入网络周期性工作阶段, 第一个从节点周期性地发送一个同步报文, 各从节点在 接收到该同步报文后将转发此同步报文到下一个从节点, 各从节点收到该同步报文后, 延迟 一定的时间以补偿网络时间延迟, 然后动作, 实现从节点间动作同步性; (4) Entering the periodic working phase of the network, the first slave node periodically sends a synchronization message, and each slave node will forward the synchronization message to the next slave node after receiving the synchronization message, and each slave node After receiving the synchronization message, delay a certain time to compensate for the network time delay, and then act to achieve synchronization of motion between the nodes;
( 5 )其他的各从节点的延迟定时器也设定初始参数值,该初始参数为测量从节点间网络 时间延迟中测得的该从节点相对于最后一个从节点的网络时间延迟; 各从节点在收到同步报 文后, 触发 迟定时器,. 该延迟定时器在时钟信号的驱动下, 开始计时, 到设定的初始参数 后,产生一个中断信号, 从节点根据该中断信号锁存当前的状态并按照控制报文的命令动作, 并将当前的状态信息以报文的形式发送到主节点; 主节点收到各从节点的状态信息后, 然后 作数据规划, 并将规划的数据以数据报文的形式在该周期发送到各从节点; 各从节点在收到 数据报文后, 在下一周期按照同样的方式动作; 这样周期往复下去, 实现系统正常的周期数 据交换和同步动作。 (5) The delay timers of the other slave nodes also set an initial parameter value, which is a network time delay of measuring the slave node relative to the last slave node measured from the inter-node network time delay; After receiving the synchronization message, the node triggers the late timer. The delay timer starts to count under the driving of the clock signal. After the initial parameter is set, an interrupt signal is generated, and the slave node latches according to the interrupt signal. The current state is in accordance with the command of the control message, and the current state information is sent to the master node in the form of a message; the master node receives the state information of each slave node, then performs data planning, and plans the data. In the form of a data message, it is sent to each slave node in the cycle; after receiving the data message, each slave node operates in the same manner in the next cycle; thus, the cycle is repeated, and the normal cycle data exchange and synchronization action of the system are realized. .
所述歩骤 2) 中, 对于链状网络, 主节点对各从节点进行枚举和配置过程为, 从主节点 收到最后一个从节点的应答报文后, 开始发送配置报文, 跟主节点相连的第一个从节点, 此 时节点号为 0, 将先收到配置报文, 收到此配置报文后, 将不转发此配置报文到下一个从节 点, 第一个从节点将自己的节点号设置为 1 , 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等, 主节点在配置完第一个从节点后, 将再发下一个配置报文, 第一 个从节点将转发此配置报文到第二个从节点, 此时节点号为 0, 第二个从节点在收到此配置 报文后将不转发此配置报文到下一个从节点, 第二个从节点将自己的节点号设置为 2, 同时 发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等; 这样依次类推, 直到配 置到最后一不从节点; 这样每个从节点都有自己唯一的节点标号, 主节点也建立一个节点表, 包含各从节点的节点号、 各从节点的功能和作用等; In the step 2), for the chain network, the master node enumerates and configures the slave nodes, and after receiving the response message of the last slave node, the master node starts to send the configuration packet, followed by the master. The first slave node connected to the node. If the node number is 0, the configuration packet will be received first. After receiving the configuration packet, the configuration packet will not be forwarded to the next slave node. The first slave node Set its own node number to 1, and send a response message, including its own node number, the function and role of the slave node. After the primary node is configured with the first slave node, it will send another configuration report. The first slave node will forward the configuration packet to the second slave node. The node number is 0. The second slave node will not forward the configuration packet to the next one after receiving the configuration packet. From the node, the second slave node sets its own node number to 2, and sends a response message, including its own node number, the function and role of the slave node, and so on; until the last one is configured. Point; so that each has its own unique reference node, the master node also create a table node from the node, the node contains the node number of each node from the function and role, and the like;
对于环形网络, 主节点通过一个数据接口开始发送配置报文, 跟主节点相连的第一个从 节点, 此时节点号为 0, 将先收到配置报文, 收到此配置报文后, 将不转发此配置报文到下 一个从节点, 第一个从节点将自己的节点号设置为 1, 同时发送一个应答报文, 包含自己的 节点号、 该从节点的功能、 作用等, 主节点在配置完第一个从节点后, 将再发下一个配置报 文, 第一个从节点将转发此配置报文到第二个从节点, 此时节点号为 0, 第二个从节点在收 到此配置报文后将不转发此配置报文到下一个从节点, 第二个从节点将自己的节点号设置为For a ring network, the master node starts sending configuration messages through a data interface, and the first slave connected to the master node The node, when the node number is 0, will receive the configuration packet first. After receiving the configuration packet, the configuration packet will not be forwarded to the next slave node. The first slave node sets its own node number to 1, at the same time send a response message, including its own node number, the function and role of the slave node, the master node will send another configuration message after the first slave node is configured, the first slave node The configuration packet will be forwarded to the second slave node. The node number is 0. After receiving the configuration packet, the second slave node will not forward the configuration packet to the next slave node. The second slave The node sets its own node number to
2, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等, 这样依次类推, 直到配置完最后一个从节点; 此时主节点再发配置报文, 各从节点都有自已的节点号, 各从 节点都将转发此配置报文, 最后一个从节点将转发此配置 ί艮文到主节点的另一个数据线接口 上; 主节点 ¾收到此配置报文后, 说明整个系统将配置完毕, 这样每个从节点都有自己唯一 的节点标号, 主节点也建立一个节点表,包含各从节点的节点号、各从节点的功能和作用等。2, simultaneously send a response message, including its own node number, the function and role of the slave node, and so on, until the last slave node is configured; at this time, the master node sends a configuration message again, and each slave node With its own node number, each slave node will forward this configuration message, and the last slave node will forward this configuration to another data line interface of the master node; after the master node receives this configuration message, It indicates that the entire system will be configured, so that each slave node has its own unique node label, and the master node also establishes a node table, including the node number of each slave node, the function and role of each slave node.
所述步骤 3 ) 中测量网络时间延迟的控制报文结构为 ΙΕΕΕ802. 3协议规范, 其组成包括 前导符 7bytes、 分割符 lbyte、 目的地址 6bytes、 源地址 6bytes、 长度 /类型字段 2bytes、 数据段 46- 1500bytes、帧校验序列域 4bytes,其中数据段又分为两个 bytes的主节点报文标 志,紫跟着的一个 byte用来区分控制报文的不同控制信息的控制类型标志,其余为控制报文 的数据信息; The control packet structure for measuring the network time delay in the step 3) is a 802.32 protocol specification, and the composition includes a preamble of 7 bytes, a separator of 1 byte, a destination address of 6 bytes, a source address of 6 bytes, a length/type field of 2 bytes, and a data segment 46. - 1500bytes, frame check sequence field 4bytes, where the data segment is further divided into two bytes of the master node message flag, a byte followed by purple is used to distinguish the control type flag of the different control information of the control message, and the rest is the control report Data information;
步骤 3 ) 中测量从节点间网络时间延迟方法为, 各从节点收到控制报文后, 将延迟定时 · 器清零, 第一个从节点向下一个从节点发送一个特定的报文, 并触发自己的延迟定时器开始 计时; 第二个从节点收到该特定报文后向下一个从节点转发此报文, 并触发自己的延迟定时. 器开始计时; 这样向下转发下去, 直到最后一个从节点; 最后一个从节点收到该特定报文后 将向上一个从节点转发该特定报文,上一个从节点收到该特定报文后再向上转发该特定报文, 并触发自己的延迟定时器停止计时, 这样向上转发并触发自己的延迟定时器停止计时, 直到:: 第一个从节点; 第一个从节点收到该特定报文后将触发自己的延迟定时器停止计时, 并不再 转发该特定 文; 这样, 每个从节点即可获得自己与最后一个从节点间的网络时间延迟, 即 延迟定时器计时的一半, 该延迟定时器的计时将以寄存器参数的形式保存在各从节点上。 Step 3) The method for measuring the time delay between the slave nodes is that after each slave node receives the control message, the delay timer is cleared, and the first slave node sends a specific message to the next slave node, and Triggering its own delay timer to start timing; the second slave node forwards the message to the next slave node after receiving the specific message, and triggers its own delay timing. The device starts timing; this is forwarded down until the end A slave node; after receiving the specific packet, the last slave node forwards the specific packet to the upper slave node, and the last slave node receives the specific packet and then forwards the specific packet upward, and triggers its own delay. The timer stops counting, thus forwarding up and triggering its own delay timer to stop timing until:: the first slave node; the first slave node will trigger its own delay timer to stop timing after receiving the specific message, and The specific text is no longer forwarded; thus, each slave node can obtain the network time delay between itself and the last slave node, that is, the delay timer When half of the form will register the timing of the delay timer parameters stored on each slave node.
当选最后一个从节点为同步信号源时, 特定延迟测量报文由最后一个从节点发出, 测量 各从节点与第一个从节点的时间延时, 工作方法与上述相仿。 When the last slave node is selected as the synchronization signal source, the specific delay measurement message is sent by the last slave node, and the time delay of each slave node and the first slave node is measured, and the working method is similar to the above.
所述步骤 4) 的周期性工作阶段中, 各从节点在动作的同时锁存当前从节点的当前状态, 并按照上一个周期收到的主节点的命令报文同时动作, 将该从节点的状态信息以报文的形式 发送到主节点, 主节点分析各从节点的状态信息, 并统一规划下一周期各从节点的动作, 并 将该动作信息以命令报文的形式在该周期传送到各从节点上, 实现各从节点动作的同步性; 周期性地发送一个同步报文是指第一个从节点的周期定时器设定初始参数后, 该初始参 数就是周期性通信的通信周期, 周期定时器在第一个从节点时钟信号的驱动下, 开始计时, · 当计时值到达设定的初始参数时, 该周期定时器产生一个中断信号并将周期定时器清零并重 新开始计时, 第一个从节点收到该中断信号, 将向下发送一个特定的同步报文, 这样周期往 复, 实现了周期性发送同步报文的方法; In the periodic working phase of the step 4), each slave node latches the current state of the current slave node while the action is active, and simultaneously operates the command message of the master node received in the previous cycle, and the slave node The status information is sent to the master node in the form of a message. The master node analyzes the state information of each slave node, and uniformly plans the actions of the slave nodes in the next cycle, and transmits the action information in the form of a command message to the slave node. On each of the slave nodes, the synchronization of the actions of the slave nodes is implemented; periodically sending a synchronization message refers to the initial parameter of the first slave node's cycle timer, and the initial parameter is the communication cycle of the periodic communication. The cycle timer starts to be driven by the first slave node clock signal. · When the timer value reaches the set initial parameter, the cycle timer generates an interrupt signal and clears the cycle timer and restarts the timer. When the first slave receives the interrupt signal, it will send a specific synchronization message downward, so that the cycle reciprocates and the periodicity is realized. The method of transmitting synchronization packets;
当选取最后一个从节点作为同步信号源时, 则指定最后一个从节点的周期定时器设定初 始参数为周 性通信的通信周期, 由最后一个从节点的周期定时器产生中断, 来发送特定的' 同步报文给各从节点。 工作方法与上述相仿。 When the last slave node is selected as the synchronization signal source, the cycle timer of the last slave node is specified to set the initial parameter to the communication cycle of the weekly communication, and the cycle timer of the last slave node generates an interrupt to transmit the specific ' Synchronize messages to each slave node. The working method is similar to the above.
步骤 4) 中从节点延迟一定的时间, 然后动作的方法为各从节点中的延迟定时器, 各延 迟定时器可设定初始参数值, 该初始参数从节点相对于最后一个从节点的网络时间延迟, 各 从节点在收到同步报文后, 触发延迟定时器, 该延迟定时器在时钟信号的驱动下, 幵始定时, 到设定的初始参数后, 产生一个中断信号, 从节点根据该中断信号锁存当前的状态并按照控 制报文的命令动作, 并将当前的状态信息以报文的形式发送到主节点.。 In step 4), the slave node is delayed by a certain time, and then the action method is a delay timer in each slave node, and each delay timer can set an initial parameter value, and the initial parameter is from the node to the network time of the last slave node. Delay, after receiving the synchronization message, each slave node triggers a delay timer, which is driven by the clock signal, starts timing, and after generating the initial parameter, generates an interrupt signal, and the slave node according to the The interrupt signal latches the current state and acts according to the command of the control message, and sends the current state information to the master node in the form of a message.
本发明的思路是在主节点端采用标准网卡, 无需任何专有硬件, 而在网络控制的从节点 中选取一个(如第一个从节点)作为同步信号源。为补偿系统传输的延时, 系统在配置阶段, 测量各网络从节点与最后一个网络从节点的网络传输时间延迟(包括器件延时、 传输线延时 和从节点时钾抖动延时),并以寄存器参数的形式保存在网络从节点的延迟定时器上,其准确 度可达到 ns级, 同步信号源根据系统配置的时间参数周期性地准确地(取决于从节点的时钟 . 精度, 可达 ns级)发送同步报文, 各网络从节点在收到该同步报文时根据测得的传输延迟时 间动作, 实现了各网络从节点的动作实时同步性。 它结合 FPGA (现场可编程门阵列)技术实 现了一种新的用于现场级通信的实时同步以太网络,将以太网中的节点分为主节点和从节点, 适合于分布式控制系统。 给出了以太网中实现全双工通信的网络拓扑结构, 并给出了主节点 自动枚举和配置从节点的方法, 以及实现网络实时通信和各从节点间同步动作的方法。The idea of the invention is to use a standard network card at the primary node, without any proprietary hardware, but in a network-controlled slave node Select one (such as the first slave) as the sync source. To compensate for the delay of the system transmission, the system measures the network transmission time delay (including device delay, transmission line delay, and potassium jitter delay from the node) of each network slave node and the last network slave node during the configuration phase, and The form of the register parameters is stored on the delay timer of the network slave node, and its accuracy can reach ns level. The synchronization signal source is periodically and accurately according to the time parameter of the system configuration (depending on the clock of the slave node. Accuracy, up to ns Level) Sending synchronization messages, each network slave node operates according to the measured transmission delay time when receiving the synchronization message, realizing the real-time synchronization of the actions of each network slave node. It combines FPGA (Field Programmable Gate Array) technology to implement a new real-time synchronous Ethernet network for field-level communication. The nodes in Ethernet are divided into master nodes and slave nodes, which are suitable for distributed control systems. The network topology of full duplex communication in Ethernet is given, and the method of automatic enumeration and configuration of slave nodes by the master node, as well as the method of realizing network real-time communication and synchronous action between slave nodes are given.
本发明的益处是降低了系统主节点端实时性要求, 主节点端可以采用标准网卡, 无需实 时操作系统支持, 真正实现了控制系统硬件的开放性, 降低了系统成本。 The invention has the advantages of reducing the real-time requirement of the main node of the system, and the main node can adopt a standard network card without real-time operating system support, which truly realizes the openness of the control system hardware and reduces the system cost.
附图说明 DRAWINGS
图 1为实施例 1的链状系统链状拓扑结构图; 1 is a chain topology diagram of a chain system of Embodiment 1;
图 2为图 1的以太网连接实例结构图; 2 is a structural diagram of an example of the Ethernet connection of FIG. 1;
图 3为图 1的以太网连接另一实施例结构图; 3 is a structural diagram of another embodiment of the Ethernet connection of FIG. 1;
图 4为系统的环形拓扑结构图; Figure 4 is a ring topology diagram of the system;
图 5为 4的以太网连接实例结构图; Figure 5 is a structural diagram of an example of an Ethernet connection of 4;
图 6为实现从节点精确同步的方法图; Figure 6 is a diagram of a method for implementing accurate synchronization from a node;
图 7为数据的传输协议格式图; Figure 7 is a format diagram of a data transmission protocol;
图 8为数据的传输协议另一格式图; Figure 8 is another format diagram of the data transmission protocol;
图 9为系统的工作流程图。 Figure 9 is a working flow chart of the system.
其中, 1.主节点, 2.从节点, 3.数据发送线, 4.数据接收线, 5.普通标准网卡, 6.网络 变压器, 7. PHY芯片, 8.带 MAC IP核的 FPGA, 9.信号同步线, 10.定时器。 Among them, 1. master node, 2. slave node, 3. data transmission line, 4. data receiving line, 5. common standard network card, 6. network transformer, 7. PHY chip, 8. FPGA with MAC IP core, 9 Signal sync line, 10. Timer.
具体实施方式detailed description
下面结合附图与实施例对本发明作进一步说明。 实施例 1: The invention will be further described below in conjunction with the drawings and embodiments. Example 1:
以一个主节点和两个从节点为例来说, 该系统的链状拓扑结构如图 1所示。 Taking a master node and two slave nodes as an example, the chain topology of the system is shown in Figure 1.
主节点 1和从节点 2之间的通信分别由数据发送线 3和数据接收线 4来完成, 从节点 2 之间的通信也由数据发送线 3和数据接收线 4来完成, 这样就实现了各节点间数据的全双工 通信。 从节 有存储转发和直接转发的功能, 主节点 1发送的数据经过从节点 2时, 从节点 2接收并直接转发给下一个从节点 2,从节点 2的数据发送给主节点 1时,若从节点 2有要发 送给主节点 1的数据, 贝 U从节点 2先存储下一个从节点 2的数据, 等从节点 2发送给主节点 1的数据发送完后, 再转发下一个从节点 2的数据, 若从节点 2没有要发送给主节点 1的数 据, 则从节点 2直接转发下一个从节点 2的数据。 这样就实现了系统的全双工通信。 此拓扑 结构不仅适用于以太网, 还可适用于用户自定义的或其他公知的传输协议形式,只是 FPGA中 IP核的协议不同。 The communication between the master node 1 and the slave node 2 is completed by the data transmission line 3 and the data reception line 4, respectively, and the communication between the slave nodes 2 is also completed by the data transmission line 3 and the data reception line 4, thus realizing Full duplex communication of data between nodes. The slave node has the functions of store-and-forward and direct-forward. When the data sent by the master node 1 passes through the slave node 2, it is received from the node 2 and directly forwarded to the next slave node 2. When the data of the slave node 2 is sent to the master node 1, if The slave node 2 has data to be sent to the master node 1, and the slave U slave node 2 stores the data of the next slave node 2 first, and after the data sent from the node 2 to the master node 1 is transmitted, the next slave node 2 is forwarded. The data, if the slave node 2 has no data to be sent to the master node 1, the slave node 2 directly forwards the data of the next slave node 2. This achieves full duplex communication of the system. This topology is not only applicable to Ethernet, but also to user-defined or other well-known transport protocol forms, except that the protocols of the IP cores in the FPGA are different.
图 1的详细结构如图 2所示, 其中的 1为主节点, 2为从节点, 5为普通标准网卡, 6为 网络变压器, 7为 PHY芯片, 8为带 MAC IP核的 FPGA。 The detailed structure of Figure 1 is shown in Figure 2, where 1 is the master node, 2 is the slave node, 5 is the common standard network card, 6 is the network transformer, 7 is the PHY chip, and 8 is the FPGA with the MAC IP core.
在该系统的链状结构中, 主节点 1可以自动检测系统是否可靠连接和正常工作。 在最后 —个从节点 2中通过一个拨码配置开关或其他公知的方式, 表明为最后一个从节点。 在主节 点 1 自动检测从节点吋, 主节点 1发送一个查询报文, 第一个从节点 2首先接收到此査询 ί艮 文, 第一个从节点 2将转发此査询报文, 并发送自己的应答报文和将自己的节点号初始化为 0, 下一个从 点 2也即最后一个从节点收到此查询报文后, 发送自己的应答报文(包含为最 后一个从节点的信息), 并将自己的节点号初始化为 0。 主节点 1收到最后一个从节点 2的应 答报文后, 说明系统连接可靠和各节点正常工作。 若主节点 1在发送完査询报文后, 等待一 段时间(此时间为正常情况下检测最大从节点数的最长时间的 2倍), 仍然收不到最后一个节 点 2的应答报文, 将报告错误, 说明有故障。In the chain structure of the system, the master node 1 can automatically detect whether the system is reliably connected and working normally. In the last slave node 2, through a dial configuration switch or other known means, it is indicated as the last slave node. After the master node 1 automatically detects the slave node, the master node 1 sends a query message, and the first slave node 2 first receives the query message, and the first slave node 2 will forward the query message, and Send its own response message and initialize its own node number to 0. After the next slave node 2, that is, the last slave node receives the query message, it sends its own response message (including the information of the last slave node). ), and initialize its own node number to 0. Master node 1 receives the last slave node 2 After the message is answered, the system connection is reliable and the nodes work normally. If the master node 1 waits for a period of time after sending the query message (this time is twice the maximum time of detecting the maximum number of slave nodes under normal conditions), the response packet of the last node 2 is still not received. An error will be reported stating that there is a failure.
在该系统的链状结构中,主节点 1可以自动枚举和配置各从节点 2。在主节点 1检测到系 统可靠连接和正常工作后, 在主节点 1收到最后一个从节点 2的应答报文后, 开始发送配置 报文, 跟主节点 1相连的第一个从节点 2 (此时节点号为 0)将先收到配置报文, 收到此配置 ί艮文后, 将不转发此配置报文到下一个从节点 2, 第一个从节点 2将自己的节点号设置为 1, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等, 主节点 1在配置完 第一个从节点 2后, 将再发下一个配置报文, 第一个从节点 2 (此时节点号不为 0)将转发此 配置报文到第二个从节点 2 (此时节点号为 0), 第二个从节点也即最后一个从节点 2在收到 . 此配置报文 ji将自己的节点号设置为 2, 同时发送一个应答报文, 包含自己的节点号、 该从 节点的功能、 作用等。 这样每个从节点 2都有自己唯一的节点标号, 主节点 1也建立一个节 点表, 包含各节点的节点号, 包含各节点的功能和作用等。 实施例 2: In the chain structure of the system, the master node 1 can automatically enumerate and configure each slave node 2. After the master node 1 detects the reliable connection and normal operation of the system, after the master node 1 receives the response packet of the last slave node 2, it starts to send the configuration packet, and the first slave node 2 connected to the master node 1 ( At this time, the node number is 0). The configuration packet will be received first. After receiving this configuration, the configuration packet will not be forwarded to the next slave node 2. The first slave node 2 will set its own node number. If it is 1, a response message is sent at the same time, including its own node number, the function and function of the slave node, and the master node 1 sends another configuration message after the first slave node 2 is configured. Slave node 2 (the node number is not 0 at this time) will forward this configuration message to the second slave node 2 (the node number is 0 at this time), and the second slave node, that is, the last slave node 2, is received. This configuration message sets its own node number to 2, and sends a response message, including its own node number, the function and function of the slave node. Thus, each slave node 2 has its own unique node label, and the master node 1 also establishes a node table containing the node numbers of the nodes, including the functions and functions of the nodes. Example 2:
图 3中为链状结构中, 带有定时器 10的以太网实施例。 In Fig. 3, an Ethernet embodiment with a timer 10 in a chain structure.
它包括主节点 1和若干个从节点 2,主节点 1能枚举和配置各从节点 2, 主节点 1分配给 各从节点 2—个单独的从节点号。 主节点 1发送一个测量从节点间时间延迟的控制报文后, 各从节点 2测量自己与最后一个从节点 2间的网络时间延迟。 在网络周期性工作阶段, 第一 个从节点 2周期性地发送一个同步报文, 各从节点 2在接收到该同步报文后将转发此同步报 文到下一个从节点 2, 各从节点 2收到该同步报文后, 延迟一定的时间以补偿网络时间延迟, ' 然后动作, 这样实现了从节点 2间动作同步性。 It includes a master node 1 and a number of slave nodes 2, the master node 1 can enumerate and configure each slave node 2, and the master node 1 assigns each slave node 2 a separate slave node number. After the master node 1 transmits a control message measuring the time delay between the slave nodes, each slave node 2 measures the network time delay between itself and the last slave node 2. During the periodic working phase of the network, the first slave node 2 periodically sends a synchronization message, and each slave node 2 forwards the synchronization message to the next slave node 2 after receiving the synchronization message, and each slave node 2 After receiving the synchronization message, delay a certain time to compensate for the network time delay, and then act, thus achieving synchronization of motion between nodes 2.
主节点 1选用标准网卡 5作为网络通信接口, 各从节点采用 dual PHY 7和带 MAC IP核 的 FPGA 8作! /网络通信接口, 这样, 主节点 1具有一个通信接口, 而各从节点具有两个通信 接口,·主节点 1的通信接口通过数据线连接到从节点的一个通信接口上, 从节点的另一个通 信接口通过数据线连接到下一个从节点的一个通信接口上, 这样彼此连接下去, 形成一个链 .状网络结构。 The master node 1 selects the standard network card 5 as the network communication interface, and each slave node uses the dual PHY 7 and the FPGA 8 with the MAC IP core! / network communication interface, such that the master node 1 has a communication interface, and each slave node has two communication interfaces, the communication interface of the master node 1 is connected to one communication interface of the slave node through the data line, and the other node of the slave node The communication interface is connected to a communication interface of the next slave node through a data line, and thus connected to each other to form a chain-like network structure.
主节点 1发送的控制报文结构符合 IEEE802. 3报文结构协议规范, 为了与主节点 1所发 的 TCP/IP等报文格式区别, 在 IEEE802. 3报文结构数据区域中前两个字节用 0X55 表示为 控制报文的格式, 紧跟着的一个字节用来区分控制报文的不同控制信息,例如 0X11表示测量 从节点间时间延迟的控制报文, 剩下的为控制报文的数据区域。 整个报文组成包括前导符 7bytes、 分割符 lbyte、 目的地址 6bytes、 源地址 6bytes、 长度 /类型字段 2bytes、 数据段 46-1500bytes、 帧校验序列域 4bytes, 其中数据段又分为两个 bytes的主节点报文标志, 紧 跟着的一个 byte用来区分控制报文的不同控制信息的控制类型标志,其余为控制报文的数据 信息。 The control message structure sent by the master node 1 conforms to the IEEE802.3 message structure protocol specification. In order to distinguish from the TCP/IP message format sent by the master node 1, the first two words in the IEEE802.3 message structure data area. The section is represented by 0X55 as the format of the control message, and the following one byte is used to distinguish different control information of the control message. For example, 0X11 indicates the control message measuring the time delay between the nodes, and the rest is the control message. Data area. The entire message consists of a preamble of 7 bytes, a separator of 1 byte, a destination address of 6 bytes, a source address of 6 bytes, a length/type field of 2 bytes, a data section of 46-1500 bytes, and a frame check sequence of 4 bytes. The data segment is further divided into two bytes. The master node message flag, followed by a byte is used to distinguish the control type flag of the different control information of the control message, and the rest is the data information of the control message.
第一个从节点 2周期性发送的同步报文,该同步报文是在各从节点 2间传送,其结构协 议不必符合 IEEE802. 3这种长的报文结构协议规范,由于同步报文关系到同步的精度,因此该 同步报文应尽量短。 该同步报文的用两个字节 0XM55来表示。 The first synchronization message periodically sent from the node 2, the synchronization message is transmitted between the slave nodes 2, and the structure protocol does not have to conform to the long message structure protocol specification of IEEE802.3, due to the synchronization message relationship. The accuracy to synchronization, so the synchronization message should be as short as possible. The synchronization message is represented by two bytes 0XM55.
由于各晶振在制造时都有一定的偏差, 这也是允许的, 为了消除各从节点的时钟信号抖 动, 各从节点中都设有一个 PLL电路, 各晶振信号经过该 PLL电路后再产生时钟信号, 该相 位^ 1定回路电路消除了各从节点的时钟信号抖动的影响。 Since each crystal oscillator has a certain deviation in manufacturing, this is also allowed. In order to eliminate the jitter of the clock signals of each slave node, each slave node is provided with a PLL circuit, and each crystal oscillator signal passes through the PLL circuit to generate a clock signal. The phase ^ 1 fixed loop circuit eliminates the influence of the clock signal jitter of each slave node.
其工作过程为: Its working process is:
( 1 )系统上电后, 主节点 1对各从节点 2进行自检, 主节点 1发送一个査询报文, 第一 个从节点 2首先接收到此查询报文, 第一个从节点 2将转发此查询报文, 并发送自己的应答 报文和将自己的节点号初始化为 0, 第二个从节点 2收到此査询报文将转发此查询报文, 并 发送自己的应答报文和将自己的节点号初始化为 0,直到最后一个从节点 2,最后一个从节点 2可以通过拨码开关或者其他的装置来确定, 该最后一个从节点 2收到此査询报文后, 发送 自己的应答 ί艮文, 包含为最后一个从节点的信息, 并将自己的节点号初始化为 0, 主节点 1 收到最后一个从节点 2的应答报文后, 说明系统连接可靠和各节点正常工作; 若主节点 1在 发送完査询 i 文后, 等待一段时间, 此时间为正常情况下枚举最大从节点数的最长时间的 2 倍, 仍然收不到最后一个从节点 2的应答报文, 将报告错误, 说明有故障;(1) After the system is powered on, the master node 1 performs a self-test on each slave node 2, and the master node 1 sends a query message, and the first slave node 2 first receives the query message, and the first slave node 2 The query message will be forwarded, and its own response message will be sent and its own node number will be initialized to 0. The second slave node 2 will receive the query message and will forward the query message. Send its own response message and initialize its own node number to 0 until the last slave node 2, the last slave node 2 can be determined by the DIP switch or other device, the last slave node 2 receives this check After the message is sent, the response message is sent, including the information of the last slave node, and its own node number is initialized to 0. After the master node 1 receives the response message of the last slave node 2, the system is described. The connection is reliable and the nodes work normally; if the master node 1 waits for a period of time after sending the query i text, this time is twice the maximum time of enumerating the maximum number of slave nodes under normal conditions, and still does not receive the last time. A response message from node 2 will report an error indicating a fault.
( 2) 自检通过后, 主节点 1对各从节点 2进行枚举和配置, 即主节点 1收到最后一个从 节点 2的应答报文后, 开始发送配置报文, 跟主节点 1相连的第一个从节点 2, 此时节点号 为 0, 将先收到配置报文, 收到此配置报文后, 将不转发此配置报文到下一个从节点 2, 第一 个从节点 2 自己的节点号设置为 1, 同时发送一个应答报文, 包含自己的节点号、 该从节 点的功能、 作用等, 主节点 1在配置完第一个从节点后, 将再发个下一个配置报文, 第一个 从节点 2 (此时节点号不为 0)将转发此配置报文到第二个从节点 2, 第二个从节点 2在收到 此配置报文后将不转发此配置报文到下一个从节点 2, 第二个从节点 2将自己的节点号设置 为 2, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等; 这样依次类 推, 直到配置到最后一个从节点 2; 这样每个从节点 2都有自己唯一的节点标号, 主节点 1 也建立一个节点表, 包含各从节点的节点号、 各从节点的功能和作用等; (2) After the self-test is passed, the master node 1 enumerates and configures each slave node 2, that is, after receiving the response packet of the last slave node 2, the master node 1 starts to send a configuration message and is connected to the master node 1. The first slave node 2, when the node number is 0, will receive the configuration packet first. After receiving the configuration packet, the configuration packet will not be forwarded to the next slave node 2, the first slave node. 2 Set its own node number to 1, and send a response message, including its own node number, the function and function of the slave node, and the master node 1 will send the next one after configuring the first slave node. Configure the packet. The first slave node 2 (the node number is not 0) will forward the configuration packet to the second slave node 2. The second slave node 2 will not forward the packet after receiving the configuration packet. This configuration message is sent to the next slave node 2, and the second slave node 2 sets its own node number to 2, and simultaneously sends a response message, including its own node number, the function and role of the slave node; Analogy, until configuration to the last one Node 2; thus each slave node 2 has its own unique node label, and the master node 1 also establishes a node table, including the node number of each slave node, the function and role of each slave node, and the like;
(3)主节点 1然后发送一个测量网络时间延迟的控制报文,各从节点上 2包括一个延迟 定时器,第一个从节点 2在收到测量网络时间延迟的控制报文后,将自己的延迟定时器清零, 并转发该测量网络时间延迟的控制报文, 各从节点收到此控制报文后, 也将自己的延迟定时 器清零Q(3) The master node 1 then sends a control message measuring the network time delay, and each slave node 2 includes a delay timer, and the first slave node 2 receives itself after receiving the control message measuring the network time delay. delay timer is cleared, and the measurement control message forwarding network time delay after each received this message from the control node, will own delay timer is clearedQ
(4)第一个从节点 2向第二个从节点 2发送一个特定的控制报文,并触发自己的延迟定- 时器开始计时, 第二个从节点 2收到该特定报文后向第三个从节点 2转发此报文, 并触发自 己的延迟定时器开始计时, 最后一个从节点 2收到该特定报文后将向上一个从节点 2转发该 特定报文, 上一个从节点 2收到该特定报文后将上转发该特定报文后, 并触发自己的延迟定 时器停止计时, 直到第一个从节点, 第一个从节点 2收到该特定报文后将触发自己的延迟定 时器停止计吋, 并不再转发该特定报文。 这样, 每个从节点 2就能知道自己跟最后一个从节 点 2间的网络时间延迟, 即延迟定时器计时的一半, 该延迟定时器的计时将以寄存器参数的 形式保存在各从节点上。 (4) The first slave node 2 sends a specific control message to the second slave node 2, and triggers its own delay timer to start timing, and the second slave node 2 receives the specific message backward. The third slave node 2 forwards the message and triggers its own delay timer to start timing. After the last slave node 2 receives the specific message, it will forward the specific message to the previous slave node 2, and the previous slave node 2 After receiving the specific message, the specific message will be forwarded, and its own delay timer will be triggered to stop timing. Until the first slave node, the first slave node 2 will trigger its own message after receiving the specific message. The delay timer stops counting and the specific message is no longer forwarded. Thus, each slave node 2 can know the network time delay between itself and the last slave node 2, that is, half of the delay timer, and the timing of the delay timer will be stored in the register parameters in the slave nodes.
(5)系统进入周期性通信阶段, 第一个从节点 2周期性地发送一个同步报文,第一个从 节点 2中的周期定时器可设定初始参数, 该初始参数就是周期性通信的通信周期, 周期定时 器在第一个从节点 2时钟信号的驱动下, 开始计时, 当定时期的值到达设定的初始参数时, 该周期定时器产生一个中断信号并将周期定时器清零, 并再开始定时, 第一个从节点 2收到 该中断信夸, 向下发送一个特定的同步报文., 各从节点将转发此同步报文。这样周期往复, 实现了周期4发送同步报文的方法。 (5) The system enters the periodic communication phase, and the first slave node 2 periodically transmits a synchronization message, and the cycle timer in the first slave node 2 can set an initial parameter, which is a periodic communication. The communication cycle, the cycle timer starts to be driven by the first slave node 2 clock signal. When the value of the fixed period reaches the set initial parameter, the cycle timer generates an interrupt signal and clears the cycle timer. And then start timing, the first one receives the interrupt letter from node 2, and sends a specific synchronization message downward. Each slave node will forward the synchronization message. In this way, the cycle is repeated, and the method of transmitting the synchronization message in the cycle 4 is realized.
(6)各从节点 2中的延迟定时器设定初始参数值,该初始参数为测量从节点间网络时间 延迟中测得的该从节点相对于最后一个从节点的网络时间延迟。 从节点 2发送该同步报文、 第三从节点转发完同步报文和第四从节点收到同步报文后, 触发延迟定时器, 该延迟定时器 10在时钟信号的驱动下, 开始定时, 到设定的初始参数后, 产生一个中断信号, 从节点 2根 据该中断信号锁存当前的状态并按照控制报文的命令动作, 并将当前的状态信息以报文的形 式发送到主节点 1。 主节点 1收到各从节点的状态信息后, 然后作数据规划, 并将规划的数 据以数据报文的形式在该周期发送到各从节点 2。 这样周期往复下去, 实现系统正常的周期 数据交换和同步动作。 (6) The delay timer in each slave node 2 sets an initial parameter value for measuring the network time delay of the slave node relative to the last slave node measured from the inter-node network time delay. After the synchronization message is sent from the node 2, the third slave node forwards the synchronization message, and the fourth slave node receives the synchronization message, a delay timer is triggered, and the delay timer 10 starts timing after being driven by the clock signal. After the initial parameter is set, an interrupt signal is generated, and the slave node 2 latches the current state according to the interrupt signal and acts according to the command of the control message, and sends the current state information to the master node in the form of a message. . After receiving the status information of each slave node, the master node 1 performs data planning, and sends the planned data to the slave nodes 2 in the form of data packets. This cycle reciprocates to achieve normal cycle data exchange and synchronization actions.
各从节点 2包括变压器 6、 DUAL PHY 7和带 MAC IP核的 FPGA. 8、 两个定时器 10, 定时 器 10中一个为延迟定时器, 另一个为周期定时器。 实施例 3:Each slave node 2 includes a transformer 6, a DUAL PHY 7 and an FPGA with a MAC IP core. 8. Two timers 10, one of which is a delay timer and the other is a periodic timer. Example 3:
以一个主节点和两个从节点为例来说, 该系统的环形拓扑结构如图 4所示。 1为主节点,: 2为从节点。主节点 1.和从节点 2之间的通信线有两根数据发送线 3和两根数据接收线 4,两 个从节点 2之间的通信也由数据发送线 3和数据接收线 4来完成, 这样相邻的节点间就实现 了数据的全双工通信。 从节点有存储转发和直接转发的功能, 主节点发送的数据经过第一个 从节点 2时, 从节点 2接收并直接转发给下一个从节点 2, 从节点 2的数据发送给主节点 1 时, 若从节点 2有要发送给主节点 1的数据, 则从节点 2先存储下一个从节点 2的数据, 等 从节点 2发送给主节点 1的数据发送完后, 再转发下一个从节点 2的数据, 若从节点 2没有 要发送给主节点 1的数据, 则从节点 2直接转发下一个从节点 2的数据。 主节点 1也可以通 过另一根数据线 3、 4与从节点 2进行通信,方法与上面提到的主节点 1通过数据发送线 3和 数据接收线 4与从节点 2通信方法一致。 即正常情况下, 一根数据线是冗余的, 但该拓扑结 构有容错功能, 即若两个从节点 2之间的数据线连接有断开的时候, 从节点 2可以通过数据 发送线 3和数据接收线 4与主节点 1进行通信, 下一个从节点 2可以通过另一根数据发送线 3和数据接收线 4与主节点 1进行数据通信。 此拓扑结构不仅适用于以太网, 还可适用于用' 户自定义的或其他公知的传输协议形式, 只是 FPGA中 IP核的协议不同。 Taking a master node and two slave nodes as an example, the ring topology of the system is shown in Figure 4. 1 is the master node, and 2 is the slave node. The communication line between the master node 1. and the slave node 2 has two data transmission lines 3 and two data reception lines 4, and communication between the two slave nodes 2 is also completed by the data transmission line 3 and the data reception line 4. , so that the full-duplex communication of data is realized between adjacent nodes. The slave node has the functions of store-and-forward and direct-forward. When the data sent by the master node passes through the first slave node 2, it is received from the node 2 and directly forwarded to the next slave node 2. When the data of the slave node 2 is sent to the master node 1, If the slave node 2 has data to be sent to the master node 1, the slave node 2 first stores the data of the next slave node 2, and after the data sent from the node 2 to the master node 1 is transmitted, the next slave node is forwarded. The data of 2, if the slave node 2 has no data to be sent to the master node 1, the slave node 2 directly forwards the data of the next slave node 2. The master node 1 can also communicate with the slave node 2 via another data line 3, 4 in the same manner as the master node 1 mentioned above through the data transmission line 3 and the data receiving line 4 and the slave node 2 communication method. That is, under normal circumstances, one data line is redundant, but the topology has a fault tolerance function, that is, if the data line connection between the two slave nodes 2 is disconnected, the slave node 2 can pass the data transmission line 3 The data receiving line 4 communicates with the master node 1, and the next slave node 2 can communicate with the master node 1 via another data transmitting line 3 and data receiving line 4. This topology is not only applicable to Ethernet, but also to the form of a user-defined or other well-known transport protocol, except that the protocol of the IP core in the FPGA is different.
图 4的内部详细结构如图 5所示。 1为主节点, 2为从节点, 5为作为主节点的通信数据 接口的普通标准网卡, 6为网络变压器, 7为 PHY芯片, 8为带 MAC IP核的 FPGA。 The internal detailed structure of Figure 4 is shown in Figure 5. 1 is the master node, 2 is the slave node, 5 is the common standard network card as the communication data interface of the master node, 6 is the network transformer, 7 is the PHY chip, and 8 is the FPGA with the MAC IP core.
在该系统的环形结构中, 主节点 1可以自动检测系统是否可靠连接和正常工作。 主节点 1通过数据发送线 3和数据接收线 4发送一个査询报文, 第一个从节点 2收到之后转发到下 一个从节点 2, 同时将自己的节点号初始化为 0,下一个从节点也即最后一个从节点 2再通过 数据发送线 3和数据接收线 4转发此查询报文到主节点 1,并初始化自己节点号为 0。主节点 1在收到此査询报文后,说明系统连接可靠和各节点工作正常。若主节点 1等待一段时间(此 时间为正常情况下检测最大从节点数的最长时间的 2倍)后, 仍然接收不到此査询报文, 说 明系统连接不可靠或某个节点不正常工作。 In the ring structure of the system, the master node 1 can automatically detect whether the system is reliably connected and working normally. The master node 1 sends a query message through the data transmission line 3 and the data receiving line 4, and the first node is forwarded to the next slave node 2 after receiving it from the node 2, and initializes its own node number to 0, and the next slave The node, that is, the last slave node 2, forwards the query message to the master node 1 through the data transmission line 3 and the data receiving line 4, and initializes its own node number to 0. After receiving the query message, the master node 1 indicates that the system connection is reliable and each node works normally. If the master node 1 waits for a period of time (this time is twice the maximum time of detecting the maximum number of slave nodes under normal conditions), the query message is still not received, indicating that the system connection is unreliable or a node is abnormal. jobs.
在该系统的环形结构中, 主节点 1有两个数据接口, 可以自动枚举和配置各从节点 2。 主节点 1检测系统可靠连接和正常工作后, 主节点 1通过数据发送线 3和数据接收线 4开始 发送配置报文, 跟主节点 1相连的第一个从节点 2 (此时节点号为 0)将先收到配置报文, 收 到此配置报文后, 将不转发此配置报文到下一个从节点 2, 第一个从节点 2将自己的节点号 设置为 1, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、作用等, 主节点 1 在配置完第一个从节点 2后, 将再发个下一个配置报文, 第一个从节点 2将转发此配置报文 到第二个从节点 2 (此时节点号为 0), 第二个从节点 2在收到此配置报文后将不转发此配置 报文到下一个从节点 2, 第二个从节点 2将自己的节点号设置为 2, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等。 此时主节点再发配置报文, 各从节点 2都有 自己的节点号 (此时节点号不为 0), 各从节点 2都将转发此配置报文, 最后一个从节点 2将 转发此配置报文到主节点 1的另一个数据线接口上。 主节点 1在收到此配置报文后, 说明整 个系统将配置完毕。 这样每个从节点 2都有自己唯一的节点标号, 主节点 1也建立一个节点 表, 包含各从节点 2的节点号, 包含各节点的功能和作用等。 实施例 4: In the ring structure of the system, the master node 1 has two data interfaces, and each slave node 2 can be automatically enumerated and configured. After the master node 1 detects the reliable connection and normal operation of the system, the master node 1 starts to send the configuration message through the data transmission line 3 and the data receiving line 4, and the first slave node 2 connected to the master node 1 (the node number is 0 at this time). The configuration packet will be received first. After receiving this configuration packet, the configuration packet will not be forwarded to the next slave node 2. The first slave node 2 sets its own node number to 1, and sends a response at the same time. The packet contains its own node number, the function and role of the slave node, and the master node 1 will send the next configuration message after the first slave node 2 is configured. The first slave node 2 will forward the packet. The configuration packet is sent to the second slave node 2 (the node number is 0), and the second slave node 2 does not forward the configuration packet to the next slave node 2 after receiving the configuration packet. The slave node 2 sets its own node number to 2, and simultaneously sends a response message, including its own node number, the function and function of the slave node. At this time, the master node sends a configuration packet again, and each slave node 2 has its own node number (the node number is not 0 at this time), and each slave node 2 will forward the configuration packet, and the last slave node 2 will forward the packet. Configure the packet to another data line interface on the primary node 1. After receiving the configuration packet, master node 1 indicates that the entire system will be configured. Thus, each slave node 2 has its own unique node label, and the master node 1 also establishes a node table, which includes the node numbers of the slave nodes 2, including the functions and functions of the nodes. Example 4:
在上面所说的链状和环形网络结构中, 除上述采用选定同步信号源发送同步报文实现同 步的方法外^还提出了一种用于各从节点精确同步的方法,就是从节点之间除了数据线之外, 再加一根同步信号线。 In the chain and ring network structure mentioned above, in addition to the above method for transmitting synchronization messages by using the selected synchronization signal source, a method for accurately synchronizing the slave nodes is also proposed, which is a slave node. In addition to the data line, add a sync signal line.
以链状拓扑结构为例, 如图 6所示, 1为主节点, 2为从节点,. 3为数据发送线、 4为数 据接收线, 9为同步信号线。 在从节点 2中可任选一个从节点为同步信号源, 举以最后一个 从节点 2为同步信号源为例, 最后一个从节点 2负责严格的定时和同步信号的发送, 周期性 的通过同步信号线 9发送同步信号.。 其他的从节点 2接收同步信号。 如果不考虑传输线的线 上延迟, 各从节点 2将同时收到同步信号, 同时动作, 实现各从节点 2动作的同步性。 如果 考虑传输线的线上延迟, 各从节点 2收到同步信号的线上延迟时间是固定的, 在配置阶段根 据各节点的传输线长和器件的传输延时给各从节点 2中设置一个时间延迟参数寄存器(也可 为延迟定时器), 在收到同步信号后,每次延迟一段确定的时间再动作,这样就实现了各从节 点 2的精确同步动作。 在上面所说的链状和环形网络结构中, 除了主节点可以与各从节点进行数据通信外, 各 从节点之间也可以进行数据通信。 主节点与各从节点进行数据通信的传输协议和报文格式, 主要包括主节点配置报文、 主节点数据 ί艮文、 从节点数据报文三类。 主节点与从节点间以及 各从节点间数据通信协议符合以太网帧协议规范, 举以太网 ΙΕΕΕ802. 3帧协议格式为例, 如 图 7所示,包括前导符、 分割符、 目的地址、 源地址、 长度 /类型字段、 数据段、 帧校验序列 域等组成。 其中数据段中包括非周期数据和周期数据, 周期数据是工业控制中, 任务(如功 能块的执行)通常按照一定的时间间隔发出,并且对任务的执行时间具有截止性要求的数据。 非周期数据是只有在特定的事件触发下才出现,例如节点配置、故障诊断、程序的上载 /下载、 运行记录、 报警处理等。Taking a chain topology as an example, as shown in FIG. 6, 1 is a master node, 2 is a slave node, 3 is a data transmission line, 4 is a data reception line, and 9 is a synchronization signal line. In slave node 2, one slave node can be selected as the synchronization signal source, and the last one is given. Taking node 2 as the synchronization signal source as an example, the last slave node 2 is responsible for the strict timing and synchronization signal transmission, and periodically transmits the synchronization signal through the synchronization signal line 9. The other slave node 2 receives the synchronization signal. If the line delay of the transmission line is not considered, each slave node 2 will simultaneously receive the synchronization signal and operate at the same time to realize the synchronization of the actions of the slave nodes 2. If the line delay of the transmission line is considered, the on-line delay time of each slave node 2 receiving the synchronization signal is fixed, and a time delay is set in each slave node 2 according to the transmission line length of each node and the transmission delay of the device in the configuration phase. The parameter register (which may also be a delay timer), after receiving the synchronization signal, is delayed by a certain time each time, so that the precise synchronization action of each slave node 2 is realized. In the chain and ring network structure described above, in addition to the master node can perform data communication with each slave node, data communication can also be performed between the slave nodes. The transmission protocol and packet format of the data communication between the master node and each slave node mainly include the master node configuration packet, the master node data, and the slave node data packet. The data communication protocol between the master node and the slave nodes and the slave nodes conforms to the Ethernet frame protocol specification, and the Ethernet ΙΕΕΕ802.3 frame protocol format is taken as an example, as shown in FIG. 7, including the preamble, the separator, the destination address, and the source. The address, length/type field, data segment, frame check sequence field, and so on. The data segment includes non-periodic data and periodic data. The periodic data is data in industrial control, and tasks (such as the execution of function blocks) are usually issued at certain time intervals and have deadlines for the execution time of the tasks. Acyclic data is only generated when a specific event is triggered, such as node configuration, fault diagnosis, program upload/download, operation log, alarm processing, and so on.
图 8中给出了主节点 1发送的另一种控制报文结构, 它也符合 ΙΕΕΕ802. 3报文结构协议 规范, 为了与主节点 1所发的 TCP/IP等报文格式区别,在工 ΕΕΕ802. 3报文结构数据区域中前 两个字节用 0Χ55ΑΑ表示为控制报文的格式,紧跟着的一个字节用来区分控制报文的不同控制 信息, 例如 0X11表示测量从节点间时间延迟的控制报文, 剩下的为控制报文的数据区域。整 个报文组成苞括前导符 7bytes、 分割符 lbyte、 目的地址 6bytes、 源地址 6bytes、 长度 /类 型字段 2bytes、数据段 46- 1500bytes、 帧校验序列域 4bytes, 其中数据段又分为两个 bytes 的主节点报文标志, 紧跟着的一个 byte用来区分控制报文的不同控制信息的控制类型标志, 其余为控制报文的数据信息。 主节点配置(查询) 报文: 系统上电以后或系统重构以后, 主 节点发送此报文, 完成系统的检测以及对各从节点的自动枚举和配置。 FIG. 8 shows another control message structure sent by the master node 1, which also conforms to the 802.3 message structure protocol specification, in order to distinguish from the TCP/IP message format sent by the master node 1, ΕΕΕ 802.3 The first two bytes in the message structure data area are represented by 0Χ55ΑΑ as the format of the control message, and the following one byte is used to distinguish different control information of the control message. For example, 0X11 indicates the time between nodes. The delayed control message, the rest is the data area of the control message. The entire message consists of a preamble of 7 bytes, a separator of 1 byte, a destination address of 6 bytes, a source address of 6 bytes, a length/type field of 2 bytes, a data section of 46-1500 bytes, and a frame check sequence of 4 bytes. The data segment is further divided into two bytes. The master node message flag, followed by a byte is used to distinguish the control type flag of the different control information of the control message, and the rest is the data information of the control message. Master node configuration (query) message: After the system is powered on or after the system is reconfigured, the master node sends the packet to complete the system detection and automatic enumeration and configuration of each slave node.
主节点数据报文用于向从节点发送指令数据, 在一次通讯周期中, 主节点发送一次主节 点周期数据报文, 从节点接收后从中提取自己的数据。 The master node data message is used to send instruction data to the slave node. In a communication cycle, the master node sends a primary node period data packet, and receives its own data from the node after receiving it.
从节点数据报文用于向主节点反映该节点的运行状态, 在一次通讯周期中, 从节点都会 向主节点发送一次从节点数据报文。 The slave node data message is used to reflect the running status of the node to the master node. In one communication cycle, the slave node sends a slave node data message to the master node.
在系统完成从节点的自动枚举和配置过程后, 以链状结构为例, 如图 6所示, 主节点 1 发送周期数据报文, 在保证各从节点 2都收到主节点 1的周期数据报文的前提下, 同步信号 源即最后一个从节点 2周期性的通过信号同步线 9发送一个同步信号, 各从节点 2在收到此 信号后, 经过设定的延迟时间值后, 锁存当前的工作状态, 按照收到的主节点 1周期数据同 时动作, 并 时将当前的工作状态即从节点周期数据报文发送到主节点 1。 After the system completes the automatic enumeration and configuration process of the slave node, taking the chain structure as an example, as shown in FIG. 6, the master node 1 sends a periodic data packet, and ensures that each slave node 2 receives the master node 1 period. On the premise of the data message, the synchronization signal source, that is, the last slave node 2 periodically transmits a synchronization signal through the signal synchronization line 9, and after receiving the signal, each slave node 2 passes the set delay time value and then locks. The current working state is stored, and the received data of the master node 1 period is simultaneously operated, and the current working state is sent from the node period data message to the master node 1.
图 9给出了本发明系统的工^流程。 Figure 9 shows the process of the system of the present invention.
—种实现以太网链状网络从节点间同步的方法, a method for realizing synchronization between nodes of an Ethernet chain network,
( 1 )系统上电后, 对于链状网络, 主节点对各从节点进行自检, 主节点发送一个査询报 文, 第一个从节点首先接收到此査询报文, 然后转发此查询报文, 并发送自己的应答报文, 将自己的节点号初始化为 0; 各从节点在收到查询报文后依次转发此査询报文, 并发送自己 的应答报文和将自己的节点号初始化为 0, 直到最后一个从节点; 最后一个从节点可以通过 拨码开关或者其他的装置来确定, 该最后一个从节点收到此查询报文后, 发送自己的应答报 文, 包含为最后一个从节点的信息, 并将自己的节点号初始化为 0, 主节点收到最后一个从 节点的应答报文后, 说明系统连接可靠和各节点正常工作; 若主节点在发送完査询报文后, 在设定时间内收不到最后一个从节点的应答报文, 将报告错误, 说明有故障; 对于环形网络, 主节点发送一个査询报文,第一个从节点收到之后转发到下一个从节点,' 同时将自己的节点号初始化为 0,各从节点依次转发并将自己节点号初始化为 0,直到最后一 个从节点, 最后一个从节点再转发此査询报文到主节点, 并初始化自己节点号为 0; 主节点 在收到此査询报文后, 说明系统连接可靠和各节点工作正常; 若主节点在设定时间内仍然接 收不到此查询报文, 说明系统连接不可靠或某个节点不正常工作;(1) After the system is powered on, for the chain network, the master node performs a self-test on each slave node, and the master node sends a query message. The first slave node first receives the query message, and then forwards the query. The message, and send its own response message, initialize its own node number to 0; each slave node forwards the query message in turn after receiving the query message, and sends its own response message and its own node. The number is initialized to 0 until the last slave node; the last slave node can be determined by a DIP switch or other device. After receiving the query message, the last slave node sends its own response message, including the last. The information of a slave node, and initializes its own node number to 0. After the master node receives the response message of the last slave node, it indicates that the system connection is reliable and the nodes work normally; if the master node sends the query message After that, the response message of the last slave node is not received within the set time, and an error is reported, indicating that there is a fault; For the ring network, the master node sends a query message, the first slave node receives it and then forwards it to the next slave node, 'at the same time, initializes its own node number to 0, and each slave node forwards it in turn and initializes its own node number. 0, until the last slave node, the last slave node forwards the query message to the master node, and initializes its own node number to 0. After receiving the query message, the master node indicates that the system connection is reliable and each The node works normally. If the master node still cannot receive the query message within the set time, the system connection is unreliable or a node is not working properly.
(2) 自检通过后, 主节点对各从节点进行枚举和配置; (2) After the self-test is passed, the master node enumerates and configures each slave node;
(3)然后, 主节点发送一个测量网络时间延迟的控制报文通知各从节点, 第一个从节点 发送一个特定的报文, 各从节点转发该特定报文, 测量自己与最后一个从节点间的网络时间 延迟; (3) Then, the master node sends a control message measuring the network time delay to notify each slave node, the first slave node sends a specific message, each slave node forwards the specific message, and measures itself and the last slave node. Network time delay between;
(4)进入网络周期性工作阶段, 第一个从节点周期性地发送一个同步报文, 各从节点在 接收到该同步报文后将转发此同步报文到下一个从节点, 各从节点收到该同步报文后, 延迟 一定的时间以补偿网络时间延迟, 然后动作, 实现从节点间动作同步性; (4) Entering the periodic working phase of the network, the first slave node periodically sends a synchronization message, and each slave node will forward the synchronization message to the next slave node after receiving the synchronization message, and each slave node After receiving the synchronization message, delay a certain time to compensate for the network time delay, and then act to achieve synchronization of motion between the nodes;
(5)其他的各从节点的延迟定时器也设定初始参数值,该初始参数为测量从节点间网络 时间延迟中测得的该从节点相对于最后一个从节点的网络时间延迟; 各从节点在收到同步报 文后, 触发延迟定时器, 该延迟定时器在时钟信号的驱动下, 开始计时, 到设定的初始参数 后,产生一个中断信号, 从节点根据该中断信号锁存当前的状态并按照控制报文的命令动作, 并将当前的状态信息以报文的形式发送到主节点; 主节点收到各从节点的状态信息后, 然后 作数据规划, 并将规划的数据以数据报文的形式在该周期发送到各从节点; 各从节点在收到 数据报文后, 在下一周期按照同样的方式动作; 这样周期往复下去, 实现系统正常的周期数 据交换和同步动作。 (5) The delay timers of the other slave nodes also set an initial parameter value, which is a network time delay of measuring the slave node relative to the last slave node measured from the inter-node network time delay; After receiving the synchronization message, the node triggers a delay timer, which is driven by the clock signal to start timing. After the initial parameter is set, an interrupt signal is generated, and the slave latches the current according to the interrupt signal. The state is in accordance with the command of the control message, and the current state information is sent to the master node in the form of a message; after receiving the state information of each slave node, the master node performs data planning, and the planned data is The form of the data message is sent to each slave node in the cycle; after receiving the data message, each slave node operates in the same manner in the next cycle; in this way, the cycle is repeated to realize the normal cycle data exchange and synchronization action of the system.
所述步骤 2) 中, 对于链状网络, 主节点对各从节点进行枚举和配置过程为, 从主节点 收到最后一个从节点的应答报文后, 开始发送配置报文, 跟主节点相连的第一个从节点, 此 时节点号为 0, 将先收到配置报文, 收到此配置报文后, 将不转发此配置报文到下一个从节 点, 第一个从节点将自己的节点号设置为 1, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等, 主节点在配置完第一个从节点后, 将再发下一个配置报文, 第一 个从节点将转发此配置报文到第二个从节点, 此时节点号为 0, 第二个从节点在收到此配置 报文后将不转发此配置报文到下一个从节点, 第二个从节点将自己的节点号设置为 2, 同时 发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等; 这样依次类推, 直到配 置到最后一个从节点; 这样每个从节点都有自己唯一的'节点标号,主节点也建立一个节点表, 包含各从节 的节点号、 各从节点的功能和作用等; In the step 2), for the chain network, the master node enumerates and configures the slave nodes, and after receiving the response packet of the last slave node, the master node starts to send the configuration packet, and the master node The first slave node that is connected, the node number is 0, and the configuration packet will be received first. After receiving the configuration packet, the configuration packet will not be forwarded to the next slave node. The first slave node will The node number of the node is set to 1, and a response packet is sent, including its own node number, the function and function of the slave node, and the master node sends another configuration packet after the first slave node is configured. The first slave node will forward the configuration packet to the second slave node. The node number is 0. The second slave node will not forward the configuration packet to the next slave after receiving the configuration packet. Node, the second slave node sets its own node number to 2, and sends a response message, including its own node number, the function and role of the slave node, and so on; until the last one is configured. Node; so that each has its own unique 'reference node, the master node also create a node from the node table contains the node number of the sections, each of the function and role of the other node;
对于环形网络, 主节点通过一个数据接口开始发送配置报文, 跟主节点相连的第一个从 节点, 此时节点号为 0, 将先收到配置报文, 收到此配置报文后, 将不转发此配置报文到下 一个从节点, 第一个从节点将自己的节点号设置为 1, 同时发送一个应答报文, 包含自己的 节点号、 该从节点的功能、 作用等, 主节点在配置完第一个从节点后, 将再发下一个配置报 文, 第一个从节点 3各转发此配置报文到第二个从节点, 此时节点号为 0, 第二个从节点在收 到此配置报文后将不转发此配置报文到下一个从节点, 第二个从节点将自己的节点号设置为 For a ring network, the master node sends a configuration packet through a data interface, and the first slave node connected to the master node. When the node number is 0, the configuration packet is received first. After receiving the configuration packet, The configuration packet will not be forwarded to the next slave node. The first slave node sets its own node number to 1, and sends a response packet, including its own node number, the function and role of the slave node, and so on. After the first slave node is configured, the node sends another configuration packet. The first slave node 3 forwards the configuration packet to the second slave node. The node number is 0, and the second slave After receiving the configuration packet, the node will not forward the configuration packet to the next slave node. The second slave node sets its own node number to
2, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等, 这样依次类推,: 直到配置完最后一个从节点; 此时主节点再发配置报文, 各从节点都有自己的节点号, 各从 节点都将转发此配置报文, 最后一个从节点将转发此配置报文到主节点的另一个数据线接口 上; 主节点在收到 1*配置报文后, 说明整个系统将配置完毕, 这样每个从节点都有自己唯一 的节点标号, 主节点也建立一个节点表, 包含各从节点的节点号、各从节点的功能和作用等。2, simultaneously send a response message, including its own node number, the function and role of the slave node, and so on, and so on: until the last slave node is configured; at this time, the master node retransmits the configuration message, each slave node Each node has its own node number, and each slave node will forward the configuration packet. The last slave node will forward the configuration packet to another data line interface of the master node. After receiving the 1* configuration packet, the master node receives the packet. , indicating that the entire system will be configured, so that each slave node has its own unique node label, and the master node also establishes a node table, including the node number of each slave node, the function and role of each slave node.
所述步骤 3) 中测量网络时间延迟的控制报文结构为 IEEE802. 3协议规范, 其组成包括 前导符 7byt s、 分割符 lbyte、 目的地址 6bytes、 源地址 6bytes、 长度 /类型字段 2bytes、 数据段 46- 15&00bytes、帧校验序列域 4bytes,其中数据段又分为两个 bytes的主节点报文标 志,紧跟着的一个 byte用来区分控制报文的不同控制信息的控制类型标志,其余为控制报文 的数据信息;The control message structure for measuring the network time delay in the step 3) is an IEEE802.3 protocol specification, and the composition includes a preamble 7byt s, a separator lbyte, a destination address of 6 bytes, a source address of 6 bytes, a length/type field of 2 bytes, and a data segment. 46- 15& 00bytes, frame check sequence field 4bytes, where the data segment is divided into two bytes of the master node message mark Zhi, followed by a byte used to distinguish the control type flag of the different control information of the control message, and the rest is the data information of the control message;
步骤 3) 中测量从节点间网络时间延迟方法为, 各从节点收到控制报文后, 将延迟定时 器清零, 第^个从节点向下一个从节点发送一个特定的报文, 并触发自己的延迟定时器开始. 计时; 第二个从节点收到该特定报文后向下一个从节点转发此报文, 并触发自己的延迟定时. 器开始计时; 这样向下转发下去, 直到最后一个从节点; 最后一个从节点收到该特定报文后.' 将向上一个从节点转发该特定报文,上一个从节点收到该特定报文后再向上转发该特定报文, 并触发自己的延迟定吋器停止计时, 这样向上转发并触发自己的延迟定时器停止计时, 直到 第一个从节点; 第一个从节点收到该特定报文后将触发自己的延迟定时器停止计时, 并不再 转发该特定报文; 这样, 每个从节点即可获得自己与最后一个从节点间的网络时间延迟, 即 延迟定时器计时的一半, 该延迟定时器的计时将以寄存器参数的形式保存在各从节点上。 In step 3), the method for measuring the time delay between nodes is: after each slave node receives the control message, the delay timer is cleared, and the second slave node sends a specific message to the next slave node, and triggers The own delay timer starts. Timing; the second slave node forwards the message to the next slave node after receiving the specific message, and triggers its own delay timing. The device starts timing; this is forwarded down until the end. a slave node; after the last slave node receives the specific message, 'will forward the particular message to the upper slave node, and the last slave node receives the specific message and then forwards the specific message upward, and triggers itself. The delay timer stops counting, so that it forwards up and triggers its own delay timer to stop timing until the first slave node; the first slave node will trigger its own delay timer to stop timing after receiving the specific message. The specific message is no longer forwarded; thus, each slave node can obtain the network time delay between itself and the last slave node, that is, the delay timer Half will form the timing register of the delay timer parameters stored in the respective slave node.
当选最后一个从节点为同步信号源时, 特定延迟测量报文由最后一个从节点发出, 测量 各从节点与第一个从节点的时间延时, 工作方法与上述相仿。 When the last slave node is selected as the synchronization signal source, the specific delay measurement message is sent by the last slave node, and the time delay of each slave node and the first slave node is measured, and the working method is similar to the above.
所述步骤 4) 的周期性工作阶段中, 各从节点在动作的同时锁存当前从节点的当前状态, 并按照上一个周期收到的主节点的命令报文同时动作, 将该从节点的状态信息以报文的形式 发送到主节点, 主节点分析各从节点的状态信息, 并统一规划下一周期各从节点的动作, 并 将该动作信息以命令报文的形式在该周期传送到各从节点上, 实现各从节点动作的同步性; ' . 周期性地发送一个同步报文是指第一个从节点的周期定时器设定初始参数后, 该初始参 数就是周期性通信的通信周期, 周期定时器在第一个从节点时钟信号的驱动下, 开始计时, 当计时值到达设定的初始参数时, 该周期定时器产生一个中断信号并将周期定时器清零并重 新开始计时, 第一个从节点收到该中断信号, 将向下发送一个特定的同步报文, 这样周期往 复, 实现了周期性发送同步报文的方法; In the periodic working phase of the step 4), each slave node latches the current state of the current slave node while the action is active, and simultaneously operates the command message of the master node received in the previous cycle, and the slave node The status information is sent to the master node in the form of a message. The master node analyzes the state information of each slave node, and uniformly plans the actions of the slave nodes in the next cycle, and transmits the action information in the form of a command message to the slave node. On each slave node, the synchronization of the actions of each slave node is implemented; '. Periodically sending a synchronization message refers to the communication of the periodic communication after the initial parameter of the first slave node's cycle timer is set. Cycle, the cycle timer starts to be driven by the first slave node clock signal. When the timer value reaches the set initial parameter, the cycle timer generates an interrupt signal and clears the cycle timer and restarts timing. The first slave node receives the interrupt signal and sends a specific synchronization message downward, so that the cycle reciprocates and the periodicity is realized. The method of transmitting synchronization packets;
' 步骤.4) 中从节点延迟一定的时间, 然后动作的方法为各从节点中都包括一个延迟定吋 器, 各延迟定时器可设定初始参数值, 该初始参数从节点相对于最后一个从节点的网络时间 延迟, 各从节点在收到同步报文后, 触发延迟定时器, 该延迟定时器在时钟信号的驱动下, 开始定时, 到设定的初始参数后, 产生一个中断信号, 从节点根据该中断信号锁存当前的状 态并按照控制报文的命令动作, 并将当前的状态信息以报文的形式发送到主节点。 In step [4], the slave node is delayed for a certain period of time, and then the action method is to include a delay timer for each slave node, and each delay timer can set an initial parameter value, which is from the node relative to the last one. After the network time delay of the slave node, each slave node triggers a delay timer after receiving the synchronization message. The delay timer starts timing after the clock signal is driven, and generates an interrupt signal after the initial parameter is set. The slave latches the current state according to the interrupt signal and acts according to the command of the control message, and sends the current state information to the master node in the form of a message.
. 当选取最后一个从节点作为同步信号源时, 则指定最后一个从节点的周期定时器设定初 始参数为周期性通信的通信周期, 由最后一个从节点的周期定时器产生中断, 来发送特定的 同步报文给各从节点。 工作方法与上述相仿。 当选定的信号源不是两端的从节点而是从它们之间的从节点中任意选定一个吋, 其同步' 方法与前述基本相同, 只是它应按照前述工作方法同时向其前方和后方的从节点发送信号。 即它应同时向其前方和后方的从节点发送特定延迟测量报文, 分别测量前方各从节点与第一 个从节点的时间延时, 同时还测量后方各从节点与最后一个从节点的时间延时, 具体过程如 上所述。 测量结束后, 将各从节点的延迟时间送至主节点, 由主节点根据最大延迟时间分别 计算各从节点的延迟时间, 然后再发送给各从节点存储到延迟定时器 10, 作为各从节点的延 迟时间。 然后由该被选为信号源的从节点的周期定时器产生中断, 并向其前方和后方的从节 点发送同步报文, 各从节点在接收到同步报文后, 经延迟定时器延时相应时间执行相应动作, 完成同步过程。 When the last slave node is selected as the synchronization signal source, the cycle timer of the last slave node is specified to set the initial parameter to the communication cycle of the periodic communication, and the cycle timer of the last slave node generates an interrupt to transmit the specific The synchronization message is sent to each slave node. The working method is similar to the above. When the selected signal source is not a slave node at both ends but an arbitrarily selected one from among the slave nodes between them, the synchronization 'method is basically the same as the foregoing, except that it should be simultaneously forward and backward according to the aforementioned working method. The slave sends a signal. That is, it should send a specific delay measurement message to the slave nodes in front of and behind it, and measure the time delay of each of the preceding slave nodes and the first slave node, and also measure the time of each slave node and the last slave node. Delay, the specific process is as described above. After the measurement is completed, the delay time of each slave node is sent to the master node, and the master node calculates the delay time of each slave node according to the maximum delay time, and then sends it to each slave node for storage to the delay timer 10 as each slave node. Delay time. Then, an interrupt is generated by the cycle timer of the slave node selected as the signal source, and a synchronization message is sent to the slave nodes in front of and behind the slave node. After receiving the synchronization message, each slave node delays the delay timer. Time to perform the corresponding action to complete the synchronization process.

Claims

权利要求书 Claim
1、一种基于标准以太网的实时同步网络, 包括至少一个主节点和至少一个从节点, 各节 点通过传输协议传送数据, 所述网络可以是链状网络或环形网络, 其特征是: 在从节点中任 选一个为同步信号源; A real-time synchronization network based on a standard Ethernet, comprising at least one master node and at least one slave node, each node transmitting data through a transmission protocol, the network may be a chain network or a ring network, and the characteristics are: Any one of the nodes is a synchronous signal source;
当所述网络为链状网络时, 主节点上有至少一个数据线接口, 各从节点有至少两个数据 线接口, 连接时彼此串行连接, 即主节点的数据线接口通过数据线连接到从节点的一个数据 线接口上, 从节点的另一个数据接口通过数据线连接到下一个从节点的一个数据接口上, 依 次连接构成链状网络, 进行实时同步的全双工通信; When the network is a chain network, the master node has at least one data line interface, and each slave node has at least two data line interfaces, and is connected to each other in series, that is, the data line interface of the master node is connected to the data line through the data line. From one data line interface of the node, another data interface of the slave node is connected to a data interface of the next slave node through the data line, and sequentially connected to form a chain network, and real-time synchronous full-duplex communication is performed;
当所述网络为环形网络时, 主节点上有至少两个数据线接口, 各从节点有至少两个数据 线接口, 主节点的一个数据线接口通过数据线连接到从节点的一个数据线接口上, 从节点的 另一个数据线接口通过数据线连接到下一个从节点的一个数据接口上, 这样级联下去, 一直 连到最后一个从节点的数据线接口上, 最后一个从节点的另一个数据线接口通过数据线连接 到主节点的另一个数据线接口上, 构成环形网络, 进行实时同步的全双工通信。 When the network is a ring network, the master node has at least two data line interfaces, each slave node has at least two data line interfaces, and one data line interface of the master node is connected to a data line interface of the slave node through the data line. On the other data line interface of the slave node is connected to a data interface of the next slave node through the data line, so that the cascade is continued, and is connected to the data line interface of the last slave node, and the other one of the last slave nodes The data line interface is connected to another data line interface of the master node through the data line to form a ring network for real-time synchronous full-duplex communication.
. 2、根据权利要求 1所述的基于标准以太网的实时同步网络, 其特征是: 所述从节点内设 有两个定时器, 分别为周期定时器和延迟定时器; 主节点为标准网卡, 其发送的控制报文为 标准以太网传输协议 IEEE802.3协议规范的报文结构;各从节点采用标准 PHY芯片和带 MAC IP 核心的 FPGA作为网络通信接口;.在各从节点内均设有一个 PLL电路, 各晶振信号经过该 PLL 电路后再产生时钟信号;其中 IEEE802.3帧协议的数据段中包括周期数据和非周期数据,周期 数据是工业控制中, 任务通常按照一定的时间间隔发出, 并且对任务的执行时间具有截止性 要求的数据; 非周期数据是只有在特定的事件触发下才出现; 控制报文还可适用于用户自定 义的或其他公知的传输协议形式。 2. The standard Ethernet-based real-time synchronization network according to claim 1, wherein: the slave node is provided with two timers, which are a periodic timer and a delay timer respectively; the master node is a standard network card. The control message sent by the standard is the message structure of the standard Ethernet transmission protocol IEEE802.3 protocol specification; each slave node adopts a standard PHY chip and an FPGA with a MAC IP core as a network communication interface; There is a PLL circuit, and each crystal signal passes through the PLL circuit to generate a clock signal; wherein the data segment of the IEEE802.3 frame protocol includes periodic data and aperiodic data, and the periodic data is in industrial control, and the task is usually at a certain time interval. Data that is issued and has a deadline for the execution time of the task; acyclic data is only triggered when a specific event is triggered; the control message can also be applied to user-defined or other well-known transport protocol forms.
3、根据权利要求 1所述的基于标准以太网的实时同步网络, 其特征是: 所述同步信号溽 是在从节点中任选一个, 同步信号源负责严格的定时和同步报文的发送, 其他从节点负责接 收同步报文, 各从节点中设有一个同步报文延迟参数寄存器, 用于设定同步报文在传输线上 的时间延迟, 这个同步报文延迟参数通过主节点发送配置报文, 各从节点自动测量该时间延 迟的形式来设定; 同步信号源周期性地发送同步报文, 各从节点收到该同步报文后延迟一定 时间再工作, 实现从节点间动作的同步性; 同步方式还可采用安装同步信号线将同步信号源 与其余从节点连接来实现; ' 3. The standard Ethernet-based real-time synchronization network according to claim 1, wherein: the synchronization signal 任 is any one of the slave nodes, and the synchronization signal source is responsible for strict timing and synchronization message transmission. The other slave nodes are responsible for receiving the synchronization message, and each slave node is provided with a synchronization message delay parameter register, which is used to set the time delay of the synchronization message on the transmission line, and the synchronization message delay parameter sends the configuration message through the master node. Each slave node automatically measures the form of the time delay to be set; the synchronization signal source periodically transmits the synchronization message, and each slave node delays the operation for a certain period of time after receiving the synchronization message, thereby realizing the synchronization of the action between the slave nodes. The synchronization method can also be implemented by installing a synchronization signal line to connect the synchronization signal source with the remaining slave nodes;
同步信号源设定时, 可根据主节点发送命令报文的形式利用软件任意指定一个从节点为 同步信号源 或者通过在任意一个从节点上设定拨码开关装置或其他公知的方式确定一个从 节点为同步信号源。 When the synchronization signal source is set, the slave node may arbitrarily designate a slave node as a synchronization signal source according to the manner in which the master node sends a command message or determine a slave switch by setting a dial switch device on any one of the slave nodes or other well-known manner. The node is the sync signal source.
4、 根据权利要求 1所述的基于标准以太网的实时同步网络, 其特征是: 所述数据线既 包括数据发送线, 也包括数据接收线, 相邻的两个节点之间通信时没有冲突, 实现全双工通 信, 数据线的传输介质既可为双绞线, 也可为光纤; 4. The standard Ethernet-based real-time synchronization network according to claim 1, wherein: the data line includes both a data transmission line and a data reception line, and there is no conflict between two adjacent nodes. To realize full-duplex communication, the transmission medium of the data line can be either a twisted pair or an optical fiber;
全双工通信时, 每个从节点有存储转发数据和直接转发数据的功能, 主节点同从节点进 行通信时, 各从节点转发主节点的信息, 整个系统通信没有冲突, 各从节点同主节点进行通 信时, 从节点如果有发送给主节点的数据, 将先发送自己的数据给主节点, 同时接收并存储 后面一个从节点发送给主节点的数据, 等待自己给主节点的数据发送完成后, 再转发已存储 的后一个从节点发送给主节点的数据, 从节点如果没有发送给主节点的数据, 将直接转发后 面一个从节点发送给主节点的数据, 避免了通信冲突, 实现了整个系统的全双工通信。 In full-duplex communication, each slave node has the function of storing and forwarding data and directly forwarding data. When the master node communicates with the slave node, each slave node forwards the information of the master node, and the entire system communicates without conflict. When the node communicates, if the slave node has data sent to the master node, it will first send its own data to the master node, and at the same time receive and store the data sent by the next slave node to the master node, waiting for the data transmission to the master node to complete. After that, the stored data of the last slave node is sent to the master node. If the slave node does not send data to the master node, the slave node directly forwards the data sent by the slave node to the master node, thereby avoiding communication conflicts. Full duplex communication of the entire system.
5、 一种采用权利要求 1所述的基于标准以太网的实时同步网络的同歩方法, 其特征是: ( 1 )系统上电后, 对于链状网络, 主节点对各从节点进行自检, 主节点发送一个查询报 文, 第一个从节点首先接收到此査询报文, 然后转发此查询报文, 并发送自己的应答报文, 将自己的节 I号初始化为 0; 各从节点在收到査询报文后依次转发此查询报文, 并发送自己 的应答报文和将自己的节点号初始化为 0, 直到最后一个从节点; 最后一个从节点可以通过 拨码开关或者其他的装置来确定, 该最后一个从节点收到此査询报文后, 发送自己的应答报 文, 包含为最后一个从节点的信息, 并将自己的节点号初始化为 0, 主节点收到最后一个从 节点的应答报文后, 说明系统连接可靠和各节点正常工作; 若主节点在发送完査询报文后, 在设定时间内收不到最后一个从节点的应答报文, 将报告错误, 说明有故障;A peer-to-peer method using the standard Ethernet-based real-time synchronization network according to claim 1, wherein: (1) after the system is powered on, for the chain network, the master node performs self-test on each slave node. The master node sends a query message, and the first slave node first receives the query message, then forwards the query message, and sends its own response message, and initializes its own section I number to 0; After receiving the query message, the node forwards the query message in turn, and sends its own response message and initializes its node number to 0 until the last slave node; the last slave node can pass the dial switch or other The device determines that the last slave node sends its own response message after receiving the query message. The text contains the information of the last slave node, and initializes its own node number to 0. After the master node receives the response message of the last slave node, it indicates that the system connection is reliable and the nodes work normally; if the master node is transmitting After the query message is received, the response message of the last slave node will not be received within the set time, and an error will be reported, indicating that there is a fault;
对于环型网络, 主节点发送一个査询报文,第一个从节点收到之后转发到下一个从节点, 同时将自己的节点号初始化为 0,各从节点依次转发并将自己节点号初始化为 0,直到最后一 个从节点, 最后一个从节点再转发此查询报文到主节点, 并初始化自己节点号为 0 ; 主节点 在收到此査询艮文后, 说明系统连接可靠和各节点工作正常; 若主节点在设定时间内仍然接 收不到此査询艮文, 说明系统连接不可靠或某个节点不正常工作; For a ring network, the master node sends a query message. After the first slave node receives it, it forwards it to the next slave node, and initializes its own node number to 0. Each slave node forwards it in turn and initializes its own node number. 0, until the last slave node, the last slave node forwards the query message to the master node, and initializes its own node number to 0. After receiving the query message, the master node indicates that the system connection is reliable and each node The work is normal; if the master node still cannot receive the query message within the set time, the system connection is not reliable or a node is not working properly;
(2 ) 自 通过后, 主节点对各从节点进行枚举和配置; (2) After passing, the master node enumerates and configures each slave node;
(3 )然后, 主节点发送一个测量网络时间延迟的控制报文通知各从节点,第一个从节点 发送一个特定的报文, 各从节点转发该特定报文, 测量自己与最后一个从节点间的网络时间 延迟; (3) Then, the master node sends a control message measuring the network time delay to notify each slave node, the first slave node sends a specific message, and each slave node forwards the specific message, and measures the self and the last slave node. Network time delay between;
(4)进入网络周期性工作阶段, 第一个从节点周期性地发送一个同步报文, 各从节点在 接收到该同步 ί艮文后将转发此同步报文到下一个从节点, 各从节点收到该同步报文后, 延迟 一定的时间以补偿网络时间延迟, 然后动作, 实现从节点间动作同步性; (4) Entering the periodic working phase of the network, the first slave node periodically sends a synchronization message, and each slave node will forward the synchronization message to the next slave node after receiving the synchronization message. After receiving the synchronization message, the node delays a certain time to compensate for the network time delay, and then acts to implement synchronization of action between the nodes;
( 5 )其他的各从节点的延迟定时器也设定初始参数值,该初始参数为测量从节点间网络 时间延迟中测得的该从节点相对于最后一个从节点的网络时间延迟; 各从节点在收到同步报 文后, 触发延迟定时器, 该延迟定时器在时钟信号的驱动下, 开始计时, 到设定的初始参数 后,产生一个中断信号,从节点根据该中断信号锁存当前的状态并按照控制报文的命令动作, 并将当前的状态信息以报文的形式发送到主节点; 主节点收到各从节点的状态信息后, 然后 作数据规划, 并将规划的数据以数据报文的形式在该周期发送到各从节点; 各从节点在收到 数据报文后 在下一周期按照同样的方式动作; 这样周期往复下去, 实现系统正常的周期数 据交换和同 动作。 (5) The delay timers of the other slave nodes also set an initial parameter value, which is a network time delay of measuring the slave node relative to the last slave node measured from the inter-node network time delay; After receiving the synchronization message, the node triggers a delay timer, which is driven by the clock signal to start timing. After the initial parameter is set, an interrupt signal is generated, and the slave latches the current according to the interrupt signal. The state is in accordance with the command of the control message, and the current state information is sent to the master node in the form of a message; after receiving the state information of each slave node, the master node performs data planning, and the planned data is The form of the data message is sent to each slave node in the cycle; each slave node operates in the same manner in the next cycle after receiving the data message; thus, the cycle is repeated to realize the normal cycle data exchange and the same action of the system.
6、根据权利要求 5所述的基于标准以太网的实时同步方法,其特征是:所述步骤 2 )中, 对于链状网络, 主节点对各从节点进行枚举和配置过程为, 从主节点收到最后一个从节点的 应答报文后, 开始发送配置报文, 跟主节点相连的第一个从节点, 此时节点号为 0, 将先收 到配置报文, 收到此配置报文后, 将不转发此配萱报文到下一个从节点, 第一个从节点将自 己的节点号设置为 1, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用 等, 主节点在配置完第一个从节点后, 将再发下一个配置报文, 第一个从节点将转发此配置 报文到第二个从节点, 此时节点号为 0,·第二个从节点在收到此配置报文后将不转发此配置 报文到卞一个从节点, 第二个从节点将自己的节点号设置为 2, 同时发送一个应答报文, 包 含自己的节点号、 该从节点的功能、 作用等; 这样依次类推, 直到配置到最后一个从节点; 这样每个从节点都有自己唯一的节点标号, 主节点也建立一个节点表, 包含各从节点的节点 号、 各从节点的功能和作用等; The standard Ethernet-based real-time synchronization method according to claim 5, wherein in the step 2), for the chain network, the master node enumerates and configures the slave nodes as the master After receiving the response packet from the last slave node, the node starts to send the configuration packet to the first slave node connected to the master node. When the node number is 0, the node receives the configuration packet first, and receives the configuration report. After the text, the matching message will not be forwarded to the next slave node. The first slave node sets its own node number to 1, and sends a response message, including its own node number, the function of the slave node, After the primary node is configured, the primary node sends another configuration packet. The first slave node forwards the configuration packet to the second slave node. The node number is 0. After receiving the configuration packet, the second slave node will not forward the configuration packet to one slave node. The second slave node sets its own node number to 2 and sends a response packet, including its own. node The function, function, etc. of the slave node; and so on, until the last slave node is configured; thus each slave node has its own unique node label, and the master node also establishes a node table containing the node numbers of the slave nodes. , the function and role of each slave node;
对于环行网络, 主节点通过一个数据接口开始发送配置报文, 跟主节点相连的第一个从 节点, 此时 点号为 0, 将先收到配置拫文, 收到此配置报文后, 将不转发此配置报文到下 一个从节点, 第一个从节点将自己的节点号设置为 1, 同时发送一个应答报文, 包含自己的 节点号、 该从节点的功能、 作用等, 主节点在配置完第一个从节点后, 将再发下一个配置报 文, 第一个从节点将转发此配置报文到第二个从节点, 此时节点号为 0, 第二个从节点在收 到此配置报文后将不转发此配置报文到下一个从节点, 第二个从节点将自己的节点号设置为 2, 同时发送一个应答报文, 包含自己的节点号、 该从节点的功能、 作用等, 这样依次类推, 直到配置完最后一个从节点; 此时主节点再发配置报文, 各从节点都有自己的节点号, 各从 节点都将转发此配置报文, 最后一个从节点将转发此配置报文到主节点的另一个数据线接口 上; 主节点在收到此配置报文后, 说明整个系统将配置完毕, 这样每个从节点都有自己唯一 的节点标号, 主节点也建立一个节点表, 包含各从节点的节点号、 各从节点的功能和作 用等。For a ring network, the master node sends a configuration packet through a data interface, and the first slave node connected to the master node. When the point number is 0, the configuration packet is received first. After receiving the configuration packet, The configuration packet will not be forwarded to the next slave node. The first slave node sets its own node number to 1, and sends a response packet, including its own node number, the function and role of the slave node, and so on. After the first slave node is configured, the node sends another configuration packet. The first slave node forwards the configuration packet to the second slave node. The node number is 0 and the second slave node. After receiving this configuration packet, the configuration packet will not be forwarded to the next slave node. The second slave node sets its own node number to 2 and sends a response packet containing its own node number. The function, function, etc. of the node, and so on, until the last slave node is configured; at this time, the master node sends a configuration packet again, each slave node has its own node number, and each slave node will forward the configuration report. The last slave node forwards the configuration packet to another data line interface of the master node. After receiving the configuration packet, the master node indicates that the entire system will be configured, so that each slave node has its own unique Node label, the master node also establishes a node table, including the node number of each slave node, the function and function of each slave node Use etc.
7、 根据权利要求 5所述的基于标准以太网的实时同步方法, 其特征是: 所述步骤 3) 中 测量网络时 ^延迟的控制报文结构为 IEEE802. 3协议规范, 其组成包括前导符 7bytes、 分割 符 lbyte、 目的地址 6bytes、源地址 6bytes、长度 /类型字段 2bytes、数据段 46- 1500bytes、 帧校验序列域 4bytes,其中数据段又分为两个 bytes的主节点报文标志,紧跟着的一个 byte 用来区分控制报文的不同控制信息的控制类型标志, 其余为控制报文的数据信息; The standard Ethernet-based real-time synchronization method according to claim 5, wherein: the control message structure in the step 3) when measuring the network delay is an IEEE 802.3 protocol specification, and the composition includes a preamble 7bytes, splitter lbyte, destination address 6bytes, source address 6bytes, length/type field 2bytes, data segment 46-1500bytes, frame check sequence field 4bytes, where the data segment is divided into two bytes of the master node message flag, tight The following byte is used to distinguish the control type flag of the different control information of the control message, and the rest is the data information of the control message;
步骤 3 ) 中测量从节点间网络时间延迟方法为, 各从节点收到控制报文后, 将延迟定时 器清零, 第一个从节点向下一个从节点发送一个特定的报文, 并触发自己的延迟定时器开始 计时; 第二个从节点收到该特定报文后向下一个从节点转发此报文, 并触发自己的延迟定时 器开始计时; 这样向下转发下去, 直到最后一个从节点; 最后一个从节点收到该特定报文后 将向上一个从节点转发该特定报文,上一个从节点收到该特定报文后再向上转发该特定报文, 并触发自己的延迟定时器停止计时, 这样向上转发并触发自己的延迟定时器停止计时, 直到 第一个从节点; 第一个从节点收到该特定报文后将触发自己的延迟定时器停止计时, 并不再 转发该特定报文; 这样, 每个从节点即可获得自己与最后一个从节点间的网络时间延迟, 即 延迟定时器计时的一半, 该延迟定时器的计时将以寄存器参数的形式保存在各从节点上。 In step 3), the method for measuring the time delay between nodes is: after each slave node receives the control message, the delay timer is cleared, and the first slave node sends a specific message to the next slave node, and triggers The own delay timer starts timing; the second slave node forwards the message to the next slave node after receiving the specific message, and triggers its own delay timer to start timing; this forwards down until the last one Node: After receiving the specific packet, the last slave node forwards the specific packet to the upper slave node. After receiving the specific packet, the last slave node forwards the specific packet and triggers its own delay timer. Stop timing, thus forwarding up and triggering its own delay timer to stop timing until the first slave node; after receiving the specific message, the first slave node will trigger its own delay timer to stop timing and no longer forward the Specific message; thus, each slave node can obtain the network time delay between itself and the last slave node, that is, the delay timer Half will form the timing register of the delay timer parameters stored in the respective slave node.
8、 根据权利要求 5所述的基于标准以太网的实时同步方法, 其特征是: 所述步骤 4) 的 周期性工作 段中, 各从节点在动作的同时锁存当前从节点的当前状态, 并按照上一个周期' 收到的主节点的命令报文同时动作, 将该从节点的状态信息以报文的形式发送到主节点, 主 节点分析各从节点的状态信息, 并统一规划下一周期各从节点的动作, 并将该动作信息以命 令报文的形式在该周期传送到各从节点上, 实现各从节点动作的同步性; 8. The standard Ethernet-based real-time synchronization method according to claim 5, wherein: in the periodic working segment of the step 4), each slave node latches the current state of the current slave node while the action is active, And according to the command message of the received master node in the previous cycle, the status information of the slave node is sent to the master node in the form of a message, and the master node analyzes the state information of each slave node, and uniformly plans the next message. The action of each slave node in the cycle, and the action information is transmitted to each slave node in the form of a command message, thereby realizing the synchronization of the action of each slave node;
周期性地发送一个同步报文是指第一个从节点的周期定时器设定初始参数后, 该初始参 数就是周期性通信的通信周期, 周期定时器在第一个从节点时钟信号的驱动下, 开始计时, 当计时值到达设定的初始参数时, 该周期定时器产生一个中断信号并将周期定时器清零并重 新开始计时, 第一个从节点收到该中断信号, 将向下发送一个特定的同步报文, 这样周期往 复, 实现了周期性发送同步报文的方法; Periodically sending a synchronization message refers to the initial parameter of the first slave node's cycle timer, which is the communication cycle of the periodic communication, and the cycle timer is driven by the first slave node clock signal. , start timing, when the timing value reaches the set initial parameter, the cycle timer generates an interrupt signal and clears the cycle timer and restarts the timing. The first slave node receives the interrupt signal and sends it down. A specific synchronization message, such that the cycle is repeated, and a method for periodically transmitting the synchronization message is implemented;
步骤 4) 中从节点延迟一定的时间, 然后动作的方法为各从节点的延迟定时器设定初始 参数值, 该初始参数从节点相对于最后一个从节点的网络时间延迟, 各从节点在收到同步报 文后, 触发延返定时器, 该延迟定时器在时钟信号的驱动下, 开始定时, 到设定的初始参数 后,产生一个中断信号,从节点根据该中断信号锁存当前的状态并按照控制报文的命令动作, 并将当前的状态信息以报文的形式发送到主节点。 In step 4), the slave node is delayed by a certain time, and then the action method sets an initial parameter value for the delay timer of each slave node, and the initial parameter is delayed from the network time of the node relative to the last slave node, and each slave node receives After the synchronization message is sent, the delay timer is triggered. The delay timer starts to be driven by the clock signal, and after the initial parameter is set, an interrupt signal is generated, and the slave latches the current state according to the interrupt signal. And according to the command action of the control message, and the current state information is sent to the master node in the form of a message.
PCT/CN2008/0002682007-02-132008-02-02Real-time synchronous method and synchronous network based on the standard ethernetWO2008101394A1 (en)

Applications Claiming Priority (4)

Application NumberPriority DateFiling DateTitle
CN200710013313ACN101018115B (en)2007-02-132007-02-13 Real-time Synchronous Network Based on Standard Ethernet and Its Working Method
CN200710013313.02007-02-13
CN200710014419.22007-04-29
CNB2007100144192ACN100561904C (en)2007-04-292007-04-29 Device and method for realizing synchronization between nodes of Ethernet chain network

Publications (1)

Publication NumberPublication Date
WO2008101394A1true WO2008101394A1 (en)2008-08-28

Family

ID=39709618

Family Applications (1)

Application NumberTitlePriority DateFiling Date
PCT/CN2008/000268WO2008101394A1 (en)2007-02-132008-02-02Real-time synchronous method and synchronous network based on the standard ethernet

Country Status (1)

CountryLink
WO (1)WO2008101394A1 (en)

Cited By (19)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107872362A (en)*2016-09-282018-04-03阿姆有限公司Error detection in communication network
CN111478834A (en)*2020-03-252020-07-31武汉迈信电气技术有限公司EtherCAT master station synchronization method based on non-real-time system
CN111948993A (en)*2013-12-312020-11-17深圳迈瑞生物医疗电子股份有限公司Sample processing pipeline control system
CN112817904A (en)*2021-02-222021-05-18中国人民解放军93114部队MilCAN bus dynamic data time sequence alignment method
CN112968822A (en)*2021-03-152021-06-15广州铁路职业技术学院(广州铁路机械学校)One-master multi-slave real-time communication system and method based on Ethernet PHY
CN113225151A (en)*2021-04-192021-08-06杭州康吉森自动化科技有限公司Clock synchronization system, method and device based on CAN bus
CN113467454A (en)*2021-07-052021-10-01中国科学院半导体研究所Tower vehicle node control device and control method applied to sprinkler
CN113645170A (en)*2021-07-122021-11-12鹏城实验室 Method for synchronizing parameters of transceivers in WFRFT hybrid carrier system and related equipment
CN114051712A (en)*2019-09-232022-02-15倍福自动化有限公司 Method for time synchronization in an Ethernet-based network
CN114089662A (en)*2021-11-172022-02-25湖南力行动力科技有限公司Implementation method of novel high-performance electronic shaft transmission control system
CN114448801A (en)*2021-12-232022-05-06东莞市李群自动化技术有限公司Method, network topology, device and storage medium for creating real-time channel group
CN114531347A (en)*2020-11-232022-05-24沈阳新松机器人自动化股份有限公司Real-time communication method based on controller
US11380190B2 (en)*2020-04-302022-07-05Kone CorporationSafety communication in an elevator communication system
CN114786248A (en)*2022-03-182022-07-22哈尔滨工业大学Wireless sensor chain type networking and clock synchronization method
CN115426070A (en)*2022-11-022022-12-02浙江国利信安科技有限公司Method, apparatus and storage medium for clock resynchronization
CN116155639A (en)*2022-12-152023-05-23卡斯柯信号有限公司Drive and mining data interaction method, device and medium based on CANOPEN protocol
CN116318497A (en)*2022-09-082023-06-23卡斯柯信号有限公司SNTP synchronization time method for rail transit secure communication platform
CN116471211A (en)*2023-06-192023-07-21威胜信息技术股份有限公司 A precise time synchronization method for power internet of things
CN119276433A (en)*2024-12-092025-01-07北京广利核系统工程有限公司 Communication rate adjustment method applicable to industrial field bus and industrial control system

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1394004A (en)*2001-06-292003-01-29深圳市中兴通讯股份有限公司上海第二研究所Method and device for choosing and controlling clock source of synchronous digital optical network
CN1421075A (en)*1999-12-222003-05-28艾利森电话股份有限公司Telecommunication network synchronisation
CN1592162A (en)*2003-08-272005-03-09华为技术有限公司Method for automatically configurating link
CN101018115A (en)*2007-02-132007-08-15张承瑞Real time synchronization network based on the standard Ethernet and its operating method
CN101039173A (en)*2007-04-292007-09-19山东大学Apparatus and method for realizing synchronization between Ethernet chain-like network nodes

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1421075A (en)*1999-12-222003-05-28艾利森电话股份有限公司Telecommunication network synchronisation
CN1394004A (en)*2001-06-292003-01-29深圳市中兴通讯股份有限公司上海第二研究所Method and device for choosing and controlling clock source of synchronous digital optical network
CN1592162A (en)*2003-08-272005-03-09华为技术有限公司Method for automatically configurating link
CN101018115A (en)*2007-02-132007-08-15张承瑞Real time synchronization network based on the standard Ethernet and its operating method
CN101039173A (en)*2007-04-292007-09-19山东大学Apparatus and method for realizing synchronization between Ethernet chain-like network nodes

Cited By (29)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111948993A (en)*2013-12-312020-11-17深圳迈瑞生物医疗电子股份有限公司Sample processing pipeline control system
CN111948993B (en)*2013-12-312024-06-21深圳迈瑞生物医疗电子股份有限公司Sample processing pipeline control system
CN107872362A (en)*2016-09-282018-04-03阿姆有限公司Error detection in communication network
CN114051712A (en)*2019-09-232022-02-15倍福自动化有限公司 Method for time synchronization in an Ethernet-based network
US12069155B2 (en)2019-09-232024-08-20Beckhoff Automation GmbhMethod for synchronizing time in an ethernet-based network
CN111478834A (en)*2020-03-252020-07-31武汉迈信电气技术有限公司EtherCAT master station synchronization method based on non-real-time system
US11380190B2 (en)*2020-04-302022-07-05Kone CorporationSafety communication in an elevator communication system
CN114531347A (en)*2020-11-232022-05-24沈阳新松机器人自动化股份有限公司Real-time communication method based on controller
CN112817904A (en)*2021-02-222021-05-18中国人民解放军93114部队MilCAN bus dynamic data time sequence alignment method
CN112817904B (en)*2021-02-222024-05-17中国人民解放军93114部队MilCAN bus dynamic data time sequence alignment method
CN112968822A (en)*2021-03-152021-06-15广州铁路职业技术学院(广州铁路机械学校)One-master multi-slave real-time communication system and method based on Ethernet PHY
CN113225151A (en)*2021-04-192021-08-06杭州康吉森自动化科技有限公司Clock synchronization system, method and device based on CAN bus
CN113225151B (en)*2021-04-192023-08-25杭州康吉森自动化科技有限公司Clock synchronization system, method and device based on CAN bus
CN113467454A (en)*2021-07-052021-10-01中国科学院半导体研究所Tower vehicle node control device and control method applied to sprinkler
CN113645170A (en)*2021-07-122021-11-12鹏城实验室 Method for synchronizing parameters of transceivers in WFRFT hybrid carrier system and related equipment
CN113645170B (en)*2021-07-122023-08-18鹏城实验室WFRFT mixed carrier system receiving and transmitting end parameter synchronization method and related equipment
CN114089662A (en)*2021-11-172022-02-25湖南力行动力科技有限公司Implementation method of novel high-performance electronic shaft transmission control system
CN114448801A (en)*2021-12-232022-05-06东莞市李群自动化技术有限公司Method, network topology, device and storage medium for creating real-time channel group
CN114448801B (en)*2021-12-232024-04-12东莞市李群自动化技术有限公司Method for creating real-time channel group, network topology, equipment and storage medium
CN114786248A (en)*2022-03-182022-07-22哈尔滨工业大学Wireless sensor chain type networking and clock synchronization method
CN114786248B (en)*2022-03-182022-10-25哈尔滨工业大学 A wireless sensor chain networking and clock synchronization method
CN116318497A (en)*2022-09-082023-06-23卡斯柯信号有限公司SNTP synchronization time method for rail transit secure communication platform
CN116318497B (en)*2022-09-082025-08-29卡斯柯信号有限公司 An SNTP time synchronization method for rail transit safety communication platform
CN115426070A (en)*2022-11-022022-12-02浙江国利信安科技有限公司Method, apparatus and storage medium for clock resynchronization
CN115426070B (en)*2022-11-022023-03-10浙江国利信安科技有限公司 Method, device and storage medium for clock resynchronization
CN116155639A (en)*2022-12-152023-05-23卡斯柯信号有限公司Drive and mining data interaction method, device and medium based on CANOPEN protocol
CN116471211A (en)*2023-06-192023-07-21威胜信息技术股份有限公司 A precise time synchronization method for power internet of things
CN116471211B (en)*2023-06-192023-10-13威胜信息技术股份有限公司 An accurate time synchronization method for the power Internet of Things
CN119276433A (en)*2024-12-092025-01-07北京广利核系统工程有限公司 Communication rate adjustment method applicable to industrial field bus and industrial control system

Similar Documents

PublicationPublication DateTitle
WO2008101394A1 (en)Real-time synchronous method and synchronous network based on the standard ethernet
CN101018115A (en)Real time synchronization network based on the standard Ethernet and its operating method
CN102237997B (en)Method for real-time synchronization and dynamic compensation between chain Ethernet nodes
CN107707447B (en)Slave station system based on EtherCAT and control method
CN102237718B (en)Method and device of operating wind power electric field power network with improved data transmission protocol
US8072999B1 (en)Method and system for removing and returning nodes in a synchronous network
CN101631016B (en)Time synchronization method of fieldbus
CN103095607B (en)A kind of real-time priority ethernet controller implementation method
US5919250A (en)Data transmission system used for plant control and based on local area network
CN100382522C (en) A Scheduling Method for Realizing Ethernet Deterministic Communication
US11706113B2 (en)Determining delay based on a measurement code block
EP1573560A1 (en)Schematizing of messages in distributed control and supervision system
JPH0373636A (en)Data synchronizing transmission system
CN115996205B (en)TSN Ethernet switching module and electric power Internet of things message processing method
US20230079341A1 (en)Time synchronization in industrial system
CN112929117B (en)Compatible definable deterministic communication Ethernet
US7272152B2 (en)Method for real-time communication between a number of network subscribers in a communication system using ethernet physics, and a corresponding communication system using ethernet physics
CN113315668B (en) Method, node device and storage medium for adaptively adjusting network configuration
CN201066852Y (en)Real time synchronization network based on standard Ethernet
CN1152522C (en)Serial bus communication system containing Ethernet nodes and real-time nodes
CN100514891C (en)Method for operating an end-user of an isochronous cyclical communication system
CN108777609A (en)TT business is avoided to export the method to conflict with ET business in TTE networks
AristovaEthernet in industrial automation: Overcoming obstacles
CN214627023U (en)Switching equipment compatible with definable deterministic communication Ethernet
EP2260599A1 (en)Network device of high-precision synchronization type, network system, and frame transfer method

Legal Events

DateCodeTitleDescription
121Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number:08714811

Country of ref document:EP

Kind code of ref document:A1

NENPNon-entry into the national phase

Ref country code:DE

122Ep: pct application non-entry in european phase

Ref document number:08714811

Country of ref document:EP

Kind code of ref document:A1


[8]ページ先頭

©2009-2025 Movatter.jp