TCP-to-EtherCAT gateway with high real-time performance and high reliability
By introducing data reception, mapping conversion and verification optimization modules into the TCP to EtherCAT gateway, the problems of low performance and insufficient compatibility of existing gateways are solved, high real-time and high reliability data transmission is achieved, and user use is simplified. process and reduce integration costs.
Patent Information
- Application Number
- CN202410756068.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-10-01
AI Technical Summary
The existing TCP to EtherCAT gateway has low performance, large latency, lack of error handling and insufficient compatibility, making it difficult to integrate into industrial control systems.
A TCP to EtherCAT gateway including a data receiving module, a mapping conversion module and a verification optimization module is designed. It is connected through a high-speed data bus to realize the mapping and conversion of protocol frames. It uses compression technology and error detection and correction mechanisms to support multiple protocols. and interfaces to improve real-time performance and reliability.
It improves the real-time and reliability of data transmission, reduces the user difficulty, enhances the compatibility and integration of the system, and reduces the error rate and maintenance costs.
Smart Images

Figure CN118740552A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of industrial automation control, and in particular relates to a TCP / IP to EtherCAT gateway with high real-time performance and high reliability. Background Art
[0002] TCP (Transmission Control Protocol) and EtherCAT (EtherCAT for Control Automation Technology) are two widely used communication protocols in industrial fieldbuses. TCP is a connection-oriented, reliable, byte-stream-based transport layer communication protocol based on Ethernet. In addition to industrial fieldbuses, it is also widely used for Internet data transmission. EtherCAT is a communication protocol based on industrial Ethernet designed specifically for the field of industrial automation, with the characteristics of high speed, high precision and low latency.
[0003] Although TCP and EtherCAT are both based on Ethernet design at the physical layer, there are significant differences between the two in terms of data format, transmission mechanism and real-time performance. Taking the servo drive, a typical object in the field of industrial control, as an example, EtherCAT is a communication protocol specially designed for real-time and embedded systems, which is very suitable for servo drive communication. However, due to its complex system and difficulty in use, users without relevant experience and expertise may face great challenges in learning and using EtherCAT. TCP is the opposite of EtherCAT. As the core protocol of the Internet, TCP has many users. Therefore, the TCP to EtherCAT gateway can greatly reduce the difficulty of using EtherCAT. Users only need to send the correct data to the TCP to EtherCAT gateway, and the gateway converts the data into data used by EtherCAT to control the start and stop of the servo drive.
[0004] The existing TCP to EtherCAT gateway has the following shortcomings:
[0005] (1) The existing TCP to EtherCAT gateway has low performance and large data transmission delays, which cannot meet the real-time requirements of the servo drive.
[0006] (2) The existing TCP to EtherCAT gateway does not have the functions of error handling and data reliability guarantee. Errors may exist in the data transmission process, which is unacceptable in industrial control.
[0007] (3) The existing TCP to EtherCAT gateway can only process one of the TCP protocols, TCP / IP or ModbusTCP, and has insufficient compatibility.
[0008] (4) The existing TCP to EtherCAT gateway lacks the necessary software and hardware interfaces, making it difficult to integrate into existing industrialization and control systems.
[0009] Based on the above reasons, it is necessary to design a TCP to EtherCAT gateway, which should include a comprehensive technical solution, fundamentally solve the problems of TCP to EtherCAT gateway, have high real-time performance and high reliability, and have multiple software and hardware interfaces, compatible with multiple protocols, greatly reducing the difficulty of use for users. Users can enjoy the high performance and real-time advantages of EtherCAT protocol in the field of industrial automation while maintaining the flexibility and versatility of TCP communication. Summary of the invention
[0010] In view of this, it is necessary to provide a TCP to EtherCAT gateway with high real-time performance and high reliability to solve the above-mentioned problems in the prior art.
[0011] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:
[0012] The present invention provides a TCP to EtherCAT gateway with high real-time performance and high reliability, the gateway comprises a data receiving module, a mapping conversion module, a verification optimization module and a data sending module, the data receiving module, the mapping conversion module, the verification optimization module and the data sending module are connected through a high-speed data bus;
[0013] The function of the data receiving module is to receive and process data, the function of the mapping conversion module is to map the TCP protocol frame to the EtherCAT protocol frame, the function of the verification optimization module is real-time optimization and error processing and reliability assurance; the data sending module is to send data to an external device.
[0014] Furthermore, the data receiving module has the functions of protocol analysis and unpacking information processing;
[0015] The protocol analysis and unpacking information processing function includes a sub-function of identifying TCP data packets and parsing the content of the data packets and a sub-function of constructing data packets that comply with the EtherCAT specification by analyzing the data format and transmission mechanism of the EtherCAT protocol.
[0016] Further, the mapping conversion module has data mapping and conversion functions;
[0017] The data mapping and conversion functions include a preset data mapping mechanism and a preset conversion algorithm.
[0018] Furthermore, the verification optimization module includes real-time optimization functions and error handling and reliability assurance functions.
[0019] Furthermore, the gateway optimizes the real-time performance of the TCP to EtherCAT process through the following three steps: (1) optimizing the data path; (2) using compression technology during data transmission; and (3) designing and managing a cache mechanism.
[0020] Furthermore, the compression technology is: using a matching algorithm of a hash table data structure in an LZ77 algorithm, and using a data sliding window and a data search buffer with adjustable size.
[0021] Furthermore, the error handling and reliability assurance functions are implemented through the following three steps: (1) error detection and correction mechanism; (2) utilizing the TCP confirmation and retransmission mechanism in combination with the EtherCAT communication mode; and (3) checking between adjacent frames and global checking.
[0022] Furthermore, the verification method between adjacent frames is a cyclic redundancy check method.
[0023] Furthermore, the gateway has corresponding software and hardware interfaces and can be easily integrated into existing industrialization and control systems.
[0024] Furthermore, the TCP to EtherCAT gateway with high real-time performance and high reliability supports both TCP / IP protocol and Modbus TCP protocol. The TCP end supports multiple structures including star, ring, tree, etc. It is flexible and scalable and supports multiple devices to communicate simultaneously.
[0025] The beneficial effects of adopting the above-mentioned embodiments are: (1) The TCP to EtherCAT gateway with high real-time performance and high reliability reduces the delay of data transmission rate and improves the real-time performance of data conversion by optimizing the real-time performance of the protocol conversion process. (2) The TCP to EtherCAT gateway with high real-time performance and high reliability has a data verification and optimization module and an error handling and reliability assurance function, which can determine whether there is erroneous data and optimize the erroneous data, and has high reliability. (3) The TCP to EtherCAT gateway with high real-time performance and high reliability can process both TCP / IP protocol and ModbusTCP protocol, and has good compatibility. (4) The TCP to EtherCAT gateway with high real-time performance and high reliability has the necessary software and hardware interfaces, and can be easily integrated into existing industrialization and control systems, thereby improving the integration and integration level of the control system and reducing the user's usage cost and learning cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram of the structure of an embodiment of a TCP to EtherCAT gateway with high real-time performance and high reliability provided by the present invention;
[0027] Figure 2 It is a schematic diagram of an embodiment of a data mapping mechanism of a data mapping conversion module provided by the present invention. DETAILED DESCRIPTION
[0028] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0029] It is understandable that the technical terms, English abbreviations, etc. that appear in the following text are all prior art, and those skilled in the art can understand their meanings based on the context, and will not be explained in detail in this article due to space constraints.
[0030] In the description of the present application, “plurality” means two or more than two, unless otherwise clearly and specifically defined.
[0031] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0032] The present invention provides a TCP to EtherCAT gateway with high real-time performance and high reliability, which is described below respectively.
[0033] A specific embodiment of the present invention discloses a TCP to EtherCAT gateway with high real-time performance and high reliability, such as Figure 1 As shown, it includes a data receiving module, a mapping conversion module, a verification optimization module and a data sending module.
[0034] The data receiving module has a protocol analysis and unpacking information processing function, which includes a sub-function of identifying a TCP data packet and parsing its content and a sub-function of constructing a data packet that complies with the EtherCAT specification by analyzing the data format and transmission mechanism of the EtherCAT protocol. The process of identifying a TCP data packet and parsing its content is divided into the following steps: (1) Using a specific network tool to capture a TCP data packet. Generally, the specific network tool includes a network packet capture tool, such as Wireshark or a network library in a programming language, such as Python's Scapy library. (2) After capturing the data, parse the data. Generally, the TCP header is usually located in the first 20 bytes of the data packet (if there is no option field). The first 20 bytes are parsed to extract fields such as the source port, destination port, sequence number, confirmation number, and flag bit. (3) Determine the starting position of the payload based on the data offset field in the TCP header.
[0035] In some embodiments, the mapping and conversion module has data mapping and conversion functions. The data mapping and conversion functions include a data mapping mechanism and a conversion algorithm. Figure 2As shown, the data mapping mechanism includes (1) determining the mapping position of key information, by determining the field position for storing key information in the EtherCAT frame structure, which can be a reserved specific field or a newly added field. (2) Data type conversion. If the data type of the key information extracted from the TCP data stream does not match the field type in the EtherCAT frame, data type conversion is required. For example, integer data is converted to the corresponding integer type; (3) Data size adjustment to ensure that the key information extracted from the TCP data stream adapts to the size of the field in the EtherCAT frame. If the size does not match, data interception or padding operations may be required; (4) Data order rearrangement. If the storage order of key information in the TCP data stream and the EtherCAT protocol is different (such as the difference between big endian and little endian), the corresponding order rearrangement operation is required to ensure that the information is correctly parsed. (5) Mapping key information. Map each key information extracted from the TCP data stream to the corresponding field in the EtherCAT frame. Ensure that each information is correctly placed at the target position. (6) Verification and exception handling. During the mapping process, verification is performed to ensure data accuracy. During the mapping process, methods such as checksums or hash values can be used for verification and to handle possible exceptions such as data loss or conversion errors.
[0036] By determining the mapping location of key information and performing operations such as data type conversion, size adjustment, and order rearrangement, it can flexibly adapt to the differences between different data sources and target devices, and achieve compatibility and scalability of data formats.
[0037] The data mapping and conversion function ensures that the key information extracted from the TCP data stream remains consistent and accurate when mapped into the EtherCAT frame, avoiding information loss or mismatch. The data mapping and conversion mechanism can flexibly adapt to different data formats and communication protocols, simplifying the system integration and deployment process and reducing the complexity and cost of system integration.
[0038] By performing verification and exception handling during the mapping process, errors or abnormal situations that may occur during data conversion can be discovered and handled in a timely manner, improving the maintainability and stability of the system.
[0039] In some embodiments, a matching algorithm of a hash table data structure is used in the LZ77 algorithm, and a data sliding window and a data search buffer with adjustable size are used.
[0040] The LZ77 algorithm is a data compression algorithm based on sliding windows and prefix / suffix matching. It reduces the size of data transmission by finding repeated data fragments and replacing the repeated parts with pointers to the same fragments that appeared before.
[0041] In actual applications, the gateway first receives TCP data, and then the TCP data is sent to the compression module, which uses the LZ77 algorithm to compress the data. The compressed data is sent to the EtherCAT communication module and forwarded to the EtherCAT network via the gateway.
[0042] During the compression process, the algorithm identifies repeated data segments and replaces the repeated parts with pointers to the same segments that appeared previously. In this way, the amount of data is reduced. However, since the LZ77 algorithm can only identify repeated data segments of a fixed length, the compression effect may not be fully utilized for longer repeated segments. In addition, the size of the sliding window and search buffer used by the LZ77 algorithm is fixed, which limits its compression effect on larger data blocks.
[0043] Therefore, a more efficient matching algorithm will be introduced, combined with data structures such as hash tables to improve the recognition and matching efficiency of repeated segments. The size of the sliding window and search buffer in the LZ77 algorithm is designed to be dynamically adjustable, and the dictionary size is optimized according to the actual data characteristics to meet the compression requirements of different types of data. Specifically:
[0044] First, the optimal sliding window and search buffer size are determined by analyzing the characteristics of the actual data, such as repetitiveness, data block size, etc. Different types of data may have different compression characteristics, so dynamic adjustments can be made based on the characteristics of the data.
[0045] Set thresholds based on data characteristics, and automatically adjust the size of the sliding window and search buffer when the data characteristics exceed or fall below these thresholds. For example, for data with high repetitiveness, you can increase the size of the sliding window and search buffer to improve the compression rate; for more random data, you can reduce the size of these two areas to reduce resource usage.
[0046] By monitoring the compression ratio or compression efficiency, the dictionary size is dynamically adjusted according to the real-time compression effect to achieve the best compression effect.
[0047] In practical applications, experimental verification methods can be used to conduct compression tests on different types of data, observe the impact of sliding windows and search buffers of different sizes on the compression effect, and thus determine the best dynamic adjustment strategy.
[0048] It should be noted that, in addition to the above-mentioned matching algorithm improvement method, Huffman coding, arithmetic coding, etc. can also be used to combine the LZ77 algorithm with other algorithms to improve the compression efficiency of various types of data.
[0049] In some embodiments, the conversion algorithm is capable of converting the data into EtherCAT frames while retaining key information in the original data.
[0050] The TCP to EtherCAT gateway with high real-time performance and high reliability optimizes the real-time performance of the TCP to EtherCAT process through three steps: (1) optimizing the data path; (2) using compression technology during data transmission; and (3) designing and managing a cache mechanism.
[0051] In some embodiments, the check optimization module has error handling and reliability assurance functions, which are achieved through the following three steps: (1) error detection and correction mechanism; (2) utilizing TCP's confirmation and retransmission mechanism in combination with the EtherCAT communication mode; and (3) checksum between adjacent frames and global checksum.
[0052] (3) The check between adjacent frames and the global check are performed through the following check mode:
[0053] a) Checksum between adjacent frames: Add a checksum field between adjacent frames, for example, use the CRC (Cyclic Redundancy Check) algorithm to calculate the checksum. The sender calculates the checksum when sending each frame of data, and the receiver performs a check after receiving the data to verify the integrity of the data.
[0054] b) Global checksum: A global checksum field is added at the end of the data stream or at a specific location to verify the accuracy of the entire data stream. The sender calculates the global checksum and appends it to the end of the data stream. The receiver performs a global checksum after receiving the complete data to ensure the integrity of the data.
[0055] c) Checksum Verification: The receiving end calculates the checksum after receiving the data and compares it with the checksum sent by the sending end to verify whether any error or loss occurred during the data transmission process.
[0056] d) Error handling: If a checksum mismatch is found during the verification process, an error handling mechanism can be triggered, such as requesting data to be resent or performing error correction.
[0057] The advantages of the above error handling and reliability assurance are:
[0058] Improve data integrity: By adding check fields between adjacent frames and at the end of the entire data stream, errors or losses that may occur during data transmission can be detected in a timely manner, thereby improving data integrity.
[0059] Reduce data transmission error rate: Combined with checksum verification mechanisms such as CRC algorithm, it can effectively reduce the error rate in the data transmission process and reduce the risk of data transmission failure.
[0060] Enhanced system reliability: By combining the TCP confirmation and retransmission mechanism with the EtherCAT communication mode, reliable error detection and correction can be achieved during data transmission, thereby enhancing the reliability of the entire system.
[0061] Improve system stability: The error handling mechanism can promptly respond to and handle errors that may occur during data transmission, ensuring system stability and continuous availability.
[0062] Reduce system maintenance costs: By automatically triggering the error handling mechanism, the system can respond to error situations in a timely manner, reducing the need for manual intervention and maintenance, and reducing system maintenance costs.
[0063] In some embodiments, the TCP to EtherCAT gateway with high real-time performance and high reliability has corresponding software and hardware interfaces, and can be easily integrated into existing industrialization and control systems. The advantages of such a setting are:
[0064] Easy to integrate: The provision of software and hardware interfaces allows the gateway to be quickly integrated with existing industrialization and control systems without large-scale system transformation or reconstruction. This reduces the cost and time of integration while reducing risks.
[0065] Improve production efficiency: By integrating the TCP to EtherCAT gateway into the existing system, efficient communication and data exchange between different devices can be achieved. This can improve production efficiency, reduce production line downtime, and optimize the production process.
[0066] Enhanced system functions: The gateway provides high real-time and high reliability communication functions, which can add new functions and capabilities to the existing system. For example, more complex control logic, real-time monitoring and remote operation can be realized.
[0067] Wide applicability: Since the TCP to EtherCAT gateway has high real-time performance and high reliability, it is suitable for various industrial fields, including manufacturing, energy, transportation, etc., to meet the communication and control needs of different industries.
[0068] Future scalability: Because the gateway has flexible software and hardware interfaces, it can be easily upgraded and expanded to meet future system demand changes and technology updates.
[0069] It should be noted that the TCP to EtherCAT converter has two communication protocols:
[0070] 1.TCP / IP 2.Modbus TCP
[0071] TCP / IP is a four-layer protocol structure, including application layer, transport layer, network layer and data link layer; ModbusTCP is an extension based on the Modbus protocol, using the TCP / IP protocol for communication, and is the application layer protocol of the TCP / IP protocol.
[0072] The TCP / IP protocol has a higher communication speed because its data transmission format is more concise and clear, and data exchange and transmission can be carried out quickly; Modbus TCP communication speed is relatively slow, mainly because it uses a longer frame structure and data format, which requires more data parsing and processing.
[0073] Using a TCP to EtherCAT converter can reduce the difficulty of using EtherCAT. You only need to send the correct data to TCP and the converter will convert the data into the data used by EtherCAT to control the start and stop of the servo drive.
[0074] In some embodiments, the TCP to EtherCAT gateway with high real-time performance and high reliability supports both TCP / IP protocol and Modbus TCP protocol. The TCP / IP protocol supports a variety of network topologies, including star, ring, tree and other structures, which is more flexible and scalable; the most suitable network structure can be selected according to specific application requirements without being limited by a single topology. At the same time, Modbus TCP adopts a star network topology based on Ethernet, which can support multiple devices to communicate simultaneously. This structure can provide higher communication efficiency and performance, enabling the system to better cope with complex control and monitoring requirements.
[0075] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A TCP to EtherCAT gateway with high real-time performance and high reliability, It is characterized in that The gateway comprises a data receiving module, a mapping conversion module, a verification optimization module and a data sending module, wherein the data receiving module, the mapping conversion module, the verification optimization module and the data sending module are connected via a high-speed data bus; The function of the data receiving module is to receive and process data, the function of the mapping conversion module is to map the TCP protocol frame to the EtherCAT protocol frame, the function of the verification optimization module is real-time optimization and error processing and reliability assurance; the data sending module is to send data to an external device.
2. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 1, It is characterized in that The data receiving module has the functions of protocol analysis and unpacking information processing; The protocol analysis and unpacking information processing function includes a sub-function of identifying TCP data packets and parsing the content of the data packets and a sub-function of constructing data packets that comply with the EtherCAT specification by analyzing the data format and transmission mechanism of the EtherCAT protocol.
3. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 1, It is characterized in that The mapping and conversion module has data mapping and conversion functions; The data mapping and conversion functions include a preset data mapping mechanism and a preset conversion algorithm.
4. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 1, It is characterized in that The verification optimization module includes real-time optimization functions and error handling and reliability assurance functions.
5. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 4, It is characterized in that The gateway optimizes the real-time performance of the TCP to EtherCAT process through the following three steps: (1) optimizing the data path; (2) using compression technology during data transmission; and (3) designing and managing a cache mechanism.
6. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 5, It is characterized in that The compression technology is: using a matching algorithm of a hash table data structure in an LZ77 algorithm, and using a data sliding window and a data search buffer with adjustable size.
7. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 1, It is characterized in that The error handling and reliability assurance functions are implemented through the following three steps: (1) error detection and correction mechanism; (2) using TCP's confirmation and retransmission mechanism in combination with EtherCAT's communication mode; (3) checking between adjacent frames and global checking; The TCP to EtherCAT gateway with high real-time performance and high reliability has software and hardware interfaces required for integration into industrial control systems.
8. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 7, It is characterized in that The verification method between adjacent frames is a cyclic redundancy check method.
9. A TCP to EtherCAT gateway with high real-time performance and high reliability as claimed in claim 1, It is characterized in that The gateway supports both TCP / IP protocol and Modbus TCP protocol. The TCP end supports star, ring and tree structures and supports multiple devices to communicate simultaneously.
Citation Information
Cited By
Dynamic redundancy transmission method and system based on EtherCAT to Profinet, and storage medium
CN120729668A
Ethercat to profinet dynamic redundancy transmission method, system and storage medium
CN120729668B
