WO2015172398A1 - Method and apparatus for acquiring packet transmission delay - Google Patents

Method and apparatus for acquiring packet transmission delay Download PDF

Info

Publication number
WO2015172398A1
WO2015172398A1 PCT/CN2014/077877 CN2014077877W WO2015172398A1 WO 2015172398 A1 WO2015172398 A1 WO 2015172398A1 CN 2014077877 W CN2014077877 W CN 2014077877W WO 2015172398 A1 WO2015172398 A1 WO 2015172398A1
Authority
WO
WIPO (PCT)
Prior art keywords
current time
time
clock
clock source
switch
Prior art date
Application number
PCT/CN2014/077877
Other languages
French (fr)
Chinese (zh)
Inventor
仁参考
张俭锋
韦锦驹
Original Assignee
北京东土科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京东土科技股份有限公司 filed Critical 北京东土科技股份有限公司
Publication of WO2015172398A1 publication Critical patent/WO2015172398A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a packet transmission delay acquisition method and apparatus. Background technique
  • the sampling device in the intelligent substation system when any one of the intelligent substation systems fails, the sampling device in the intelligent substation system generates SV according to the data related to the fault (Sample Sampled) Value; sampled value), and the SV message is transmitted to the protection device through the switch network.
  • the protection device Based on the performance limitation of the existing switching network, there is a transmission delay in the transmission of the SV packet in the switching network. That is, the protection device receives the SV packet later than the substation device sends the SV packet. Therefore, in the smart substation system or outside the intelligent substation system, a synchronization source corresponding to the intelligent substation system is provided, which is used for ensuring the synchronization of the data acquired by the substation equipment. Specifically, the protection device calibrates the local clock information of the protection device according to the clock information of the synchronization source according to the preset period.
  • the protection device After receiving the SV message, the protection device acquires the sample data carried in the SV message, and according to the The collection time corresponding to the sample data carried in the SV packet determines the fault occurrence time of the faulty device, thereby performing corresponding operations on the faulty device.
  • the protection device cannot determine the data when receiving the SV message. Synchronization, based on the settings of the existing intelligent substation, the above protection device will be out of operation, which is not conducive to the protection of equipment and fault detection in the intelligent substation system.
  • the above method is also used for GOOSE (Generic Object Oriented Substation Event) Station event)
  • GOOSE Generic Object Oriented Substation Event
  • the protection device cannot determine the transmission delay of the GOOSE message in the switch.
  • the embodiment of the invention provides a method and a device for acquiring a message transmission delay, which are used to solve the problem that the device in the industrial measurement and control system cannot detect faults and protect faults in the industrial measurement and control system.
  • a packet transmission delay acquisition method is applied to an industrial measurement and control system, where the industrial measurement and control system includes at least one switch, and the method includes:
  • the first clock information corresponding to the clock source of the switch is added to the specified location in the communication packet; wherein the first clock information is a link.
  • the second clock information includes the sending port acquiring the Adding a time of the communication message of the first clock information; or, the second clock information includes a time at which the sending port acquires the communication message to which the first clock information is added, and a number of times of inversion of the clock source;
  • the communication packet further carries the first current time and the link delay
  • the size relationship of the clock source time corresponding to the first current time and the half of the maximum time recordable by the clock source, and the link delay and half of the maximum time recordable by the clock source Corresponding clock source time relationship; when the second clock information only includes the second current time, when the first current time is less than the link delay, the link delay is greater than the clock source And when the second current time is less than the clock source time, calculating a sum of the second current time and the first clock information as an initial communication message transmission delay, if the initial communication is The transmission delay is less than the maximum time recordable by the clock source, and the initial communication delay is used as the transmission delay of the communication message in the switch; when the first current time is less than the Calculating the second current time and the first clock information when the link delay is less than the clock source time, and the second current time is less than the clock source time And a transmission delay of the communication message in the switch; when the first current time is less than the link delay, the link delay is greater
  • the difference between the first clock and the first clock is the transmission delay of the communication packet in the switch; when the first current time is greater than the link delay, the first current time is smaller than the clock source And when the second current time is less than the clock source time, calculating a difference between the second current time and the first clock information as a transmission delay of the communication message in the switch;
  • the current time is greater than the link delay, the first current time is less than the clock source time, and the second time is When the previous time is greater than the clock source time, the difference between the second current time and the first clock information is calculated as the transmission delay of the communication message in the switch.
  • the communication packet further carries a size relationship between the first current time and the link delay; when the second clock information includes a second current time and a reverse of the clock source The number of times, when the first current time is less than the link delay, according to the first clock information, the second current time, the maximum time that the clock source can record, and the clock source The number of times of inversion, the transmission delay of the communication message in the switch; the delay when the first current time is greater than the link, according to the first clock information, the second current The time at which the clock source can record, and the number of times the clock source is inverted, obtains a transmission delay of the communication message in the switch.
  • the first clock information and the second clock information acquired by the switch are clock information provided according to the local clock source, and need not be synchronized with the synchronization source, thereby reducing the letter between the industrial measurement and control system and the synchronization source. Make interactions and save system resources.
  • the communication is sent to the local device by the sampling device in the industrial measurement and control system, or the communication is sent to the local device by other switches in the industrial measurement and control system.
  • the binary delay information corresponding to the transmission delay of the communication packet is generated, and the binary delay information is added to the specified location in the communication message; Sending the communication message to the protection device in the industrial measurement and control system, and causing the protection device to perform a corresponding protection operation on the faulty device according to the data carried in the communication message.
  • a message transmission delay acquisition device is applied to an industrial measurement and control system, the industrial measurement and control system comprising at least one switch, the device comprising:
  • a writing unit configured to add a first clock information corresponding to a clock source of the switch, at a specified position in the communication packet, after determining that the receiving port of the switch receives the communication packet;
  • a clock information is an absolute value of a difference between a link delay and a time at which the receiving port receives the communication message;
  • a clock information obtaining unit configured to: when determining that the sending port of the switch is acquired, adding the first After the communication message of the clock information, the second clock information corresponding to the clock source is determined; wherein the second clock information includes a time when the sending port obtains the communication message that adds the first clock information; or The second clock information includes a time at which the sending port obtains the communication message that adds the first clock information, and a number of times the clock source is inverted.
  • a transmission delay obtaining unit configured to obtain, according to the first clock information carried in the communication packet, and the second clock information, a transmission delay of the communication packet in the switch.
  • the transmission delay obtaining unit is specifically configured to: if the communication packet further carries a size relationship between the first current time and the link delay, the first current moment a magnitude relationship between a clock source time corresponding to a half of a maximum time recordable by the clock source, and a magnitude relationship between the link delay and a clock source time corresponding to a half of a maximum time recordable by the clock source,
  • the second clock information includes only the second current time, if the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time If the time of the clock source is less than the clock source, the sum of the second current time and the first clock information is calculated as the initial communication message transmission delay, if the initial communication message transmission delay is smaller than the clock source a transmission delay; if the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is less than the clock source time, then calculating Said The sum of the current time and the first clock information is used as the transmission
  • the sum of the first clock information is used as a transmission delay of the communication packet in the switch; if the first current time is greater than the link delay, the first current time is greater than the clock source time, And the second current time is less than the clock source time, and the maximum time and the recordable time of the clock source are calculated. a difference between the first clock information, and a sum of the difference and the second current time as a transmission delay of the communication message in the switch; if the first current time is greater than the link delay If the first current time is greater than the clock source time, and the second current time is greater than the clock source time, calculate a difference between the second current time and the first clock information as a communication message.
  • a transmission delay in the switch if the first current time is greater than the link delay, the first current time is less than the clock source time, and the second current time is less than the clock source time And calculating a difference between the second current time and the first clock information as a transmission delay of the communication packet in the switch; if the first current time is greater than the link delay, the Calculating a difference between the second current time and the first clock information as a communication message in the switch, if a current time is less than the clock source time, and the second current time is greater than the clock source time Transmission delay.
  • the transmission delay acquiring unit is specifically configured to: when the communication packet further carries a size relationship between the first current time and the link delay, when the second When the clock information includes the second current time and the number of times of inversion of the clock source, if the first current time is less than the link delay, the second current time, according to the first clock information, The maximum time that can be recorded by the clock source, and the number of times the clock source is reversed, obtains a transmission delay of the communication packet in the switch; if the first current time is greater than the link delay, Obtaining, according to the first clock information, the second current time, the maximum time recordable by the clock source, and the number of times of inversion of the clock source, acquiring the communication message in the switch Transmission delay.
  • the first clock information and the second clock information acquired by the switch are clock information provided according to the local clock source, and need not be synchronized with the synchronization source, thereby reducing the letter between the industrial measurement and control system and the synchronization source. Make interactions and save system resources.
  • the writing unit is configured to: receive the communication message sent by the sampling device in the industrial measurement and control system, or receive the message sent by another switch in the industrial measurement and control system Communication text.
  • the foregoing apparatus further includes: a sending unit, configured to: after acquiring the transmission packet transmission delay, generate binary delay information corresponding to the transmission delay of the communication packet, and perform the binary And the delay information is added to the specified location in the communication message; the communication message is sent to the protection device in the industrial measurement and control system, and the protection device is caused to be carried according to the communication message.
  • the data performs the corresponding protection operations on the failed device.
  • the first clock information of the communication packet received by the receiving port is obtained, and the second clock information of the communication packet is sent by the sending port, and the second clock information is determined in the switch according to the first clock information.
  • the transmission delay of the communication message in the switch is added to the specified location in the communication message, and according to the timestamp information, determines the communication message corresponding to the communication message in the switch during the local transmission process of the switch. Delay, in the case of industrial measurement and control system and synchronization source out of step, it is still convenient and quick to determine the transmission delay of communication messages in the switch, thus ensuring the fault protection of equipment in the industrial measurement and control system and the accuracy of fault detection results. . DRAWINGS
  • FIG. 1 is a schematic structural diagram of an industrial measurement and control system according to an embodiment of the present invention.
  • FIG. 2 is a flow chart of obtaining a transmission delay of a communication packet in a switch according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a switch according to an embodiment of the present invention.
  • 4a and 4b are schematic diagrams of SV 4 ⁇ in the embodiment of the present invention.
  • FIG. 5 is a schematic diagram of an SV packet after a transmission delay of an SV packet is added to a switch according to an embodiment of the present disclosure
  • FIG. 6 is a schematic structural diagram of a device for acquiring a packet transmission delay according to an embodiment of the present invention. detailed description
  • the first clock information of the communication port is received by the receiving port, and the second clock information of the communication message is sent by the sending port, and the second clock information is determined according to the first clock information and the second clock information.
  • the transmission delay of the communication message in the switch is determined according to the first clock information and the second clock information.
  • the communication message is an SV message as an example.
  • the GOOSE message has the same message format as the SV message, and the reserved location is also specified in the GOOSE message.
  • the location is used to carry packet transmission delay information.
  • the industrial communication protocol is used as a communication message.
  • the data area in the Profinet format is not specifically defined. Therefore, the data area can be used as a designated location for carrying packet transmission delay information.
  • the relevant location can be delineated as a designated location, and the requirements of the present invention can also be met.
  • the industrial measurement and control system includes a faulty device, a sampling device, a switching network, and a protection device, wherein the switching network includes at least one switch, which can be exchanged.
  • the switching network includes at least one switch, which can be exchanged.
  • Each switch in the network obtains the transmission delay of the SV packet in the switch.
  • the transmission delay of the SV packet of the switching network in the switch can also be obtained by the special transmission delay acquisition device.
  • the transmission delay of the SV packet in the switch is obtained by using each switch in the switching network as an example.
  • the process of obtaining the transmission delay of the SV packet in the switch is:
  • Step 200 After the switch determines that the local receiving port receives the SV packet, the switch obtains the first clock information corresponding to the local clock source at the specified location in the SV packet.
  • the switch includes a receiving port, a sending port, a switching array, and a clock source.
  • the receiving port is configured to receive the SV packet; the sending port is used to send the SV packet to the protection device; the clock source is used to mark the clock information, and the clock source has a recordable maximum time (ie, td), when the clock source When it reaches its own recordable maximum time, the clock source is inverted (ie, restarting from 0).
  • the SV message is sent to the local switch by the sampling device in the industrial measurement and control system; or, when the switching system includes at least two switches, the SV message can also be sent by other switches in the industrial measurement and control system. Local to the switch.
  • the link delay (indicated as ⁇ to ) of the switching network carried in the SV packet is 0; when the SV packet received by the switch is sent by another switch
  • the link delay A tO of the switching network carried in the SV packet is not 0.
  • the switch 1 receives the SV packet sent by the switch 0, the switch 1 can obtain the link delay carried in the SV packet.
  • the link delay is the transmission delay of the SV packet corresponding to the switch 1 in the switch 1.
  • the first current time corresponding to the first bit information in the SV packet is received from the clock source receiving port when the receiving port receives the SV packet, and the SV packet is calculated in the SV packet.
  • the absolute value of the difference between the carried link delay and the first current time, and the absolute value of the difference between the link delay and the first current time is written as the first clock information to the designated position in the SV message.
  • FIG. 4a it is a schematic diagram of the SV " ⁇ " in the embodiment of the present invention.
  • the reserved field of the Reservedl and the Reserved2 in the SV is added as the first clock information as a specified location.
  • FIG. 4b As shown in the figure, a part of the SV packet includes 32 bits, and the position corresponding to the bit number 0 to 23 is the designated position of the SV packet, that is, the first clock information is saved to the SV packet.
  • the switch obtains the first clock information, converting the first clock information into a binary format, and storing the first clock information in the binary format to the specified location; and storing the time in the SV packet
  • the information is in nanoseconds. Since the SV message contains 24 bits to store the time information, the maximum time value represented by the time information stored in the SV message is 16.777215 milliseconds (ie, 2 24 nanoseconds).
  • the maximum time td recordable by the clock source is preset according to a specific application scenario. In order to facilitate the process of obtaining the transmission delay of the SV packet in the switch, it is preferred.
  • the maximum time td recordable by the clock source is equal to the maximum time value represented by the time information storable in the SV message.
  • the SV packet carries the first current time (denoted as t1), the link delay AtO, and the maximum time td that can be recorded by the clock source.
  • t1 current time
  • AtO link delay AtO
  • td/2 first current time and a clock source recordable
  • the switch compares the obtained first current time t1 with the link delay ⁇ t0, the link delay AtO, and the clock time corresponding to half of the maximum time that the clock source can record. Td/2, and a clock source time td/2 corresponding to a half of the maximum time recordable by the clock source, and generating a corresponding binary identifier according to the foregoing three comparison results, the sequence number added to the SV message is 0. Bits of ⁇ 2.
  • tl, At0, and t2 are represented by three binary identifiers.
  • the relationship between the td/2 and the specified position in the SV message, in addition to the above three bits, the first clock information may be carried, thereby improving the accuracy of the clock information carried in the SV message.
  • Step 210 After the switch determines that the local sending port obtains the SV packet that adds the first clock information, the switch determines the second clock information corresponding to the clock source.
  • the switch determines that the sending port obtains the second current time of the clock source corresponding to the first bit information in the SV packet, and the clock source is obtained.
  • the second current time is recorded as the second clock information; or, when the switch determines that the SV message reaches the local sending port, it is determined that the sending port obtains the SV report.
  • the second current time of the clock source corresponding to the first bit information in the text, and the number of times of inversion of the clock source, and the second current time of the clock source and the number of times of inversion of the clock source are recorded as the second clock information. It can be seen that the foregoing second clock information is obtained by representing the sending port of the switch.
  • the information of the first bit time of the SV packet; or the second clock information is information indicating the first bit time of the SV message and the number of times of inversion of the clock source.
  • the first clock information and the second clock information acquired by the switch are clock information provided according to the local clock source, and need not be synchronized with the synchronization source, thereby reducing the letter between the industrial measurement and control system and the synchronization source. Make interactions and save system resources.
  • Step 220 Acquire a transmission delay of the SV packet in the switch according to the first clock information carried in the SV packet and the second clock information.
  • the manner in which the switch obtains the transmission delay of the SV packet in the switch is divided into two types:
  • the first mode when the second clock information includes only the first clock information, the switch according to the first current time t1, the second current time included in the second clock information (denoted as t2), and the clock source recordable
  • the maximum time td, and the clock source time td/2 corresponding to half of the maximum time recordable by the clock source; and the first current time t1 and the link delay A tO , the link delay A tO and the clock source respectively
  • One half of the recorded maximum time corresponds to the clock source time td/2
  • the first current time t1 corresponds to the clock source time td/2 corresponding to half of the maximum time recordable by the clock source
  • the second current time t2 and the clock source are recordable
  • the comparison of the clock source time td/2 of the half of the maximum time can be used to obtain the following eight comparison results.
  • the process of obtaining the transmission delay A t of the SV message in the switch according to the eight comparison results is:
  • the second case is: when the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is less than the clock source time, the sum of the second current time and the first clock information is calculated as The transmission delay of the SV packet in the switch. If you use a formula, you can express it as:
  • the third case is: when the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time is greater than the clock source time, the sum of the second current time and the first clock information is calculated as The transmission delay of the SV packet in the switch. If you use a formula, you can express it as:
  • the fourth case when the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is greater than the clock source time, the second current time and the first clock information are calculated as the SV report.
  • the transmission delay of the text in the switch If you use a formula, you can express it as:
  • the fifth case when the first current time is greater than the link delay, the first current time is greater than the clock source time, and the second current time is less than the clock source time, the maximum time recordable by the clock source is obtained and the first clock is The difference between the information, and the sum of the difference and the second current time is taken as the transmission delay of the SV message in the switch.
  • tl>AtO, tl>td/2, and t2 ⁇ td/2 it indicates that the clock source has been inverted, which can be expressed as:
  • the switch determines whether the clock source is reversed according to the relationship between tl, AtO, t2, and td/2. Therefore, the transmission delay of the obtained SV packet in the switch is not greater than td. /2.
  • the second mode when the second clock information includes the second current time and the number of times of inversion of the clock source, the switch according to the first current time t1 included in the first clock information, and the second current information included in the second clock information At time t2, and the number of times of inversion of the clock source, comparing the first current time t1 and the link delay AtO, the following two comparison results can be obtained, and according to the two comparison results and the number of times of inversion of the clock source, N can be supported here.
  • the process of obtaining the transmission delay ⁇ t of the SV message in the switch is:
  • the first case when the first current time is less than the link delay, according to the link delay, the first current time, the second current time, the maximum time that the clock source can record, and the number of times the clock source is inverted, The transmission delay of the SV packet in the switch.
  • the specified position of the SV message is optionally divided into two parts, and part of The other part is used to carry the transmission delay of the SV packet that is not greater than td in the switch in the case of ensuring the transmission delay of the SV packet in the switch.
  • the second case when the first current time is greater than the link delay, according to the link delay, the first current time, the second current time, the maximum time that the clock source can record, and the number of times the clock source is inverted, The transmission delay of the SV packet in the switch. If you use a formula, you can express it as:
  • the number of the sequence number 3 to 6 is added with an identifier indicating the number of times the clock source is inverted. For example, when the number of times of inversion of the clock source is three, the number of times of inversion of the clock source is The identifier is 11, and the binary identifier is added to the bit numbered 3-6 in the SV message.
  • the SV packet is in the specified location of the SV packet, and the transmission delay of the SV packet in the switch is no longer affected by the td. /2 limit.
  • the switch After the switch obtains the transmission delay of the SV packet in the switch, the switch generates the binary delay information corresponding to the transmission delay of the SV packet in the switch, and adds the binary delay information to the specified in the SV packet.
  • the MU inherently delays the occurrence of the received data of the plurality of intervals, and completes the synchronization processing of the sample values.
  • the transmission delay of the SV packet obtained by the switch in the switch is ⁇ 100 nanoseconds (determined according to the test result, not less than 1 microsecond); when there are multiple switches in the switching network
  • the multi-switch cascading delay per hop is ⁇ 100 nanoseconds (determined according to the test result, not less than 1 microsecond); the technical solution of the present invention supports a message with a line rate greater than or equal to 64 bytes (hundred megabits per thousand) Mega).
  • the present invention further provides a packet transmission delay obtaining apparatus, including a writing unit 60, a clock information acquiring unit 61, and a transmission delay obtaining unit 62, wherein:
  • the writing unit 60 is configured to: after determining that the receiving port of the switch receives the communication packet, add the first clock information corresponding to the clock source of the switch in the specified location in the communication packet;
  • the first clock information is an absolute value of a difference between a link delay and a time at which the receiving port receives the communication message;
  • the clock information acquiring unit 61 is configured to: after determining that the sending port of the switch acquires the communication packet that adds the first clock information, determine the second clock information corresponding to the clock source; where the second clock information includes And the time at which the sending port obtains the communication message that adds the first clock information; or the second clock information includes the time and the time at which the sending port obtains the communication message that adds the first clock information The number of inversions of the clock source;
  • the transmission delay obtaining unit 62 is configured to obtain, according to the first clock information carried in the communication packet, and the second clock information, a transmission delay of the communication packet in the switch.
  • the foregoing apparatus further includes: a sending unit 63, configured to: after acquiring a transmission delay of the communication packet in the switch, generate a binary time corresponding to a transmission delay of the communication packet in the switch Extending the information, and adding the binary delay information to the communication Specifying a location; sending the communication message to the protection device in the industrial measurement and control system, and causing the protection device to perform a corresponding protection operation on the faulty device according to the data carried in the communication message.
  • a sending unit 63 configured to: after acquiring a transmission delay of the communication packet in the switch, generate a binary time corresponding to a transmission delay of the communication packet in the switch Extending the information, and adding the binary delay information to the communication Specifying a location; sending the communication message to the protection device in the industrial measurement and control system, and causing the protection device to perform a corresponding protection operation on the faulty device according to the data carried in the communication message.
  • the switch when the switch determines that the local receiving port receives the sampled value communication message, the first clock information corresponding to the local clock source is added to the designated position in the communication message; After the local sending port receives the communication message that adds the first clock information, the second clock information corresponding to the clock source is obtained, and the communication is obtained according to the first clock information and the second clock information carried in the communication packet.
  • the transmission delay of the message in the switch According to the technical solution of the present invention, the switch adds corresponding timestamp information to the specified location in the communication packet, and according to the timestamp information, determines that the corresponding communication packet of the communication packet in the local transmission process of the switch is in the switch.
  • the transmission delay in the case of the industrial measurement and control system and the synchronization source out of step, can still conveniently and quickly determine the transmission delay of the communication message in the switch, thereby ensuring the fault protection of the equipment in the industrial measurement and control system and Accuracy of fault detection results.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can be embodied in the form of one or more computer program products embodied on a computer-usable storage medium (including but not limited to disk storage, CD-ROM, optical storage, etc.) in which computer usable program code is embodied.
  • a computer-usable storage medium including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a bootable computer or other programmable data processing device.
  • a computer readable memory that operates in a particular manner, causing instructions stored in the computer readable memory to produce an article of manufacture comprising instruction means implemented in one or more flows and/or block diagrams of the flowchart The function specified in the box or in multiple boxes.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed are a method and apparatus for acquiring a packet transmission delay. The method comprises: acquiring first clock information for receiving a communication packet by a receiving port and second clock information for sending the communication packet by a sending port; and determining a transmission delay of the communication packet in a switch according to the first clock information and the second clock information. By using the technical scheme, corresponding timestamp information is added by a switch to a designated position in the communication packet, and a transmission delay of the corresponding communication packet in the switch is determined during the local transmission process of the communication packet in the switch according to the timestamp information, so that the transmission delay of the communication packet in the switch can still be conveniently and rapidly determined in a case in which an industrial measurement and control system is out of synchronization with a synchronous source, thereby ensuring device fault protection in the industrial measurement and control system and the accuracy of a fault detection result.

Description

一种报文传输时延获取方法及装置 本申请要求在 2014年 05月 16日提交中国专利局、 申请号为 201410207297.9、发明名称为 一种报文传输时延获取方法及装置的中国专利申请的优先权,其全部内容通过引用结合在本申 请中。 技术领域  Method and device for acquiring message transmission delays The present application claims to be filed on May 16, 2014 by the Chinese Patent Office, the application number is 201410207297.9, and the invention name is a message transmission delay acquisition method and device. Priority is hereby incorporated by reference in its entirety. Technical field
本发明涉及通信技术领域, 尤其涉及一种报文传输时延获取方法及装置。 背景技术  The present invention relates to the field of communications technologies, and in particular, to a packet transmission delay acquisition method and apparatus. Background technique
目前, 在工业测控系统中, 以智能变电站系统中为例, 当智能变电站系 统中的任意一设备出现故障时, 智能变电站系统中的釆样装置会根据与故障 相关的釆样数据生成 SV ( Sampled Value; 取样值 )报文, 并将 SV报文通过 交换机网络传输至保护装置。  At present, in the industrial measurement and control system, taking the intelligent substation system as an example, when any one of the intelligent substation systems fails, the sampling device in the intelligent substation system generates SV according to the data related to the fault (Sample Sampled) Value; sampled value), and the SV message is transmitted to the protection device through the switch network.
基于现有的交换网络性能限制, SV报文在交换网络中的传输存在传输时 延, 即保护装置接收到 SV报文的时刻要晚于变电设备发出 SV报文。 因此, 在智能变电站系统中或者智能变电站系统外还设置有智能变电站系统对应的 同步源, 用于保证变电设备获取的釆样数据的同步性。 具体的, 保护装置会 按照预设周期根据同步源的时钟信息对保护装置本地时钟信息进行校准, 当 保护装置接收到 SV报文后, 即获取该 SV报文中携带的釆样数据, 以及根据 SV报文中携带的釆样数据对应的釆集时间, 确定故障设备的故障发生时间, 从而对故障设备执行相应的操作。 特殊的, 当智能变电站系统对应的同步源 故障时, 由于无法确定交换网络传输 SV "^艮文时所对应的传输时延, 因此, 保 护装置接收到 SV报文时即无法判断釆用数据的同步性,基于现有智能变电站 的设置, 上述保护装置将退出运行, 从而不利于智能变电站系统中设备的保 护以及故障检测。  Based on the performance limitation of the existing switching network, there is a transmission delay in the transmission of the SV packet in the switching network. That is, the protection device receives the SV packet later than the substation device sends the SV packet. Therefore, in the smart substation system or outside the intelligent substation system, a synchronization source corresponding to the intelligent substation system is provided, which is used for ensuring the synchronization of the data acquired by the substation equipment. Specifically, the protection device calibrates the local clock information of the protection device according to the clock information of the synchronization source according to the preset period. After receiving the SV message, the protection device acquires the sample data carried in the SV message, and according to the The collection time corresponding to the sample data carried in the SV packet determines the fault occurrence time of the faulty device, thereby performing corresponding operations on the faulty device. In particular, when the synchronization source corresponding to the intelligent substation system is faulty, since the transmission delay corresponding to the transmission network transmission SV is not determined, the protection device cannot determine the data when receiving the SV message. Synchronization, based on the settings of the existing intelligent substation, the above protection device will be out of operation, which is not conducive to the protection of equipment and fault detection in the intelligent substation system.
同样地, 以智能工业测控系统为例的工业测控系统中, 也是釆用上述方 法对 GOOSE ( Generic Object Oriented Substation Event , 面向通用对象的变电 站事件)报文进行传输, 因此, 保护装置同样无法确定 GOOSE报文在交换机 中的传输时延。 Similarly, in the industrial measurement and control system using the intelligent industrial measurement and control system as an example, the above method is also used for GOOSE (Generic Object Oriented Substation Event) Station event) The message is transmitted. Therefore, the protection device cannot determine the transmission delay of the GOOSE message in the switch.
另夕卜, 针对一些工业通讯协议作为通讯报文, 例如: profinet (实时确定性 工业以太网协议)在交换机中进行传输的传输时延同样无法确定。  In addition, for some industrial communication protocols as communication messages, for example: profinet (real-time deterministic industrial Ethernet protocol) transmission delays in the transmission of the switch can not be determined.
综上所述, 目前在包括在工业测控系统中, 由于无法获取交换网络的通 讯报文在交换机中的传输时延, 造成无法对工业测控系统中设备进行故障检 测以及故障保护的问题。 发明内容  To sum up, at present, in the industrial measurement and control system, the transmission delay of the communication message of the switching network in the switch cannot be obtained, which causes the problem of failure detection and fault protection of the equipment in the industrial measurement and control system. Summary of the invention
本发明实施例提供一种报文传输时延获取方法及装置, 用以解决目前在 工业测控系统中, 存在无法对工业测控系统中设备进行故障检测以及故障保 护的问题。  The embodiment of the invention provides a method and a device for acquiring a message transmission delay, which are used to solve the problem that the device in the industrial measurement and control system cannot detect faults and protect faults in the industrial measurement and control system.
本发明实施例提供的具体技术方案如下:  The specific technical solutions provided by the embodiments of the present invention are as follows:
一种报文传输时延获取方法, 应用于工业测控系统中, 所述工业测控系 统包含至少一个交换机, 所述方法包括:  A packet transmission delay acquisition method is applied to an industrial measurement and control system, where the industrial measurement and control system includes at least one switch, and the method includes:
当确定所述交换机的接收端口接收到通讯报文后, 在所述通讯报文中的 指定位置添加所述交换机的时钟源对应的第一时钟信息; 其中, 所述第一时 钟信息为链路时延与所述接收端口接收到所述通讯报文的时刻之差的绝对 值;  After the receiving port of the switch receives the communication packet, the first clock information corresponding to the clock source of the switch is added to the specified location in the communication packet; wherein the first clock information is a link. The absolute value of the difference between the delay and the time at which the receiving port receives the communication message;
当确定所述交换机的发送端口获取到添加第一时钟信息的通讯报文后, 确定所述时钟源对应的第二时钟信息; 其中, 所述第二时钟信息包含所述发 送端口获取到所述添加第一时钟信息的通讯报文的时刻; 或者, 所述第二时 钟信息包含所述发送端口获取到所述添加第一时钟信息的通讯报文的时刻以 及所述时钟源的反转次数;  Determining the second clock information corresponding to the clock source after determining that the sending port of the switch obtains the communication message that adds the first clock information, where the second clock information includes the sending port acquiring the Adding a time of the communication message of the first clock information; or, the second clock information includes a time at which the sending port acquires the communication message to which the first clock information is added, and a number of times of inversion of the clock source;
根据所述通讯报文中携带的所述第一时钟信息, 以及所述第二时钟信 息, 获取所述通讯报文在所述交换机中的传输时延。  Obtaining a transmission delay of the communication packet in the switch according to the first clock information carried in the communication packet and the second clock information.
可选的, 所述通讯报文中还携带所述第一当前时刻与所述链路时延之间 的大小关系, 所述第一当前时刻与所述时钟源可记录的最大时刻的一半对应 的时钟源时刻的大小关系, 以及所述链路时延与所述时钟源可记录的最大时 刻的一半对应的时钟源时刻的大小关系; 当所述第二时钟信息仅包含第二当 前时刻时, 当所述第一当前时刻小于所述链路时延, 所述链路时延大于所述 时钟源时刻, 且所述第二当前时刻小于所述时钟源时刻时, 计算所述第二当 前时刻与所述第一时钟信息之和作为初始通讯报文传输时延, 若所述初始通 讯才艮文传输时延小于所述时钟源可记录的最大时刻, 则将所述初始通讯 ^艮文 传输时延作为通讯报文在所述交换机中的传输时延; 当所述第一当前时刻小 于所述链路时延, 所述链路时延小于所述时钟源时刻, 且所述第二当前时刻 小于所述时钟源时刻时, 计算所述第二当前时刻与所述第一时钟信息之和作 为通讯报文在所述交换机中的传输时延; 当所述第一当前时刻小于所述链路 时延, 所述链路时延大于所述时钟源时刻, 且所述第二当前时刻大于所述时 钟源时刻时, 计算所述第二当前时刻与所述第一时钟信息之和作为通讯报文 在所述交换机中的传输时延; 当所述第一当前时刻小于所述链路时延, 所述 链路时延小于所述时钟源时刻, 且所述第二当前时刻大于所述时钟源时刻 时, 计算所述第二当前时刻与所述第一时钟信息之和作为通讯报文在所述交 换机中的传输时延; 当所述第一当前时刻大于所述链路时延, 所述第一当前 时刻大于所述时钟源时刻, 且所述第二当前时刻小于所述时钟源时刻时, 计 算所述时钟源可记录的最大时刻与所述第一时钟信息的差值, 以及获取所述 差值与第二当前时刻之和作为通讯报文在所述交换机中的传输时延; 当所述 第一当前时刻大于所述链路时延, 所述第一当前时刻大于所述时钟源时刻, 且所述第二当前时刻大于所述时钟源时刻时, 计算所述第二当前时刻与所述 第一时钟信息之差作为通讯报文在所述交换机中的传输时延; 当所述第一当 前时刻大于所述链路时延, 所述第一当前时刻小于所述时钟源时刻, 且所述 第二当前时刻小于所述时钟源时刻时, 计算所述第二当前时刻与所述第一时 钟信息之差作为通讯报文在所述交换机中的传输时延; 当所述第一当前时刻 大于所述链路时延, 所述第一当前时刻小于所述时钟源时刻, 且所述第二当 前时刻大于所述时钟源时刻时, 计算所述第二当前时刻与所述第一时钟信息 之差作为通讯报文在所述交换机中的传输时延。 Optionally, the communication packet further carries the first current time and the link delay The size relationship of the clock source time corresponding to the first current time and the half of the maximum time recordable by the clock source, and the link delay and half of the maximum time recordable by the clock source Corresponding clock source time relationship; when the second clock information only includes the second current time, when the first current time is less than the link delay, the link delay is greater than the clock source And when the second current time is less than the clock source time, calculating a sum of the second current time and the first clock information as an initial communication message transmission delay, if the initial communication is The transmission delay is less than the maximum time recordable by the clock source, and the initial communication delay is used as the transmission delay of the communication message in the switch; when the first current time is less than the Calculating the second current time and the first clock information when the link delay is less than the clock source time, and the second current time is less than the clock source time And a transmission delay of the communication message in the switch; when the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time When the time of the clock source is greater than the clock source, the sum of the second current time and the first clock information is calculated as a transmission delay of the communication message in the switch; when the first current time is smaller than the link a delay, when the link delay is less than the clock source time, and the second current time is greater than the clock source time, calculating a sum of the second current time and the first clock information as a communication report a transmission delay in the switch; when the first current time is greater than the link delay, the first current time is greater than the clock source time, and the second current time is less than the clock Calculating, by the source time, a difference between the maximum time recordable by the clock source and the first clock information, and obtaining a sum of the difference and the second current time as a transmission of the communication message in the switch Delay When the first current time is greater than the link delay, the first current time is greater than the clock source time, and the second current time is greater than the clock source time, the second current time is calculated. The difference between the first clock and the first clock is the transmission delay of the communication packet in the switch; when the first current time is greater than the link delay, the first current time is smaller than the clock source And when the second current time is less than the clock source time, calculating a difference between the second current time and the first clock information as a transmission delay of the communication message in the switch; The current time is greater than the link delay, the first current time is less than the clock source time, and the second time is When the previous time is greater than the clock source time, the difference between the second current time and the first clock information is calculated as the transmission delay of the communication message in the switch.
可选的, 所述通讯报文中还携带所述第一当前时刻与所述链路时延之间 的大小关系; 当所述第二时钟信息包含第二当前时刻以及所述时钟源的反转 次数时, 当所述第一当前时刻小于所述链路时延时, 根据所述第一时钟信 息, 所述第二当前时刻, 所述时钟源可记录的最大时刻, 以及所述时钟源的 反转次数, 获取所述通讯报文在所述交换机中的传输时延; 当所述第一当前 时刻大于所述链路时延时, 根据所述第一时钟信息, 所述第二当前时刻, 所 述时钟源可记录的最大时刻, 以及所述时钟源的反转次数, 获取所述通讯报 文在所述交换机中的传输时延。  Optionally, the communication packet further carries a size relationship between the first current time and the link delay; when the second clock information includes a second current time and a reverse of the clock source The number of times, when the first current time is less than the link delay, according to the first clock information, the second current time, the maximum time that the clock source can record, and the clock source The number of times of inversion, the transmission delay of the communication message in the switch; the delay when the first current time is greater than the link, according to the first clock information, the second current The time at which the clock source can record, and the number of times the clock source is inverted, obtains a transmission delay of the communication message in the switch.
釆用上述技术方案, 交换机获取的第一时钟信息以及第二时钟信息均为 根据本地的时钟源提供的时钟信息, 无须与同步源保持同步, 从而减少了工 业测控系统与同步源之间的信令交互, 节约了系统资源。  With the above technical solution, the first clock information and the second clock information acquired by the switch are clock information provided according to the local clock source, and need not be synchronized with the synchronization source, thereby reducing the letter between the industrial measurement and control system and the synchronization source. Make interactions and save system resources.
可选的, 所述通讯 ^艮文由所述工业测控系统中的釆样装置发送至本地, 或者, 所述通讯 ^艮文由所述工业测控系统中的其他交换机发送至本地。  Optionally, the communication is sent to the local device by the sampling device in the industrial measurement and control system, or the communication is sent to the local device by other switches in the industrial measurement and control system.
进一步的, 获取所述通讯报文传输时延之后, 生成所述通讯报文传输时 延对应的二进制时延信息, 并将所述二进制时延信息添加至所述通讯 ^艮文中 的指定位置; 将所述通讯报文发送至所述工业测控系统中的保护装置, 令所 述保护装置根据所述通讯报文中携带的釆样数据对故障设备执行相应的保护 操作。  After the transmission delay of the communication packet is obtained, the binary delay information corresponding to the transmission delay of the communication packet is generated, and the binary delay information is added to the specified location in the communication message; Sending the communication message to the protection device in the industrial measurement and control system, and causing the protection device to perform a corresponding protection operation on the faulty device according to the data carried in the communication message.
一种报文传输时延获取装置, 应用于工业测控系统中, 所述工业测控系 统包含至少一个交换机, 所述装置包括:  A message transmission delay acquisition device is applied to an industrial measurement and control system, the industrial measurement and control system comprising at least one switch, the device comprising:
写入单元, 用于当确定所述交换机的接收端口接收到通讯报文后, 在所 述通讯报文中的指定位置添加所述交换机的时钟源对应的第一时钟信息; 其 中, 所述第一时钟信息为链路时延与所述接收端口接收到所述通讯报文的时 刻之差的绝对值;  a writing unit, configured to add a first clock information corresponding to a clock source of the switch, at a specified position in the communication packet, after determining that the receiving port of the switch receives the communication packet; A clock information is an absolute value of a difference between a link delay and a time at which the receiving port receives the communication message;
时钟信息获取单元, 用于当确定所述交换机的发送端口获取到添加第一 时钟信息的通讯报文后, 确定所述时钟源对应的第二时钟信息; 其中, 所述 第二时钟信息包含所述发送端口获取到所述添加第一时钟信息的通讯报文的 时刻; 或者, 所述第二时钟信息包含所述发送端口获取到所述添加第一时钟 信息的通讯报文的时刻以及所述时钟源的反转次数; a clock information obtaining unit, configured to: when determining that the sending port of the switch is acquired, adding the first After the communication message of the clock information, the second clock information corresponding to the clock source is determined; wherein the second clock information includes a time when the sending port obtains the communication message that adds the first clock information; or The second clock information includes a time at which the sending port obtains the communication message that adds the first clock information, and a number of times the clock source is inverted.
传输时延获取单元, 用于根据所述通讯报文中携带的所述第一时钟信 息, 以及所述第二时钟信息, 获取所述通讯报文在所述交换机中的传输时 延。  And a transmission delay obtaining unit, configured to obtain, according to the first clock information carried in the communication packet, and the second clock information, a transmission delay of the communication packet in the switch.
可选的, 所述传输时延获取单元, 具体用于: 若所述通讯报文中还携带 所述第一当前时刻与所述链路时延之间的大小关系, 所述第一当前时刻与所 述时钟源可记录的最大时刻的一半对应的时钟源时刻的大小关系, 以及所述 链路时延与所述时钟源可记录的最大时刻的一半对应的时钟源时刻的大小关 系, 则当所述第二时钟信息仅包含第二当前时刻时, 若所述第一当前时刻小 于所述链路时延, 所述链路时延大于所述时钟源时刻, 且所述第二当前时刻 小于所述时钟源时刻, 则计算所述第二当前时刻与所述第一时钟信息之和作 为初始通讯报文传输时延, 若所述初始通讯报文传输时延小于所述时钟源可 机中的传输时延; 若所述第一当前时刻小于所述链路时延, 所述链路时延小 于所述时钟源时刻, 且所述第二当前时刻小于所述时钟源时刻, 则计算所述 第二当前时刻与所述第一时钟信息之和作为通讯报文在所述交换机中的传输 时延; 若所述第一当前时刻小于所述链路时延, 所述链路时延大于所述时钟 源时刻, 且所述第二当前时刻大于所述时钟源时刻, 则计算所述第二当前时 刻与所述第一时钟信息之和作为通讯报文在所述交换机中的传输时延; 若所 述第一当前时刻小于所述链路时延, 所述链路时延小于所述时钟源时刻, 且 所述第二当前时刻大于所述时钟源时刻, 则计算所述第二当前时刻与所述第 一时钟信息之和作为通讯报文在所述交换机中的传输时延; 若所述第一当前 时刻大于所述链路时延, 所述第一当前时刻大于所述时钟源时刻, 且所述第 二当前时刻小于所述时钟源时刻, 则计算所述时钟源可记录的最大时刻与所 述第一时钟信息的差值, 以及获取所述差值与第二当前时刻之和作为通讯报 文在所述交换机中的传输时延; 若所述第一当前时刻大于所述链路时延, 所 述第一当前时刻大于所述时钟源时刻, 且所述第二当前时刻大于所述时钟源 时刻, 则计算所述第二当前时刻与所述第一时钟信息之差作为通讯报文在所 述交换机中的传输时延; 若所述第一当前时刻大于所述链路时延, 所述第一 当前时刻小于所述时钟源时刻, 且所述第二当前时刻小于所述时钟源时刻, 则计算所述第二当前时刻与所述第一时钟信息之差作为通讯报文在所述交换 机中的传输时延; 若所述第一当前时刻大于所述链路时延, 所述第一当前时 刻小于所述时钟源时刻, 且所述第二当前时刻大于所述时钟源时刻, 则计算 所述第二当前时刻与所述第一时钟信息之差作为通讯报文在所述交换机中的 传输时延。 Optionally, the transmission delay obtaining unit is specifically configured to: if the communication packet further carries a size relationship between the first current time and the link delay, the first current moment a magnitude relationship between a clock source time corresponding to a half of a maximum time recordable by the clock source, and a magnitude relationship between the link delay and a clock source time corresponding to a half of a maximum time recordable by the clock source, When the second clock information includes only the second current time, if the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time If the time of the clock source is less than the clock source, the sum of the second current time and the first clock information is calculated as the initial communication message transmission delay, if the initial communication message transmission delay is smaller than the clock source a transmission delay; if the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is less than the clock source time, then calculating Said The sum of the current time and the first clock information is used as the transmission delay of the communication message in the switch; if the first current time is less than the link delay, the link delay is greater than the a clock source time, and the second current time is greater than the clock source time, the sum of the second current time and the first clock information is calculated as a transmission delay of the communication message in the switch; The first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is greater than the clock source time, and the second current time is calculated. The sum of the first clock information is used as a transmission delay of the communication packet in the switch; if the first current time is greater than the link delay, the first current time is greater than the clock source time, And the second current time is less than the clock source time, and the maximum time and the recordable time of the clock source are calculated. a difference between the first clock information, and a sum of the difference and the second current time as a transmission delay of the communication message in the switch; if the first current time is greater than the link delay If the first current time is greater than the clock source time, and the second current time is greater than the clock source time, calculate a difference between the second current time and the first clock information as a communication message. a transmission delay in the switch; if the first current time is greater than the link delay, the first current time is less than the clock source time, and the second current time is less than the clock source time And calculating a difference between the second current time and the first clock information as a transmission delay of the communication packet in the switch; if the first current time is greater than the link delay, the Calculating a difference between the second current time and the first clock information as a communication message in the switch, if a current time is less than the clock source time, and the second current time is greater than the clock source time Transmission delay.
可选的, 所述传输时延获取单元, 具体用于: 若所述通讯报文中还携带 所述第一当前时刻与所述链路时延之间的大小关系, 则当所述第二时钟信息 包含第二当前时刻以及所述时钟源的反转次数时, 若所述第一当前时刻小于 所述链路时延, 则根据所述第一时钟信息, 所述第二当前时刻, 所述时钟源 可记录的最大时刻, 以及所述时钟源的反转次数, 获取所述通讯报文在所述 交换机中的传输时延; 若所述第一当前时刻大于所述链路时延, 则根据所述 所述第一时钟信息, 所述第二当前时刻, 所述时钟源可记录的最大时刻, 以 及所述时钟源的反转次数, 获取所述通讯报文在所述交换机中的传输时延。  Optionally, the transmission delay acquiring unit is specifically configured to: when the communication packet further carries a size relationship between the first current time and the link delay, when the second When the clock information includes the second current time and the number of times of inversion of the clock source, if the first current time is less than the link delay, the second current time, according to the first clock information, The maximum time that can be recorded by the clock source, and the number of times the clock source is reversed, obtains a transmission delay of the communication packet in the switch; if the first current time is greater than the link delay, Obtaining, according to the first clock information, the second current time, the maximum time recordable by the clock source, and the number of times of inversion of the clock source, acquiring the communication message in the switch Transmission delay.
釆用上述技术方案, 交换机获取的第一时钟信息以及第二时钟信息均为 根据本地的时钟源提供的时钟信息, 无须与同步源保持同步, 从而减少了工 业测控系统与同步源之间的信令交互, 节约了系统资源。  With the above technical solution, the first clock information and the second clock information acquired by the switch are clock information provided according to the local clock source, and need not be synchronized with the synchronization source, thereby reducing the letter between the industrial measurement and control system and the synchronization source. Make interactions and save system resources.
可选的, 所述写入单元, 用于: 接收由所述工业测控系统中的釆样装置 发送的所述通讯报文, 或者, 接收由所述工业测控系统中的其他交换机发送 的所述通讯艮文。  Optionally, the writing unit is configured to: receive the communication message sent by the sampling device in the industrial measurement and control system, or receive the message sent by another switch in the industrial measurement and control system Communication text.
进一步的, 上述装置还包括发送单元, 用于: 获取所述通讯报文传输时 延之后, 生成所述通讯报文传输时延对应的二进制时延信息, 并将所述二进 制时延信息添加至所述通讯报文中的指定位置; 将所述通讯报文发送至所述 工业测控系统中的保护装置, 令所述保护装置根据所述通讯报文中携带的釆 样数据对故障设备执行相应的保护操作。 Further, the foregoing apparatus further includes: a sending unit, configured to: after acquiring the transmission packet transmission delay, generate binary delay information corresponding to the transmission delay of the communication packet, and perform the binary And the delay information is added to the specified location in the communication message; the communication message is sent to the protection device in the industrial measurement and control system, and the protection device is caused to be carried according to the communication message. The data performs the corresponding protection operations on the failed device.
本发明实施例中, 获取接收端口接收到通讯报文的第一时钟信息, 以及 发送端口发送上述通讯报文的第二时钟信息, 根据该第一时钟信息, 第二时 钟信息, 确定在交换机中通讯报文在交换机中的传输时延。 釆用上述技术方 案, 交换机在通讯报文中的指定位置添加相应的时间戳信息, 并根据该时间 戳信息, 确定通讯报文在交换机本地传输过程中对应的通讯报文在交换机中 的传输时延, 在工业测控系统与同步源失步的情况下, 仍能够方便快捷的确 定通讯报文在交换机中的传输时延, 从而保证了对工业测控系统中设备的故 障保护以及故障检测结果准确性。 附图说明  In the embodiment of the present invention, the first clock information of the communication packet received by the receiving port is obtained, and the second clock information of the communication packet is sent by the sending port, and the second clock information is determined in the switch according to the first clock information. The transmission delay of the communication message in the switch. Using the above technical solution, the switch adds corresponding timestamp information to the specified location in the communication message, and according to the timestamp information, determines the communication message corresponding to the communication message in the switch during the local transmission process of the switch. Delay, in the case of industrial measurement and control system and synchronization source out of step, it is still convenient and quick to determine the transmission delay of communication messages in the switch, thus ensuring the fault protection of equipment in the industrial measurement and control system and the accuracy of fault detection results. . DRAWINGS
图 1为本发明实施例中工业测控系统架构示意图;  1 is a schematic structural diagram of an industrial measurement and control system according to an embodiment of the present invention;
图 2为本发明实施例中获取通讯报文在交换机中的传输时延流程图; 图 3为本发明实施例中交换机结构示意图;  2 is a flow chart of obtaining a transmission delay of a communication packet in a switch according to an embodiment of the present invention; FIG. 3 is a schematic structural diagram of a switch according to an embodiment of the present invention;
图 4a和图 4b为本发明实施例中 SV 4艮文示意图;  4a and 4b are schematic diagrams of SV 4艮 in the embodiment of the present invention;
图 5为本发明实施例中添加 SV报文在交换机中的传输时延后的 SV报文 示意图;  FIG. 5 is a schematic diagram of an SV packet after a transmission delay of an SV packet is added to a switch according to an embodiment of the present disclosure;
图 6为本发明实施例中报文传输时延获取装置结构示意图。 具体实施方式  FIG. 6 is a schematic structural diagram of a device for acquiring a packet transmission delay according to an embodiment of the present invention. detailed description
为了解决目前在智能工业测控系统中, 存在无法对智能工业测控系统中 设备进行故障检测以及故障保护的问题。 本发明实施例中, 获取接收端口接 收到通讯^艮文的第一时钟信息, 以及发送端口发送上述通讯 文的第二时钟 信息, 根据该第一时钟信息, 第二时钟信息, 确定在交换机中通讯报文在交 换机中的传输时延。 釆用上述技术方案, 交换机在通讯报文中的指定位置添 加相应的时间戳信息, 并根据该时间戳信息, 确定通讯报文在交换机本地传 输过程中对应的通讯报文在交换机中的传输时延, 在工业测控系统与同步源 失步的情况下, 仍能够方便快捷的确定通讯报文在交换机中的传输时延, 从 而保证了对工业测控系统中设备的故障保护以及故障检测结果准确性。 In order to solve the current problem in the intelligent industrial measurement and control system, there is a problem that the fault detection and fault protection of the equipment in the intelligent industrial measurement and control system cannot be performed. In the embodiment of the present invention, the first clock information of the communication port is received by the receiving port, and the second clock information of the communication message is sent by the sending port, and the second clock information is determined according to the first clock information and the second clock information. The transmission delay of the communication message in the switch. Using the above technical solution, the switch adds the specified location in the communication message. Adding corresponding timestamp information, and determining the transmission delay of the corresponding communication message in the switch during the local transmission process of the communication message according to the timestamp information, in the case that the industrial measurement and control system and the synchronization source are out of step, It is still convenient and quick to determine the transmission delay of the communication message in the switch, thereby ensuring the fault protection of the equipment in the industrial measurement and control system and the accuracy of the fault detection result.
本下述具体实施例中, 以通讯报文为 SV报文为例进行的具体说明; 同样 地, GOOSE报文具有 SV报文相同的报文格式, 在 GOOSE报文中同样将保 留位置作为指定位置使用, 用于承载报文传输时延信息。 另外, 工业通讯协 议作为通讯报文, 例如 Profinet格式中的数据区没有具体定义, 因此可以将该 数据区域作为指定位置使用, 用于承载报文传输时延信息。 同理, 其它的工 业通讯协议中可以划定相关位置作为指定位置使用, 也可满足本发明的要求。  In the following specific embodiments, the communication message is an SV message as an example. Similarly, the GOOSE message has the same message format as the SV message, and the reserved location is also specified in the GOOSE message. The location is used to carry packet transmission delay information. In addition, the industrial communication protocol is used as a communication message. For example, the data area in the Profinet format is not specifically defined. Therefore, the data area can be used as a designated location for carrying packet transmission delay information. Similarly, in other industrial communication protocols, the relevant location can be delineated as a designated location, and the requirements of the present invention can also be met.
下面结合附图对本发明优选的实施装置进行详细说明。  The preferred embodiment of the present invention will now be described in detail with reference to the accompanying drawings.
参阅图 1 所示, 为本发明实施例中工业测控系统架构图, 该工业测控系 统包括故障设备, 釆样装置, 交换网络, 以及保护装置, 其中, 该交换网络 包含至少一个交换机,可以通过交换网络中的每一个交换机获取自身的 SV报 文在交换机中的传输时延, 也可以通过专门的传输时延获取装置获取交换网 络的 SV报文在交换机中的传输时延。 本发明实施例中, 以通过交换网络中的 每一个交换机获取自身的 SV报文在交换机中的传输时延为例进行详细介绍。  Referring to FIG. 1 , which is a structural diagram of an industrial measurement and control system according to an embodiment of the present invention, the industrial measurement and control system includes a faulty device, a sampling device, a switching network, and a protection device, wherein the switching network includes at least one switch, which can be exchanged. Each switch in the network obtains the transmission delay of the SV packet in the switch. The transmission delay of the SV packet of the switching network in the switch can also be obtained by the special transmission delay acquisition device. In the embodiment of the present invention, the transmission delay of the SV packet in the switch is obtained by using each switch in the switching network as an example.
参阅图 2所示, 本发明实施例中, 获取 SV报文在交换机中的传输时延的 过程为:  Referring to FIG. 2, in the embodiment of the present invention, the process of obtaining the transmission delay of the SV packet in the switch is:
步骤 200: 当交换机确定本地的接收端口接收到 SV报文后, 在该 SV报 文中的指定位置获取本地时钟源对应的第一时钟信息。  Step 200: After the switch determines that the local receiving port receives the SV packet, the switch obtains the first clock information corresponding to the local clock source at the specified location in the SV packet.
参阅图 3 所示, 本发明实施例中, 交换机包含接收端口、 发送端口、 交 换阵列, 以及时钟源。 其中, 接收端口用于接收 SV报文; 发送端口用于将 该 SV报文发送至保护装置; 时钟源用于标记时钟信息, 该时钟源存在可记 录最大时刻 (即为 td ) , 当时钟源到达自身的可记录最大时刻时, 该时钟源 发生反转(即从 0重新开始计时) 。  Referring to FIG. 3, in the embodiment of the present invention, the switch includes a receiving port, a sending port, a switching array, and a clock source. The receiving port is configured to receive the SV packet; the sending port is used to send the SV packet to the protection device; the clock source is used to mark the clock information, and the clock source has a recordable maximum time (ie, td), when the clock source When it reaches its own recordable maximum time, the clock source is inverted (ie, restarting from 0).
本发明实施例中, 由于工业测控系统中的交换网络中包含至少一个交换 机, 因此, 上述 SV报文由工业测控系统中的釆样装置发送至本交换机本 地; 或者, 当交换系统中包含至少两个交换机时, SV报文也可以由工业测控 系统中的其他交换机发送至本交换机本地。 当交换机接收到的 SV报文由釆 样装置发送时, 上述 SV报文中携带的交换网络的链路时延(记为 Δ to )为 0; 当交换机接收到的 SV报文由其他交换机发送时, 上述 SV报文中携带的交换 网络的链路时延 A tO不为 0, 例如, 交换机 1接收到交换机 0发送的 SV报文 时, 即可获取 SV报文中携带的链路时延, 该链路时延即为交换机 1对应的 SV报文在交换机 1中的传输时延。 In the embodiment of the present invention, at least one exchange is included in the switching network in the industrial measurement and control system Therefore, the SV message is sent to the local switch by the sampling device in the industrial measurement and control system; or, when the switching system includes at least two switches, the SV message can also be sent by other switches in the industrial measurement and control system. Local to the switch. When the SV packet received by the switch is sent by the sampling device, the link delay (indicated as Δ to ) of the switching network carried in the SV packet is 0; when the SV packet received by the switch is sent by another switch The link delay A tO of the switching network carried in the SV packet is not 0. For example, when the switch 1 receives the SV packet sent by the switch 0, the switch 1 can obtain the link delay carried in the SV packet. The link delay is the transmission delay of the SV packet corresponding to the switch 1 in the switch 1.
基于上述图 3所示的交换机, 当检测到接收端口接收到 SV报文时, 即从 时钟源接收端口接收到 SV报文中的第一比特信息对应的第一当前时刻; 计 算 SV报文中携带的链路时延与第一当前时刻之差的绝对值,将该链路时延与 第一当前时刻之差的绝对值作为第一时钟信息写入 S V报文中的指定位置。  The first current time corresponding to the first bit information in the SV packet is received from the clock source receiving port when the receiving port receives the SV packet, and the SV packet is calculated in the SV packet. The absolute value of the difference between the carried link delay and the first current time, and the absolute value of the difference between the link delay and the first current time is written as the first clock information to the designated position in the SV message.
参阅图 4a所示, 为本发明实施例中 SV "^艮文示意图。 可选的, 将 SV才艮 文中的 Reservedl和 Reserved2的保留字段作为指定位置添加第一时钟信息。 具体的, 参阅图 4b所示, 为 SV报文的一部分, 该 SV报文的一部分包含 32 比特, 其中, 比特序号 0~23对应的位置即为 SV报文的指定位置, 即将第一 时钟信息保存至 SV报文的第 1比特至第 24比特对应的位置; 比特序号 24~29 对应的位置即为 SV 文的扩展位; 比特序号 30对应的位置为 SV 文的品 质位, 当该位置为 0即表示有效, 当该位置为 1即表示无效; 比特序号 31对 应的位置为 SV "¾文的测试位。  Referring to FIG. 4a, it is a schematic diagram of the SV "^" in the embodiment of the present invention. Optionally, the reserved field of the Reservedl and the Reserved2 in the SV is added as the first clock information as a specified location. Specifically, refer to FIG. 4b. As shown in the figure, a part of the SV packet includes 32 bits, and the position corresponding to the bit number 0 to 23 is the designated position of the SV packet, that is, the first clock information is saved to the SV packet. The position corresponding to the first bit to the 24th bit; the position corresponding to the bit number 24~29 is the extended bit of the SV text; the position corresponding to the bit number 30 is the quality bit of the SV text, and when the position is 0, it means valid, when If the position is 1, it means invalid; the position corresponding to bit number 31 is the test bit of SV "3⁄4".
可选的, 当交换机获取第一时钟信息后, 将该第一时钟信息转换为二进 制格式, 并将该二进制格式的第一时钟信息存储至上述指定位置; 并且, 该 SV报文中存储的时间信息以纳秒为单位, 由于该 SV报文中包含 24比特位存 储该时间信息, 因此, SV报文中可存储的时间信息所表示的最大时间值为 16.777215毫秒(即 224纳秒 ) 。 Optionally, after the switch obtains the first clock information, converting the first clock information into a binary format, and storing the first clock information in the binary format to the specified location; and storing the time in the SV packet The information is in nanoseconds. Since the SV message contains 24 bits to store the time information, the maximum time value represented by the time information stored in the SV message is 16.777215 milliseconds (ie, 2 24 nanoseconds).
进一步的, 上述时钟源可记录的最大时刻 td根据具体应用场景预先设 定。 为了便于对 SV报文在交换机中的传输时延获取过程的简便性, 较佳 的, 上述时钟源可记录的最大时刻 td等于上述 SV报文中可存储的时间信息 所表示的最大时间值。 Further, the maximum time td recordable by the clock source is preset according to a specific application scenario. In order to facilitate the process of obtaining the transmission delay of the SV packet in the switch, it is preferred. The maximum time td recordable by the clock source is equal to the maximum time value represented by the time information storable in the SV message.
可选的, 上述 SV报文中还携带上述第一当前时刻(记为 tl ) , 链路时延 AtO以及时钟源可记录的最大时刻 td, 当该 SV报文到达发送端口时, 将上述 第一当前时刻 tl与链路时延 AtO, 链路时延 AtO与时钟源可记录的最大时刻 的一半对应的时钟源时刻(记为 td/2 ) , 以及第一当前时刻与时钟源可记录的 最大时刻的一半对应的时钟源时刻 td/2分别进行比较。 或者, 当交换机接收 端口接收到 S V报文后, 即分别比较获取的第一当前时刻 tl与链路时延 Δ t0 , 链路时延 AtO 以及时钟源可记录的最大时刻的一半对应的时钟时刻 td/2, 以 及第一当前时刻与时钟源可记录的最大时刻的一半对应的时钟源时刻 td/2 , 并根据上述三个比较结果生成相应的二进制标识添加至 SV报文中的序号为 0~2的比特位。 例如, 若 tl<td/2, 则记录 ft尸 1, 若 tl>td/2, 则记录 ft尸 0; 若 At0<td/2, 则记录 fM0=l, 若 At0>td/2, 则记录 fM0=0; 若 tl < AtO , 则 记录 ftMlddie=l , 若 tl > Δ t0 , 则记录 ftMlddle=0 , 其中, 该 tMiddle= |ΔίΟ - tl。 由此可见, 当釆用上述技术方案时, 若 SV报文中的序号为 0~2的比特位对应 的二进制标识为 ftMlddie=l, ft尸 1, 则表示 tl> AtO, tl <td/2。 相较于前一种 方案中直接将上述 tl、 AtO、 t2, 以及 td/2添加至 SV报文中的方式, 釆用后 一种技术方案时, 通过三个二进制标识表示 tl、 At0、 t2, 以及 td/2之间的关 系, SV报文中指定位置中除上述三个比特位外还可以携带第一时钟信息, 从 而提高了 SV报文中所携带的时钟信息的精度。 Optionally, the SV packet carries the first current time (denoted as t1), the link delay AtO, and the maximum time td that can be recorded by the clock source. When the SV message reaches the sending port, the foregoing a current time t1 and a link delay AtO, a link time delay AtO corresponding to a clock source time (recorded as td/2) corresponding to a half of a maximum time recordable by the clock source, and a first current time and a clock source recordable The clock source time td/2 corresponding to half of the maximum time is compared separately. Or, when the receiving port receives the SV packet, the switch compares the obtained first current time t1 with the link delay Δt0, the link delay AtO, and the clock time corresponding to half of the maximum time that the clock source can record. Td/2, and a clock source time td/2 corresponding to a half of the maximum time recordable by the clock source, and generating a corresponding binary identifier according to the foregoing three comparison results, the sequence number added to the SV message is 0. Bits of ~2. For example, if tl<td/2, record f t corpse 1, if tl>td/2, record f t corpse 0; if At0<td/2, record f M0 =l, if At0>td/2 Then, f M0 =0 is recorded; if tl < AtO, f tMl ddi e = l is recorded, and if tl > Δ t0 , f tMlddle =0 is recorded, where tMiddle= |ΔίΟ - tl. It can be seen that when the above technical solution is used, if the binary identifier corresponding to the bit number 0~2 in the SV message is f tMl ddi e = l, ft corpse 1, it means tl> AtO, tl < Td/2. Compared with the manner in which the above tl, AtO, t2, and td/2 are directly added to the SV message in the former solution, when the latter technical solution is used, tl, At0, and t2 are represented by three binary identifiers. And the relationship between the td/2 and the specified position in the SV message, in addition to the above three bits, the first clock information may be carried, thereby improving the accuracy of the clock information carried in the SV message.
步骤 210: 当交换机确定本地的发送端口获取到上述添加第一时钟信息的 SV报文后, 确定时钟源对应的第二时钟信息。  Step 210: After the switch determines that the local sending port obtains the SV packet that adds the first clock information, the switch determines the second clock information corresponding to the clock source.
本发明实施例中, 当交换机确定上述 SV报文到达本地的发送端口时, 确定该发送端口获取到 SV报文中的第一比特信息对应的时钟源的第二当前 时刻, 并将该时钟源的第二当前时刻作为第二时钟信息进行记录; 或者, 当 交换机确定上述 S V报文到达本地的发送端口时, 确定发送端口获取到 S V报 文中的第一比特信息对应的时钟源的第二当前时刻, 以及该时钟源的反转次 数, 并将上述时钟源的第二当前时刻以及时钟源的反转次数作为第二时钟信 息进行记录。 由此可见, 上述第二时钟信息为表征交换机的发送端口获取到In the embodiment of the present invention, when the switch determines that the SV packet reaches the local sending port, the switch determines that the sending port obtains the second current time of the clock source corresponding to the first bit information in the SV packet, and the clock source is obtained. The second current time is recorded as the second clock information; or, when the switch determines that the SV message reaches the local sending port, it is determined that the sending port obtains the SV report. The second current time of the clock source corresponding to the first bit information in the text, and the number of times of inversion of the clock source, and the second current time of the clock source and the number of times of inversion of the clock source are recorded as the second clock information. It can be seen that the foregoing second clock information is obtained by representing the sending port of the switch.
SV报文的第一比特时刻的信息; 或者, 上述第二时钟信息为表征交换机的发 送端口获取到 SV报文的第一比特时刻, 以及时钟源对应的反转次数的信息。 The information of the first bit time of the SV packet; or the second clock information is information indicating the first bit time of the SV message and the number of times of inversion of the clock source.
釆用上述技术方案, 交换机获取的第一时钟信息以及第二时钟信息均为 根据本地的时钟源提供的时钟信息, 无须与同步源保持同步, 从而减少了工 业测控系统与同步源之间的信令交互, 节约了系统资源。  With the above technical solution, the first clock information and the second clock information acquired by the switch are clock information provided according to the local clock source, and need not be synchronized with the synchronization source, thereby reducing the letter between the industrial measurement and control system and the synchronization source. Make interactions and save system resources.
步骤 220: 根据上述 SV报文中携带的第一时钟信息, 以及第二时钟信 息, 获取 SV报文在交换机中的传输时延。  Step 220: Acquire a transmission delay of the SV packet in the switch according to the first clock information carried in the SV packet and the second clock information.
本发明实施例中, 根据第二时钟信息中是否包含反转次数, 交换机获取 SV报文在交换机中的传输时延的方式分为两种:  In the embodiment of the present invention, according to whether the second clock information includes the number of inversions, the manner in which the switch obtains the transmission delay of the SV packet in the switch is divided into two types:
第一种方式: 当第二时钟信息中仅包含第一时钟信息时, 交换机根据第 一当前时刻 tl , 第二时钟信息中包含的第二当前时刻 (记为 t2 ) , 以及时钟 源可记录的最大时刻 td, 并计算时钟源可记录的最大时刻的一半对应的时钟 源时刻 td/2; 分别将上述第一当前时刻 tl与链路时延 A tO , 链路时延 A tO与时 钟源可记录的最大时刻的一半对应的时钟源时刻 td/2 , 第一当前时刻 tl与时 钟源可记录的最大时刻的一半对应的时钟源时刻 td/2 , 以及第二当前时刻 t2 与时钟源可记录的最大时刻的一半对应的时钟源时刻 td/2进行比较, 可以获 取以下八种比较结果, 根据该八种比较结果获取 SV报文在交换机中的传输 时延 A t的过程为:  The first mode: when the second clock information includes only the first clock information, the switch according to the first current time t1, the second current time included in the second clock information (denoted as t2), and the clock source recordable The maximum time td, and the clock source time td/2 corresponding to half of the maximum time recordable by the clock source; and the first current time t1 and the link delay A tO , the link delay A tO and the clock source respectively One half of the recorded maximum time corresponds to the clock source time td/2, the first current time t1 corresponds to the clock source time td/2 corresponding to half of the maximum time recordable by the clock source, and the second current time t2 and the clock source are recordable The comparison of the clock source time td/2 of the half of the maximum time can be used to obtain the following eight comparison results. The process of obtaining the transmission delay A t of the SV message in the switch according to the eight comparison results is:
第一种情况: 当第一当前时刻小于链路时延, 链路时延大于时钟源时 刻, 且第二当前时刻小于时钟源时刻时, 交换机计算第二当前时刻与第一时 钟信息之和作为初始 SV报文传输时延, 若初始 SV报文传输时延小于时钟源 可记录的最大时刻, 则将初始 SV报文传输时延作为 SV报文在交换机中的传 输时延。 若用公式可以表示为: 当 tl < AtO, At0>td/2, t2 < td/2时, △ t=t2+ |AtO— tl。 The first case: when the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time is less than the clock source time, the switch calculates the sum of the second current time and the first clock information as The initial SV packet transmission delay is used as the transmission delay of the SV packet in the switch if the initial SV packet transmission delay is less than the maximum time that can be recorded by the clock source. If you use a formula, you can express it as: When tl < AtO, At0>td/2, t2 < td/2, Δ t=t2+ |AtO- tl.
在第一种情况中, 由于 At0>td/2, tl < AtO, 而 t2<td/2, 因此, 当 tl < td/2时, 表明时钟源没有发生反转, 此时, At=t2+|AtO- tl| ; 当 tl >td/2时, 表明时钟源发生反转, 此时, 根据 M=t2+|AtO- tl|获取的 M0将大于 td, 若 td等于 16.777215毫秒, 则由于 td超出 SV报文中的指定位置所能表示的最大 时间值, 因此, 交换机需要发送错误报告提示 SV报文中的指定位置无法表 示上述 SV报文在交换机中的传输时延。  In the first case, since At0>td/2, tl < AtO, and t2<td/2, when tl < td/2, it indicates that the clock source has not reversed. At this time, At=t2+| AtO- tl| ; When tl >td/2, it indicates that the clock source is inverted. At this time, M0 obtained according to M=t2+|AtO- tl| will be greater than td. If td is equal to 16.777215 milliseconds, since td exceeds SV The maximum time value that can be indicated by the specified location in the packet. Therefore, the switch needs to send an error report. The specified location in the SV packet cannot indicate the transmission delay of the SV packet in the switch.
第二种情况: 当第一当前时刻小于链路时延, 链路时延小于时钟源时 刻, 且第二当前时刻小于时钟源时刻时, 计算第二当前时刻与上述第一时钟 信息之和作为 SV报文在交换机中的传输时延。 若用公式可以表示为:  The second case is: when the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is less than the clock source time, the sum of the second current time and the first clock information is calculated as The transmission delay of the SV packet in the switch. If you use a formula, you can express it as:
当 tl < AtO, Δ t0 < td/2, t2 < td/2时, △ t=t2+ |AtO— tl。  When tl < AtO, Δ t0 < td/2, t2 < td/2, Δ t = t2+ | AtO - tl.
第三种情况: 当第一当前时刻小于链路时延, 链路时延大于时钟源时 刻, 且第二当前时刻大于时钟源时刻时, 计算第二当前时刻与上述第一时钟 信息之和作为 SV报文在交换机中的传输时延。 若用公式可以表示为:  The third case is: when the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time is greater than the clock source time, the sum of the second current time and the first clock information is calculated as The transmission delay of the SV packet in the switch. If you use a formula, you can express it as:
当 tl < AtO, Δ t0 > td/2, t2 > td/2时, △ t=t2+ |AtO— tl。  When tl < AtO, Δ t0 > td/2, t2 > td/2, Δ t = t2+ | AtO - tl.
第四种情况: 当第一当前时刻小于链路时延, 链路时延小于时钟源时 刻, 且第二当前时刻大于时钟源时刻时, 计算第二当前时刻与上述第一时钟 信息作为 SV报文在交换机中的传输时延。 若用公式可以表示为:  The fourth case: when the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is greater than the clock source time, the second current time and the first clock information are calculated as the SV report. The transmission delay of the text in the switch. If you use a formula, you can express it as:
当 tl < AtO, Δ t0 < td/2, t2 > td/2时, △ t=t2+ |AtO— tl。  When tl < AtO, Δ t0 < td/2, t2 > td/2, Δ t = t2+ | AtO - tl.
第五种情况: 当第一当前时刻大于链路时延, 第一当前时刻大于时钟源 时刻, 且第二当前时刻小于时钟源时刻时, 获计算时钟源可记录的最大时刻 与上述第一时钟信息的差值, 以及获取上述差值与第二当前时刻之和作为 SV 报文在交换机中的传输时延。 在第五种情况中, 由于 tl> AtO, tl>td/2, 而 t2<td/2, 因此, 表明时钟源发生了反转, 若用公式可以表示为:  The fifth case: when the first current time is greater than the link delay, the first current time is greater than the clock source time, and the second current time is less than the clock source time, the maximum time recordable by the clock source is obtained and the first clock is The difference between the information, and the sum of the difference and the second current time is taken as the transmission delay of the SV message in the switch. In the fifth case, since tl>AtO, tl>td/2, and t2<td/2, it indicates that the clock source has been inverted, which can be expressed as:
当 tl >△ t0 , t2 > td/2 , t2< td/2时, △ t=td- |ΔίΟ - til +t2。 第六种情况: 当第一当前时刻大于链路时延, 第一当前时刻大于时钟源 时刻, 且第二当前时刻大于时钟源时刻时, 计算第二当前时刻与上述第一时 钟信息之差作为 SV报文在交换机中的传输时延。 若用公式可以表示为: 当 tl > AtO, tl>td/2, t2>td/2时, Δ t=t2- |AtO— tl。 When tl > Δ t0 , t2 > td/2 , t2 < td / 2, Δ t = td - | Δί Ο - til + t2. The sixth case is: when the first current time is greater than the link delay, the first current time is greater than the clock source time, and the second current time is greater than the clock source time, the difference between the second current time and the first clock information is calculated as The transmission delay of the SV packet in the switch. If you use the formula, you can express it as: When tl > AtO, tl>td/2, t2>td/2, Δ t=t2- |AtO- tl.
第七种情况: 当第一当前时刻大于链路时延, 第一当前时刻小于时钟源 时刻, 且第二当前时刻小于时钟源时刻时, 计算第二当前时刻与上述第一时 钟信息之差作为 SV报文在交换机中的传输时延。 若用公式可以表示为: 当 tl> AtO, tl<td/2, t2<td/2时, At=t2-|AtO— tl。  The seventh case is: when the first current time is greater than the link delay, the first current time is less than the clock source time, and the second current time is less than the clock source time, the difference between the second current time and the first clock information is calculated as The transmission delay of the SV packet in the switch. If you use the formula, you can express it as: When tl> AtO, tl<td/2, t2<td/2, At=t2-|AtO- tl.
第八种情况: 当第一当前时刻大于链路时延, 第一当前时刻小于时钟源 时刻, 且第二当前时刻大于时钟源时刻时, 计算第二当前时刻与上述第一时 钟信息之差作为 SV报文在交换机中的传输时延。 若用公式可以表示为: 当 tl> AtO, tl<td/2, t2>td/2时, At=t2-|AtO— tl。  The eighth case is: when the first current time is greater than the link delay, the first current time is less than the clock source time, and the second current time is greater than the clock source time, the difference between the second current time and the first clock information is calculated as The transmission delay of the SV packet in the switch. If you use the formula, you can express it as: When tl> AtO, tl<td/2, t2>td/2, At=t2-|AtO- tl.
由于在第一种实现方式中, 交换机根据 tl、 AtO、 t2, 以及 td/2之间的判 断时钟源是否发生反转, 因此, 上述获取的 SV报文在交换机中的传输时延 不大于 td/2。  In the first implementation manner, the switch determines whether the clock source is reversed according to the relationship between tl, AtO, t2, and td/2. Therefore, the transmission delay of the obtained SV packet in the switch is not greater than td. /2.
第二种方式: 当第二时钟信息同时包含第二当前时刻以及时钟源的反转 次数时, 交换机根据第一时钟信息中包含的第一当前时刻 tl, 第二时钟信息 中包含的第二当前时刻 t2, 以及时钟源的反转次数, 比较第一当前时刻 tl以 及链路时延 AtO,可以获取以下两种比较结果, 根据该两种比较结果以及时钟 源的反转次数 N, 这里能够支持正确判断的反转次数 N取决于 SV报文中预 留的比特位数 n, 关系是 Ν=2η-1 , 获取 SV报文在交换机中的传输时延 Δ t的 过程为: The second mode: when the second clock information includes the second current time and the number of times of inversion of the clock source, the switch according to the first current time t1 included in the first clock information, and the second current information included in the second clock information At time t2, and the number of times of inversion of the clock source, comparing the first current time t1 and the link delay AtO, the following two comparison results can be obtained, and according to the two comparison results and the number of times of inversion of the clock source, N can be supported here. The number of inversions N correctly determined depends on the number of bits n reserved in the SV message. The relationship is Ν=2 η -1 . The process of obtaining the transmission delay Δ t of the SV message in the switch is:
第一种情况: 当第一当前时刻小于链路时延时, 根据链路时延, 第一当 前时刻,第二当前时刻,时钟源可记录的最大时刻, 以及时钟源的反转次数, 获取 SV报文在交换机中的传输时延。 在第一种情况中, 由于 tl< AtO, N >1时, 表明时钟源发生反转。 若用公式可以表示为: 当 tl < A tO , 时, A t=td*N+t2+ |AtO— tl 。 The first case: when the first current time is less than the link delay, according to the link delay, the first current time, the second current time, the maximum time that the clock source can record, and the number of times the clock source is inverted, The transmission delay of the SV packet in the switch. In the first case, since tl < AtO, N > 1, it indicates that the clock source is inverted. If you use a formula, you can express it as: When tl < A tO , A t = td * N + t2 + | AtO - tl .
在上述过程中, 若 td等于 16.777215毫秒, 则由于 td超出 SV "¾文中的 指定位置所能表示的最大时间值, 因此, 可选的, 将 SV报文的指定位置划 分为两部分, 一部分用于承载时钟源的反转次数, 另一部分用于在保证 SV 报文在交换机中的传输时延精度的情况下, 承载不大于 td的 SV报文在交换 机中的传输时延。  In the above process, if td is equal to 16.777215 milliseconds, since td exceeds the maximum time value that can be represented by the specified position in the SV "3⁄4 text", therefore, the specified position of the SV message is optionally divided into two parts, and part of The other part is used to carry the transmission delay of the SV packet that is not greater than td in the switch in the case of ensuring the transmission delay of the SV packet in the switch.
第二种情况: 当第一当前时刻大于链路时延时, 根据链路时延, 第一当 前时刻,第二当前时刻,时钟源可记录的最大时刻, 以及时钟源的反转次数, 获取 SV报文在交换机中的传输时延。 若用公式可以表示为:  The second case: when the first current time is greater than the link delay, according to the link delay, the first current time, the second current time, the maximum time that the clock source can record, and the number of times the clock source is inverted, The transmission delay of the SV packet in the switch. If you use a formula, you can express it as:
当 tl >△ t0 , Δ t=td*N+t2 - |ΔίΟ - tl 。  When tl > Δ t0 , Δ t = td * N + t2 - | Δί Ο - tl .
进一步的, 在 SV报文中序号为 3~6的比特位添加表示时钟源的反转次数 的标识, 例如, 当时钟源的反转次数为 3 次时, 则该时钟源的反转次数的标 识即为 11 , 将该二进制标识添加至上述 SV报文中序号为 3~6的比特位。  Further, in the SV packet, the number of the sequence number 3 to 6 is added with an identifier indicating the number of times the clock source is inverted. For example, when the number of times of inversion of the clock source is three, the number of times of inversion of the clock source is The identifier is 11, and the binary identifier is added to the bit numbered 3-6 in the SV message.
在第二种实现方式中, 由于 SV报文的指定位置中包含了表示时钟源的 反转次数的标识, 因此, 在该种方式中, SV报文在交换机中的传输时延不再 受 td/2的限制。  In the second implementation manner, the SV packet is in the specified location of the SV packet, and the transmission delay of the SV packet in the switch is no longer affected by the td. /2 limit.
进一步的, 交换机获取 SV报文在交换机中的传输时延之后, 生成 SV报 文在交换机中的传输时延对应的二进制时延信息, 并将该二进制时延信息添 加至 SV报文中的指定位置; 将该 SV报文发送至工业测控系统中的保护装 置, 令保护装置根据 SV报文中携带的釆样数据对故障设备执行相应的保护 操作。 例如, 当 SV 报文的第一比特进入接收端口时, 记录到达时刻 tl=193.457101130秒; 当 SV报文的第一比特从发送端口发送出去时, 交换机 记录发送时刻 t2=193.457204970秒; 计算 SV报文在当前交换机的驻留时间 At=t2-tl=103840 ns, 将 At值转换为二进制为: 11001010110100000, 将上述二 进制时延信息由低位到高位依次图 5所示的 SV报文中。  After the switch obtains the transmission delay of the SV packet in the switch, the switch generates the binary delay information corresponding to the transmission delay of the SV packet in the switch, and adds the binary delay information to the specified in the SV packet. The SV message is sent to the protection device in the industrial measurement and control system, so that the protection device performs a corresponding protection operation on the faulty device according to the data carried in the SV message. For example, when the first bit of the SV packet enters the receiving port, the recording arrival time is tl=193.457101130 seconds. When the first bit of the SV packet is sent out from the sending port, the switch records the sending time t2=193.457204970 seconds; In the current switch's dwell time At=t2-tl=103840 ns, the At value is converted to binary: 11001010110100000, and the above binary delay information is sequenced from the low to the high in the SV message shown in FIG.
釆用上述技术方案, 通过在 SV报文中添加时间戳精确计算 SV报文在交 换机中的传输时延, 并将该 SV报文在交换机中的传输时延发送至保护装置; 保护装置接收到 SV报文在交换机中的传输时延后,依赖本地时间基准, 利用釆 Using the above technical solution, accurately calculate the SV message by adding a timestamp in the SV message. The transmission delay in the changeover, and the transmission delay of the SV packet in the switch is sent to the protection device; after receiving the transmission delay of the SV packet in the switch, the protection device relies on the local time reference and utilizes
MU固有延时还原收到的多个间隔的釆样数据的发生时刻,完成釆样值的同步 处理。 The MU inherently delays the occurrence of the received data of the plurality of intervals, and completes the synchronization processing of the sample values.
釆用本发明技术方案后,交换机获取的 SV报文在交换机中的传输时延精 度为 ±100纳秒 (根据测试结果确定, 不能低于 1微秒); 当交换网络中存在多 个交换机时, 多交换机级联每跳时延累加精度为 ±100 纳秒 (根据测试结果确 定, 不能低于 1微秒); 本发明技术方案支持线速大于等于 64字节的报文(百 兆 /千兆 ) 。  After the technical solution of the present invention is used, the transmission delay of the SV packet obtained by the switch in the switch is ±100 nanoseconds (determined according to the test result, not less than 1 microsecond); when there are multiple switches in the switching network The multi-switch cascading delay per hop is ±100 nanoseconds (determined according to the test result, not less than 1 microsecond); the technical solution of the present invention supports a message with a line rate greater than or equal to 64 bytes (hundred megabits per thousand) Mega).
基于上述技术方案, 参阅图 6所示, 本发明还提供一种报文传输时延获 取装置, 包括写入单元 60 , 时钟信息获取单元 61 , 传输时延获取单元 62 , 其 中:  Based on the foregoing technical solution, as shown in FIG. 6, the present invention further provides a packet transmission delay obtaining apparatus, including a writing unit 60, a clock information acquiring unit 61, and a transmission delay obtaining unit 62, wherein:
写入单元 60 , 用于当确定所述交换机的接收端口接收到通讯报文后, 在 所述通讯报文中的指定位置添加所述交换机的时钟源对应的第一时钟信息; 其中, 所述第一时钟信息为链路时延与所述接收端口接收到所述通讯报文的 时刻之差的绝对值;  The writing unit 60 is configured to: after determining that the receiving port of the switch receives the communication packet, add the first clock information corresponding to the clock source of the switch in the specified location in the communication packet; The first clock information is an absolute value of a difference between a link delay and a time at which the receiving port receives the communication message;
时钟信息获取单元 61 , 用于当确定所述交换机的发送端口获取到添加第 一时钟信息的通讯报文后, 确定所述时钟源对应的第二时钟信息; 其中, 所 述第二时钟信息包含所述发送端口获取到所述添加第一时钟信息的通讯报文 的时刻; 或者, 所述第二时钟信息包含所述发送端口获取到所述添加第一时 钟信息的通讯报文的时刻以及所述时钟源的反转次数;  The clock information acquiring unit 61 is configured to: after determining that the sending port of the switch acquires the communication packet that adds the first clock information, determine the second clock information corresponding to the clock source; where the second clock information includes And the time at which the sending port obtains the communication message that adds the first clock information; or the second clock information includes the time and the time at which the sending port obtains the communication message that adds the first clock information The number of inversions of the clock source;
传输时延获取单元 62, 用于根据所述通讯报文中携带的所述第一时钟信 息, 以及所述第二时钟信息, 获取所述通讯报文在所述交换机中的传输时 延。  The transmission delay obtaining unit 62 is configured to obtain, according to the first clock information carried in the communication packet, and the second clock information, a transmission delay of the communication packet in the switch.
进一步的, 上述装置还包括发送单元 63 , 用于: 获取所述通讯报文在所 述交换机中的传输时延之后, 生成所述通讯报文在所述交换机中的传输时延 对应的二进制时延信息, 并将所述二进制时延信息添加至所述通讯 ^艮文中的 指定位置; 将所述通讯报文发送至所述工业测控系统中的保护装置, 令所述 保护装置根据所述通讯报文中携带的釆样数据对故障设备执行相应的保护操 作。 Further, the foregoing apparatus further includes: a sending unit 63, configured to: after acquiring a transmission delay of the communication packet in the switch, generate a binary time corresponding to a transmission delay of the communication packet in the switch Extending the information, and adding the binary delay information to the communication Specifying a location; sending the communication message to the protection device in the industrial measurement and control system, and causing the protection device to perform a corresponding protection operation on the faulty device according to the data carried in the communication message.
综上所述, 本发明实施例中, 当交换机确定本地的接收端口接收到取样 值通讯 ^艮文后, 在该通讯 ^艮文中的指定位置添加本地时钟源对应的第一时钟 信息; 当交换机确定本地的发送端口接收到上述添加第一时钟信息的通讯报 文后, 获取时钟源对应的第二时钟信息; 根据上述通讯报文中携带的第一时 钟信息, 以及第二时钟信息, 获取通讯报文在所述交换机中的传输时延。 釆 用本发明技术方案, 交换机在通讯报文中的指定位置添加相应的时间戳信 息, 并根据该时间戳信息, 确定通讯报文在交换机本地传输过程中对应的通 讯报文在所述交换机中的传输时延, 在工业测控系统与同步源失步的情况下, 仍能够方便快捷的确定通讯报文在所述交换机中的传输时延, 从而保证了对 工业测控系统中设备的故障保护以及故障检测结果准确性。  In summary, in the embodiment of the present invention, when the switch determines that the local receiving port receives the sampled value communication message, the first clock information corresponding to the local clock source is added to the designated position in the communication message; After the local sending port receives the communication message that adds the first clock information, the second clock information corresponding to the clock source is obtained, and the communication is obtained according to the first clock information and the second clock information carried in the communication packet. The transmission delay of the message in the switch. According to the technical solution of the present invention, the switch adds corresponding timestamp information to the specified location in the communication packet, and according to the timestamp information, determines that the corresponding communication packet of the communication packet in the local transmission process of the switch is in the switch. The transmission delay, in the case of the industrial measurement and control system and the synchronization source out of step, can still conveniently and quickly determine the transmission delay of the communication message in the switch, thereby ensuring the fault protection of the equipment in the industrial measurement and control system and Accuracy of fault detection results.
本领域内的技术人员应明白, 本发明的实施例可提供为方法、 系统、 或 计算机程序产品。 因此, 本发明可釆用完全硬件实施例、 完全软件实施例、 或结合软件和硬件方面的实施例的形式。 而且, 本发明可釆用在一个或多个 其中包含有计算机可用程序代码的计算机可用存储介质 (包括但不限于磁盘 存储器、 CD-ROM、 光学存储器等)上实施的计算机程序产品的形式。  Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can be embodied in the form of one or more computer program products embodied on a computer-usable storage medium (including but not limited to disk storage, CD-ROM, optical storage, etc.) in which computer usable program code is embodied.
本发明是参照根据本发明实施例的方法、 设备(系统)、 和计算机程序产 品的流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流程图 和 /或方框图中的每一流程和 /或方框、 以及流程图和 /或方框图中的流程 和 /或方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器, 使得通 过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流 程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的 装置。  The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowcharts and/or block diagrams, and combinations of flow and/or blocks in the flowcharts and/or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设 备以特定方式工作的计算机可读存储器中, 使得存储在该计算机可读存储器 中的指令产生包括指令装置的制造品, 该指令装置实现在流程图一个流程或 多个流程和 /或方框图一个方框或多个方框中指定的功能。 These computer program instructions can also be stored in a bootable computer or other programmable data processing device. In a computer readable memory that operates in a particular manner, causing instructions stored in the computer readable memory to produce an article of manufacture comprising instruction means implemented in one or more flows and/or block diagrams of the flowchart The function specified in the box or in multiple boxes.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的 处理, 从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图 一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的步 骤。  These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
尽管已描述了本发明的优选实施例, 但本领域内的技术人员一旦得知了 基本创造性概念, 则可对这些实施例作出另外的变更和修改。 所以, 所附权 利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。 脱离本发明实施例的精神和范围。 这样, 倘若本发明实施例的这些修改和变 型属于本发明权利要求及其等同技术的范围之内, 则本发明也意图包含这些 改动和变型在内。  Although the preferred embodiment of the invention has been described, it will be apparent to those skilled in the < Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and modifications The spirit and scope of the embodiments of the present invention are departed. Thus, it is intended that the present invention cover the modifications and modifications of the embodiments of the invention.

Claims

权 利 要 求 Rights request
1、 一种 "^文传输时延获取方法, 应用于工业测控系统中, 其特征在于, 所述工业测控系统包含至少一个交换机, 所述方法包括: A method for acquiring a transmission delay delay, which is applied to an industrial measurement and control system, wherein the industrial measurement and control system includes at least one switch, and the method includes:
当确定所述交换机的接收端口接收到通讯报文后, 在所述通讯报文中的 指定位置添加所述交换机的时钟源对应的第一时钟信息; 其中, 所述第一时 钟信息为链路时延与所述接收端口接收到所述通讯报文的时刻之差的绝对 值;  After the receiving port of the switch receives the communication packet, the first clock information corresponding to the clock source of the switch is added to the specified location in the communication packet; wherein the first clock information is a link. The absolute value of the difference between the delay and the time at which the receiving port receives the communication message;
当确定所述交换机的发送端口获取到添加第一时钟信息的通讯报文后, 确定所述时钟源对应的第二时钟信息; 其中, 所述第二时钟信息包含所述发 送端口获取到所述添加第一时钟信息的通讯报文的时刻; 或者, 所述第二时 钟信息包含所述发送端口获取到所述添加第一时钟信息的通讯报文的时刻以 及所述时钟源的反转次数;  Determining the second clock information corresponding to the clock source after determining that the sending port of the switch obtains the communication message that adds the first clock information, where the second clock information includes the sending port acquiring the Adding a time of the communication message of the first clock information; or, the second clock information includes a time at which the sending port acquires the communication message to which the first clock information is added, and a number of times of inversion of the clock source;
根据所述通讯报文中携带的所述第一时钟信息, 以及所述第二时钟信 息, 获取所述通讯报文在所述交换机中的传输时延。  Obtaining a transmission delay of the communication packet in the switch according to the first clock information carried in the communication packet and the second clock information.
2、 如权利要求 1所述的方法, 其特征在于, 所述通讯报文中还携带所述 第一当前时刻与所述链路时延之间的大小关系, 所述第一当前时刻与所述时 钟源可记录的最大时刻的一半对应的时钟源时刻的大小关系, 以及所述链路 时延与所述时钟源可记录的最大时刻的一半对应的时钟源时刻的大小关系; 当所述第二时钟信息仅包含第二当前时刻时, 根据所述通讯报文中携带 的所述第一时钟信息, 以及所述第二时钟信息, 获取所述通讯报文在所述交 换机中的传输时延, 具体包括:  The method according to claim 1, wherein the communication message further carries a size relationship between the first current time and the link delay, and the first current time and location a relationship between a clock source time corresponding to a half of a maximum time recordable by the clock source, and a clock source time corresponding to a half of a maximum time recordable by the clock source; When the second clock information includes only the second current time, according to the first clock information carried in the communication message, and the second clock information, when the communication message is transmitted in the switch, Delay, specifically including:
当所述第一当前时刻小于所述链路时延, 所述链路时延大于所述时钟源 时刻, 且所述第二当前时刻小于所述时钟源时刻时, 计算所述第二当前时刻 与所述第一时钟信息之和作为初始通讯报文传输时延, 若所述初始通讯报文 传输时延小于所述时钟源可记录的最大时刻, 则将所述初始通讯报文传输时 延作为通讯报文在所述交换机中的传输时延; 当所述第一当前时刻小于所述链路时延, 所述链路时延小于所述时钟源 时刻, 且所述第二当前时刻小于所述时钟源时刻时, 计算所述第二当前时刻 与所述第一时钟信息之和作为通讯报文在所述交换机中的传输时延; When the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time is less than the clock source time, the second current time is calculated. And the sum of the first clock information as the initial communication message transmission delay, if the initial communication message transmission delay is less than the maximum time recordable by the clock source, the initial communication message transmission delay As a transmission delay of the communication message in the switch; Calculating the second current moment when the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is less than the clock source time And a sum of the first clock information as a transmission delay of the communication message in the switch;
当所述第一当前时刻小于所述链路时延, 所述链路时延大于所述时钟源 时刻, 且所述第二当前时刻大于所述时钟源时刻时, 计算所述第二当前时刻 与所述第一时钟信息之和作为通讯报文在所述交换机中的传输时延;  Calculating the second current moment when the first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time is greater than the clock source time And a sum of the first clock information as a transmission delay of the communication message in the switch;
当所述第一当前时刻小于所述链路时延, 所述链路时延小于所述时钟源 时刻, 且所述第二当前时刻大于所述时钟源时刻时, 计算所述第二当前时刻 与所述第一时钟信息之和作为通讯报文在所述交换机中的传输时延;  When the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is greater than the clock source time, the second current time is calculated. And a sum of the first clock information as a transmission delay of the communication message in the switch;
当所述第一当前时刻大于所述链路时延, 所述第一当前时刻大于所述时 钟源时刻, 且所述第二当前时刻小于所述时钟源时刻时, 计算所述时钟源可 记录的最大时刻与所述第一时钟信息的差值, 以及获取所述差值与第二当前 时刻之和作为通讯报文在所述交换机中的传输时延;  When the first current time is greater than the link delay, the first current time is greater than the clock source time, and the second current time is less than the clock source time, the clock source is recordable a difference between the maximum time and the first clock information, and obtaining a sum of the difference and the second current time as a transmission delay of the communication message in the switch;
当所述第一当前时刻大于所述链路时延, 所述第一当前时刻大于所述时 钟源时刻, 且所述第二当前时刻大于所述时钟源时刻时, 计算所述第二当前 时刻与所述第一时钟信息之差作为通讯报文在所述交换机中的传输时延; 当所述第一当前时刻大于所述链路时延, 所述第一当前时刻小于所述时 钟源时刻, 且所述第二当前时刻小于所述时钟源时刻时, 计算所述第二当前 时刻与所述第一时钟信息之差作为通讯报文在所述交换机中的传输时延; 当所述第一当前时刻大于所述链路时延, 所述第一当前时刻小于所述时 钟源时刻, 且所述第二当前时刻大于所述时钟源时刻时, 计算所述第二当前 时刻与所述第一时钟信息之差作为通讯报文在所述交换机中的传输时延。  When the first current time is greater than the link delay, the first current time is greater than the clock source time, and the second current time is greater than the clock source time, the second current time is calculated. The difference between the first clock and the first clock is the transmission delay of the communication packet in the switch; when the first current time is greater than the link delay, the first current time is smaller than the clock source And when the second current time is less than the clock source time, calculating a difference between the second current time and the first clock information as a transmission delay of the communication message in the switch; Calculating the second current time and the first time when a current time is greater than the link delay, the first current time is less than the clock source time, and the second current time is greater than the clock source time The difference between the clock information is used as the transmission delay of the communication message in the switch.
3、 如权利要求 1所述的方法, 其特征在于, 所述通讯报文中还携带所述 第一当前时刻与所述链路时延之间的大小关系;  The method according to claim 1, wherein the communication message further carries a size relationship between the first current time and the link delay;
当所述第二时钟信息包含第二当前时刻以及所述时钟源的反转次数时, 根据所述通讯报文中携带的所述第一时钟信息, 以及所述第二时钟信息, 获 取所述通讯报文在所述交换机中的传输时延, 具体包括: 当所述第一当前时刻小于所述链路时延时, 根据所述第一时钟信息, 所 述第二当前时刻, 所述时钟源可记录的最大时刻, 以及所述时钟源的反转次 数, 获取所述通讯报文在所述交换机中的传输时延; Obtaining, according to the first clock information carried in the communication packet, and the second clock information, when the second clock information includes a second current time and a number of times of inversion of the clock source The transmission delay of the communication packet in the switch includes: When the first current time is less than the link delay, according to the first clock information, the second current time, the maximum time that the clock source can record, and the number of times the clock source is inverted Obtaining a transmission delay of the communication packet in the switch;
当所述第一当前时刻大于所述链路时延时, 根据所述第一时钟信息, 所 述第二当前时刻, 所述时钟源可记录的最大时刻, 以及所述时钟源的反转次 数, 获取所述通讯报文在所述交换机中的传输时延。  When the first current time is greater than the link delay, according to the first clock information, the second current time, the maximum time that the clock source can record, and the number of times the clock source is inverted And acquiring a transmission delay of the communication packet in the switch.
4、 如权利要求 1-3所述的方法, 其特征在于, 所述通讯^艮文由所述工业 测控系统中的釆样装置发送至本地, 或者, 所述通讯报文由所述工业测控系 统中的其他交换机发送至本地。  The method according to any one of claims 1-3, wherein the communication message is sent to the local device by the sampling device in the industrial measurement and control system, or the communication message is controlled by the industrial device. Other switches in the system are sent locally.
5、 如权利要求 1所述的方法, 其特征在于, 获取所述通讯报文传输时延 之后, 进一步包括:  The method of claim 1, wherein after obtaining the transmission delay of the communication message, the method further comprises:
生成所述通讯报文传输时延对应的二进制时延信息, 并将所述二进制时 延信息添加至所述通讯>¾文中的指定位置;  Generating a binary delay information corresponding to the transmission delay of the communication message, and adding the binary delay information to a specified location in the communication >3⁄4 text;
将所述通讯报文发送至所述工业测控系统中的保护装置, 令所述保护装 置根据所述通讯报文中携带的釆样数据对故障设备执行相应的保护操作。  Sending the communication message to the protection device in the industrial measurement and control system, and causing the protection device to perform a corresponding protection operation on the faulty device according to the data carried in the communication message.
6、 一种报文传输时延获取装置, 应用于工业测控系统中, 其特征在 于, 所述工业测控系统包含至少一个交换机, 所述装置包括:  6. A message transmission delay acquisition device, which is applied to an industrial measurement and control system, wherein the industrial measurement and control system comprises at least one switch, and the device comprises:
写入单元, 用于当确定所述交换机的接收端口接收到通讯报文后, 在所 述通讯报文中的指定位置添加所述交换机的时钟源对应的第一时钟信息; 其 中, 所述第一时钟信息为链路时延与所述接收端口接收到所述通讯报文的时 刻之差的绝对值;  a writing unit, configured to add a first clock information corresponding to a clock source of the switch, at a specified position in the communication packet, after determining that the receiving port of the switch receives the communication packet; A clock information is an absolute value of a difference between a link delay and a time at which the receiving port receives the communication message;
时钟信息获取单元, 用于当确定所述交换机的发送端口获取到添加第一 时钟信息的通讯报文后, 确定所述时钟源对应的第二时钟信息; 其中, 所述 第二时钟信息包含所述发送端口获取到所述添加第一时钟信息的通讯报文的 时刻; 或者, 所述第二时钟信息包含所述发送端口获取到所述添加第一时钟 信息的通讯报文的时刻以及所述时钟源的反转次数;  a clock information acquiring unit, configured to: after determining that the sending port of the switch acquires the communication packet that adds the first clock information, determine the second clock information corresponding to the clock source; where the second clock information includes The time at which the sending port obtains the communication message to which the first clock information is added; or the second clock information includes the time at which the sending port obtains the communication message to which the first clock information is added, and the The number of times the clock source is inverted;
传输时延获取单元, 用于根据所述通讯报文中携带的所述第一时钟信 息, 以及所述第二时钟信息, 获取所述通讯报文在所述交换机中的传输时 延。 a transmission delay obtaining unit, configured to: according to the first clock signal carried in the communication packet And the second clock information, obtaining a transmission delay of the communication message in the switch.
7、 如权利要求 6所述的装置, 其特征在于, 所述传输时延获取单元, 具 体用于:  7. The apparatus according to claim 6, wherein the transmission delay acquisition unit is specifically configured to:
若所述通讯报文中还携带所述第一当前时刻与所述链路时延之间的大小 关系, 所述第一当前时刻与所述时钟源可记录的最大时刻的一半对应的时钟 源时刻的大小关系, 以及所述链路时延与所述时钟源可记录的最大时刻的一 半对应的时钟源时刻的大小关系, 则当所述第二时钟信息仅包含第二当前时 刻时, 若所述第一当前时刻小于所述链路时延, 所述链路时延大于所述时钟 源时刻, 且所述第二当前时刻小于所述时钟源时刻, 则计算所述第二当前时 刻与所述第一时钟信息之和作为初始通讯报文传输时延, 若所述初始通讯报 文传输时延小于所述时钟源可记录的最大时刻, 则将所述初始通讯 文传输 时延作为通讯报文在所述交换机中的传输时延; 若所述第一当前时刻小于所 述链路时延, 所述链路时延小于所述时钟源时刻, 且所述第二当前时刻小于 所述时钟源时刻, 则计算所述第二当前时刻与所述第一时钟信息之和作为通 讯报文在所述交换机中的传输时延; 若所述第一当前时刻小于所述链路时 延, 所述链路时延大于所述时钟源时刻, 且所述第二当前时刻大于所述时钟 源时刻, 则计算所述第二当前时刻与所述第一时钟信息之和作为通讯报文在 所述交换机中的传输时延; 若所述第一当前时刻小于所述链路时延, 所述链 路时延小于所述时钟源时刻, 且所述第二当前时刻大于所述时钟源时刻, 则 计算所述第二当前时刻与所述第一时钟信息之和作为通讯报文在所述交换机 中的传输时延; 若所述第一当前时刻大于所述链路时延, 所述第一当前时刻 大于所述时钟源时刻, 且所述第二当前时刻小于所述时钟源时刻, 则计算所 述时钟源可记录的最大时刻与所述第一时钟信息的差值, 以及获取所述差值 与第二当前时刻之和作为通讯报文在所述交换机中的传输时延; 若所述第一 当前时刻大于所述链路时延, 所述第一当前时刻大于所述时钟源时刻, 且所 述第二当前时刻大于所述时钟源时刻, 则计算所述第二当前时刻与所述第一 时钟信息之差作为通讯报文在所述交换机中的传输时延; 若所述第一当前时 刻大于所述链路时延, 所述第一当前时刻小于所述时钟源时刻, 且所述第二 当前时刻小于所述时钟源时刻, 则计算所述第二当前时刻与所述第一时钟信 息之差作为通讯报文在所述交换机中的传输时延; 若所述第一当前时刻大于 所述链路时延, 所述第一当前时刻小于所述时钟源时刻, 且所述第二当前时 刻大于所述时钟源时刻, 则计算所述第二当前时刻与所述第一时钟信息之差 作为通讯报文在所述交换机中的传输时延。 And if the communication packet further carries a size relationship between the first current time and the link delay, the clock source corresponding to the first current time and a half of the maximum time recordable by the clock source The relationship between the size of the time and the size of the clock source corresponding to the half of the maximum time recordable by the clock source, and when the second clock information only includes the second current time, The first current time is less than the link delay, the link delay is greater than the clock source time, and the second current time is less than the clock source time, and the second current time is calculated. The sum of the first clock information is used as an initial communication message transmission delay. If the initial communication message transmission delay is less than the maximum time recordable by the clock source, the initial communication message transmission delay is used as the communication. The transmission delay of the packet in the switch; if the first current time is less than the link delay, the link delay is less than the clock source time, and the second current time is less than the And calculating, by the clock source, a sum of the second current time and the first clock information as a transmission delay of the communication message in the switch; if the first current time is less than the link delay, If the link delay is greater than the clock source time, and the second current time is greater than the clock source time, calculate a sum of the second current time and the first clock information as a communication message. a transmission delay in the switch; if the first current time is less than the link delay, the link delay is smaller than the clock source time, and the second current time is greater than the clock source time, Calculating a sum of the second current time and the first clock information as a transmission delay of the communication message in the switch; if the first current time is greater than the link delay, the first Calculating a difference between a maximum time recordable by the clock source and the first clock information, and acquiring the difference, when the current time is greater than the clock source time, and the second current time is less than the clock source time Value and number The sum of the current time is the transmission delay of the communication message in the switch; if the first current time is greater than the link delay, the first current time is greater than the clock source time, and the Calculating the second current time and the first time when the second current time is greater than the clock source time The difference between the clock information is the transmission delay of the communication message in the switch; if the first current time is greater than the link delay, the first current time is smaller than the clock source time, and the If the current time is less than the clock source time, calculate a difference between the second current time and the first clock information as a transmission delay of the communication message in the switch; if the first current time is greater than the current time Calculating a link delay, where the first current time is less than the clock source time, and the second current time is greater than the clock source time, calculating a difference between the second current time and the first clock information As the transmission delay of the communication message in the switch.
8、 如权利要求 6所述的装置, 其特征在于, 所述传输时延获取单元, 具 体用于:  8. The apparatus according to claim 6, wherein the transmission delay acquisition unit is specifically configured to:
若所述通讯报文中还携带所述第一当前时刻与所述链路时延之间的大小 关系, 则当所述第二时钟信息包含第二当前时刻以及所述时钟源的反转次数 时, 若所述第一当前时刻小于所述链路时延, 则根据所述第一时钟信息, 所 述第二当前时刻, 所述时钟源可记录的最大时刻, 以及所述时钟源的反转次 数, 获取所述通讯报文在所述交换机中的传输时延; 若所述第一当前时刻大 于所述链路时延, 则根据所述第一时钟信息, 所述第二当前时刻, 所述时钟 源可记录的最大时刻, 以及所述时钟源的反转次数, 获取所述通讯报文在所 述交换机中的传输时延。  If the communication message further carries a size relationship between the first current time and the link delay, when the second clock information includes the second current time and the number of times the clock source is inverted And, if the first current time is less than the link delay, according to the first clock information, the second current time, the maximum time recordable by the clock source, and the inverse of the clock source The number of rotations, the transmission delay of the communication message in the switch; if the first current time is greater than the link delay, according to the first clock information, the second current time, The maximum time that the clock source can record, and the number of times the clock source is inverted, obtains the transmission delay of the communication message in the switch.
9、 如权利要求 6-8任一项所述的装置, 其特征在于, 所述写入单元, 用 于:  9. The apparatus according to any one of claims 6-8, wherein the writing unit is used to:
接收由所述工业测控系统中的釆样装置发送的所述通讯报文, 或者, 接 收由所述工业测控系统中的其他交换机发送的所述通讯 ^艮文。  Receiving the communication message sent by the sampling device in the industrial measurement and control system, or receiving the communication message sent by other switches in the industrial measurement and control system.
10、 如权利要求 6所述的装置, 其特征在于, 还包括发送单元, 用于: 获取所述通讯报文传输时延之后, 生成所述通讯报文传输时延对应的二 进制时延信息, 并将所述二进制时延信息添加至所述通讯报文中的指定位置; 将所述通讯报文发送至所述工业测控系统中的保护装置, 令所述保护装置根 据所述通讯报文中携带的釆样数据对故障设备执行相应的保护操作。  The device according to claim 6, further comprising: a sending unit, configured to: after acquiring the transmission delay of the communication message, generate binary delay information corresponding to a transmission delay of the communication message, And adding the binary delay information to a specified location in the communication message; sending the communication message to a protection device in the industrial measurement and control system, so that the protection device is configured according to the communication message The carried data carries out corresponding protection operations on the faulty device.
PCT/CN2014/077877 2014-05-16 2014-05-20 Method and apparatus for acquiring packet transmission delay WO2015172398A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410207297.9A CN103986601B (en) 2014-05-16 2014-05-16 A kind of message transmissions time delay acquisition methods and device
CN201410207297.9 2014-05-16

Publications (1)

Publication Number Publication Date
WO2015172398A1 true WO2015172398A1 (en) 2015-11-19

Family

ID=51278428

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/077877 WO2015172398A1 (en) 2014-05-16 2014-05-20 Method and apparatus for acquiring packet transmission delay

Country Status (2)

Country Link
CN (1) CN103986601B (en)
WO (1) WO2015172398A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104377820B (en) * 2014-11-14 2017-01-11 国电南瑞科技股份有限公司 Method for increasing state estimation data percent of pass of substation collection end under IEC103 communication
CN105376115A (en) * 2015-12-01 2016-03-02 北京博维亚讯技术有限公司 Hardware-based sampling value clock transparent transmission device and method for mutual inductor of transformer substation
CN116436994B (en) * 2023-06-15 2023-08-25 杭州禾芯半导体有限公司 Profinet protocol message transmission method, device, equipment and medium
CN117544550A (en) * 2024-01-10 2024-02-09 紫光恒越技术有限公司 Method and device for monitoring network quality, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102594683A (en) * 2012-02-17 2012-07-18 黑龙江省电力有限公司 Special network switching method and equipment with synchronous digital hierarchy (SDH) network accurate clock synchronization function
CN103001820A (en) * 2012-04-25 2013-03-27 广东电网公司电力科学研究院 Online measuring alarming method based on intelligent substation switch latency
CN103236893A (en) * 2013-03-22 2013-08-07 南京南瑞继保电气有限公司 Network message synchronizing method for process levels of intelligent substation
CN103716147A (en) * 2013-12-16 2014-04-09 武汉中元华电软件有限公司 Sampling value transmission and synchronization method with path delay measurement function

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101447861B (en) * 2008-12-29 2011-10-26 中兴通讯股份有限公司 IEEE 1588 time synchronization system and implementation method thereof
WO2011100906A2 (en) * 2011-04-11 2011-08-25 华为技术有限公司 Method and apparatus for simulating packet delay variation in current network
CN102571253B (en) * 2012-02-23 2015-03-18 杭州华三通信技术有限公司 Method and equipment for implementing precise time synchronization
CN103607267B (en) * 2013-07-23 2019-03-15 王健 The end-to-end propagation delay time of data network message is with band measurement method
CN103618592B (en) * 2013-11-22 2017-01-04 华为技术有限公司 A kind of PWM synchronization method and device
CN103647682B (en) * 2013-12-09 2016-08-10 北京航空航天大学 A kind of analogue system simulating the synchronization of switching Ethernet clock

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102594683A (en) * 2012-02-17 2012-07-18 黑龙江省电力有限公司 Special network switching method and equipment with synchronous digital hierarchy (SDH) network accurate clock synchronization function
CN103001820A (en) * 2012-04-25 2013-03-27 广东电网公司电力科学研究院 Online measuring alarming method based on intelligent substation switch latency
CN103236893A (en) * 2013-03-22 2013-08-07 南京南瑞继保电气有限公司 Network message synchronizing method for process levels of intelligent substation
CN103716147A (en) * 2013-12-16 2014-04-09 武汉中元华电软件有限公司 Sampling value transmission and synchronization method with path delay measurement function

Also Published As

Publication number Publication date
CN103986601A (en) 2014-08-13
CN103986601B (en) 2017-10-10

Similar Documents

Publication Publication Date Title
US9876596B2 (en) Method and device for detecting fault in synchronization link
EP2288070B1 (en) Time synchronizing method, device and system of master clock side and slave clock side in synchronous network
KR102055201B1 (en) Methods, Nodes, and Systems for Detecting Clock Synchronization Paths
US20160315756A1 (en) Methods, systems, and computer readable media for testing recovered clock quality
WO2009098757A1 (en) Method for measuring frame loss, system for measuring frame loss, and device for measuring frame loss
CN103155488B (en) Delay measurements system and delay measuring method and delay measurements equipment and delay measurements program
WO2017101528A1 (en) Method and device for clock link switching and base station
EP2706686B1 (en) Method, terminal and system for measuring asymmetric delay of transmission link
WO2014146554A1 (en) Method and system for packet synchronization on process layer network of intelligent substation
WO2017032113A1 (en) Method and apparatus for measuring time synchronization deviation
KR101988274B1 (en) Data transmission method, communication device, and communication system
WO2015172398A1 (en) Method and apparatus for acquiring packet transmission delay
BRPI0806401B1 (en) METHOD AND EQUIPMENT FOR SERVER TIME PROTOCOL
WO2014032350A1 (en) Method and node based on seamless redundant ring network for increasing precision of clock
CN101330342B (en) Method for implementing time synchronization protocol using port mirror and apparatus thereof
US9866314B2 (en) Protection switching method and apparatus for minimizing data loss in optical transport network system
CN105323054A (en) Clock synchronization method and device
WO2016054884A1 (en) Frequency deviation monitoring method, device and computer storage medium
CN102523263A (en) Sharing access host quantity monitoring method, device thereof and system thereof
WO2014101668A1 (en) Time synchronization processing method and apparatus
JP2014183386A (en) Communication control device and communication system
CN105530698A (en) Time synchronization method and system among wireless devices
WO2016000324A1 (en) Method and apparatus for implementing time synchronization
WO2018219271A1 (en) Synchronous network alarming method and apparatus
WO2016177240A1 (en) Frequency synchronization method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14891857

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14891857

Country of ref document: EP

Kind code of ref document: A1