Dual-bus redundant communication and switching method and device, electronic equipment and storage medium
By transmitting Ethernet and CAN bus data frames in parallel within an industrial control system and dynamically switching paths based on transmission metrics, the reliability and continuity issues of existing communication systems in complex environments are resolved, achieving rapid automatic switching and stable data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-10
- Publication Date
- 2026-04-10
AI Technical Summary
In existing industrial control systems, the communication switching mechanism between Ethernet and CAN bus relies on a single bus, simple timeout, or manual intervention, which cannot achieve fast and reliable redundant switching in complex industrial environments, resulting in a high risk of communication interruption and insufficient system continuity.
The transmitter acquires industrial equipment parameters, encapsulates them into Ethernet and CAN bus data frames, and sends them to the receiver in parallel. The receiver monitors the transmission indicators of the two paths, dynamically determines the primary path, and automatically switches to the backup path in case of a failure.
It enables intelligent parallel monitoring and rapid automatic switching between Ethernet and CAN bus, improving the reliability and continuity of industrial communication systems and reducing the risk of data interruption due to single-path failure.
Smart Images

Figure CN121841898A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of path switching, in particular to a dual-bus redundant communication and switching method and device, electronic equipment and storage medium. BACKGROUND
[0002] In an industrial control system, Ethernet and CAN bus are often used together to realize communication between the management layer and the field layer. However, the current scheme usually relies on a single bus or simple dual backup, and the switching mechanism relies on simple timeout or manual intervention, which is slow in response and based on a single judgment, and cannot realize fast and reliable redundant switching in a complex industrial environment, resulting in high risk of communication interruption and insufficient system continuity. SUMMARY
[0003] Therefore, the purpose of the present application is to provide a dual-bus redundant communication and switching method and device, electronic equipment and storage medium, which realizes intelligent parallel monitoring and fast automatic switching of Ethernet and CAN bus, significantly improves the reliability and continuity of the industrial communication system, and reduces the risk of data interruption caused by single fault.
[0004] In a first aspect, the embodiments of the present application provide a dual-bus redundant communication and switching method, which includes: a sending end obtains industrial equipment parameters, and performs encapsulation processing based on the industrial equipment parameters to obtain an Ethernet data frame and a CAN bus data frame; the Ethernet data frame and the CAN bus data frame are sent in parallel to a receiving end through two independent physical communication paths; the receiving end receives data frames from the two physical communication paths in parallel, and dynamically determines one of the physical communication paths as a current main communication path based on the monitoring result of the transmission indicators of the two physical communication paths; and when it is monitored that the transmission indicator of the current main communication path meets a pre-set fault condition, the data communication path is switched from the current main path to the other physical communication path.
[0005] In a preferred embodiment of the present application, the encapsulation processing based on the industrial equipment parameters to obtain the Ethernet data frame and the CAN bus data frame includes: performing format standardization processing on the industrial equipment parameters to obtain standardized parameters; and encapsulating the standardized parameters into the Ethernet data frame and the CAN bus data frame according to the Ethernet protocol and the CAN bus protocol respectively; wherein the Ethernet data frame and the CAN bus data frame both contain the same node identifier, timestamp and parameter sequence number.
[0006] In the preferred embodiment of the present application, the parallel sending of Ethernet data frames and CAN bus data frames to the receiving end through two independent physical communication paths comprises: sending Ethernet data frames through an independently set Ethernet interface; sending CAN bus data frames through an independently set CAN bus interface; and the sending is synchronized in time or with a pre-set phase difference.
[0007] In the preferred embodiment of the present application, the monitoring result based on the transmission indicators of the two physical communication paths comprises: respectively counting the transmission indicators of the two physical communication paths; the transmission indicators include data reception success rate, transmission delay and signal quality indicators; performing content consistency check on the Ethernet data frames and CAN bus data frames from the same sending node to obtain a consistency check result; generating a comprehensive availability score of each physical communication path based on the transmission indicators and the consistency check result; and taking the comprehensive availability score as the monitoring result.
[0008] In the preferred embodiment of the present application, the dynamic determination of one of the physical communication paths as the current main communication path comprises: selecting a physical communication path with a comprehensive availability score higher than a pre-set score threshold as the current main communication path; and if the comprehensive availability scores of the two physical communication paths are both higher than the score threshold, selecting the path according to a pre-set priority strategy.
[0009] In the preferred embodiment of the present application, the fault condition comprises at least one of the following: continuous multiple times of not receiving data frames from the current main communication path; the comprehensive availability score of the current main communication path being lower than a pre-set score threshold; receiving a path switching instruction or a fault simulation instruction from the upper computer.
[0010] In the preferred embodiment of the present application, the switching of the data communication path from the current main path to another physical communication path comprises: sending a path switching notification to the sending end, so that the sending end sends subsequent data to the interface corresponding to the other physical communication path; updating the routing configuration at the receiving end to take the data from the other physical communication path as the effective data source; recording the path switching event and generating a switching report; and sending the switching report to the monitoring interface.
[0011] In a second aspect, the embodiments of the present application also provide a dual-bus redundant communication and switching device, which comprises: an industrial equipment parameter acquisition module, configured to acquire industrial equipment parameters at a sending end, and perform encapsulation processing based on the industrial equipment parameters to obtain an Ethernet data frame and a CAN bus data frame; a data frame sending module, configured to send the Ethernet data frame and the CAN bus data frame in parallel to a receiving end through two independent physical communication paths; a current main communication path dynamic determination module, configured to receive the data frames from the two physical communication paths at the receiving end in parallel, and dynamically determine one of the physical communication paths as a current main communication path based on a monitoring result of transmission indexes of the two physical communication paths; and a physical communication path switching module, configured to switch the data communication path from the current main path to the other physical communication path when it is monitored that the transmission index of the current main communication path meets a pre-set fault condition.
[0012] In a third aspect, the embodiments of the present application also provide an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the dual-bus redundant communication and switching method of the first aspect.
[0013] In a fourth aspect, the embodiments of the present application also provide a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions, when invoked and executed by a processor, cause the processor to implement the dual-bus redundant communication and switching method of the first aspect.
[0014] The embodiments of the present application have the following beneficial effects: The embodiments of the present application provide a dual-bus redundant communication and switching method, device, electronic device and storage medium, wherein the industrial equipment parameters are acquired at a sending end, and encapsulation processing is performed based on the industrial equipment parameters to obtain an Ethernet data frame and a CAN bus data frame, the Ethernet data frame and the CAN bus data frame are sent in parallel to a receiving end through two independent physical communication paths, the data frames from the two physical communication paths are received at the receiving end in parallel, and one of the physical communication paths is dynamically determined as a current main communication path based on a monitoring result of transmission indexes of the two physical communication paths, and the data communication path is switched from the current main path to the other physical communication path when it is monitored that the transmission index of the current main communication path meets a pre-set fault condition. In this way, intelligent parallel monitoring and fast automatic switching of the Ethernet and the CAN bus are realized, the reliability and continuity of the industrial communication system are significantly improved, and the risk of data interruption caused by single path failure is reduced.
[0015] Other features and advantages of the present disclosure will be set forth in the descriptions that follow, and in part will be apparent from the description, or can be learned by practice of the present disclosure as hereinafter more fully described, or can be learned by practice of the present disclosure.
[0016] In order to make the above objectives, features and advantages of the present disclosure more obvious and comprehensible, the following preferred embodiments are specifically described below, and the accompanying drawings are referred to for a detailed description. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings described below are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0018] Figure 1 A flow chart of a dual-bus redundant communication and switching method provided by an embodiment of the present application; Figure 2 A flow chart of another dual-bus redundant communication and switching method provided by an embodiment of the present application; Figure 3 A main working flow chart of a UDP transceiver module provided by an embodiment of the present application; Figure 4 A main working flow chart of a switching module provided by an embodiment of the present application; Figure 5 A main working flow chart of a switching module provided by an embodiment of the present application; Figure 6 A structural schematic diagram of a dual-bus redundant communication and switching device provided by an embodiment of the present application; Figure 7 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to make the objectives, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the present application will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.
[0020] In recent years, the Ethernet architecture has been widely applied in the industrial control field due to its high bandwidth, easy expansion and strong compatibility. The core application scenarios of the Ethernet architecture are concentrated in the management layer communication link. The Ethernet architecture is commonly used to connect data acquisition controllers, fault recorders, voltage and reactive power controllers and other management layer devices, to realize massive data interaction between these devices and a monitoring host or an operation and maintenance workstation, and to provide a stable data channel for upper management work such as production data statistics, fault analysis and system scheduling. At the same time, the CAN bus, as a mature field bus technology in the industrial field, occupies an important position in the field control link due to its low cost, high real-time performance, strong running stability, excellent electromagnetic interference resistance and the advantage of supporting simultaneous communication of multiple nodes (up to 110 nodes). The CAN bus is widely used in real-time instruction transmission and state feedback between devices, and is a key communication link connecting the monitoring layer and the field device layer.
[0021] In a modern industrial production environment, the field working conditions often exhibit a high degree of complexity. The production workshop is densely populated with various types of industrial equipment such as processing equipment, transmission devices and sensing components. The operation logic and signal format of different equipment differ significantly, and the equipment needs to be coordinated to complete a continuous production process, which poses a severe challenge to the overall stability of a system using a single communication mode.
[0022] Based on this, the embodiment of the present application provides a dual-bus redundant communication and switching method, device, electronic equipment and storage medium, which can obtain industrial equipment parameters through a sending end, and perform packaging processing based on the industrial equipment parameters to obtain an Ethernet data frame and a CAN bus data frame. The Ethernet data frame and the CAN bus data frame are sent in parallel to a receiving end through two independent physical communication paths. The receiving end receives data frames from the two physical communication paths in parallel, and dynamically determines one of the physical communication paths as a current main communication path based on a monitoring result of transmission indexes of the two physical communication paths. When it is monitored that the transmission index of the current main communication path meets a pre-set fault condition, the data communication path is switched from the current main path to the other physical communication path. In this way, intelligent parallel monitoring and rapid automatic switching of the Ethernet and the CAN bus are realized, the reliability and continuity of the industrial communication system are significantly improved, and the risk of data interruption caused by single path failure is reduced.
[0023] To facilitate understanding of the present embodiment, first, a dual-bus redundant communication and switching method disclosed by the present embodiment is described in detail.
[0024] Embodiment 1 The embodiment of the present application provides a dual-bus redundant communication and switching method, Figure 1 A flowchart of the dual-bus redundant communication and switching method provided by the embodiment of the present application is shown in FIG. 1.Figure 1 As shown, the dual-bus redundant communication and switching method can include the following steps: In step S101, the sending end obtains industrial equipment parameters and performs encapsulation processing based on the industrial equipment parameters to obtain an Ethernet data frame and a CAN bus data frame.
[0025] The industrial equipment parameters refer to real-time operation data collected from industrial field devices (such as sensors, PLCs, and motor controllers), such as temperature, pressure, speed, voltage, and switch status.
[0026] The encapsulation processing involves packing raw data according to a specific communication protocol format, adding frame headers, frame trailers, and check codes, and forming data frames that can be transmitted in a network.
[0027] The Ethernet data frame is a network packet that conforms to the IEEE 802.3 standard and typically includes a target MAC address, a source MAC address, a type field, a data payload, and a CRC check.
[0028] The CAN bus data frame conforms to the CAN 2.0A / B standard and includes an arbitration field, a control field, a data field (up to 8 bytes), and a CRC field.
[0029] The sending end (such as an embedded data acquisition terminal) reads sensor data through analog-to-digital conversion (ADC) or digital interfaces (such as GPIO and SPI).
[0030] Optionally, the data can be pre-processed before encapsulation, such as filtering and denoising, dimension normalization, and data compression, to improve data quality and reduce invalid transmissions.
[0031] The Ethernet protocol stack (such as LWIP) and the CAN driver library can be called separately to encapsulate the same set of parameters into two frame formats.
[0032] This implementation allows the same data source to be adapted to dual protocols, laying the foundation for redundant transmission.
[0033] Specifically, the encapsulation processing based on the industrial equipment parameters to obtain the Ethernet data frame and the CAN bus data frame can include: performing format standardization processing on the industrial equipment parameters to obtain standardized parameters; encapsulating the standardized parameters into Ethernet data frames and CAN bus data frames according to Ethernet protocols and CAN bus protocols, respectively; and wherein the Ethernet data frames and the CAN bus data frames both contain the same node identifier, timestamp, and parameter sequence number.
[0034] The standardization processing involves converting raw data of different sources, units, and precisions into a unified internal representation format. For example, temperature values are unified as Celsius (℃), floating-point numbers, and one decimal place.
[0035] Wherein, the standardization can be performed using a conversion formula or a lookup table, without limitation.
[0036] Wherein, the standardization can include data validity check, such as range check and mutation detection, and invalid data is marked and triggers an alarm.
[0037] Wherein, the Ethernet frame encapsulation: adding a 14-byte Ethernet header (MAC address, etc.), a 20-byte IP header (if using IP), and an 8-byte UDP header, and the data payload is the standardized parameter.
[0038] Wherein, the CAN frame encapsulation: the standardized parameter is divided into data blocks not exceeding 8 bytes, and an 11-bit or 29-bit identifier (representing node ID and parameter type) is added.
[0039] Wherein, to improve the utilization of the CAN bus, a data packaging strategy can be used to combine multiple parameters into one frame, and differential encoding can be used to reduce data volume.
[0040] Wherein, the node identifier: a unique identifier for the data source, such as device ID "NODE_001".
[0041] Wherein, the timestamp: absolute time (such as Unix timestamp) or relative system startup time in milliseconds. The timestamp can use a high-precision synchronous clock source (such as GPS or PTP) to ensure that the time alignment accuracy of the two-way data is within microseconds.
[0042] Wherein, the parameter sequence number: a self-incrementing counter used to detect frame loss and out-of-order.
[0043] Step S102, through two independent physical communication paths, Ethernet data frames and CAN bus data frames are sent to the receiving end in parallel.
[0044] Wherein, the independent physical communication path: refers to a hardware communication channel that does not interfere with each other, such as one through RJ45 network cable connection switch (Ethernet), and the other through twisted pair connection CAN bus network.
[0045] Wherein, parallel sending: two-way data frames are sent at the same time or almost at the same time, rather than sequentially.
[0046] Wherein, the sending end has dual network ports, specifically an Ethernet PHY chip (such as W5500) and a CAN controller (such as MCP2515).
[0047] Wherein, the time difference between the two frames can be ensured to be very small (such as <1ms) through a timer or real-time operating system (RTOS) task scheduling.
[0048] In which, two-way simultaneous transmission, avoid single path interruption resulting in complete failure of communication, time synchronization mechanism helps the receiving end more accurately to compare data and delay analysis.
[0049] Specifically, by two independent physical communication path, parallel sending Ethernet data frame and CAN bus data frame to the receiving end, can include: sending Ethernet data frame through the independent set of Ethernet interface; sending CAN bus data frame through the independent set of CAN bus interface.
[0050] In which, CAN bus interface: refers to the DB9 or terminal row connected to the CAN transceiver (such as TJA1050).
[0051] In which, CAN driver API can be called to write data frame into the sending mailbox.
[0052] In which, sending in time synchronization or by pre-set phase difference.
[0053] In which, synchronous sending: using the same hardware timer to trigger two-way sending task, to ensure simultaneous sending.
[0054] In which, phase difference sending: for example, Ethernet frame is sent at t time, CAN frame is sent at t+5ms, to reduce the bus instantaneous load by peak shifting.
[0055] In which, the phase difference can be dynamically adjusted according to the network load, to realize adaptive traffic shaping.
[0056] Step S103, the receiving end receives the data frame from the two physical communication paths in parallel, and dynamically determines one of the two physical communication paths as the current main communication path based on the monitoring results of the transmission indicators of the two physical communication paths.
[0057] In which, transmission indicators: parameters for quantifying communication quality, such as packet loss rate, delay, signal strength, bit error rate, etc.
[0058] In which, dynamic determination: automatically select the optimal path according to real-time monitoring results, rather than fixed configuration.
[0059] In which, the receiving end (such as the host computer industrial computer) simultaneously listens to two network interfaces. The monitoring module periodically calculates the RTT (round trip time), throughput and CRC error count of each path.
[0060] Optionally, double-buffered queues can be used to receive two-way data, and real-time analysis can be performed through timestamp alignment, so as to adaptively balance the load and avoid single link congestion.
[0061] In which, intelligent routing is realized, to improve the overall communication efficiency and stability.
[0062] Step S104, when the transmission index of the current primary communication path meets the pre-set failure condition, switching the data communication path from the current primary path to another physical communication path.
[0063] The failure condition includes at least one of the following: no data frame is received from the current primary communication path for a plurality of consecutive times; the comprehensive availability score of the current primary communication path is lower than a pre-set score threshold; a path switching instruction or a failure simulation instruction is received from a host computer.
[0064] For example, if no frame is received for 3 consecutive periods (3 seconds), it is determined that the link is interrupted.
[0065] For example, if the score suddenly drops from 80 to 40 (assuming that 40 is less than the score threshold), it is determined that the link is deteriorating.
[0066] For example, an operator clicks “force switch to CAN bus” through HMI, or issues a “simulate Ethernet interruption” test instruction.
[0067] The real-time transmission index is continuously compared with the failure condition, an interruption or event flag is triggered, the routing table is updated, and the application layer data source is notified to switch to the new path.
[0068] The new path can be temporarily dual-issued before it is ready to ensure zero data loss.
[0069] Specifically, switching the data communication path from the current primary path to another physical communication path can include: sending a path switching notification to the sending end, so that the sending end sends subsequent data to the interface corresponding to the other physical communication path; updating the routing configuration at the receiving end to treat data from the other physical communication path as a valid data source; recording the path switching event and generating a switching report, and sending the switching report to a monitoring interface.
[0070] The receiving end sends a “switch to Ethernet” instruction to the sending end through the path (such as CAN) that is still in operation. After receiving the instruction, the sending end stops sending to the faulty interface and starts sending to the backup interface.
[0071] Optionally, the notification mechanism can support ACK confirmation and retransmission to ensure reliable delivery of the switching instruction.
[0072] The internal routing table of the receiving end is updated: valid data source = CAN interface (assuming Ethernet failure). The application layer reads data from this interface and ignores data from the original interface (or only for monitoring).
[0073] The report content includes: switching time, reason, original path, new path, and switching time consumption.
[0074] The monitoring interface displays a red warning bar and a switching log.
[0075] Exemplarily, on an assembly line of a smart factory, the sending end is a data acquisition module installed at a joint of a robot, which acquires industrial equipment parameters such as torque, position, and temperature in real time. The module sends data to the receiving end (an industrial control server) in the control room in parallel through Ethernet (connected to the factory backbone network) and CAN bus (connected to the local control cabinet). The server dynamically monitors the quality of the two paths, and usually takes the low-delay CAN bus as the main path. When the CAN network has a rising packet loss rate due to electromagnetic interference, and the score is lower than the threshold, the system automatically switches to the Ethernet path within 50 ms, and a switching report is popped up on the monitoring screen. The whole process does not require manual intervention, ensuring the continuous operation of the assembly line, and reflecting the significant value of the method in improving the robustness of industrial communication systems and realizing unmanned operation and maintenance.
[0076] It should be noted that by optimizing the judgment logic and execution process of route switching, the response time of switching between the two bus communication paths is effectively shortened, fundamentally solving the problem of data transmission interruption between different bus types due to path failure, and further improving the reliability of data transmission in industrial monitoring systems, providing a more solid communication technology guarantee for the continuous and stable operation of industrial production.
[0077] The dual-bus redundant communication and switching method provided by the embodiment of the application can acquire industrial equipment parameters through the sending end, encapsulate the industrial equipment parameters to obtain an Ethernet data frame and a CAN bus data frame, send the Ethernet data frame and the CAN bus data frame in parallel to the receiving end through two independent physical communication paths, receive the data frames from the two physical communication paths in parallel by the receiving end, dynamically determine one of the physical communication paths as a current main communication path based on the monitoring result of the transmission indicators of the two physical communication paths, and switch the data communication path from the current main path to the other physical communication path when it is monitored that the transmission indicator of the current main communication path meets the pre-set failure condition. In this way, intelligent parallel monitoring and fast automatic switching of the Ethernet and the CAN bus are realized, the reliability and continuity of the industrial communication system are significantly improved, and the risk of data interruption caused by single-path failure is reduced.
[0078] Embodiment 2 The embodiment of the application also provides another dual-bus redundant communication and switching method; the method is implemented on the basis of the above-mentioned embodiment method; the method mainly describes a specific implementation manner of dynamically determining one of the physical communication paths as a current main communication path based on the monitoring result of the transmission indicators of the two physical communication paths.
[0079] Figure 2A flowchart of another dual-bus redundant communication and switching method provided by an embodiment of the present application is shown in FIG. 3, which dynamically determines one of the two physical communication paths as the current primary communication path based on the monitoring result of the transmission indicators of the two physical communication paths, and can include the following steps: Figure 2 The step of dynamically determining one of the two physical communication paths as the current primary communication path based on the monitoring result of the transmission indicators of the two physical communication paths can include the following steps: In step S201, the transmission indicators of the two physical communication paths are respectively counted.
[0080] The transmission indicators include a data reception success rate, a transmission delay, and a signal quality indicator.
[0081] The data reception success rate is: the number of successfully received frames / total number of frames to be received x 100%.
[0082] The transmission delay is the time difference from frame sending to receiving, which can be estimated by round trip time (RTT).
[0083] The signal quality indicator is: error frame count for CAN bus; CRC error count or link state (such as 100M / 10M) for Ethernet.
[0084] Optionally, delay variation can be introduced as an indicator to evaluate network stability.
[0085] In step S202, content consistency check is performed on the Ethernet data frames and CAN bus data frames from the same sending node to obtain a consistency check result.
[0086] The consistency check is: comparing whether the parameter values in the two frames are the same (within the allowable error range).
[0087] Optionally, the consistency check can identify data tampering or sensor failure, and when inconsistent, trigger data source credibility evaluation.
[0088] In step S203, based on the transmission indicators and the consistency check result, a comprehensive availability score of each physical communication path is generated.
[0089] For example, the comprehensive availability score = w1 x data reception success rate + w2 x (1 / transmission delay) + w3 x consistency flag.
[0090] w1, w2, and w3 are weights, which can be dynamically adjusted by machine learning method to adapt to different working conditions.
[0091] In step S204, the comprehensive availability score is taken as the monitoring result.
[0092] In step S205, the physical communication path with a comprehensive availability score higher than a pre-set score threshold is selected as the current primary communication path.
[0093] For example, the score threshold is set to 70, and only when the comprehensive availability score is higher than 70 can the candidate be qualified.
[0094] In step S206, if the comprehensive availability scores of the two physical communication paths are both higher than the score threshold, the path is selected according to the pre-set priority strategy.
[0095] For example, Ethernet priority (high bandwidth) or CAN priority (strong real-time performance). The priority strategy can be dynamically set, for example, Ethernet priority during daytime office hours and CAN priority during nighttime maintenance hours.
[0096] As an embodiment of the present application, in actual application, the host computer is the "data processing and control core" of the system. After receiving the Ethernet frame and CAN frame transmitted by the node, the host computer will immediately start the data analysis module to accurately extract and verify the core parameters, node identification, transmission timestamp and other information in the two types of data frames, to ensure the consistency of the received data and the node collected data. After the analysis is completed, the host computer will display the key information in real time through the visual interface: on the one hand, the running state of each node (such as whether it is normally collecting data, the current working mode) is clearly presented, and on the other hand, the connection state and transmission quality of the two transmission routes (Ethernet route and CAN bus route) are intuitively fed back, so that the operation and maintenance personnel can master the overall picture of system communication in real time.
[0097] At the same time, the host computer also has the core function of "active control and fault simulation". According to the actual test requirements or operation and maintenance scene, the host computer can send two types of key control frames to the specified node: one is the configuration frame. The operation and maintenance personnel can set the parameters through the host computer interface, and the "transmission time interval adjustment instruction" (such as modifying the default 1-second transmission period to 0.5 seconds or 2 seconds), "route switching instruction" (such as specifying transmission only through Ethernet, transmission only through CAN bus, or restoring double bus parallel transmission) are issued to the node by the configuration frame, to realize flexible regulation and control of the node transmission mode; the other is the fault frame. This frame can accurately simulate three types of faults commonly seen in industrial scenes, namely node collection fault (simulate data collection interruption caused by sensor failure), Ethernet transmission fault (simulate Ethernet line disconnection or signal interference), and CAN network transmission fault (simulate CAN bus node abnormality or bus conflict), which is used to test the fault tolerance ability and route switching efficiency of the system under fault conditions.
[0098] After receiving the configuration frame or fault frame sent by the upper computer, the field node will first start the instruction recognition and response module: if it is a configuration frame, the node will update its transmission parameters or routing selection according to the instruction content, and generate a "configuration effective confirmation signal"; if it is a fault frame, the node will simulate the corresponding fault state (such as stopping data collection, interrupting specified bus transmission), and generate a "fault simulation start feedback signal". Finally, the node will encapsulate the above response results into a feedback frame and return it to the upper computer through the corresponding communication interface. After receiving the feedback, the upper computer will update the state on the interface synchronously, forming a complete interactive closed loop of "upper computer instruction issuing-node response execution-result returning verification", ensuring that the control instructions and fault simulation operations of the entire system are traceable and verifiable.
[0099] As a specific implementation, the programming of the lower computer master control chip is realized by using the modularization idea, mainly including: initialization module (mainly needing to complete the initialization of clock, GPIO, SPI, W5500, CAN, timer), CAN transceiver module, UDP transceiver module, and GPIO module for communication between the two master control chips of the lower computer.
[0100] Figure 3 The main working process diagram of the UDP transceiver module provided for the embodiment of the application mainly realizes that: Under the default state, the UDP frame is transmitted once every 1s, and the content of the frame includes the analog value of the node, the switching value action result, the routing information, the transmission interval, and whether the node is faulty and the like.
[0101] The UDP frame sent by the upper computer is received in an interrupt manner, corresponding actions are taken after analyzing the instructions, and the results of the actions are transmitted to the upper computer at the moment when the next transmission time arrives.
[0102] Figure 4 The main working process diagram of the CAN transceiver module provided for the embodiment of the application mainly realizes that: Under the default state, the node transmits the CAN frame once every 1s, and the content of the frame includes the analog value of the node, the switching value action result, the routing information, the transmission interval, and whether the node is faulty and the like.
[0103] The CAN frame sent by the upper computer is received in an interrupt manner, corresponding actions are taken after analyzing the instructions, and the results of the actions are transmitted to the upper computer at the moment when the next transmission time arrives.
[0104] Figure 5The switching module provided by the embodiment of the present application mainly has the following working flow chart, and the switching Ethernet / CAN routing module mainly implements switching of Ethernet / CAN routing. The implementation manner is that two main controllers are connected through two GPIO ports, one port is used to send its own state information, and the other port is used to monitor the level information sent by the other party. In the normal working condition, only one Ethernet / CAN interacts with the upper computer, and when the Ethernet / CAN interface fails, the upper computer cannot receive the Ethernet / CAN information of the node. At this time, the upper computer sends a switching routing instruction to the redundant main controller, the redundant main controller sets the state information to high, and when the state information of the other party is low, the routing is switched, so that the control right is transferred.
[0105] Embodiment 3 Corresponding to the above method embodiment, the embodiment of the present application provides a dual-bus redundant communication and switching device, Figure 6 The structure diagram of the dual-bus redundant communication and switching device provided by the embodiment of the present application is shown in Figure 6 As shown in the figure, the dual-bus redundant communication and switching device can include: The industrial equipment parameter acquisition module 301 is used for the sending end to acquire the industrial equipment parameters, and encapsulates the industrial equipment parameters to obtain the Ethernet data frame and the CAN bus data frame.
[0106] The data frame sending module 302 is used for sending the Ethernet data frame and the CAN bus data frame to the receiving end in parallel through two independent physical communication paths.
[0107] The current main communication path dynamic determination module 303 is used for the receiving end to receive the data frame from the two physical communication paths in parallel, and dynamically determines one of the physical communication paths as the current main communication path based on the monitoring result of the transmission indicators of the two physical communication paths.
[0108] The physical communication path switching module 304 is used for switching the data communication path from the current main path to the other physical communication path when it is monitored that the transmission indicator of the current main communication path meets the pre-set failure condition.
[0109] The dual-bus redundancy communication and switching device provided by the embodiment of the present application can acquire industrial equipment parameters through a sending end, encapsulate the industrial equipment parameters to obtain an Ethernet data frame and a CAN bus data frame, send the Ethernet data frame and the CAN bus data frame to a receiving end in parallel through two independent physical communication paths, receive the data frames from the two physical communication paths in parallel by the receiving end, and dynamically determine one of the two physical communication paths as a current main communication path based on a monitoring result of transmission indexes of the two physical communication paths, and switch the data communication path from the current main path to the other physical communication path when it is monitored that the transmission index of the current main communication path meets a pre-set fault condition. In this way, intelligent parallel monitoring and fast automatic switching of the Ethernet and the CAN bus are realized, the reliability and continuity of the industrial communication system are significantly improved, and the risk of data interruption caused by single-path failure is reduced.
[0110] In some embodiments, the industrial equipment parameter acquisition module is further configured to perform format standardization processing on the industrial equipment parameters to obtain standardized parameters, and encapsulate the standardized parameters into an Ethernet data frame and a CAN bus data frame according to an Ethernet protocol and a CAN bus protocol respectively, wherein the Ethernet data frame and the CAN bus data frame both contain the same node identifier, timestamp and parameter serial number.
[0111] In some embodiments, the data frame sending module is further configured to send the Ethernet data frame through an independently set Ethernet interface, and send the CAN bus data frame through an independently set CAN bus interface, wherein the sending is synchronized in time or performed with a pre-set phase difference.
[0112] In some embodiments, the current main communication path dynamic determination module is further configured to respectively count transmission indexes of the two physical communication paths, wherein the transmission indexes include a data reception success rate, a transmission time delay and a signal quality index, perform content consistency checking on the Ethernet data frame and the CAN bus data frame from the same sending node to obtain a consistency checking result, generate a comprehensive availability score of each physical communication path based on the transmission indexes and the consistency checking result, and take the comprehensive availability score as the monitoring result.
[0113] In some embodiments, the current main communication path dynamic determination module is further configured to select a physical communication path with a comprehensive availability score higher than a pre-set score threshold as the current main communication path, and select a path according to a pre-set priority strategy if the comprehensive availability scores of the two physical communication paths are both higher than the score threshold.
[0114] In some embodiments, the fault condition comprises at least one of the following: a plurality of consecutive times of not receiving a data frame from the current primary communication path; a comprehensive availability score of the current primary communication path being lower than a pre-set score threshold; receiving a path switching instruction or a fault simulation instruction from a host computer.
[0115] In some embodiments, the physical communication path switching module is further configured to send a path switching notification to the sending end, so that the sending end sends subsequent data to an interface corresponding to another physical communication path; update a routing configuration at the receiving end, so that data from the another physical communication path is taken as a valid data source; record a path switching event and generate a switching report, and send the switching report to a monitoring interface.
[0116] The device provided in the embodiments of the present application has the same implementation principle and technical effects as the foregoing method embodiments. For brevity, the part not mentioned in the device embodiment part can be referred to the corresponding content in the foregoing method embodiments.
[0117] Embodiment 4 The embodiments of the present application further provide an electronic device for running the double-bus redundant communication and switching method. Figure 7 As shown in the structural schematic diagram of an electronic device, the electronic device comprises a memory 400 and a processor 401, wherein the memory 400 is configured to store one or more computer instructions, and the one or more computer instructions are executed by the processor 401 to implement the double-bus redundant communication and switching method.
[0118] Further, Figure 7 The electronic device further comprises a bus 402 and a communication interface 403, and the processor 401, the communication interface 403 and the memory 400 are connected through the bus 402.
[0119] The memory 400 can include a high-speed random access memory (RAM) and can also include a non-volatile memory, for example, at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used. The bus 402 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 7 In the foregoing description, only one bidirectional arrow is used to represent one bus or one type of bus.
[0120] The processor 401 can be an integrated circuit chip having a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 401 or the instruction in the form of software. The processor 401 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block diagram disclosed in the embodiment of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiment of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, etc. The storage medium in the storage 400 is read by the processor 401, and the hardware thereof is combined to complete the steps of the method of the above embodiment.
[0121] The embodiment of the present application also provides a computer readable storage medium, the computer readable storage medium stores computer executable instructions, when the computer executable instructions are called and executed by the processor, the computer executable instructions cause the processor to implement the above-mentioned double bus redundancy communication and switching method. For specific implementation, please refer to the method embodiment, which will not be repeated here.
[0122] The computer program product for performing the double bus redundancy communication and switching method provided by the embodiment of the present application includes a computer readable storage medium storing non-volatile program codes executable by the processor. The instructions included in the program codes can be used to execute the method described in the foregoing method embodiment. For specific implementation, please refer to the method embodiment, which will not be repeated here.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
[0124] In several embodiments provided by the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. The described device embodiments are merely schematic, and for example, the division of the units is only a logical function division, and there can be another division manner in actual implementation; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, or the among different units, can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electric, mechanical or other forms.
[0125] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. In actual implementation, some or all of the units can be selected according to the actual needs to achieve the purposes of the embodiments of the present application.
[0126] In addition, each function unit in the various embodiments of the present application can be integrated in one processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit.
[0127] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a non-volatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art, or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0128] Finally, it should be noted that the above-described embodiments are merely specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, but not to limit the present application, and the protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still make modifications or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features therein, within the technical scope disclosed by the present application, and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A dual-bus redundant communication and switching method, characterized in that, The method includes: The transmitting end acquires industrial equipment parameters and performs encapsulation processing based on the industrial equipment parameters to obtain Ethernet data frames and CAN bus data frames; The Ethernet data frames and the CAN bus data frames are sent to the receiving end in parallel through two independent physical communication paths; The receiving end receives data frames from two physical communication paths in parallel, and dynamically determines one of the physical communication paths as the current primary communication path based on the monitoring results of the transmission indicators of the two physical communication paths. When the transmission indicators of the current primary communication path are monitored to meet the preset fault conditions, the data communication path is switched from the current primary path to another physical communication path.
2. The method according to claim 1, characterized in that, The encapsulation process based on the industrial equipment parameters to obtain Ethernet data frames and CAN bus data frames includes: The parameters of the industrial equipment are standardized by performing format standardization processing to obtain standardized parameters; The standardized parameters are encapsulated into Ethernet data frames and CAN bus data frames according to the Ethernet protocol and CAN bus protocol, respectively. The Ethernet data frame and the CAN bus data frame both contain the same node identifier, timestamp, and parameter sequence number.
3. The method according to claim 1, characterized in that, The method of transmitting the Ethernet data frame and the CAN bus data frame to the receiving end in parallel through two independent physical communication paths includes: The Ethernet data frames are sent through a separately configured Ethernet interface; The CAN bus data frame is sent through a separately configured CAN bus interface; The transmission is synchronized in time or performed according to a preset phase difference.
4. The method according to claim 1, characterized in that, The monitoring results based on the transmission metrics of the two physical communication paths include: The transmission metrics for the two physical communication paths are calculated separately; the transmission metrics include: data reception success rate, transmission delay, and signal quality. Content consistency verification is performed on Ethernet data frames and CAN bus data frames from the same transmitting node to obtain the consistency verification result; Based on the transmission metrics and the consistency verification results, a comprehensive availability score is generated for each physical communication path. The comprehensive usability score is used as the monitoring result.
5. The method according to claim 4, characterized in that, The dynamic determination of one of the physical communication paths as the current primary communication path includes: Select the physical communication path whose overall availability score is higher than the preset score threshold as the current primary communication path; If the combined availability score of both physical communication paths is higher than the score threshold, then the path is selected according to the pre-set priority strategy.
6. The method according to claim 1, characterized in that, The fault condition includes at least one of the following: No data frames were received from the current primary communication path for several consecutive times; The overall availability score of the current primary communication path is lower than the preset score threshold; Receive path switching instructions or fault simulation instructions from the host computer.
7. The method according to claim 1, characterized in that, The step of switching the data communication path from the current primary path to another physical communication path includes: Send a path switching notification to the sending end, so that the sending end will send subsequent data to the interface corresponding to the other physical communication path; The receiving end updates the routing configuration to use data from another physical communication path as a valid data source; Record path switching events and generate switching reports, then send the switching reports to the monitoring interface.
8. A dual-bus redundant communication and switching device, characterized in that, The device includes: An industrial equipment parameter acquisition module is used to acquire industrial equipment parameters at the transmitting end and encapsulate the industrial equipment parameters to obtain Ethernet data frames and CAN bus data frames. The data frame sending module is used to send the Ethernet data frame and the CAN bus data frame to the receiving end in parallel through two independent physical communication paths; The current primary communication path dynamic determination module is used for the receiving end to receive data frames from two physical communication paths in parallel, and dynamically determine one of the physical communication paths as the current primary communication path based on the monitoring results of the transmission indicators of the two physical communication paths. The physical communication path switching module is used to switch the data communication path from the current primary path to another physical communication path when the transmission index of the current primary communication path is monitored to meet the preset fault conditions.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the dual-bus redundant communication and switching method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the dual-bus redundant communication and switching method according to any one of claims 1 to 7.