Master-slave station communication link self-healing method, device, equipment and storage medium

CN123020329APending Publication Date: 2026-10-30SHENZHEN XUANJI POWER TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611175740.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-04
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0005]本申请的主要目的在于提供一种主从站通信链路自愈方法、装置、设备及存储介质,旨在解决如何提高主从站通信链路自愈效率的技术问题

Benefits of technology

本申请实施例提出的主从站通信链路自愈方法、装置、设备及存储介质,具体通过基于所述主站设备,读取若干个从站设备的端口链路状态信息,并获取对应通信周期中的预设双向工作计数器值;根据所述端口链路状态信息与预设双向工作计数器值,对所述若干个从站设备进行判断,以确定断连从站设备,所述断连从站设备是实际发生断连的从站设备;在单个通信周期内,以绕过所述断连从站设备的方式,重构所述主站设备与所述从站设备之间的通信链路。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020329A_ABST
    Figure CN123020329A_ABST
Patent Text Reader

Abstract

The application discloses a master-slave station communication link self-healing method and device, equipment and a storage medium, and relates to the technical field of industrial communication. The master-slave station communication link self-healing method comprises the following steps: reading port link state information of a plurality of slave station devices and obtaining preset bidirectional working counter values in a corresponding communication period based on a master station device; judging the plurality of slave station devices according to the port link state information and the preset bidirectional working counter values to determine a disconnected slave station device, wherein the disconnected slave station device is actually disconnected; and reconstructing a communication link between the master station device and the slave station devices in a single communication period in a manner of bypassing the disconnected slave station device. Through the above scheme, the communication link between the master station device and each slave station device can be reconstructed in a single communication period, so that the self-healing efficiency of the master-slave station communication link is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of industrial communication technology, and in particular to a self-healing method, apparatus, device and storage medium for master-slave communication links. Background Technology

[0002] EtherCAT (Ethernet Control Automation Technology) is a high-performance real-time industrial Ethernet protocol with low communication latency, flexible network topology, and efficient distributed clock synchronization mechanism. It is widely used in industrial scenarios such as motion control and industrial robots.

[0003] The existing EtherCAT master station uses a dual-port redundant topology and utilizes port link status to detect slave station disconnections. However, the existing technology has high latency in detecting slave station disconnections, making it difficult to locate faults in a timely manner. Secondly, when a slave station disconnects, the data forwarding path cannot be reconstructed within a single cycle, which may lead to communication interruptions for some slave stations.

[0004] Therefore, it is necessary to propose a self-healing method for master-slave communication links to improve the efficiency of self-healing of master-slave communication links. Summary of the Invention

[0005] The main objective of this application is to provide a self-healing method, apparatus, device, and storage medium for master-slave communication links, aiming to solve the technical problem of how to improve the self-healing efficiency of master-slave communication links.

[0006] To achieve the above objectives, this application proposes a self-healing method for master-slave communication links. This method is applied to an Ethernet communication system, which includes a master station device and several slave station devices. The self-healing method comprises: Based on the master station device, the port link status information of several slave station devices is read, and the preset bidirectional working counter value in the corresponding communication cycle is obtained; Based on the port link status information and the preset bidirectional working counter value, the plurality of slave devices are judged to determine the disconnected slave device, which is the slave device that actually lost connection; Within a single communication cycle, the communication link between the master station device and the slave station device is reconstructed in a manner that bypasses the disconnected slave station device.

[0007] In one embodiment, the preset bidirectional working counter value includes the number of data frame processing times in the first physical direction and the number of data frame processing times in the second physical direction. The step of determining the disconnected slave device by judging the plurality of slave devices based on the port link status information and the preset bidirectional working counter value includes: For any slave device, the number of times the first physical direction data frame is processed by the bidirectional working counter of the slave device is compared with the first expected value to determine whether the slave device has an uplink data anomaly. The number of data frames processed in the second physical direction by the bidirectional working counter of the slave device is compared with the second expected value to determine whether there is a downlink data anomaly in the slave device; Based on the port link status information, determine whether the slave device has a link status abnormality; If the slave device has at least one of the following: abnormal uplink data, abnormal downlink data, or abnormal link status, it is determined to be a disconnected slave device.

[0008] In one embodiment, the steps of comparing the number of first physical direction data frame processing times of the bidirectional working counter of the slave device with a first expected value to determine whether the slave device has uplink data anomalies, and comparing the number of second physical direction data frame processing times of the bidirectional working counter of the slave device with a second expected value to determine whether the slave device has downlink data anomalies, include: When the number of times the first physical direction data frame is processed by the bidirectional working counter of the slave device is inconsistent with the first expected value, it is determined that the slave device has an uplink data anomaly. When the number of data frames processed in the second physical direction by the bidirectional working counter of the slave device is inconsistent with the second expected value, it is determined that there is a downlink data anomaly in the slave device.

[0009] In one embodiment, the step of reconstructing the communication link between the master station device and the slave device within a single communication cycle, bypassing the disconnected slave device, includes: Obtain the network location information and breakpoint port information of the disconnected slave device; Within a single communication cycle, based on the network location information and breakpoint port information of the disconnected slave device, several redundant data frame transmission paths are calculated to bypass the disconnected slave device. Based on the preset slave priority and the port and load information of each slave device, redundant communication links are determined from the several redundant data frame transmission paths, so as to reconstruct the communication link between the master device and the slave device based on the redundant communication links.

[0010] In one embodiment, the step of obtaining the network location information and breakpoint port information of the disconnected slave device includes: The network location information of the disconnected slave device is determined based on the first difference between the number of data frames processed in the first physical direction and the first expected value of the bidirectional working counter of the disconnected slave device, the second difference between the number of data frames processed in the second physical direction and the second expected value, and the port link status information. The breakpoint port information is determined based on the port link status information of the disconnected slave device.

[0011] In one embodiment, after the step of reconstructing the communication link between the master station device and the slave device within a single communication cycle by bypassing the disconnected slave device, the method further includes: When the disconnected slave device recovers to a communicable state, the master device triggers the disconnected slave device to reset its state machine and clear its error state, and then reconnects to the reconstructed communication link.

[0012] In one embodiment, before the step of determining the disconnected slave device by judging the plurality of slave devices based on the port link status information and a preset bidirectional working counter value, the method further includes: Based on historical port link status information and preset bidirectional working counter values, identify several potential disconnected slave devices. The step of determining the disconnected slave device by judging the plurality of slave devices based on the port link status information and the preset bidirectional working counter value includes: Based on the port link status information and the preset bidirectional working counter value, the plurality of potential disconnected slave devices are judged to determine the disconnected slave device, which is the slave device that actually disconnected.

[0013] Furthermore, to achieve the above objectives, this application also proposes a master-slave communication link self-healing device, which is applied to an Ethernet communication system. The Ethernet communication system includes a master station device and several slave station devices. The master-slave communication link self-healing device includes: The reading module is used to read the port link status information of several slave devices based on the master station device, and obtain the preset bidirectional working counter value in the corresponding communication cycle; The determination module is used to determine the plurality of slave devices based on the port link status information and the preset bidirectional working counter value, so as to determine the disconnected slave device, wherein the disconnected slave device is the slave device that actually disconnected. The reconstruction module is used to reconstruct the communication link between the master station device and the slave station device within a single communication cycle, bypassing the disconnected slave station device.

[0014] In addition, to achieve the above objectives, this application also proposes a master-slave communication link self-healing device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the master-slave communication link self-healing method as described above.

[0015] In addition, to achieve the above objectives, this application also provides a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the master-slave communication link self-healing method described above.

[0016] One or more technical solutions proposed in this application have at least the following technical effects: The master-slave communication link self-healing method, apparatus, device, and storage medium proposed in this application specifically involve: reading port link status information of several slave devices based on the master device, and obtaining a preset bidirectional working counter value in the corresponding communication cycle; judging the several slave devices based on the port link status information and the preset bidirectional working counter value to identify the disconnected slave device, which is the slave device that actually experienced a disconnection; and reconstructing the communication link between the master device and the slave devices within a single communication cycle by bypassing the disconnected slave device.

[0017] This application collects port link status information and preset bidirectional working counter values ​​of each slave device in real time by the master device. Based on the port link status information and preset bidirectional working counter values, it identifies the slave device that has actually lost connection, i.e. the disconnected slave device. Within a single communication cycle, it reconstructs the communication link between the master device and each slave device by bypassing the disconnected slave device, thereby improving the self-healing efficiency of the master-slave communication link and ensuring the reliability of the communication link in high real-time industrial scenarios. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating the first embodiment of the master-slave communication link self-healing method of this application; Figure 2 This is a flowchart illustrating the second embodiment of the master-slave communication link self-healing method of this application; Figure 3 This is a flowchart illustrating the third embodiment of the master-slave communication link self-healing method of this application; Figure 4 This is a schematic diagram of the module structure of the master-slave communication link self-healing device of this application; Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the master-slave communication link self-healing method in this application embodiment.

[0021] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0022] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0023] The main solution of this application embodiment is as follows: Based on the master station device, read the port link status information of several slave devices and obtain the preset bidirectional working counter value in the corresponding communication cycle; judge the several slave devices according to the port link status information and the preset bidirectional working counter value to determine the disconnected slave device, which is the slave device that actually disconnected; within a single communication cycle, reconstruct the communication link between the master station device and the slave device by bypassing the disconnected slave device.

[0024] EtherCAT (Ethernet Control Automation Technology) is a high-performance real-time industrial Ethernet protocol with low communication latency, flexible network topology, and efficient distributed clock synchronization mechanism. It is widely used in industrial scenarios such as motion control and industrial robots.

[0025] The existing EtherCAT master station uses a dual-port redundant topology and utilizes port link status to detect slave station disconnections. However, the existing technology has high latency in detecting slave station disconnections, making it difficult to locate faults in a timely manner. Secondly, when a slave station disconnects, the data forwarding path cannot be reconstructed within a single cycle, which may lead to communication interruptions for some slave stations.

[0026] Therefore, it is necessary to propose a self-healing method for master-slave communication links to improve the efficiency of self-healing of master-slave communication links.

[0027] To address the aforementioned technical issues, this application proposes a solution that involves a master station device collecting real-time port link status information and preset bidirectional working counter values ​​from each slave device. Based on these information, the master station device identifies the slave device that has experienced a disconnection (i.e., the disconnected slave device). Within a single communication cycle, the master station device reconstructs the communication link with each slave device by bypassing the disconnected slave device. This improves the self-healing efficiency of the master-slave communication link and ensures the reliability of the communication link in high-real-time industrial scenarios.

[0028] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, personal computer, mobile phone, etc., or a master-slave communication link self-healing device, EtherCAT communication system, etc. that can realize the above functions.

[0029] Based on this, embodiments of this application provide a self-healing method for master-slave communication links, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the master-slave communication link self-healing method of this application. The master-slave communication link self-healing method is applied to an Ethernet communication system, which includes a master station device and several slave station devices. The master-slave communication link self-healing method includes steps S110 to S130: Step S110: Based on the master station device, read the port link status information of several slave station devices and obtain the preset bidirectional working counter value in the corresponding communication cycle; This application embodiment applies to an EtherCAT communication system, which includes an EtherCAT master station (i.e., master station device) and several EtherCAT slave stations (i.e., slave station devices). The EtherCAT master station communicates with the several EtherCAT slave stations via Ethernet. The EtherCAT master station is the hardware that undertakes centralized control functions, typically an embedded controller or industrial computer, responsible for initiating communication cycles and managing the slave device cluster. The EtherCAT slave stations are terminal execution units connected to the communication link, including but not limited to controlled devices such as servo drivers, I / O modules, and sensor gateways.

[0030] It should be noted that the preset bidirectional working counter refers to the bidirectional working counter pre-configured in the EtherCAT slave firmware. The bidirectional working counter is used to accumulate and record the number of times the slave processes data frames in both the uplink and downlink data directions.

[0031] First, the EtherCAT master station periodically reads the real-time count values ​​recorded by the preset bidirectional working counters in several EtherCAT slave stations connected to it, according to a pre-set communication cycle. The EtherCAT master station also periodically obtains the physical layer connection parameters of the port from the port status register corresponding to the communication port of each EtherCAT slave station, i.e., the port link status information, so as to subsequently determine which EtherCAT slave stations are in a disconnected state based on the information read above.

[0032] The preset bidirectional working counter value includes the number of data frames processed in the first physical direction and the number of data frames processed in the second physical direction. Port link status information refers to register data reflecting the health of the physical connection of the communication link, which may include: port physical connection status (e.g., connection normal or disconnected), data transmission and reception enable status, signal quality indicators (e.g., bit error rate, signal strength, etc.), and topology path identifier.

[0033] Step S120: Based on the port link status information and the preset bidirectional working counter value, the plurality of slave devices are judged to determine the disconnected slave device, which is the slave device that actually disconnected. Specifically, based on the number of data frames processed in the first physical direction and the number of data frames processed in the second physical direction recorded by the preset bidirectional working counter in each EtherCAT slave station, and the port physical connection status and data transmission / reception enable status in the port link status information, the EtherCAT slave station in a disconnected state is determined, i.e., the disconnected slave station device. Here, a disconnected slave station device refers to a slave node that cannot participate in network communication normally due to communication path interruption or its own failure; that is, a slave station device that has actually experienced a disconnection.

[0034] Step S130: Within a single communication cycle, reconstruct the communication link between the master station device and the slave station device in a manner that bypasses the disconnected slave station device.

[0035] Specifically, in a single EtherCAT standard communication cycle, the EtherCAT communication system dynamically modifies the data frame forwarding path through the EtherCAT master station. For example, it enables the reverse transmission path in a ring topology and directly connects to adjacent normal slave stations in a linear topology, bypassing faulty nodes. This reconstructs the communication link between the EtherCAT master station and multiple other EtherCAT slave stations.

[0036] In this embodiment, the application collects the port link status information and preset bidirectional working counter value of each slave device in real time through the master station device. Based on the port link status information and preset bidirectional working counter value, the application identifies the slave device that has actually lost connection, i.e. the disconnected slave device, and reconstructs the communication link between the master station device and each slave device by bypassing the disconnected slave device within a single communication cycle. This improves the self-healing efficiency of the master-slave communication link and ensures the reliability of the communication link in high real-time industrial scenarios.

[0037] Based on the above embodiments of this application, a second embodiment of this application is proposed. In the second embodiment of this application, content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of the master-slave communication link self-healing method of this application; as shown below. Figure 2 As shown, the preset bidirectional working counter value includes the number of data frame processing times in the first physical direction and the number of data frame processing times in the second physical direction. The step of judging the plurality of slave devices based on the port link status information and the preset bidirectional working counter value to determine the disconnected slave device includes steps S210~S240: Step S210: For any slave device, compare the number of times the first physical direction data frame is processed by the bidirectional working counter of the slave device with the first expected value to determine whether there is an uplink data anomaly in the slave device. Step S220: Compare the number of data frames processed in the second physical direction of the bidirectional working counter of the slave device with the second expected value to determine whether there is a downlink data anomaly in the slave device; Specifically, for any slave device, the uplink and downlink data frame processing status of the EtherCAT slave can be determined by whether the number of data frame processing times in the first physical direction and the number of data frame processing times in the second physical direction meet the corresponding expected values. In this way, slave devices whose uplink and downlink data frame processing statuses are in an abnormal state are identified as disconnected slave devices.

[0038] Preferably, the number of times the data frame is processed in the first physical direction is the same as the number of times the data frame is processed in the uplink direction; and the number of times the data frame is processed in the second physical direction is the same as the number of times the data frame is processed in the downlink direction.

[0039] It should be noted that the first expected value refers to the theoretical number of uplink data frames that the EtherCAT master station will process based on the communication plan for the EtherCAT slave station. The first expected value is related to the number of uplink commands sent by the EtherCAT master station to the slave station, the number of uplink data frames forwarded by the EtherCAT slave station, and the number of uplink command responses from the EtherCAT slave station.

[0040] Additionally, it should be noted that the second expected value refers to the theoretical number of downlink data frame processing times calculated by the EtherCAT master station based on the communication plan for the EtherCAT slave station. The second expected value is related to the number of downlink commands sent by the EtherCAT master station to the slave station, the number of downlink data frame forwardings by the EtherCAT slave station, and the number of downlink command responses by the EtherCAT slave station.

[0041] Specifically, the EtherCAT master station compares the number of times the EtherCAT slave station processes the first physical direction data frame (i.e., the actual WKC2 value) with the first expected value to determine whether the EtherCAT slave station has uplink data anomalies; at the same time, it compares the number of times the EtherCAT slave station processes the second physical direction data frame with the second expected value to determine whether the EtherCAT slave station has downlink data anomalies.

[0042] Optionally, when the number of data frames processed in the first physical direction by the bidirectional working counter of the slave device is inconsistent with the first expected value, it is determined that the slave device has an uplink data anomaly. Optionally, when the number of data frames processed in the second physical direction by the bidirectional working counter of the slave device is inconsistent with the second expected value, it is determined that the slave device has a downlink data anomaly.

[0043] The above method uses hardware-level real-time comparison to identify data packet loss in the EtherCAT slave when the number of data frame processing times in the first physical direction is less than the first expected value or the number of data frame processing times in the second physical direction is less than the second expected value. When the number of data frame processing times in the first physical direction is greater than the first expected value or the number of data frame processing times in the second physical direction is greater than the second expected value, it can identify data duplication in the EtherCAT slave, providing a quantitative basis for port-level fault diagnosis.

[0044] Step S230: Based on the port link status information, determine whether the slave device has a link status abnormality; Specifically, the disconnection of a slave device can also be determined based on whether there are any abnormalities in the port link status information. In particular, based on the port physical connection status, data transmission and reception enable status, and signal quality indicators in the port link status information, it can be determined whether the physical connection of the EtherCAT slave has failed or whether the signal quality has been severely degraded, thereby determining whether there is a link status abnormality for the EtherCAT slave.

[0045] Understandably, the EtherCAT master station can comprehensively evaluate the signal quality of the EtherCAT slave station by considering whether multiple signal quality indicators meet preset thresholds. For example, if the CRC (Cyclic Redundancy Check) error rate is greater than a preset value or the signal strength is less than a preset value, it is determined that the signal quality of the EtherCAT slave station is poor and there is an abnormal link status.

[0046] Step S240: If the slave device has at least one of the following: uplink data abnormality, downlink data abnormality, or link status abnormality, it is determined to be a disconnected slave device.

[0047] Specifically, if an EtherCAT slave station experiences any of the following anomalies: uplink data anomaly, downlink data anomaly, or link status anomaly, it is confirmed to be in a disconnected state, and the EtherCAT slave station is determined to be a disconnected slave station device.

[0048] Before the step of determining the disconnected slave device based on the port link status information and the preset bidirectional working counter value, step B01 is included: Step B01: Based on historical port link status information and preset bidirectional working counter values, identify several potential disconnected slave devices. The step of determining the disconnected slave device by judging the plurality of slave devices based on the port link status information and the preset bidirectional working counter value includes step B02: Step B02: Based on the port link status information and the preset bidirectional working counter value, the plurality of potential disconnected slave devices are judged to determine the disconnected slave device, which is the slave device that actually disconnected.

[0049] Specifically, the EtherCAT master station stores historical records of port link status information for each slave station, as well as historical records of preset bidirectional working counter values.

[0050] The EtherCAT master station uses time-series pattern analysis or machine learning algorithms (such as LSTM networks) to process the aforementioned historical port link status information and preset bidirectional working counter values. It identifies abnormal counter trends or link status degradation patterns from several EtherCAT slave stations, and then predicts multiple slave devices that may be disconnected, i.e., potential disconnected slave devices. By reconnecting the potential disconnected slave devices, predictive communication link self-healing is achieved.

[0051] Furthermore, in order to improve fault detection efficiency and avoid misjudgment interference from low-risk nodes, the disconnected slave device in this application can be identified from several potential disconnected slave devices.

[0052] Specifically, after identifying several potential disconnected slave devices, the EtherCAT master station can execute the aforementioned disconnected slave device determination process based on the port link status information of each EtherCAT slave device and the preset bidirectional working counter value, so as to identify the slave device that actually disconnected from the several potential disconnected slave devices, i.e., the disconnected slave device.

[0053] In this embodiment, this application determines whether any slave device is disconnected by identifying at least one of the following: uplink data anomaly, downlink data anomaly, or link status anomaly. By constructing a multi-dimensional real-time disconnection diagnosis through multiple anomaly judgments, the accuracy and efficiency of identifying disconnected slave devices are improved, thereby improving the self-healing efficiency of the master-slave communication link and ensuring the reliability of the communication link in high real-time industrial scenarios.

[0054] Based on the above embodiments of this application, a third embodiment of this application is proposed. In this third embodiment, content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 , Figure 3 This is a flowchart illustrating the third embodiment of the master-slave communication link self-healing method of this application; the step of reconstructing the communication link between the master station device and the slave device within a single communication cycle by bypassing the disconnected slave device includes steps S310~S330: Step S310: Obtain the network location information and breakpoint port information of the disconnected slave device; Specifically, the EtherCAT master station can scan each disconnected slave device to determine its network location information within the entire EtherCAT communication system, as well as the breakpoint port information. The network location information includes the logical address and physical adjacency of the disconnected slave device within the EtherCAT network topology. The breakpoint port information includes the identifier and fault mode of the faulty port.

[0055] In one feasible embodiment, the step of obtaining the network location information and breakpoint port information of the disconnected slave device includes steps C01 to C03: Step C01: Determine the network location information of the disconnected slave device based on the first difference between the number of data frames processed in the first physical direction and the first expected value, the second difference between the number of data frames processed in the second physical direction and the second expected value, and the port link status information. Step C02: Determine the breakpoint port information based on the port link status information of the disconnected slave device.

[0056] Since scanning each disconnected slave device by the EtherCAT master takes a long time, this implementation provides a method to more quickly determine the network location information and breakpoint port information of the disconnected slave device.

[0057] Specifically, based on the first difference between the number of data frames processed in the first physical direction and the first expected value, and the second difference between the number of data frames processed in the second physical direction and the second expected value, the precise location of the disconnected slave device in the EtherCAT network topology is derived by analyzing the direction and magnitude of the first and second differences and combining them with the port physical connection status in the port link status information of the disconnected slave device.

[0058] For example, if the first difference is abnormal while the second difference is normal and the output port is disconnected, the disconnected slave device is determined to be located at the end of the network topology; if both differences are abnormal and the input and / or output ports are disconnected, the disconnected slave device is determined to be located in the trunk segment of the network topology.

[0059] Specifically, based on the port physical connection status in the port link status information of the disconnected slave device, the port information in the disconnected state, i.e., the breakpoint port information, is determined.

[0060] Step S320: Within a single communication cycle, based on the network location information and breakpoint port information of the disconnected slave device, calculate several redundant data frame transmission paths in a way that bypasses the disconnected slave device. Specifically, in a single EtherCAT standard communication cycle, the EtherCAT communication system, through the EtherCAT master station, plans redundant data frame transmission paths in real time based on the network location information and breakpoint port information of the disconnected slave devices, according to the network topology type, by bypassing the disconnected slave devices throughout the entire network topology. For example, it generates a clockwise / counterclockwise dual path candidate set for a ring topology and generates a straight jump or loop path for a linear topology, thereby determining several redundant data frame transmission paths.

[0061] Understandably, to meet data transmission requirements, the redundant data frame transmission path in this embodiment may include at least one slave device from all slave devices in normal operation. Different redundant data frame transmission paths may traverse different numbers of slave devices.

[0062] Step S330: Based on the preset slave priority and the port information and load information of each slave device, a redundant communication link is determined from the several redundant data frame transmission paths, so as to reconstruct the communication link between the master device and the slave device based on the redundant communication link.

[0063] It should be noted that the preset slave priority refers to the criticality level set according to the industrial control requirements. For example, the priority of the motion controller is higher than that of the temperature sensor. The port information includes the available bandwidth and error rate of the port, and the load information refers to the workload and processing capacity of the slave processor.

[0064] Specifically, the EtherCAT master station can calculate the score of each EtherCAT slave station based on the preset slave station priority, as well as the port information and load information of each EtherCAT slave station, using a weighted scoring method. Then, based on the pre-configured scoring threshold or the number of slave devices traversed by the redundant data frame transmission path, redundant communication links can be determined from several redundant data frame transmission paths.

[0065] Then, based on the redundant communication link, by updating the destination MAC address sequence of the data frames of the EtherCAT slave, a port redirection command is sent to the EtherCAT slave to reconfigure the physical port connection of the EtherCAT slave, thereby completing the reconstruction of the communication link between the EtherCAT master and some EtherCAT slaves.

[0066] Furthermore, when the disconnected slave device comes back online, in order to achieve seamless reentry of the disconnected slave device, after the step of reconstructing the communication link between the master device and the slave device in a single communication cycle by bypassing the disconnected slave device, the method further includes step D01: Step D01: When the disconnected slave device recovers to a communicable state, the master device triggers the disconnected slave device to reset its state machine and clear its error state, and reconnects to the reconstructed communication link.

[0067] Specifically, when the physical link of the disconnected slave device is restored and the hardware self-test shows no abnormalities, the disconnected slave device is in a communicable state. Then, the EtherCAT master station triggers the disconnected slave device to reset its state machine, forcing the slave's state machine to transition from the current error state back to the initial state, and activating the communication function step by step in a preset order (e.g., INIT→PREOP→SAFEOP→OP). At the same time, the EtherCAT master station also needs to rewrite the error state of the disconnected slave device to clear the error state, so that the disconnected slave device can reconnect to the aforementioned reconstructed communication link.

[0068] In this embodiment, this application calculates several redundant data frame transmission paths within a single communication cycle based on the network location information and breakpoint port information of the disconnected slave device, bypassing the disconnected slave device. Then, based on the preset slave priority and the port and load information of each slave device, redundant communication links are determined from the several redundant data frame transmission paths. The communication link between the master device and the slave device is reconstructed based on the redundant communication links. This achieves the isolation of the disconnected slave device and the switching of the communication link within a single communication cycle, thereby improving the self-healing efficiency of the master-slave communication link and ensuring the reliability of the communication link in high real-time industrial scenarios.

[0069] It should be noted that the above embodiments can be combined and implemented in a reasonable manner according to the actual situation, and this embodiment will not elaborate on this further.

[0070] This application also provides a self-healing device for master-slave communication links; please refer to [reference needed]. Figure 4 The master-slave communication link self-healing device is applied to an Ethernet communication system, which includes a master station device and several slave station devices. The master-slave communication link self-healing device includes: The reading module 10 is used to read the port link status information of several slave devices based on the master station device, and obtain the preset bidirectional working counter value in the corresponding communication cycle; The determination module 20 is used to determine the plurality of slave devices based on the port link status information and the preset bidirectional working counter value, so as to determine the disconnected slave device, wherein the disconnected slave device is the slave device that actually disconnected. The reconstruction module 30 is used to reconstruct the communication link between the master station device and the slave station device in a single communication cycle, bypassing the disconnected slave station device.

[0071] The master-slave communication link self-healing device provided in this application, employing the master-slave communication link self-healing method described in the above embodiments, can solve the technical problem of how to improve the self-healing efficiency of the master-slave communication link. Compared with the prior art, the beneficial effects of the master-slave communication link self-healing device provided in this application are the same as those of the master-slave communication link self-healing method described in the above embodiments, and other technical features in the master-slave communication link self-healing device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0072] This application provides a master-slave communication link self-healing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the master-slave communication link self-healing method described in the above embodiments.

[0073] The following is for reference. Figure 5 This document illustrates a structural diagram suitable for implementing a master-slave communication link self-healing device in the embodiments of this application. The master-slave communication link self-healing device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The self-healing device for master-slave communication links shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0074] like Figure 5As shown, the master-slave communication link self-healing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in the read-only memory 1002 or a program loaded from the storage device 1003 into the random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the master-slave communication link self-healing device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the master-slave communication link self-healing device to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows master-slave communication link self-healing devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0075] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0076] The master-slave communication link self-healing device provided in this application, employing the master-slave communication link self-healing method described in the above embodiments, can solve the technical problem of how to improve the self-healing efficiency of the master-slave communication link. Compared with the prior art, the beneficial effects of the master-slave communication link self-healing device provided in this application are the same as those of the master-slave communication link self-healing method described in the above embodiments, and other technical features of the master-slave communication link self-healing device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0077] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0078] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0079] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the master-slave communication link self-healing method in the above embodiments.

[0080] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0081] The aforementioned computer-readable storage medium may be included in the master-slave communication link self-healing device; or it may exist independently and not be assembled into the master-slave communication link self-healing device.

[0082] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the master-slave communication link self-healing device, the master-slave communication link self-healing device: based on the master device, reads the port link status information of several slave devices and obtains a preset bidirectional working counter value in the corresponding communication cycle; judges the several slave devices according to the port link status information and the preset bidirectional working counter value to determine the disconnected slave device, wherein the disconnected slave device is the slave device that actually experienced a disconnection; and within a single communication cycle, reconstructs the communication link between the master device and the slave devices by bypassing the disconnected slave device.

[0083] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0084] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0085] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0086] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described master-slave communication link self-healing method, thereby solving the technical problem of how to improve the self-healing efficiency of the master-slave communication link. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the master-slave communication link self-healing method provided in the above embodiments, and will not be repeated here.

[0087] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the master-slave communication link self-healing method described above.

[0088] The computer program product provided in this application can solve the technical problem of how to improve the self-healing efficiency of master-slave communication links. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the master-slave communication link self-healing method provided in the above embodiments, and will not be repeated here.

[0089] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A self-healing method for master-slave communication links, characterized in that, The master-slave communication link self-healing method is applied to an Ethernet communication system, which includes a master station device and several slave station devices. The master-slave communication link self-healing method includes: Based on the master station device, the port link status information of several slave station devices is read, and the preset bidirectional working counter value in the corresponding communication cycle is obtained; Based on the port link status information and the preset bidirectional working counter value, the plurality of slave devices are judged to determine the disconnected slave device, which is the slave device that actually lost connection; Within a single communication cycle, the communication link between the master station device and the slave station device is reconstructed in a manner that bypasses the disconnected slave station device.

2. The self-healing method for master-slave communication links as described in claim 1, characterized in that, The preset bidirectional working counter value includes the number of data frame processing times in the first physical direction and the number of data frame processing times in the second physical direction. The step of judging the plurality of slave devices based on the port link status information and the preset bidirectional working counter value to determine the disconnected slave device includes: For any slave device, the number of times the first physical direction data frame is processed by the bidirectional working counter of the slave device is compared with the first expected value to determine whether the slave device has an uplink data anomaly. The number of data frames processed in the second physical direction by the bidirectional working counter of the slave device is compared with the second expected value to determine whether there is a downlink data anomaly in the slave device; Based on the port link status information, determine whether the slave device has a link status abnormality; If the slave device has at least one of the following: abnormal uplink data, abnormal downlink data, or abnormal link status, it is determined to be a disconnected slave device.

3. The self-healing method for master-slave communication links as described in claim 2, characterized in that, The steps of comparing the number of data frames processed in the first physical direction of the bidirectional working counter of the slave device with a first expected value to determine whether the slave device has uplink data anomalies, and comparing the number of data frames processed in the second physical direction of the bidirectional working counter of the slave device with a second expected value to determine whether the slave device has downlink data anomalies, include: When the number of times the first physical direction data frame is processed by the bidirectional working counter of the slave device is inconsistent with the first expected value, it is determined that the slave device has an uplink data anomaly. When the number of data frames processed in the second physical direction by the bidirectional working counter of the slave device is inconsistent with the second expected value, it is determined that there is a downlink data anomaly in the slave device.

4. The self-healing method for master-slave communication links as described in claim 1, characterized in that, The step of reconstructing the communication link between the master station device and the slave device within a single communication cycle, by bypassing the disconnected slave device, includes: Obtain the network location information and breakpoint port information of the disconnected slave device; Within a single communication cycle, based on the network location information and breakpoint port information of the disconnected slave device, several redundant data frame transmission paths are calculated to bypass the disconnected slave device. Based on the preset slave priority and the port and load information of each slave device, redundant communication links are determined from the several redundant data frame transmission paths, so as to reconstruct the communication link between the master device and the slave device based on the redundant communication links.

5. The self-healing method for master-slave communication links as described in claim 4, characterized in that, The step of obtaining the network location information and breakpoint port information of the disconnected slave device includes: The network location information of the disconnected slave device is determined based on the first difference between the number of data frames processed in the first physical direction and the first expected value of the bidirectional working counter of the disconnected slave device, the second difference between the number of data frames processed in the second physical direction and the second expected value, and the port link status information. The breakpoint port information is determined based on the port link status information of the disconnected slave device.

6. The self-healing method for master-slave communication links as described in claim 1, characterized in that, After the step of reconstructing the communication link between the master station device and the slave device within a single communication cycle by bypassing the disconnected slave device, the method further includes: When the disconnected slave device recovers to a communicable state, the master device triggers the disconnected slave device to reset its state machine and clear its error state, and then reconnects to the reconstructed communication link.

7. The self-healing method for master-slave communication links as described in claim 1, characterized in that, Before the step of determining the disconnected slave device based on the port link status information and the preset bidirectional working counter value, the method further includes: Based on historical port link status information and preset bidirectional working counter values, identify several potential disconnected slave devices. The step of determining the disconnected slave device by judging the plurality of slave devices based on the port link status information and the preset bidirectional working counter value includes: Based on the port link status information and the preset bidirectional working counter value, the plurality of potential disconnected slave devices are judged to determine the disconnected slave device, which is the slave device that actually disconnected.

8. A self-healing device for master-slave communication links, characterized in that, The master-slave communication link self-healing device is applied to an Ethernet communication system, which includes a master station device and several slave station devices. The master-slave communication link self-healing device includes: The reading module is used to read the port link status information of several slave devices based on the master station device, and obtain the preset bidirectional working counter value in the corresponding communication cycle; The determination module is used to determine the plurality of slave devices based on the port link status information and the preset bidirectional working counter value, so as to determine the disconnected slave device, wherein the disconnected slave device is the slave device that actually disconnected. The reconstruction module is used to reconstruct the communication link between the master station device and the slave station device within a single communication cycle, bypassing the disconnected slave station device.

9. A self-healing device for master-slave communication links, characterized in that, The master-slave communication link self-healing device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the master-slave communication link self-healing method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the master-slave communication link self-healing method as described in any one of claims 1 to 7.