CN100382522C - A Scheduling Method for Realizing Ethernet Deterministic Communication - Google Patents
A Scheduling Method for Realizing Ethernet Deterministic Communication Download PDFInfo
- Publication number
- CN100382522C CN100382522C CNB031420400A CN03142040A CN100382522C CN 100382522 C CN100382522 C CN 100382522C CN B031420400 A CNB031420400 A CN B031420400A CN 03142040 A CN03142040 A CN 03142040A CN 100382522 C CN100382522 C CN 100382522C
- Authority
- CN
- China
- Prior art keywords
- information
- time
- aperiodic
- periodic
- send
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Lifetime
Links
Images
Landscapes
- Small-Scale Networks (AREA)
Abstract
一种实现以太网确定性通信的调度方法,将网络中的信息划分为周期信息和非周期信息,对于周期信息,采用时隙访问的控制方式,在固定的时间片中进行周期性的数据交换;对于非周期信息,采用基于令牌的集中调度方式,在周期信息通信的间隙即非周期信息通信阶段进行;本发明的调度方法在网络上定义至少有一个主设备和一个或多个从设备,从设备只有在获得来自主设备的令牌后才能发送非周期信息;同时,网络上设有至少有一个时钟服务器,用于各个设备(包括主设备和从设备)之间的时钟同步。本发明合理调度以太网中的周期和非周期信息,在以以太网+UDP/IP为基础的工业控制网络上实现实时和确定性的通信,满足了工业控制网络对通信的实时性和确定性的要求。
A scheduling method for realizing Ethernet deterministic communication, which divides the information in the network into periodic information and non-periodic information. For periodic information, the control method of time slot access is adopted to perform periodic data exchange in a fixed time slice ; For non-periodic information, adopt centralized scheduling mode based on token, and carry out in the interval of periodic information communication, that is, the stage of non-periodic information communication; The scheduling method of the present invention defines at least one master device and one or more slave devices on the network , the slave device can only send aperiodic information after obtaining the token from the master device; at the same time, there is at least one clock server on the network for clock synchronization between each device (including the master device and the slave device). The invention reasonably dispatches periodic and non-periodic information in Ethernet, realizes real-time and deterministic communication on the industrial control network based on Ethernet+UDP/IP, and satisfies the real-time and deterministic communication of industrial control network requirements.
Description
技术领域 technical field
本发明涉及以太网通信的调度方法,尤其涉及一种以以太网+UDP/IP为基础的工业控制网络中多个网络节点之间进行确定性通信的调度方法。The invention relates to a scheduling method for Ethernet communication, in particular to a scheduling method for deterministic communication between multiple network nodes in an industrial control network based on Ethernet+UDP/IP.
背景技术 Background technique
以太网作为一种成熟的网络技术,具有成本低、稳定和可靠等诸多优点,在办公自动化和工业控制领域得到了广泛应用,成为当前最受欢迎的通信网络之一。目前使用的以太网标准,在MAC(介质访问控制)层大多采用带冲突检测的载波监听多路访问的CSMA/CD协议,其工作流程是:当一个网络上的某一个节点需要发送数据时,它首先监听信道,若信道忙就持续等待,直到它一旦监听到信道空闲时,就将数据发送出去。如果两个或多个节点都在监听和等待发送数据,当监听到信道空闲时,各节点就立即(几乎同时)开始发送数据,这时就发生冲突。如果一个节点在传输期间检测出冲突,则立即停止传输,并向信道发出一个“拥挤”信号,以确保网络上的所有其它节点也发现该冲突。在基于以太网的通信系统中,为避免冲突,各个节点采用1坚持的二进制指数退避(BEB,Binary Exponential Back-Off)算法处理冲突,但该方法具有冲突时延不确定的缺陷,无法在工业控制网络等实时网络中得到有效应用。As a mature network technology, Ethernet has many advantages such as low cost, stability and reliability, etc. It has been widely used in the field of office automation and industrial control, and has become one of the most popular communication networks. The currently used Ethernet standards mostly use the CSMA/CD protocol with collision detection in the MAC (Media Access Control) layer. The working process is: when a certain node on a network needs to send data, It first monitors the channel, and if the channel is busy, it continues to wait until it detects that the channel is free, and then sends the data. If two or more nodes are listening and waiting to send data, when the channel is detected to be idle, each node immediately (almost at the same time) starts sending data, and a conflict occurs at this time. If a node detects a collision during transmission, it immediately stops transmission and sends a "congestion" signal to the channel to ensure that all other nodes on the network also see the collision. In an Ethernet-based communication system, in order to avoid conflicts, each node uses a 1-persistent Binary Exponential Back-Off (BEB, Binary Exponential Back-Off) algorithm to deal with conflicts. It is effectively applied in real-time networks such as control networks.
工业控制网络是一种典型的实时应用系统,其中的任务(如功能块的执行)通常按照一定的时间间隔触发,并且对任务的执行时间具有截止期要求,这种任务称为周期性任务。实时应用系统中还有一种任务,这种任务只有在特定的事件触发下才出现,例如设备配置、故障诊断、程序的上载/下载、运行记录、报警处理等,这类任务称为非周期性任务,非周期性任务是随机触发的。这两种任务反映在工业控制网络的通信上,就是两类通信信息:周期性通信信息和非周期性通信信息。周期性信息是实时信息,非周期信息是非实时信息,周期性通信信息和非周期性通信信息具有不同的时间特性。一旦系统组态完成,周期性通信信息的发送就具有时间确定性。而非周期性通信信息往往是突发信息,在时间上是不确定的。The industrial control network is a typical real-time application system, in which the tasks (such as the execution of function blocks) are usually triggered according to a certain time interval, and there is a deadline requirement for the execution time of the tasks. This task is called a periodic task. There is also a task in the real-time application system, which only occurs when a specific event is triggered, such as device configuration, fault diagnosis, program upload/download, running record, alarm processing, etc. Such tasks are called aperiodic Tasks, non-periodic tasks are triggered randomly. These two tasks are reflected in the communication of the industrial control network, which are two types of communication information: periodic communication information and non-periodic communication information. Periodic information is real-time information, non-periodic information is non-real-time information, and periodic communication information and non-periodic communication information have different time characteristics. Once the system configuration is complete, the periodic communication messages are sent with time determinism. Non-periodic communication information is often burst information, which is uncertain in time.
为了提高以太网通信的实时性和确定性,人们做了不少研究,提出各种方法来改进CSMA/CD,按照对CSMA/CD的改进方法划分,主要有:改进以太网MAC协议、在以太网上层增加传输控制机制等。CSMA/DCR(DeterministicCollision Resolution)是最具有代表性的一种MAC协议改进方法。当冲突发生时,采用确定性的二叉树寻址方法,CSMA/DCR依照节点地址采取先序遍历的方式解决冲突。当冲突发生时,低优先级的节点停止对信道的竞争,而高优先级的节点继续竞争信道,直到成功传输。这种修改以太网MAC协议的方式虽然可以极大的改善以太网通信确定性的问题,却是以更改以太网固件(以太网控制器硬件和软件)为代价的,很难与标准的商用以太网兼容,并且增加了开发成本。In order to improve the real-time and certainty of Ethernet communication, people have done a lot of research and put forward various methods to improve CSMA/CD. According to the improvement methods of CSMA/CD, they mainly include: improving the Ethernet MAC protocol, The network layer increases the transmission control mechanism, etc. CSMA/DCR (DeterministicCollision Resolution) is the most representative MAC protocol improvement method. When a conflict occurs, the deterministic binary tree addressing method is adopted, and CSMA/DCR adopts a preorder traversal method according to the node address to resolve the conflict. When a collision occurs, nodes with low priority stop competing for the channel, while nodes with high priority continue to compete for the channel until successful transmission. Although this method of modifying the Ethernet MAC protocol can greatly improve the determinism of Ethernet communication, it is at the expense of changing the Ethernet firmware (Ethernet controller hardware and software), and it is difficult to integrate with standard commercial Ethernet. Network compatibility, and increased development costs.
在以太网上层增加传输控制机制中最典型的一种方法是时分多路获取(TDMA)策略,TDMA为每个节点分配一定的带宽,每个节点在固定的时间片内发送信息,以保证每个节点的信息具有确定的发送时间。由于TDMA不需要传输额外的控制信息,使得网络带宽的利用率比较高。但TDMA是基于节点的方法,不能反映每个节点的实际带宽需求,无法保证非周期信息及时发送。另外一种在以太网上层增加传输控制的方法是主从式传输控制方式,这是一种集中式的传输控制方式,网络中至少有一个主设备和多个从设备。从设备只有在收到来自主设备的控制报文之后,才可以发送数据。这种主从式传输控制方式的优点是可以保证每个从设备都有发送数据的机会,但缺点是无法处理工业控制网络中的突发性通信,例如工业控制网络中的报警信息。The most typical method of adding transmission control mechanism on the upper layer of Ethernet is Time Division Multiple Access (TDMA) strategy. TDMA allocates a certain bandwidth for each node, and each node sends information within a fixed time slice to ensure that each The information of each node has a definite sending time. Because TDMA does not need to transmit additional control information, the utilization rate of network bandwidth is relatively high. However, TDMA is a node-based method, which cannot reflect the actual bandwidth requirements of each node, and cannot guarantee timely transmission of aperiodic information. Another way to increase transmission control on the upper layer of the Ethernet is the master-slave transmission control mode, which is a centralized transmission control mode. There is at least one master device and multiple slave devices in the network. The slave device can only send data after receiving the control message from the master device. The advantage of this master-slave transmission control method is that it can ensure that each slave device has the opportunity to send data, but the disadvantage is that it cannot handle sudden communications in the industrial control network, such as alarm information in the industrial control network.
因此,尽管上述方法都在一定程度上提高了以太网传输的实时性和确定性,却是或者以改变以太网结构为代价(如CSMA/DCR),或者在较低的网络层次(如MAC层的上层)实现,这些方法的最大不足是实现难度大,往往涉及到硬件,无法与传统标准的以太网相互兼容,并且无法满足工业控制网络中对两类信息——周期信息(即实时信息)和非周期信息(通常为非实时信息)进行同时处理的特殊要求。Therefore, although the above methods have improved the real-time and certainty of Ethernet transmission to a certain extent, they are either at the expense of changing the Ethernet structure (such as CSMA/DCR), or at a lower network level (such as the MAC layer). The biggest disadvantage of these methods is that they are difficult to implement, often involve hardware, and cannot be compatible with traditional standard Ethernet, and cannot meet the requirements of two types of information in industrial control networks—periodic information (that is, real-time information) Special requirements for simultaneous processing with non-periodic information (usually non-real-time information).
发明内容 Contents of the invention
本发明的目的是在不改变以太网原有结构的条件下,在位于UDP之上的用户层提供一种确定性通信的调度方法,以合理调度工业控制网络中的周期和非周期信息,在以以太网+UDP/IP为基础的工业控制网络上实现实时和确定性的通信,以满足基于传统以太网标准的工业控制网络对通信的实时性和确定性的要求。The purpose of the present invention is to provide a scheduling method for deterministic communication at the user layer above UDP without changing the original structure of the Ethernet, so as to reasonably schedule periodic and aperiodic information in the industrial control network. The real-time and deterministic communication is realized on the industrial control network based on Ethernet + UDP/IP to meet the real-time and deterministic requirements of the industrial control network based on the traditional Ethernet standard.
为了达到上述目的,本发明采用如下技术方案:In order to achieve the above object, the present invention adopts following technical scheme:
一种实现以太网确定性通信的调度方法,其特点是,A scheduling method for realizing Ethernet deterministic communication, characterized in that,
在所述以太网上定义至少一个主设备和一个或多个从设备,在所述以太网上设有至少一个时钟服务器;defining at least one master device and one or more slave devices on the Ethernet, and having at least one clock server on the Ethernet;
将所述以太网中的信息分为周期信息和非周期信息,对所述周期信息采用时隙访问的控制方式,在固定的时间片中进行周期性的数据交换;对所述非周期信息采用基于令牌的集中调度方式,在所述周期信息通信的间隙即非周期信息通信阶段进行数据交换;The information in the Ethernet is divided into periodic information and non-periodic information, and the control mode of time slot access is adopted for the periodic information, and periodic data exchange is performed in a fixed time slice; Based on the token-based centralized scheduling method, data exchange is performed during the interval of the periodic information communication, that is, the aperiodic information communication phase;
包括以下步骤:Include the following steps:
a.系统启动之前,所述主设备负责对整个系统进行组态,包括,指定传输周期的大小;指定各从设备在一个传输周期中发送周期信息的时间长度;设置每个从设备在传输周期中传输周期信息的起始时刻相对于传输周期起始时刻的时间偏差;并将这些信息下载到每个从设备中;a. Before the system starts, the master device is responsible for configuring the entire system, including specifying the size of the transmission cycle; specifying the time length for each slave device to send cycle information in a transmission cycle; setting each slave device in the transmission cycle The time deviation between the start moment of the transmission cycle information in the transmission cycle relative to the start moment of the transmission cycle; and download the information to each slave device;
b.系统上电后,所有主设备和所有从设备首先与所述时钟服务器进行时钟同步;b. After the system is powered on, all master devices and all slave devices first synchronize clocks with the clock server;
c.传输周期开始后,所述主设备对周期信息采用时隙访问的控制方式,每个从设备在预定的时刻发送周期信息,每个从设备在发送完周期信息之后接下来的一段时间中,向主设备发送声明报文,通知所述主设备其是否有非周期信息要发送,如果有非周期信息要发送,所述主设备将相应从设备的IP地址、信息优先级以及预期的信息发送时间保存在一个非周期信息发送队列中,而从设备在接下来的非周期信息通信阶段等待非周期信息调度令牌;c. After the transmission cycle starts, the master device adopts a time slot access control method for the periodic information, and each slave device sends the periodic information at a predetermined time, and each slave device transmits the periodic information in the next period of time after sending the periodic information , send a statement message to the master device, informing the master device whether it has aperiodic information to send, if there is aperiodic information to send, the master device will correspond to the IP address of the slave device, information priority and expected information The sending time is stored in an aperiodic information sending queue, and the slave device waits for the aperiodic information scheduling token in the next aperiodic information communication phase;
d.在一个传输周期的非周期信息通信阶段,所述主设备进行如下操作:d. In the non-periodic information communication phase of a transmission cycle, the master device performs the following operations:
d1.扫描非周期信息发送队列,判断队列是否空,如果队列不空,转d2;否则,结束;d1. Scan the non-periodic message sending queue to determine whether the queue is empty, if the queue is not empty, go to d2; otherwise, end;
d2.根据所述队列中的信息,向具有最高优先级非周期信息的从设备发送非周期信息调度令牌,同时启动定时器,定时器大小为令牌持有时间;d2. According to the information in the queue, send the aperiodic information scheduling token to the slave device with the highest priority aperiodic information, and start a timer at the same time, the timer size is the token holding time;
d3.等待从设备释放令牌;d3. Waiting for the token to be released from the device;
d4.判断是否收到来自从设备的确认,如果收到,转d1;否则,转d5;d4. Determine whether the confirmation from the slave device is received, if so, go to d1; otherwise, go to d5;
d5.判断定时器是否溢出,如果未溢出,转d3;否则,转d1;d5. Determine whether the timer overflows, if not, go to d3; otherwise, go to d1;
非周期信息通信阶段结束后,所述主设备终止上述操作,同时保存非周期信息发送队列中还未处理的信息;After the aperiodic information communication phase ends, the master device terminates the above operations, and simultaneously saves unprocessed information in the aperiodic information sending queue;
e.在一个传输周期的非周期信息通信阶段,所述从设备进行如下操作:e. In the non-periodic information communication phase of a transmission cycle, the slave device performs the following operations:
e1.等待所述非周期信息调度令牌;e1. Waiting for the aperiodic information scheduling token;
e2.判断是否接收到非周期信息调度令牌,如果还未收到,转e1;否则,转e3;e2. Judging whether the aperiodic information scheduling token is received, if not received, go to e1; otherwise, go to e3;
e3.判断信息优先级是否不小于令牌的优先级,如果为真,转e4;否则,转e6;e3. Determine whether the priority of the information is not less than the priority of the token, if true, go to e4; otherwise, go to e6;
e4.判断令牌持有时间是否不小于信息发送时间,如果为真,转e5;否则,转e6;e4. Determine whether the token holding time is not less than the information sending time, if true, go to e5; otherwise, go to e6;
e5.发送非周期信息;e5. Send aperiodic information;
e6.向所述主设备发送确认信息,释放所述非周期信息调度令牌,然后结束。e6. Send confirmation information to the master device, release the aperiodic information scheduling token, and end.
整个网络传输时间划分为无限个等长的所述传输周期,每个所述传输周期包括周期信息通信阶段和非周期信息通信阶段,所有从设备在每个所述传输周期中发送和接收所述周期信息和所述非周期信息。The entire network transmission time is divided into an infinite number of transmission periods of equal length, each transmission period includes a periodical information communication phase and an aperiodic information communication phase, and all slave devices send and receive the transmission period in each transmission period Periodic information and the non-periodic information.
所述步骤c中,所述主设备对周期信息通信采用时隙访问的控制方式:网络上每个设备,包括主设备和从设备均与所述时钟服务器保持时钟同步,所述主设备在步骤a系统组态时确定每个从设备在一个传输周期中发送周期信息的时间长度以及从设备发送周期信息的起始时间相对于传输周期的起始时间的偏移量。In the step c, the master device adopts a time slot access control method for periodic information communication: each device on the network, including the master device and the slave device, maintains clock synchronization with the clock server, and the master device in step a. During system configuration, determine the length of time for each slave device to send periodic information in a transmission cycle and the offset of the start time of slave device sending cycle information relative to the start time of the transmission cycle.
在所述步骤c周期信息通信阶段,每个从设备在预定时刻发送完周期信息之后,还留有一段时间,用于向主设备发送一个声明报文,通知所述主设备它在接下来的时间里是否还有非周期信息要发送;如果有,还要标明该非周期信息所需要的发送时间,以及信息的优先级,主设备收到该报文后,将有非周期信息要发送的设备的IP地址、信息的优先级以及信息的预期发送时间保存在一个队列中;如果所述主设备在连续三个周期内没有收到来自某个从设备的声明报文,那么就认为该从设备已经失效。In the period information communication phase of step c, after each slave device sends the period information at a predetermined time, there is still a period of time for sending a statement message to the master device, notifying the master device that it is in the next Whether there is any non-periodic information to be sent within the time; if so, indicate the sending time required for the aperiodic information and the priority of the information. After the master device receives the message, there will be aperiodic information to be sent The IP address of the device, the priority of the information, and the expected sending time of the information are stored in a queue; if the master device does not receive a statement message from a slave device within three consecutive cycles, it is considered that the slave device The device has failed.
所述步骤d、e非周期信息通信基于令牌的集中调度方式,是将网络中的非周期信息划分为不同的优先级,所述主设备根据非周期信息优先级的高低决定哪个从设备首先发送,高优先级的信息将首先获得所述令牌,具有优先发送权。The aperiodic information communication in steps d and e is based on token-based centralized scheduling, which is to divide the aperiodic information in the network into different priorities, and the master device decides which slave device should be the first according to the priority of the aperiodic information. Send, high-priority information will get the token first, and have the priority to send.
所述的时钟同步方式由设备与所述时钟服务器之间通过简单网络时间协议(SNTP,Simple Network Time Protocol)实现。The clock synchronization method is realized by the simple network time protocol (SNTP, Simple Network Time Protocol) between the device and the clock server.
由于采用了上述技术方案,本发明的调度方法合理调度工业控制网络中的周期和非周期信息,在以以太网+UDP/IP为基础的工业控制网络上实现了实时和确定性的通信。Due to the adoption of the above technical solution, the scheduling method of the present invention reasonably schedules periodic and non-periodic information in the industrial control network, and realizes real-time and deterministic communication on the industrial control network based on Ethernet+UDP/IP.
附图说明 Description of drawings
图1是网络传输时间的传输周期的划分示意图;FIG. 1 is a schematic diagram of the division of the transmission period of the network transmission time;
图2是一个传输周期中信息通信过程的示意图;FIG. 2 is a schematic diagram of an information communication process in a transmission cycle;
图3是本发明的调度方法的一个实施例中使用的非周期信息调度令牌的一种格式;Fig. 3 is a kind of format of the aperiodic information scheduling token used in an embodiment of the scheduling method of the present invention;
图4是本发明的调度方法的一个实施例中主设备对非周期信息的处理流程;FIG. 4 is a processing flow of the master device for aperiodic information in one embodiment of the scheduling method of the present invention;
图5是本发明的调度方法的一个实施例中从设备对非周期信息的处理流程;Fig. 5 is the processing flow of the aperiodic information from the device in one embodiment of the scheduling method of the present invention;
图6是用SNTP实现时钟同步的示意图。Fig. 6 is a schematic diagram of realizing clock synchronization by SNTP.
具体实施方式 Detailed ways
下面结合附图和实施例来进一步说明本发明的技术方案。The technical solutions of the present invention will be further described below in conjunction with the drawings and embodiments.
本发明的调度方法在以太网上定义至少一个主设备和一个或多个从设备,并在在以太网上设有至少一个时钟服务器;The scheduling method of the present invention defines at least one master device and one or more slave devices on the Ethernet, and is provided with at least one clock server on the Ethernet;
并将以太网中的信息分为周期信息和非周期信息,对周期信息采用时隙访问的控制方式,在固定的时间片中进行周期性的数据交换;对非周期信息采用基于令牌的集中调度方式,在周期信息通信的间隙即非周期信息通信阶段进行数据交换;And the information in the Ethernet is divided into periodic information and non-periodic information, the control method of time slot access is adopted for periodic information, and periodic data exchange is carried out in a fixed time slice; for non-periodic information, token-based centralized Scheduling mode, data exchange is performed in the interval of periodic information communication, that is, in the non-periodic information communication stage;
包括以下步骤:Include the following steps:
a.系统启动之前,主设备负责对整个系统进行组态,包括,指定传输周期的大小;指定各从设备在一个传输周期中发送周期信息的时间长度;设置每个从设备在传输周期中传输周期信息的起始时刻相对于传输周期起始时刻的时间偏差;并将这些信息下载到每个从设备中;a. Before the system starts, the master device is responsible for configuring the entire system, including specifying the size of the transmission cycle; specifying the time length for each slave device to send cycle information in a transmission cycle; setting each slave device to transmit in a transmission cycle The time deviation of the start moment of the cycle information relative to the start moment of the transmission cycle; and download the information to each slave device;
图1是网络传输时间的传输周期的划分示意图,如图1所示的网络传输时间被划分为无限个等长的传输周期。每个传输周期由周期信息传输阶段和非周期信息传输阶段构成,如图2所示。FIG. 1 is a schematic diagram of division of transmission periods of network transmission time. As shown in FIG. 1 , the network transmission time is divided into an infinite number of transmission periods of equal length. Each transmission cycle is composed of a periodic information transmission phase and an aperiodic information transmission phase, as shown in FIG. 2 .
图2是一个传输周期中信息通信过程的示意图,图2的示例网络中有6个从设备进行通信。每个从设备发送周期信息的时间长度由主设备在系统组态时确定;所示各从设备发送周期信息的起始时间相对于传输周期的起始时间的偏移量是不同的,从而避免了多个设备同时访问网络资源时发生冲突的可能。同时,每个设备发送周期信息在时间上具有确定性,即一旦设备在某个时刻发送了一个周期信息,那么该设备下次发送同一种周期信息的时间可以通过以下方式计算而得到:Fig. 2 is a schematic diagram of an information communication process in a transmission cycle, and there are 6 slave devices communicating in the example network in Fig. 2 . The length of time for each slave device to send cycle information is determined by the master device during system configuration; the offsets of the start time of each slave device sending cycle information relative to the start time of the transmission cycle are different, so as to avoid It eliminates the possibility of conflicts when multiple devices access network resources at the same time. At the same time, each device sends periodic information with certainty in time, that is, once a device sends a periodic information at a certain moment, the next time the device sends the same periodic information can be calculated by the following method:
NextSendTime=CurrentTime+传输周期NextSendTime=CurrentTime+transmission period
其中,NextSendTime为设备下次传输相同周期信息的时间,CurrentTime为当前传输周期信息的时刻。Wherein, NextSendTime is the time when the device transmits the same cycle information next time, and CurrentTime is the moment when the current cycle information is transmitted.
b.系统上电后,所有主设备和所有从设备首先与时钟服务器进行时钟同步;b. After the system is powered on, all master devices and all slave devices first synchronize the clock with the clock server;
图6是用SNTP实现时钟同步的示意图。本发明所述的保持各个设备之间严格的时钟同步是通过基于UDP的SNTP协议来实现,如图6所示。利用SNTP实现设备之间的时钟同步,实际上就是让每个设备定期与时钟服务器通过交换SNTP报文,计算出设备同时钟服务器之间的时间差,从而调整本地时钟,使设备本地时钟与时钟服务器之间的时间差保持在可以允许的范围内。在计算设备与时钟服务器之间的时间差时要用到四个时间戳:T1,T2,T3和T4,其意义如下:Fig. 6 is a schematic diagram of realizing clock synchronization by SNTP. Keeping strict clock synchronization between devices described in the present invention is realized through the UDP-based SNTP protocol, as shown in FIG. 6 . Using SNTP to achieve clock synchronization between devices is actually to allow each device to periodically exchange SNTP messages with the clock server to calculate the time difference between the device and the clock server, thereby adjusting the local clock so that the local clock of the device is consistent with the clock server The time difference between them is kept within the allowable range. Four timestamps are used when calculating the time difference between the device and the clock server: T 1 , T 2 , T 3 and T 4 , and their meanings are as follows:
T1:设备发送时钟同步请求时的本地时间戳;T 1 : the local time stamp when the device sends the clock synchronization request;
T2:时钟服务器接收到时钟同步请求时的时间戳(标准时间);T 2 : the time stamp (standard time) when the clock server receives the clock synchronization request;
T3:时钟服务器发送时钟同步应答时的时间戳(标准时间);T 3 : the time stamp (standard time) when the clock server sends the clock synchronization response;
T4:设备接收到时钟同步应答时的本地时间戳。T 4 : The local time stamp when the device receives the clock synchronization reply.
简单网络时间协议实现时钟同步基于一个假定,就是设备到时钟服务器和时钟服务器到现场设备之间的传输延时是相等的。基于这个假设,我们通过以下算法计算现场设备与时钟服务器之间的时间偏差Td。Simple Network Time Protocol implements clock synchronization based on an assumption that the transmission delay between the device to the clock server and the clock server to the field device is equal. Based on this assumption, we calculate the time deviation T d between the field device and the clock server through the following algorithm.
T2-(T1+Td)=(T4+Td)-T3 T 2 -(T 1 +T d )=(T 4 +T d )-T 3
根据上式就可以计算出设备与时钟服务器之间的时间偏差Td:According to the above formula, the time deviation T d between the device and the clock server can be calculated:
Td=((T2-T1)+(T3-T4))/2Td=((T2-T1)+(T3-T4))/2
设备可以根据时间偏差Td调整本地时钟,从而与时钟服务器实现同步。网络上的所有主设备和所有从设备通过相同的方式与时钟服务器实现同步之后,意味着网络上所有主设备和所有从设备之间在时间上也是同步的。The device can adjust the local clock according to the time deviation T d , so as to achieve synchronization with the clock server. After all master devices and all slave devices on the network are synchronized with the clock server in the same way, it means that all master devices and all slave devices on the network are also synchronized in time.
c.传输周期开始后,所述主设备对周期信息采用时隙访问的控制方式,每个从设备在预定的时刻发送周期信息,每个从设备在发送完周期信息之后接下来的一段时间中,向主设备发送声明报文,通知所述主设备其是否有非周期信息要发送,如果有非周期信息要发送,所述主设备将相应从设备的IP地址、信息优先级以及预期的信息发送时间保存在一个非周期信息发送队列中,而从设备在接下来的非周期信息通信阶段等待非周期信息调度令牌;c. After the transmission cycle starts, the master device adopts a time slot access control method for the periodic information, and each slave device sends the periodic information at a predetermined time, and each slave device transmits the periodic information in the next period of time after sending the periodic information , send a statement message to the master device, informing the master device whether it has aperiodic information to send, if there is aperiodic information to send, the master device will correspond to the IP address of the slave device, information priority and expected information The sending time is stored in an aperiodic information sending queue, and the slave device waits for the aperiodic information scheduling token in the next aperiodic information communication phase;
在周期信息通信阶段,每个设备在预定的时刻发送完周期信息之后,还留有一段时间,如图2中虚线方框所示。在这段时间中,从设备向主设备发送声明报文,通知主设备其在接下来的时间里是否还有非周期信息要发送。如果有,还要标明该非周期信息所需要的发送时间,以及信息的优先级,主设备收到该报文后,将有非周期信息要发送的设备的IP地址、信息的优先级以及信息的预期发送时间保存在一个队列中。通过这种方式,主设备就可以知道在一个传输周期内,每个从设备是否有非周期信息要发送,同时,主设备也可以监测每个从设备的状态。如果主设备在连续三个周期内没有收到来自某个从设备的声明报文,那么就认为该设备已经失效。In the periodic information communication stage, after each device sends the periodic information at a predetermined time, there is still a period of time, as shown in the dashed box in Figure 2 . During this time, the slave device sends a declaration message to the master device, informing the master device whether there is any aperiodic information to be sent in the next time. If yes, also indicate the sending time required for the aperiodic information and the priority of the information. After the master device receives the message, it will have the IP address of the device to send the aperiodic information, the priority of the information and the information priority. The expected send times are kept in a queue. In this way, the master device can know whether each slave device has aperiodic information to send within a transmission cycle, and at the same time, the master device can also monitor the status of each slave device. If the master device does not receive a declaration message from a slave device within three consecutive cycles, the device is considered to have failed.
d.在一个传输周期的非周期信息通信阶段,所述主设备进行如下操作,图4是本发明的调度方法的一个实施例中主设备对非周期信息的处理流程:d. In the aperiodic information communication phase of a transmission cycle, the master device performs the following operations, and FIG. 4 is a processing flow of the master device for aperiodic information in one embodiment of the scheduling method of the present invention:
d1.扫描非周期信息发送队列,判断队列是否空,如果队列不空,转d1. Scan the non-periodic information sending queue to determine whether the queue is empty, if the queue is not empty, go to
d2;否则,结束;d2; otherwise, end;
d2.根据所述队列中的信息,向具有最高优先级非周期信息的从设备发送非周期信息调度令牌,同时启动定时器(定时器大小为令牌持有时间);d2. According to the information in the queue, send the aperiodic information scheduling token to the slave device with the highest priority aperiodic information, and start the timer simultaneously (the timer size is the token holding time);
d3.等待从设备释放令牌;d3. Waiting for the token to be released from the device;
d4.判断是否收到来自从设备的确认,如果收到,转d1;否则,转d5;d4. Determine whether the confirmation from the slave device is received, if so, go to d1; otherwise, go to d5;
d5.判断定时器是否溢出,如果未溢出,转d3;否则,转d1;d5. Determine whether the timer overflows, if not, go to d3; otherwise, go to d1;
非周期信息通信阶段结束后,所述主设备终止上述操作,同时保存非周期信息发送队列中还未处理的信息;After the aperiodic information communication phase ends, the master device terminates the above operations, and simultaneously saves unprocessed information in the aperiodic information sending queue;
在非周期信息通信阶段,主设备根据在周期信息通信阶段所获得的从设备的信息(包括有非周期信息要发送的设备IP地址、信息的优先级以及信息的预期发送时间等),由主设备中的调度器通过特殊的控制报文来实现非周期信息调度令牌的发送。In the phase of aperiodic information communication, the master device will be sent by the master according to the information of the slave device (including the IP address of the device to send aperiodic information, the priority of the information, and the expected sending time of the information, etc.) obtained in the phase of periodic information communication. The scheduler in the device implements the sending of aperiodic information scheduling tokens through special control messages.
图3是该实施例中非周期信息调度令牌的一种实现格式。1个字节的报文类型字段用于标识此报文类型,即是否为一个非周期信息调度令牌,例如0表示非周期信息调度令牌,其它值则表示其它类型的普通报文。1个字节优先级字段标识令牌的优先级。最后4个字节用来表示令牌持有时间。Fig. 3 is an implementation format of the aperiodic information scheduling token in this embodiment. The 1-byte message type field is used to identify the message type, that is, whether it is an aperiodic information scheduling token, for example, 0 indicates an aperiodic information scheduling token, and other values indicate other types of ordinary messages. The 1-byte priority field identifies the priority of the token. The last 4 bytes are used to indicate the token holding time.
令牌的持续时间根据要发送非周期信息的设备所提供的非周期信息发送时间来确定,一般不小于非周期信息发送持续时间,以保证非周期信息完整发送。信息的发送持续时间可以通过以下方式进行估算:The duration of the token is determined according to the aperiodic information sending time provided by the device to send aperiodic information, generally not less than the aperiodic information sending duration to ensure the aperiodic information is sent completely. The duration of sending a message can be estimated by:
信息发送持续时间(s)=信息长度(bit)/网络带宽(Mbps)Information sending duration (s) = information length (bit) / network bandwidth (Mbps)
其中,信息长度由以下几个部分构成:有效数据的长度,UDP报文头部长度,IP报文头部长度以及以太网帧头部长度。Wherein, the information length is composed of the following parts: the length of valid data, the length of the UDP message header, the length of the IP message header and the length of the Ethernet frame header.
从设备收到来自主设备的非周期信息调度令牌后,它得到在一定时间内发送非周期信息的权利,时间长度在令牌中指定。为了保证周期信息的正常发送,令牌持有时间(令牌持有时间是指从设备从获得令牌到释放令牌所经历的时间)不能超过非周期信息通信阶段所占的总时间。如果从设备发送完成或到达最大允许发送的时间(即超过非周期信息通信阶段所占的总时间)时,则向主设备发送一个确认信息,同时释放令牌。After the slave device receives the aperiodic information scheduling token from the master device, it gets the right to send aperiodic information within a certain period of time, and the time length is specified in the token. In order to ensure the normal transmission of periodic information, the token holding time (token holding time refers to the time from obtaining the token to releasing the token) cannot exceed the total time occupied by the non-periodic information communication phase. If the slave device completes sending or reaches the maximum allowable sending time (that is, exceeds the total time occupied by the non-periodic information communication phase), it sends an acknowledgment message to the master device and releases the token at the same time.
e.在一个传输周期的非周期信息通信阶段,所述从设备进行如下操作,图5是本发明的调度方法的一个实施例中从设备对非周期信息的处理流程:e. In the aperiodic information communication phase of a transmission cycle, the slave device performs the following operations, and Fig. 5 is a processing flow of the slave device to aperiodic information in one embodiment of the scheduling method of the present invention:
e1.等待所述非周期信息调度令牌;e1. Waiting for the aperiodic information scheduling token;
e2.判断是否接收到非周期信息调度令牌,如果还未收到,转e1;否则,转e3;e2. Judging whether the aperiodic information scheduling token is received, if not received, go to e1; otherwise, go to e3;
e3.判断信息优先级是否不小于令牌的优先级,如果为真,转e4;否则,转e6;e3. Determine whether the priority of the information is not less than the priority of the token, if true, go to e4; otherwise, go to e6;
e4.判断令牌持有时间是否不小于信息发送时间,如果为真,转e5;否则,转e6;e4. Determine whether the token holding time is not less than the information sending time, if true, go to e5; otherwise, go to e6;
e5.发送非周期信息;e5. Send aperiodic information;
e6.向所述主设备发送确认信息,释放所述非周期信息调度令牌,然后结束。e6. Send confirmation information to the master device, release the aperiodic information scheduling token, and end.
为了保证重要而紧急的非周期信息(如报警信息)能及时发送,每个非周期信息同样具有不同的优先级。以三级优先级为例,分别为0级,1级,2级,其中,0级优先级是最高优先级,2级优先级是最低优先级,1级优先级处在两者之间。非周期信息调度令牌也划分为同非周期信息相同的优先级类别。从设备收到令牌后,比较发送缓冲区中的非周期信息和令牌的优先级,只有当非周期信息的优先级不低于令牌的优先级,并且,令牌持有时间不小于信息发送时间时,才发送非周期信息,否则,直接向主设备释放令牌。In order to ensure that important and urgent aperiodic information (such as alarm information) can be sent in time, each aperiodic information also has different priorities. Taking the three levels of priority as an example, they are respectively level 0,
由于采用了上述技术方案,本发明在位于UDP之上的用户层提供一种确定性通信的调度方法,以合理调度工业控制网络中的周期和非周期信息,在以以太网+UDP/IP为基础的工业控制网络上实现实时和确定性的通信,以满足基于传统以太网标准的工业控制网络对通信的实时性和确定性的要求。Due to the adoption of the above technical solution, the present invention provides a scheduling method for deterministic communication at the user layer above UDP, to reasonably schedule periodic and non-periodic information in the industrial control network, using Ethernet+UDP/IP as the The real-time and deterministic communication is realized on the basic industrial control network to meet the real-time and deterministic requirements of the industrial control network based on the traditional Ethernet standard.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB031420400A CN100382522C (en) | 2003-08-04 | 2003-08-04 | A Scheduling Method for Realizing Ethernet Deterministic Communication |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB031420400A CN100382522C (en) | 2003-08-04 | 2003-08-04 | A Scheduling Method for Realizing Ethernet Deterministic Communication |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1581815A CN1581815A (en) | 2005-02-16 |
CN100382522C true CN100382522C (en) | 2008-04-16 |
Family
ID=34579341
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB031420400A Expired - Lifetime CN100382522C (en) | 2003-08-04 | 2003-08-04 | A Scheduling Method for Realizing Ethernet Deterministic Communication |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100382522C (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101404601B (en) * | 2008-11-12 | 2011-01-19 | 中控科技集团有限公司 | Ethernet communication method and device |
Families Citing this family (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101075945B (en) * | 2006-05-19 | 2011-06-08 | 中国科学院沈阳自动化研究所 | Method for determining realtime Ethernet telecommunication |
CN101222403B (en) * | 2008-01-29 | 2011-04-13 | 杭州华三通信技术有限公司 | Method and node for implementing time synchronization in arbitrarily topological intersected ring network |
CN101321127B (en) * | 2008-07-21 | 2010-12-22 | 重庆邮电大学 | Determined communication scheduling method of industrial wireless network |
CN101729231B (en) * | 2009-12-03 | 2013-05-29 | 北京和利时系统工程有限公司 | Industrial Ethernet in distributed control system |
CN102201909A (en) * | 2011-04-27 | 2011-09-28 | 盛科网络有限公司 | Multi-master clock sampling data synchronization core device |
CN102857315B (en) * | 2011-06-29 | 2016-09-14 | 南京中兴新软件有限责任公司 | Master clock service is from the method and system of clock |
CN102624620B (en) * | 2012-03-12 | 2016-04-20 | 四川银海天怡信息技术有限公司 | A kind of transmission system of the Ethernet transmission method based on token frame |
CN102970762A (en) * | 2012-05-11 | 2013-03-13 | 深圳市创想网络系统有限公司 | Processing method for scheduling in wireless network by combining tokens on basis of time slice rotation |
CN102970203A (en) * | 2012-12-04 | 2013-03-13 | 中国北方车辆研究所 | CAN (controller area network) communication equipment and method for dynamic synchronization |
CN103281261B (en) * | 2013-06-05 | 2016-08-24 | 浙江中控研究院有限公司 | A kind of ethernet communication method and system |
JP6390113B2 (en) * | 2014-02-14 | 2018-09-19 | オムロン株式会社 | Control system, development support apparatus, control apparatus, and control method |
CN108093486B (en) * | 2016-11-23 | 2021-01-26 | 中国科学院沈阳自动化研究所 | Scheduling method for reliable transmission of mixed data stream in industrial wireless sensor network |
CN110474318B (en) * | 2019-06-25 | 2021-11-16 | 许昌许继软件技术有限公司 | Accurate load control system |
CN110601997B (en) * | 2019-08-12 | 2023-03-31 | 北京时代民芯科技有限公司 | Time division multiplexing method for mixed flow fusion |
CN113271238B (en) * | 2021-07-16 | 2021-10-15 | 浙江国利信安科技有限公司 | Link detection method of EPA system, EPA device and computer medium |
CN114528076B (en) * | 2022-01-04 | 2024-09-20 | 北京电子工程总体研究所 | Satellite-borne software communication scheduling method and system |
CN115426070B (en) * | 2022-11-02 | 2023-03-10 | 浙江国利信安科技有限公司 | Method, device and storage medium for clock resynchronization |
CN117278639B (en) * | 2023-11-21 | 2024-01-30 | 浙江国利信安科技有限公司 | Method, apparatus and storage medium for deterministic network-based communication time scheduling |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020064157A1 (en) * | 2000-11-24 | 2002-05-30 | Karl-Heinz Krause | System and method for the parallel transmission of real-time-critical and non-real-time critical data via switched data networks, especially the Ethernet |
DE10147434A1 (en) * | 2001-09-26 | 2002-10-10 | Siemens Ag | Switched communications system diagnosis method has diagnosis data transmitted in each transmission cycle after real-time critical data and non real-time critical data |
CN1411211A (en) * | 2002-04-17 | 2003-04-16 | 华为技术有限公司 | Ethernet exchange chip output queue management and dispatching method and device |
-
2003
- 2003-08-04 CN CNB031420400A patent/CN100382522C/en not_active Expired - Lifetime
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020064157A1 (en) * | 2000-11-24 | 2002-05-30 | Karl-Heinz Krause | System and method for the parallel transmission of real-time-critical and non-real-time critical data via switched data networks, especially the Ethernet |
DE10147434A1 (en) * | 2001-09-26 | 2002-10-10 | Siemens Ag | Switched communications system diagnosis method has diagnosis data transmitted in each transmission cycle after real-time critical data and non real-time critical data |
CN1411211A (en) * | 2002-04-17 | 2003-04-16 | 华为技术有限公司 | Ethernet exchange chip output queue management and dispatching method and device |
Non-Patent Citations (1)
Title |
---|
基于以太网的工业控制网络实时通信模型研究. 冯冬芹,廖智军.仪器仪表学报,第24卷第4期. 2003 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101404601B (en) * | 2008-11-12 | 2011-01-19 | 中控科技集团有限公司 | Ethernet communication method and device |
Also Published As
Publication number | Publication date |
---|---|
CN1581815A (en) | 2005-02-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100382522C (en) | A Scheduling Method for Realizing Ethernet Deterministic Communication | |
CN103823780B (en) | A kind of Real-time Fieldbus controls dispatching method | |
Hong et al. | Bandwidth allocation scheme in CAN protocol | |
Tovar et al. | Real-time fieldbus communications using Profibus networks | |
US8850058B2 (en) | Ethernet-based data transmission method, ethernet nodes and control system | |
CN101018115A (en) | Real time synchronization network based on the standard Ethernet and its operating method | |
JP7394986B2 (en) | Method of transmitting data packets and apparatus for implementing this method | |
WO2008101394A1 (en) | Real-time synchronous method and synchronous network based on the standard ethernet | |
US7075898B2 (en) | Method and device for the exchange of data between at least two users connected to a bus system | |
CN100417122C (en) | A Scheduling Method for Realizing Ethernet Deterministic Communication | |
CN113347048B (en) | Method, node device and storage medium for adaptively adjusting network configuration | |
Bello et al. | Priority-driven swapping-based scheduling of aperiodic real-time messages over EtherCAT networks | |
CN113315668B (en) | Method, node device and storage medium for adaptively adjusting network configuration | |
Scharbarg et al. | CAN-Ethernet architectures for real-time applications | |
Cena et al. | Achieving round-robin access in controller area networks | |
dos Santos | Enhanced Ethernet switching technology for adaptive hard real-time applications | |
Moraes et al. | Enforcing the timing behavior of real-time stations in legacy bus-based industrial Ethernet networks | |
CN113940038B (en) | Subscriber station for a serial bus system and method for communication in a serial bus system | |
CN102624620A (en) | Token-frame-based transmission method and system for Ethernet | |
CN201066852Y (en) | Real time synchronization network based on standard Ethernet | |
Cavalieri et al. | On the integration of fieldbus traffic within IEEE 802.11 wireless LAN | |
CN113994638A (en) | Subscriber station for a serial bus system and method for communication in a serial bus system | |
CN117220810A (en) | Asynchronous data transmission method and system based on POWERLINK protocol | |
KR20210141678A (en) | Media access to time-sensitive and best effort data packets, and related systems, methods, and devices | |
Pedreiras | Supporting flexible real-time communication on distributed systems |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20190529 Address after: 310053 No. 309 Liuhe Road, Binjiang District, Hangzhou City, Zhejiang Province Co-patentee after: ZHEJIANG University Patentee after: ZHEJIANG SUPCON TECHNOLOGY Co.,Ltd. Address before: Hangzhou City, Zhejiang province 310012 No. 252 Wensanlu Road Weixing building 21 Patentee before: ZHEJIANG SUPCON TECHNOLOGY Co.,Ltd. |
|
TR01 | Transfer of patent right | ||
CX01 | Expiry of patent term |
Granted publication date: 20080416 |
|
CX01 | Expiry of patent term |