Dynamic redundancy transmission method and system based on EtherCAT to Profinet, and storage medium
By parsing data frames through the EtherCAT protocol controller and combining it with the dynamic priority scheduling of the central processor, efficient mapping and conversion between EtherCAT and Profinet protocols is achieved. This solves the problems of insufficient transmission rate, electromagnetic interference and topology structure limitations of existing industrial bus protocols in high-speed and high-reliability scenarios, and improves the reliability and flexibility of industrial networks.
Patent Information
- Application Number
- CN202511221201.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-08-29
AI Technical Summary
Existing industrial bus protocols have problems such as insufficient transmission rate, susceptibility to electromagnetic interference, limited communication distance, topology restrictions and inflexible protocol conversion in high-speed, high-reliability scenarios, resulting in high control command delays, reduced synchronization accuracy and poor device interconnection complexity.
By parsing data frames through the EtherCAT protocol controller and combining it with the dynamic priority scheduling of the central processor, efficient mapping and conversion between EtherCAT and Profinet protocols is achieved, supporting high-speed transmission. Redundant switching of faulty ports is achieved through a link status determination mechanism based on feedback instructions. Integrated magnetic coupling isolation and TVS surge protection mechanisms ensure zero transmission interruption.
It improves the reliability and flexibility of industrial networks, meets high-speed transmission requirements, avoids equipment replacement downtime, reduces wiring complexity and scalability barriers, and ensures the stability and reliability of real-time communications.
Smart Images

Figure CN120729668A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial gateways, and more specifically, to a dynamic redundant transmission method, system, and storage medium based on EtherCAT to Profinet. Background Art
[0002] In industrial automation, the reliability and transmission efficiency of real-time communication networks directly impact the performance of production systems. Currently, bus protocols such as EtherCAT, RS485, and CANOPEN are widely used for device interconnection in industrial fields. However, these technologies have limitations in high-speed, high-reliability scenarios. Traditional buses (such as RS485 and CANOPEN) have a maximum transmission rate of only 10 Mbps, which is insufficient to meet the demand for 100-Mbps / 1000-Mbps real-time data in scenarios such as robotic control and high-speed production lines. This results in high control command latency and reduced synchronization accuracy. RS485 is susceptible to electromagnetic interference over long transmission distances, increasing bit error rates. CANOPEN's communication distance is limited to 40 meters and supports only half-duplex communication, making it unsuitable for complex industrial environments. Traditional buses strictly adhere to linear or tree topologies and lack support for flexible networking configurations such as star and ring configurations, resulting in complex wiring and poor scalability. Furthermore, most gateways only support single-protocol conversion, such as EtherCAT to RS485, and cannot seamlessly integrate high-performance industrial Ethernet protocols such as Profinet and EtherNet / IP, limiting the openness of device connectivity.
[0003] There is an urgent need for a high-speed, highly reliable, and flexibly scalable dynamic redundant transmission technology. Summary of the Invention
[0004] In view of the above problems, the purpose of the present invention is to provide a dynamic redundant transmission method, system and storage medium based on EtherCAT to Profinet. The method parses data frames through the EtherCAT protocol controller and combines the dynamic priority scheduling of the central processing unit to achieve efficient mapping and conversion between the EtherCAT and Profinet protocols, supporting high-speed transmission. A link status determination mechanism based on feedback instructions is used to achieve redundant switching of fault ports, and a public storage area is used to cache unconfirmed data to ensure zero transmission interruption. In addition, magnetic coupling isolation and TVS surge protection mechanisms are integrated to suppress electromagnetic interference in industrial environments. At the same time, hot plugging and automatic configuration are supported, and equipment replacement does not require downtime, thereby improving the reliability of industrial networks.
[0005] A first aspect of the present invention provides a dynamic redundant transmission method based on EtherCAT to Profinet, the method comprising: The first protocol data frame is received and converted by the first protocol transceiver; Parsing the first protocol data frame based on the first protocol controller to obtain a first instruction; determining a first priority according to the first instruction; Determining whether the first priority exceeds a priority threshold; If yes, writing the first instruction into the interrupt storage area; If not, writing the first instruction into the polling storage area; Extracting a second instruction according to the interrupt storage area or the polling storage area; Based on a preset mapping rule table, and according to the second instruction, obtaining a second protocol data frame; responding to a feedback instruction of the second protocol data frame; When it is determined according to the feedback instruction that the link is abnormal, the redundant transmission port is started.
[0006] This plan also includes: Extracting the first instruction based on the opcode field to obtain a first opcode; Based on a preset priority mapping table, obtaining a first priority according to the operation code field; Determining whether the first priority exceeds a priority threshold; If yes, then determining interrupt priority information according to the first priority, adding the information to the tail of the first instruction, and storing the information together in the interrupt storage area; If not, insert it into the tail of the first-in-first-out queue of the polling storage area.
[0007] In this solution, the second instruction is extracted according to the interrupt storage area or the polling storage area, specifically: Determine whether the interrupt storage area is empty; If not, extract the second instruction in descending order according to the interrupt priority; If so, determining whether the polling storage area is empty; If not, the second instruction is obtained according to the head of the first-in-first-out queue; If so, the second instruction is set as the preset heartbeat instruction.
[0008] In this solution, the second protocol data frame is obtained according to the second instruction based on the preset mapping rule table, specifically: Extracting the second instruction based on the opcode field to obtain a second opcode; Based on a preset mapping rule table, obtaining a first device address according to the second operation code; Determining whether the second operation code is an output operation code; If yes, generating a second protocol data frame according to the first device address; If not, determining the first data amount according to the second operation code; Obtaining a first storage address based on the feedback storage area and the first data amount; A second protocol data frame is generated according to the first device address and the first storage address.
[0009] In this solution, when it is determined that the link is abnormal according to the feedback instruction, starting the redundant transmission port specifically includes: Determining whether the feedback instruction is received within a preset feedback time; If not, it is marked as data loss. When the preset number of consecutive losses occurs, the current port is disabled and the backup port is activated; If so, the receiving time is recorded, and when the average receiving time within the preset window exceeds the time threshold, the backup port is switched.
[0010] This plan also includes: After parsing the first protocol data frame, determining whether the transmission process of the first instruction is correct based on a preset CRC check; If yes, add a timestamp to the first instruction; After receiving the feedback instruction of the second protocol data frame, performing an integrity check based on the hash value carried in the feedback instruction; If the hash values do not match, the second protocol data frame is resent.
[0011] A second aspect of the present invention provides a dynamic redundant transmission system based on EtherCAT to Profinet, including a dynamic redundant transmission method program based on EtherCAT to Profinet, wherein the dynamic redundant transmission method program based on EtherCAT to Profinet, when executed by the processor, implements the following steps: The first protocol data frame is received and converted by the first protocol transceiver; Parsing the first protocol data frame based on the first protocol controller to obtain a first instruction; determining a first priority according to the first instruction; Determining whether the first priority exceeds a priority threshold; If yes, writing the first instruction into the interrupt storage area; If not, writing the first instruction into the polling storage area; Extracting a second instruction according to the interrupt storage area or the polling storage area; Based on a preset mapping rule table, and according to the second instruction, obtaining a second protocol data frame; responding to a feedback instruction of the second protocol data frame; When it is determined according to the feedback instruction that the link is abnormal, the redundant transmission port is started.
[0012] This plan also includes: Extracting the first instruction based on the opcode field to obtain a first opcode; Based on a preset priority mapping table, obtaining a first priority according to the operation code field; Determining whether the first priority exceeds a priority threshold; If yes, then determining interrupt priority information according to the first priority, adding the information to the tail of the first instruction, and storing the information together in the interrupt storage area; If not, insert it into the tail of the first-in-first-out queue of the polling storage area.
[0013] In this solution, the second instruction is extracted according to the interrupt storage area or the polling storage area, specifically: Determine whether the interrupt storage area is empty; If not, extract the second instruction in descending order according to the interrupt priority; If so, determining whether the polling storage area is empty; If not, the second instruction is obtained according to the head of the first-in-first-out queue; If so, the second instruction is set as the preset heartbeat instruction.
[0014] A third aspect of the present invention provides a computer-readable storage medium, which includes a dynamic redundant transmission method program based on EtherCAT to Profinet. When the dynamic redundant transmission method program based on EtherCAT to Profinet is executed by a processor, the steps of the dynamic redundant transmission method based on EtherCAT to Profinet as described in any one of the above items are implemented.
[0015] The present invention provides a dynamic redundant transmission method, system and storage medium based on EtherCAT to Profinet. The method comprises the following steps: an EtherCAT protocol controller parses data frames, determines an operation priority according to an operation instruction, stores the operation instruction in a corresponding interrupt storage area or a polling storage area according to the operation priority, extracts a second instruction based on the priority according to a preset instruction extraction mechanism, and maps the second instruction into a corresponding Profinet protocol data frame. If a link abnormality is determined based on the link status of the feedback instruction of the Profinet protocol data frame, a redundant transmission port is started. The method prioritizes key instructions by storing instructions in dual areas, thereby meeting the real-time requirements of the instructions. The method also solves the dual bottlenecks of industrial network bandwidth and reliability by using a protocol mapping table. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope.
[0017] Figure 1 A topological connection diagram based on EtherCAT to Profinet is shown; Figure 2 A flow chart of a dynamic redundant transmission method based on EtherCAT to Profinet according to the present invention is shown; Figure 3 A determination flow chart of a priority mechanism provided by an embodiment of the present invention is shown; Figure 4 A flowchart of extracting a second instruction provided by an embodiment of the present invention is shown; Figure 5 A block diagram of a dynamic redundant transmission system based on EtherCAT to Profinet according to the present invention is shown. DETAILED DESCRIPTION
[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0019] Unless otherwise defined, all terms (including technical and scientific terms) used in the embodiments of the present invention have the same meaning as commonly understood by those skilled in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having meanings consistent with their meanings in the context of the relevant technology, and should not be interpreted in an idealized or extremely formal sense, unless explicitly defined in this manner in the embodiments of the present invention.
[0020] The words "first", "second" and similar terms used in the embodiments of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Words such as "one", "an" or "the" do not indicate a quantity limitation, but rather indicate the existence of at least one. Similarly, words such as "include" or "comprise" mean that the elements or objects preceding the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The steps before or after the method of the embodiment of the present invention do not necessarily have to be performed in exact order. On the contrary, the various steps may be processed in reverse order or simultaneously. At the same time, other operations may be added to these processes, or one or more steps may be removed from these processes.
[0021] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0022] Figure 1 A topological connection diagram based on EtherCAT to Profinet is shown. Figure 1 As shown: The first protocol transceiver 101 is an EtherCAT protocol transceiver, which converts the received and transmitted data into electrical signals that comply with the EtherCAT physical layer regulations, and at the same time isolates and protects the EtherCAT protocol control circuit; The first protocol controller 102 is an EtherCAT protocol controller, which is responsible for monitoring and managing the bus, sending or receiving data, and encoding or decoding data frames; The public storage area 103 includes an interrupt storage area, a polling storage area, and a feedback storage area, and performs data reading and writing via a standard communication bus; The first communication controller 104 is a Profinet master station communication controller, responsible for monitoring and managing the Profinet bus, sending or receiving data, encoding or decoding data frames, converting the received and sent data into electrical signals that comply with the physical layer specifications of the Profinet protocol, and isolating and protecting the Profinet protocol control circuit.
[0023] like Figure 2 As shown, the first aspect of the present invention discloses a dynamic redundant transmission method based on EtherCAT to Profinet, the method comprising: S202, receiving and converting a first protocol data frame by a first protocol transceiver; S204, parsing the first protocol data frame based on the first protocol controller to obtain a first instruction; S206, determining a first priority according to the first instruction; S208, determining whether the first priority exceeds a priority threshold; S210, if yes, write the first instruction into the interrupt storage area; S212, if not, writing the first instruction into the polling storage area; S214, extracting a second instruction according to the interrupt storage area or the polling storage area; S216, obtaining a second protocol data frame based on a preset mapping rule table and according to the second instruction; S218, responding to the feedback instruction of the second protocol data frame; S220: When it is determined that the link is abnormal according to the feedback instruction, a redundant transmission port is started.
[0024] It should be noted that the first protocol data frame is EtherCAT protocol data; the first instruction is the parsed EtherCAT instruction; the second instruction is an instruction that needs to be converted into Profinet; and the second protocol data frame is EtherCAT protocol data.
[0025] In this embodiment, the EtherCAT protocol transceiver first receives the raw electrical signal transmitted by the industrial bus, filters out electromagnetic interference through a built-in magnetic coupling isolation circuit, and converts it into a digital signal. The EtherCAT protocol controller parses the data frame structure, strips off the frame header and check bits, and extracts the device control instruction as the first instruction. The central processing unit queries a preset priority mapping table based on the opcode field in the instruction. If it is a high-priority instruction, it triggers a hardware interrupt and writes it to a dedicated cache queue in the interrupt storage area to ensure an immediate response. If it is a low-priority instruction, it is inserted into the end of the first-in-first-out queue in the polling storage area to await sequential processing. The system preferentially scans the interrupt storage area, extracts instructions in descending priority order, processes the polling queue, and then converts the extracted second instruction into a protocol format using the EtherCAT-Profinet field mapping table, generating a Profinet data frame for transmission. If no feedback is received within a preset time or an abnormal transmission delay is detected, the link is determined to be faulty, the current port is immediately disabled, and the backup fiber port is activated. This embodiment adopts a dual-level storage strategy to ensure that high-real-time instructions are processed first to avoid motion control blocking; and implements zero-configuration conversion based on the protocol field mapping table to reduce development complexity; and also triggers redundant switching instead of periodic detection through feedback to reduce network overhead.
[0026] Figure 3 A determination flow chart of a priority mechanism provided by an embodiment of the present invention is shown.
[0027] According to an embodiment of the present invention, Figure 3 As shown, it also includes: S302, extracting the first instruction based on the opcode field to obtain a first opcode; S304, obtaining a first priority according to the operation code field based on a preset priority mapping table; S306, determining whether the first priority exceeds a priority threshold; S308, if yes, then determine interrupt priority information according to the first priority, add it to the end of the first instruction, and store it in the interrupt storage area; S310: If not, insert the data into the tail of the first-in-first-out queue of the polling storage area.
[0028] It should be noted that the first opcode is a unique code for the control operation. This embodiment provides a priority determination mechanism. The central processing unit parses the opcode field of the first instruction and matches the instruction type based on a preset priority mapping table. As an implementation method, motion control instructions are assigned high priority level 3, safety signals are assigned level 2, and status queries are assigned level 1. If the priority is ≥ level 2, an interrupt flag INT_LEVEL2 is added to the instruction and appended to the end of the instruction, and written to the corresponding LEVEL2 partition of the interrupt storage area; wherein the high priority partition has exclusive processing rights. If the priority is < level 2, the instruction is inserted into the end of the first-in-first-out queue of the polling storage area. The interrupt flag contains a timestamp and a priority code to ensure that the interrupt can be executed in the order of the flags; the polling queue is only processed in batches when the central processing unit is idle to avoid low-priority tasks blocking the real-time control flow. This embodiment automatically classifies priorities through opcodes without manual configuration, significantly improving the system's adaptability; in addition, the interrupt flag is stored at the end to retain the context and ensure instruction integrity.
[0029] Figure 4 A flowchart of extracting a second instruction provided by an embodiment of the present invention is shown.
[0030] According to an embodiment of the present invention, Figure 4 As shown, the second instruction is extracted according to the interrupt storage area or the polling storage area, specifically: S402, determining whether the interrupt storage area is empty; S404, if not, extracting the second instruction in descending order according to the interrupt priority; S406, if yes, then determine whether the polling storage area is empty; S408, if not, extract the second instruction according to the head of the first-in-first-out queue; S410: If yes, set the second instruction as a preset heartbeat instruction.
[0031] It should be noted that this embodiment provides a mechanism for extracting a second instruction. In this embodiment, the central processing unit scans the interrupt storage area at a fixed cycle. If a non-empty state is detected, instructions are extracted from high to low priority according to the interrupt mark, and instructions of the same level are first-in-first-out according to the timestamp order. If the interrupt storage area is empty, the first-in-first-out queue of the polling storage area is checked, and the instructions to be processed are extracted from the head of the queue; when both storage areas are empty, the system automatically generates a Profinet heartbeat instruction. As an implementation method, the heartbeat instruction has a device address of 0xFFFF and an empty data field. It is sent through a backup port to maintain the active state of the link and prevent the port from misjudging the device as offline. After the extracted instruction is handed over to the protocol conversion module, the corresponding storage area location is cleared and the memory space is released. This design ensures that high real-time instructions are processed first, while enhancing system availability through the heartbeat keep-alive mechanism to avoid accidental interruption of the communication link.
[0032] According to an embodiment of the present invention, the second protocol data frame is obtained according to the second instruction based on the preset mapping rule table, specifically: Extracting the second instruction based on the opcode field to obtain a second opcode; Based on a preset mapping rule table, obtaining a first device address according to the second operation code; Determining whether the second operation code is an output operation code; If yes, generating a second protocol data frame according to the first device address; If not, determining the first data amount according to the second operation code; Obtaining a first storage address based on the feedback storage area and the first data amount; A second protocol data frame is generated according to the first device address and the first storage address.
[0033] It should be noted that this embodiment provides a process for generating a second protocol data frame. In this embodiment, the opcode field of the second instruction is parsed, the preset EtherCAT-Profinet mapping rule table is queried, and the target Profinet device address is determined; as an implementation method, the opcode field is 0xA002 corresponding to port IO-Device2. If the opcode is of output type, such as a motor output control operation, the Profinet output frame is directly constructed and filled with data values. If it is of input type, such as a sensor data reading operation, the amount of data to be read is determined based on the opcode, and temporary cache space is opened in the dynamic allocation area of the feedback storage area to record the starting address and data length. For input instructions, the generated Profinet input frame contains the target device address and cache address pointer; when the port feeds back data, the result is written to the designated cache area according to the pointer in the frame for subsequent use by the central processor. This embodiment reduces data duplication through address pointer transmission and optimizes resource utilization through dynamic memory allocation.
[0034] According to an embodiment of the present invention, when it is determined that the link is abnormal according to the feedback instruction, starting the redundant transmission port specifically includes: Determining whether the feedback instruction is received within a preset feedback time; If not, it is marked as data loss. When the preset number of consecutive losses occurs, the current port is disabled and the backup port is activated; If so, the receiving time is recorded, and when the average receiving time within the preset window exceeds the time threshold, the backup port is switched.
[0035] It should be noted that this embodiment provides a redundant port switching mechanism. In this embodiment, a timer is started after sending a Profinet data frame. If no confirmation feedback frame is received from the port within a preset time, the data is marked as lost once. When the number of consecutive losses reaches the threshold, it is determined to be a link interruption, and the current faulty port is immediately disabled and the physical layer backup port is activated. If a confirmation frame is received but the delay fluctuates significantly, the average transmission delay within the sliding window is calculated. When the average delay exceeds the safety threshold, the port switching is actively triggered and the path table is updated. During the switching process, the unconfirmed data frames temporarily stored in the redundant queue of the public storage area are resent through the new port. This embodiment combines packet loss statistics and delay analysis to achieve two-dimensional fault judgment, avoid false switching caused by instantaneous jitter, and improve transmission stability.
[0036] According to an embodiment of the present invention, the further embodiment includes: After parsing the first protocol data frame, determining whether the transmission process of the first instruction is correct based on a preset CRC check; If yes, add a timestamp to the first instruction; After receiving the feedback instruction of the second protocol data frame, performing an integrity check based on the hash value carried in the feedback instruction; If the hash values do not match, the second protocol data frame is resent.
[0037] It should be noted that this embodiment provides a data transmission correctness verification process. In this embodiment, after parsing the original data frame, the EtherCAT protocol controller performs a CRC cyclic redundancy check. If the check fails, the data is discarded and a retransmission request is sent to the slave station; the instruction that passes the check is added with a high-precision timestamp to record the reception time. After receiving the feedback instruction, the Profinet communication controller performs a hash match based on the hash value at the end of the frame; if there is no match, the original data frame is extracted from the historical cache of the public storage area and resent; if it still fails after retransmission, the redundant port switching mechanism is triggered. The dual-end verification mechanism ensures integrity from the dual dimensions of transmission errors and data tampering.
[0038] It is worth mentioning that it also includes: If the detection determines that a surge fault occurs, the TVS diode clamp is triggered; Drive the magnetic coupling isolator to cut off the electrical connection of the fault port; The fault duration is recorded. If the duration exceeds a preset time threshold, power supply is switched to the redundant power supply module.
[0039] It should be noted that this embodiment provides a hardware fault isolation mechanism. The voltage sensor monitors the port level in real time. When a surge overvoltage is detected, the TVS diode is used to clamp the voltage to a safe range within nanoseconds; the magnetic coupling isolator is synchronously triggered to cut off the electrical connection of the faulty port. The system records the duration of the fault. If it exceeds the preset threshold, the power relay is driven to switch to the redundant power supply module for power supply; the background displays the isolation status of the faulty port and the progress of the power switching in real time, and the operation and maintenance personnel can reset it remotely. This embodiment realizes the physical isolation and energy redundancy of electrical faults, forming a hardware-level protection closed loop.
[0040] It is worth mentioning that it also includes hot-swap mechanisms, including: In response to the port access request, setting a second device address according to the port IP; Based on a preset device configuration template, the mapping rule table is updated according to the second device address.
[0041] It should be noted that this embodiment provides a port hot-swap mechanism. In this embodiment, when a new device is connected to a physical port, the Profinet DCP protocol automatically broadcasts a device discovery request; the gateway allocates an idle IP address and marks the port as "to be configured". The central processing unit loads the pre-stored device configuration template, which includes the EtherCAT slave address mapping table, communication parameters, etc., and updates the global protocol mapping rule table according to the new IP address. The configuration information is synchronized to the local storage area of the device to establish a Profinet IO real-time data channel. This embodiment ensures the consistency of device parameters through configuration templates, reduces human errors, and ensures zero interruption of the production link.
[0042] Figure 5 A block diagram of a dynamic redundant transmission system based on EtherCAT to Profinet according to the present invention is shown.
[0043] like Figure 5 As shown, the second aspect of the present invention discloses a dynamic redundant transmission system 5 based on EtherCAT to Profinet, including a memory 51 and a processor 52. The memory includes a dynamic redundant transmission method program based on EtherCAT to Profinet. When the dynamic redundant transmission method program based on EtherCAT to Profinet is executed by the processor, the following steps are implemented: The first protocol data frame is received and converted by the first protocol transceiver; Parsing the first protocol data frame based on the first protocol controller to obtain a first instruction; determining a first priority according to the first instruction; Determining whether the first priority exceeds a priority threshold; If yes, writing the first instruction into the interrupt storage area; If not, writing the first instruction into the polling storage area; Extracting a second instruction according to the interrupt storage area or the polling storage area; Based on a preset mapping rule table, and according to the second instruction, obtaining a second protocol data frame; responding to a feedback instruction of the second protocol data frame; When it is determined according to the feedback instruction that the link is abnormal, the redundant transmission port is started.
[0044] It should be noted that the first protocol data frame is EtherCAT protocol data; the first instruction is the parsed EtherCAT instruction; the second instruction is an instruction that needs to be converted into Profinet; and the second protocol data frame is EtherCAT protocol data.
[0045] In this embodiment, the EtherCAT protocol transceiver first receives the raw electrical signal transmitted by the industrial bus, filters out electromagnetic interference through a built-in magnetic coupling isolation circuit, and converts it into a digital signal. The EtherCAT protocol controller parses the data frame structure, strips off the frame header and check bits, and extracts the device control instruction as the first instruction. The central processing unit queries a preset priority mapping table based on the opcode field in the instruction. If it is a high-priority instruction, it triggers a hardware interrupt and writes it to a dedicated cache queue in the interrupt storage area to ensure an immediate response. If it is a low-priority instruction, it is inserted into the end of the first-in-first-out queue in the polling storage area to await sequential processing. The system preferentially scans the interrupt storage area, extracts instructions in descending priority order, processes the polling queue, and then converts the extracted second instruction into a protocol format using the EtherCAT-Profinet field mapping table, generating a Profinet data frame for transmission. If no feedback is received within a preset time or an abnormal transmission delay is detected, the link is determined to be faulty, the current port is immediately disabled, and the backup fiber port is activated. This embodiment adopts a dual-level storage strategy to ensure that high-real-time instructions are processed first to avoid motion control blocking; and implements zero-configuration conversion based on the protocol field mapping table to reduce development complexity; and also triggers redundant switching instead of periodic detection through feedback to reduce network overhead.
[0046] According to an embodiment of the present invention, the further embodiment includes: Extracting the first instruction based on the opcode field to obtain a first opcode; Based on a preset priority mapping table, obtaining a first priority according to the operation code field; Determining whether the first priority exceeds a priority threshold; If yes, then determining interrupt priority information according to the first priority, adding the information to the tail of the first instruction, and storing the information together in the interrupt storage area; If not, insert it into the tail of the first-in-first-out queue of the polling storage area.
[0047] It should be noted that the first opcode is a unique code for the control operation. This embodiment provides a priority determination mechanism. The central processing unit parses the opcode field of the first instruction and matches the instruction type based on a preset priority mapping table. As an implementation method, motion control instructions are assigned high priority level 3, safety signals are assigned level 2, and status queries are assigned level 1. If the priority is ≥ level 2, an interrupt flag INT_LEVEL2 is added to the instruction and appended to the end of the instruction, and written to the corresponding LEVEL2 partition of the interrupt storage area; wherein the high priority partition has exclusive processing rights. If the priority is < level 2, the instruction is inserted into the end of the first-in-first-out queue of the polling storage area. The interrupt flag contains a timestamp and a priority code to ensure that the interrupt can be executed in the order of the flags; the polling queue is only processed in batches when the central processing unit is idle to avoid low-priority tasks blocking the real-time control flow. This embodiment automatically classifies priorities through opcodes without manual configuration, significantly improving the system's adaptability; in addition, the interrupt flag is stored at the end to retain the context and ensure instruction integrity.
[0048] According to an embodiment of the present invention, extracting the second instruction according to the interrupt storage area or the polling storage area is specifically: Determine whether the interrupt storage area is empty; If not, extract the second instruction in descending order according to the interrupt priority; If so, determining whether the polling storage area is empty; If not, the second instruction is obtained according to the head of the first-in-first-out queue; If so, the second instruction is set as the preset heartbeat instruction.
[0049] It should be noted that this embodiment provides a mechanism for extracting a second instruction. In this embodiment, the central processing unit scans the interrupt storage area at a fixed cycle. If a non-empty state is detected, instructions are extracted from high to low priority according to the interrupt mark, and instructions of the same level are first-in-first-out according to the timestamp order. If the interrupt storage area is empty, the first-in-first-out queue of the polling storage area is checked, and the instructions to be processed are extracted from the head of the queue; when both storage areas are empty, the system automatically generates a Profinet heartbeat instruction. As an implementation method, the heartbeat instruction has a device address of 0xFFFF and an empty data field. It is sent through a backup port to maintain the active state of the link and prevent the port from misjudging the device as offline. After the extracted instruction is handed over to the protocol conversion module, the corresponding storage area location is cleared and the memory space is released. This design ensures that high real-time instructions are processed first, while enhancing system availability through the heartbeat keep-alive mechanism to avoid accidental interruption of the communication link.
[0050] According to an embodiment of the present invention, the second protocol data frame is obtained according to the second instruction based on the preset mapping rule table, specifically: Extracting the second instruction based on the opcode field to obtain a second opcode; Based on a preset mapping rule table, obtaining a first device address according to the second operation code; Determining whether the second operation code is an output operation code; If yes, generating a second protocol data frame according to the first device address; If not, determining the first data amount according to the second operation code; Obtaining a first storage address based on the feedback storage area and the first data amount; A second protocol data frame is generated according to the first device address and the first storage address.
[0051] It should be noted that this embodiment provides a process for generating a second protocol data frame. In this embodiment, the opcode field of the second instruction is parsed, the preset EtherCAT-Profinet mapping rule table is queried, and the target Profinet device address is determined; as an implementation method, the opcode field is 0xA002 corresponding to port IO-Device2. If the opcode is of output type, such as a motor output control operation, the Profinet output frame is directly constructed and filled with data values. If it is of input type, such as a sensor data reading operation, the amount of data to be read is determined based on the opcode, and temporary cache space is opened in the dynamic allocation area of the feedback storage area to record the starting address and data length. For input instructions, the generated Profinet input frame contains the target device address and cache address pointer; when the port feeds back data, the result is written to the designated cache area according to the pointer in the frame for subsequent use by the central processor. This embodiment reduces data duplication through address pointer transmission and optimizes resource utilization through dynamic memory allocation.
[0052] According to an embodiment of the present invention, when it is determined that the link is abnormal according to the feedback instruction, starting the redundant transmission port specifically includes: Determining whether the feedback instruction is received within a preset feedback time; If not, it is marked as data loss. When the preset number of consecutive losses occurs, the current port is disabled and the backup port is activated; If so, the receiving time is recorded, and when the average receiving time within the preset window exceeds the time threshold, the backup port is switched.
[0053] It should be noted that this embodiment provides a redundant port switching mechanism. In this embodiment, a timer is started after sending a Profinet data frame. If no confirmation feedback frame is received from the port within a preset time, the data is marked as lost once. When the number of consecutive losses reaches the threshold, it is determined to be a link interruption, and the current faulty port is immediately disabled and the physical layer backup port is activated. If a confirmation frame is received but the delay fluctuates significantly, the average transmission delay within the sliding window is calculated. When the average delay exceeds the safety threshold, the port switching is actively triggered and the path table is updated. During the switching process, the unconfirmed data frames temporarily stored in the redundant queue of the public storage area are resent through the new port. This embodiment combines packet loss statistics and delay analysis to achieve two-dimensional fault judgment, avoid false switching caused by instantaneous jitter, and improve transmission stability.
[0054] According to an embodiment of the present invention, the further embodiment includes: After parsing the first protocol data frame, determining whether the transmission process of the first instruction is correct based on a preset CRC check; If yes, add a timestamp to the first instruction; After receiving the feedback instruction of the second protocol data frame, performing an integrity check based on the hash value carried in the feedback instruction; If the hash values do not match, the second protocol data frame is resent.
[0055] It should be noted that this embodiment provides a data transmission correctness verification process. In this embodiment, after parsing the original data frame, the EtherCAT protocol controller performs a CRC cyclic redundancy check. If the check fails, the data is discarded and a retransmission request is sent to the slave station; the instruction that passes the check is added with a high-precision timestamp to record the reception time. After receiving the feedback instruction, the Profinet communication controller performs a hash match based on the hash value at the end of the frame; if there is no match, the original data frame is extracted from the historical cache of the public storage area and resent; if it still fails after retransmission, the redundant port switching mechanism is triggered. The dual-end verification mechanism ensures integrity from the dual dimensions of transmission errors and data tampering.
[0056] It is worth mentioning that it also includes: If the detection determines that a surge fault occurs, the TVS diode clamp is triggered; Drive the magnetic coupling isolator to cut off the electrical connection of the fault port; The fault duration is recorded. If the duration exceeds a preset time threshold, power supply is switched to the redundant power supply module.
[0057] It should be noted that this embodiment provides a hardware fault isolation mechanism. The voltage sensor monitors the port level in real time. When a surge overvoltage is detected, the TVS diode is used to clamp the voltage to a safe range within nanoseconds; the magnetic coupling isolator is synchronously triggered to cut off the electrical connection of the faulty port. The system records the duration of the fault. If it exceeds the preset threshold, the power relay is driven to switch to the redundant power supply module for power supply; the background displays the isolation status of the faulty port and the progress of the power switching in real time, and the operation and maintenance personnel can reset it remotely. This embodiment realizes the physical isolation and energy redundancy of electrical faults, forming a hardware-level protection closed loop.
[0058] It is worth mentioning that it also includes hot-swap mechanisms, including: In response to the port access request, setting a second device address according to the port IP; Based on a preset device configuration template, the mapping rule table is updated according to the second device address.
[0059] It should be noted that this embodiment provides a port hot-swap mechanism. In this embodiment, when a new device is connected to a physical port, the Profinet DCP protocol automatically broadcasts a device discovery request; the gateway allocates an idle IP address and marks the port as "to be configured". The central processing unit loads the pre-stored device configuration template, which includes the EtherCAT slave address mapping table, communication parameters, etc., and updates the global protocol mapping rule table according to the new IP address. The configuration information is synchronized to the local storage area of the device to establish a Profinet IO real-time data channel. This embodiment ensures the consistency of device parameters through configuration templates, reduces human errors, and ensures zero interruption of the production link.
[0060] A third aspect of the present invention provides a computer-readable storage medium, which includes a dynamic redundant transmission method program based on EtherCAT to Profinet. When the dynamic redundant transmission method program based on EtherCAT to Profinet is executed by a processor, the steps of the dynamic redundant transmission method based on EtherCAT to Profinet as described in any one of the above items are implemented.
[0061] In summary, the present invention provides a dynamic redundant transmission method, system and storage medium based on EtherCAT to Profinet. The method parses data frames through an EtherCAT protocol controller and determines the operation priority according to the operation instruction. According to the operation priority, the operation instruction is stored in a corresponding interrupt storage area or a polling storage area. According to a preset instruction extraction mechanism, a second instruction is extracted based on the priority and mapped into a corresponding Profinet protocol data frame. Based on the link status of the feedback instruction of the Profinet protocol data frame, if the link is judged to be abnormal, the redundant transmission port is started. The present invention prioritizes the processing of key instructions by dual-area storage of instructions, thereby meeting the real-time requirements of the instructions. The dual bottlenecks of industrial network bandwidth and reliability are solved by a protocol mapping table.
[0062] If the functions are implemented as software modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or the portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0063] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A dynamic redundant transmission method based on EtherCAT to Profinet, characterized in that: The method comprises: The first protocol data frame is received and converted by the first protocol transceiver; Parsing the first protocol data frame based on the first protocol controller to obtain a first instruction; determining a first priority according to the first instruction; Determining whether the first priority exceeds a priority threshold; If yes, writing the first instruction into the interrupt storage area; If not, writing the first instruction into the polling storage area; Extracting a second instruction according to the interrupt storage area or the polling storage area; Based on a preset mapping rule table, and according to the second instruction, obtaining a second protocol data frame; responding to a feedback instruction of the second protocol data frame; When it is determined according to the feedback instruction that the link is abnormal, the redundant transmission port is started.
2. The dynamic redundant transmission method based on EtherCAT to Profinet according to claim 1, characterized in that: Also includes: Extracting the first instruction based on the opcode field to obtain a first opcode; Based on a preset priority mapping table, obtaining a first priority according to the operation code field; Determining whether the first priority exceeds a priority threshold; If yes, then determining interrupt priority information according to the first priority, adding the information to the tail of the first instruction, and storing the information together in the interrupt storage area; If not, insert it into the tail of the first-in-first-out queue of the polling storage area.
3. The dynamic redundant transmission method based on EtherCAT to Profinet according to claim 2, characterized in that: The second instruction is extracted according to the interrupt storage area or the polling storage area, specifically: Determine whether the interrupt storage area is empty; If not, extract the second instruction in descending order according to the interrupt priority; If so, determining whether the polling storage area is empty; If not, the second instruction is obtained according to the head of the first-in-first-out queue; If so, the second instruction is set as the preset heartbeat instruction.
4. The dynamic redundant transmission method based on EtherCAT to Profinet according to claim 1, characterized in that: The method of obtaining the second protocol data frame based on the preset mapping rule table and according to the second instruction is as follows: Extracting the second instruction based on the opcode field to obtain a second opcode; Based on a preset mapping rule table, obtaining a first device address according to the second operation code; Determining whether the second operation code is an output operation code; If yes, generating a second protocol data frame according to the first device address; If not, determining the first data amount according to the second operation code; Obtaining a first storage address based on the feedback storage area and the first data amount; A second protocol data frame is generated according to the first device address and the first storage address.
5. The dynamic redundant transmission method based on EtherCAT to Profinet according to claim 1, characterized in that: When it is determined according to the feedback instruction that the link is abnormal, starting the redundant transmission port specifically includes: Determining whether the feedback instruction is received within a preset feedback time; If not, it is marked as data loss. When the preset number of consecutive losses occurs, the current port is disabled and the backup port is activated; If so, the receiving time is recorded, and when the average receiving time within the preset window exceeds the time threshold, the backup port is switched.
6. The dynamic redundant transmission method based on EtherCAT to Profinet according to claim 1, characterized in that: Also includes: After parsing the first protocol data frame, determining whether the transmission process of the first instruction is correct based on a preset CRC check; If yes, add a timestamp to the first instruction; After receiving the feedback instruction of the second protocol data frame, performing an integrity check based on the hash value carried in the feedback instruction; If the hash values do not match, the second protocol data frame is resent.
7. A dynamic redundant transmission system based on EtherCAT to Profinet, characterized in that: The system includes a memory and a processor. The memory includes a dynamic redundant transmission method program based on EtherCAT to Profinet. When the dynamic redundant transmission method program based on EtherCAT to Profinet is executed by the processor, the following steps are implemented: The first protocol data frame is received and converted by the first protocol transceiver; Parsing the first protocol data frame based on the first protocol controller to obtain a first instruction; determining a first priority according to the first instruction; Determining whether the first priority exceeds a priority threshold; If yes, writing the first instruction into the interrupt storage area; If not, writing the first instruction into the polling storage area; Extracting a second instruction according to the interrupt storage area or the polling storage area; Based on a preset mapping rule table, and according to the second instruction, obtaining a second protocol data frame; responding to a feedback instruction of the second protocol data frame; When it is determined according to the feedback instruction that the link is abnormal, the redundant transmission port is started.
8. The dynamic redundant transmission system based on EtherCAT to Profinet according to claim 7, characterized in that: Also includes: Extracting the first instruction based on the opcode field to obtain a first opcode; Based on a preset priority mapping table, obtaining a first priority according to the operation code field; Determining whether the first priority exceeds a priority threshold; If yes, then determining interrupt priority information according to the first priority, adding the information to the tail of the first instruction, and storing the information together in the interrupt storage area; If not, insert it into the tail of the first-in-first-out queue of the polling storage area.
9. The dynamic redundant transmission system based on EtherCAT to Profinet according to claim 8, characterized in that: The second instruction is extracted according to the interrupt storage area or the polling storage area, specifically: Determine whether the interrupt storage area is empty; If not, extract the second instruction in descending order according to the interrupt priority; If so, determining whether the polling storage area is empty; If not, the second instruction is obtained according to the head of the first-in-first-out queue; If so, the second instruction is set as the preset heartbeat instruction.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer-readable storage medium includes a dynamic redundant transmission method program based on EtherCAT to Profinet. When the dynamic redundant transmission method program based on EtherCAT to Profinet is executed by a processor, the steps of the dynamic redundant transmission method based on EtherCAT to Profinet as described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
TCP-to-EtherCAT gateway with high real-time performance and high reliability
CN118740552A
Fuzzy dynamic scheduling data communication detection system based on virtual-real interaction scene
CN120186238A
Time and frequency method and system for optical comb
US20210175678A1
Cited By
Fusion frame type dynamic mapping and adaptive optimization of redundant network verification method
CN121486259B