Network switching method and device based on dual-redundancy control network
By adopting a network switching method based on a dual-redundant control network and utilizing clock synchronization and dynamic QoS scoring mechanisms, seamless switching of the industrial control system in the event of equipment failure is achieved, ensuring that the system can be maintained and upgraded without interruption of operation or production, thereby improving the system's reliability and real-time performance.
Patent Information
- Application Number
- CN202511510121.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2025-11-18
AI Technical Summary
In industrial control systems, when faced with scenarios such as equipment failure and sudden power outages, existing technologies struggle to achieve fully automated, uninterrupted, and unstoppable system maintenance and upgrades with zero interference and zero downtime. Furthermore, the reliability and real-time performance of the system cannot be guaranteed during vulnerability patching.
A network switching method based on a dual-redundant control network is adopted. Through dual-redundant architecture, clock synchronization mechanism, dynamic primary/backup switching and intelligent status monitoring, the high reliability, real-time performance and adaptive capability of the control network are achieved. The network quality assessment and dynamic switching are carried out by using a clock compensation model and dynamic QoS comprehensive scoring mechanism to ensure that the backup module can quickly and seamlessly take over when the primary module fails.
It enables seamless switching to backup networks in industrial control systems, avoiding system paralysis due to single point of failure, ensuring the timeliness of control commands and the timeliness of status feedback, improving bandwidth utilization, and meeting the stringent timing requirements of industrial control scenarios.
Smart Images

Figure CN120979912A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial communication technology, and in particular relates to a network switching method and apparatus based on a dual-redundant control network. Background Technology
[0002] In the industrial sector, the reliability of control systems is paramount. Faced with scenarios such as equipment failures, sudden power outages, and firmware upgrades, industrial systems must possess robust redundancy mechanisms to achieve truly zero-interference and zero-downtime operation. Furthermore, considering industrial system security requirements, vulnerability patching must support fully automated, non-stop, and production-uninterrupted repair modes. This can be achieved through a seamless switching method for control systems based on redundant networks. As industrial applications continue to deepen, different scenarios place varying demands on the reliability of industrial control systems, but the core objective remains focused on completing critical maintenance tasks such as system repair and upgrades while ensuring system and production line continuity, thereby minimizing the impact of maintenance processes on the continuity of industrial production. Summary of the Invention
[0003] To address the aforementioned issues, this invention proposes a network switching method and apparatus based on a dual-redundant control network. Through a dual-redundant architecture, clock synchronization mechanism, dynamic primary / backup switching, and intelligent status monitoring, the method achieves high reliability, real-time performance, and adaptive capability of the control network.
[0004] The first aspect of the present invention provides a network switching method based on a dual-redundant control network, comprising: Based on the master-slave configuration data, the first communication management module of the first network and the second communication management module of the second network are determined to be the master communication management module and the other is the backup communication management module through overlap time detection, dynamic arbitration or static arbitration, and master heartbeat detection. Based on the clock synchronization protocol, clock synchronization of the first network and the second network is achieved by constructing a clock compensation model. The clock compensation model obtains the first compensation parameter and the second compensation parameter corresponding to the first network and the second network through sliding window calculation. Periodic signals are obtained through the first communication management module or the second communication management module; Initiate the transmission of control data or status data during both signal transmission cycles and non-signal transmission cycles; Based on the status data, one of the first communication management module and the second communication management module is updated to become the primary communication management module, and the other becomes the backup communication management module.
[0005] Preferably, the network switching method based on the dual-redundant control network further includes real-time acquisition of the network quality of the first network and the second network and driving switching between the first network and the second network. The specific steps are as follows: Based on the first network and the second network respectively, network data and the file type of the network data are collected. The network data includes at least network latency, packet loss rate, jitter, and signal strength. Based on the network data, a first data point is obtained by normalizing the network data to eliminate dimensional differences. A dynamic QoS comprehensive score is obtained based on the first data and the file type using a dynamic weighting factor. Specifically, the process involves obtaining a dynamic weighting factor based on the file type, and then obtaining the QoS comprehensive score based on the first data and the weighting factor. The calculation expression is as follows: Q=α×L_norm+β×D_norm+γ×J_norm+δ×B_norm; In the formula, α, β, γ, and δ are the packet loss rate weight, network delay weight, jitter weight, and signal strength weight of the weighting factor, respectively; L_norm, D_norm, J_norm, and B_norm are the packet loss rate, network delay, jitter, and signal strength of the first data, respectively. The network is dynamically switched based on the dynamic QoS comprehensive score. The specific logic is as follows: a timed task monitors the quality of the first network and the quality of the second network. Specifically, if the dynamic QoS comprehensive score of the first network is greater than that of the second network, the first network is set to the master control state and the second network is set to the slave control state; if the dynamic QoS comprehensive score of the first network is less than that of the second network, the first network is set to the slave control state and the second network is set to the master control state.
[0006] Preferably, the step of determining, based on master-slave configuration data, which of the first communication management modules of the first network and the second communication management modules of the second network is the master communication management module and the other is the backup communication management module through overlap time detection, dynamic arbitration or static arbitration, and master heartbeat detection, further includes: Based on the master-slave configuration data, the master heartbeat timeout time, the first priority and the second priority corresponding to the first network and the second network are obtained respectively. The first communication management module and the second communication management module respectively initiate the first waiting task and the second waiting task, and dynamically obtain the overlap time and waiting time of the first waiting task and the second waiting task, and calculate the expression: t overlap =max(t start1, t start2 )+min(Δt1, Δt2); In the formula t overlap For the overlapping time, t start1 t start2 Let Δt1 and Δt2 be the start times of the first waiting task and the second waiting task, respectively, and their corresponding values within the waiting time. Based on the first waiting task, the second waiting task, and the overlapping time, the primary communication management module and the backup communication management module are determined through dynamic arbitration. The specific logic is as follows: if the first communication management module and the second communication management module acquire message data at the overlapping time, the primary communication management module and the backup communication management module are determined through dynamic arbitration. If neither the first communication management module nor the second communication management module acquires message data at the overlapping time, the primary communication management module and the backup communication management module are determined through static arbitration. If either the first communication management module or the second communication management module acquires message data at the overlapping time, the first communication management module or the second communication management module corresponding to the timed task that receives the message data is updated to the backup communication management module, and the other is the primary communication management module.
[0007] Preferably, the step of determining the primary communication management module and the backup communication management module through dynamic arbitration further includes: Based on the master-slave configuration data and network switching time, the first dynamic priority and second dynamic priority of the first communication management module or the second communication management module are obtained, and the calculation expressions are as follows:
[0008]
[0009] In the formula , These are the first dynamic priority and the second dynamic priority, respectively. , These are the first static priority and the second static priority of the master-slave configuration data, respectively. , These are the first and second decay constants of the master-slave configuration data, respectively. , These are the current time and the last time the primary and backup communication management modules were updated sequentially, respectively. Based on the first dynamic priority, the second dynamic priority, and the master-slave configuration data, the primary and backup communication management modules are confirmed through arbitration. The specific logic is as follows: if the first dynamic priority is greater than the second dynamic priority, the first communication management module and the second communication management module are respectively the primary communication management module and the backup communication management module; if the first dynamic priority is less than the second dynamic priority, the first communication management module and the second communication management module are respectively the backup communication management module and the primary communication management module; if the first dynamic priority is equal to the second dynamic priority, the first communication management module and the second communication management module are respectively the backup communication management module and the primary communication management module. A backoff time is constructed for the first communication management module and the second communication management module, and the calculation expression is: t_backoff=rand(0,T_max_backoff), where T_max_backoff is the maximum backoff time of the master-slave configuration data. If the backoff times are equal, the backoff time is recalculated; otherwise, the communication management module corresponding to the smaller backoff time value is identified as the primary communication management module, and the other is identified as the backup communication management module.
[0010] Preferably, it also includes starting a main heartbeat periodic task after determining the main communication management module. The period of the main heartbeat periodic task is the main heartbeat timeout time. If the heartbeat of the main communication management module is not detected in the periodic task, a network switch is driven.
[0011] Preferably, according to the network switching method based on a dual-redundant control network, the step of realizing clock synchronization of the first network and the second network respectively by constructing a clock compensation model based on a clock synchronization protocol further includes: Based on the clock synchronization protocol, the updated clocks of the first communication management module and the second communication management module are obtained by constructing a clock compensation model. The specific logic is as follows: the first communication management module and the second communication management module collect the returned response messages and obtain the timestamps of each transceiver node, and obtain the first one-way delay and the second one-way delay based on the timestamps. The first delay variance and the second delay variance are obtained through a sliding window algorithm based on the first unidirectional delay and the second unidirectional delay. Based on the first one-way delay, the second one-way delay, the first delay variance, and the second delay variance, a first compensation parameter and a second compensation parameter are obtained through a compensation algorithm; Based on the first compensation parameter and the second compensation parameter, clock synchronization is achieved by updating the corresponding communication couplers through the first communication management module and the second communication management module, respectively.
[0012] Preferably, the step of achieving clock synchronization between the first network and the second network respectively by constructing a clock compensation model based on the clock synchronization protocol further includes: the first network and the second network respectively preset a first calibration task and a second calibration task. The specific logic of the preset number of first waiting tasks and second waiting tasks is as follows: the synchronization errors of the first communication management module and the second communication management module are counted respectively. If a preset number of consecutive errors are hit, a special calibration clock is driven. The specific steps of calibrating the clock include: adjusting the period of the corresponding first waiting task or second waiting task to a preset period time; updating the dynamic coefficient of the compensation algorithm to a constant; adjusting the period time of the corresponding waiting task to the initial value; and triggering an early warning notification if the number of errors reaches a threshold.
[0013] Preferably, the step of transmitting control data or status data during the initiation signal transmission cycle and non-signal transmission cycle further includes: The main communication management module and the backup communication management module respectively send the control data during the signal transmission cycle and send the status data during the non-signal transmission cycle; The data of the first communication coupler of the first network or the second communication coupler of the second network is updated based on the control data or the status data.
[0014] A second aspect of the present invention provides a network switching device based on a dual-redundant control network, comprising: The first communication coupling module is used to realize data transmission and processing based on primary and backup control data through redundancy switching and real-time scheduling. It includes a first communication coupler, a second communication coupler, and several controlled modules. The first communication coupler and the second communication coupler are used for data communication between the primary and backup channels, respectively, and the controlled modules are used for sending and receiving data. The first communication management module is used to drive primary / backup switching based on primary / backup control data, synchronize clocks, and achieve redundant switching based on network adjustment and adaptive switching. The first communication module includes at least a first controller and a first communication manager. The second communication management module is used to drive primary / backup switching based on primary / backup control data, synchronize clocks, and achieve redundant switching based on network adjustment and adaptive switching. The second communication module includes at least a second controller and a second communication manager. The first communication manager is signal-connected to the first communication coupler, the second communication manager is signal-connected to the second communication coupler, and the first communication manager is signal-connected to the second communication manager.
[0015] Preferably, the signals between the first communication manager and the second communication manager are connected via twisted pair cable, optical fiber, backplane connection cable, or differential cable.
[0016] Because the present invention adopts the above technical solution, it has the following advantages and positive effects compared with the prior art: By waiting for task contention and dynamic network quality, the backup module can quickly and seamlessly take over in the event of a failure in the main communication management module or a deterioration in network quality, avoiding system paralysis caused by a single point of failure. The first and second networks operate independently, with physical layer redundancy achieved through a communication coupler.
[0017] The communication management module and coupler are synchronized based on a clock synchronization protocol, ensuring strict alignment of the rising edges of periodic signals to meet the stringent timing requirements of industrial control and other scenarios. Control data is prioritized for transmission during the signal transmission cycle, while status data is transmitted during non-periodic periods, avoiding competition between real-time control flow and non-real-time data and reducing latency jitter.
[0018] Based on status data such as master clock data, synchronization time, and master control identifier, the communication management module can accurately determine network health and achieve proactive switching rather than passive response. It obtains periodic signals through the communication management module or coupler, reducing additional synchronization signal overhead, and improves bandwidth utilization by dividing signal transmission periods into periodic and aperiodic time slots. Attached Figure Description
[0019] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings, wherein: Figure 1 This is a schematic diagram of the main flow of a network switching method based on a dual-redundant control network according to the present invention; Figure 2 This is a first schematic diagram of a network switching device based on a dual-redundant control network according to the present invention; Figure 3 This is a second schematic diagram of a network switching device based on a dual-redundant control network according to the present invention. Detailed Implementation
[0020] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The advantages and features of the present invention will become clearer from the following description and claims. It should be noted that the drawings are all in a very simplified form and use non-precise ratios, and are only used to facilitate and clarify the illustration of the embodiments of the present invention.
[0021] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.
[0022] First Embodiment See Figure 1The first aspect of the present invention provides a network switching method based on a dual-redundant control network, comprising: Based on the master-slave configuration data, the first communication management module of the first network and the second communication management module of the second network are determined to be the master communication management module and the other is the backup communication management module through overlap time detection, dynamic arbitration or static arbitration, and master heartbeat detection. Based on the clock synchronization protocol, clock synchronization of the first network and the second network is achieved by constructing a clock compensation model. The clock compensation model obtains the first compensation parameter and the second compensation parameter corresponding to the first network and the second network through sliding window calculation. Periodic signals are obtained through either the first or second communication management module; Initiate the transmission of control data or status data during both signal transmission cycles and non-signal transmission cycles; Based on the status data, update one of the first communication management module and the second communication management module to become the primary communication management module, and the other to become the backup communication management module.
[0023] By employing overlap detection, dynamic / static arbitration, and heartbeat monitoring, the status of the primary / backup communication management modules is determined in real time, ensuring seamless switching to the backup module in the event of a failure in either module, eliminating the risk of single-point failure. Combining the collaborative design of periodic signal transmission and non-signal transmission periods, continuous transmission of control / status data is maintained during switching, achieving seamless service switching. A sliding window algorithm generates first / second compensation parameters independent of the two networks, dynamically correcting clock skew between networks. A clock compensation model independently synchronizes the clocks of the two networks, resolving clock drift issues between multiple networks and providing a nanosecond-level time reference for periodic signal acquisition and data transmission / reception. By synchronizing the clock to constrain the boundaries between signal transmission and non-transmission periods, the timeliness of control commands and the timeliness of status feedback are ensured, meeting the hard real-time requirements of industrial control scenarios. Control data and status data are transmitted periodically, and important information can be repeatedly verified through multiple paths, reducing the risk of packet loss. Tasks can be flexibly scheduled during non-signal transmission periods, improving bandwidth utilization.
[0024] Preferably, the method further includes real-time acquisition of the network quality of the first network and the second network and driving switching between the first network and the second network, with the following specific steps: Based on the first network and the second network, network data and the file type of the network data are collected respectively. The network data includes at least network latency, packet loss rate, jitter, and signal strength. The first data, which eliminates dimensional differences in network data, is obtained through normalization processing based on network data. A dynamic QoS comprehensive score is obtained based on the first data and file type using a dynamic weighting factor. Specifically, the weighting factor is dynamically obtained based on the file type, and the QoS comprehensive score is obtained based on the first data and the weighting factor. The calculation expression is as follows: Q=α×L_norm+β×D_norm+γ×J_norm+δ×B_norm; In the formula, α, β, γ, and δ are the packet loss rate weight, network delay weight, jitter weight, and signal strength weight of the weighting factor, respectively; L_norm, D_norm, J_norm, and B_norm are the packet loss rate, network delay, jitter, and signal strength of the first data, respectively. The network is dynamically switched based on the dynamic QoS comprehensive score. The specific logic is as follows: a scheduled task monitors the quality of the first network and the second network. Specifically, if the dynamic QoS comprehensive score of the first network is greater than that of the second network, the first network is set to the master state and the second network is set to the slave state; if the dynamic QoS comprehensive score of the first network is less than that of the second network, the first network is set to the slave state and the second network is set to the master state.
[0025] The logic of this step is as follows: The first network and the second network collect network data respectively, with the collection period being a preset value. The network data includes at least network latency, packet loss rate, jitter, and signal strength. For each network data point, the parameters are compared with the average value. If the value exceeds the threshold, the corresponding network data is filtered out. The window size is preset, and updated network data is obtained by averaging the network data in the window. Based on the first network and the second network respectively collecting network data and the file types of the network data, the network data includes at least network latency, packet loss rate, jitter, and signal strength. The file types include voice, video, and packets. Different weight parameter strategies are specified for file types to obtain appropriate weight parameters. The weight parameters include at least: network latency weight, packet loss rate weight, jitter weight, and signal strength weight; wherein the sum of the network latency weight, packet loss rate weight, jitter weight, and signal strength weight is 1. Based on the network data, the network latency, packet loss rate, jitter, and signal strength parameters are normalized to obtain normalized network data. The dynamic QoS comprehensive score is obtained by weighting the normalized network data and the dynamic weight parameters, and the calculation expression is as follows: A dynamic QoS comprehensive score is obtained based on the first data and the file type using a dynamic weighting factor. Specifically, the weighting factor is dynamically obtained based on the file type using a weighting parameter strategy. The QoS comprehensive score is then obtained based on the first data and the weighting factor. The calculation expression is as follows: Q=α×L_norm+β×D_norm+γ×J_norm+δ×B_norm; In the formula, α, β, γ, and δ are the packet loss rate weight, network latency weight, jitter weight, and signal strength weight, respectively; L_norm, D_norm, J_norm, and B_norm are the packet loss rate, network latency, jitter, and signal strength of the normalized network data, respectively.
[0026] The network is dynamically switched based on dynamic QoS comprehensive score. The specific logic is as follows: a timed task monitors the quality of the first network and the second network. Specifically, if the dynamic QoS comprehensive score of the first network is greater than that of the second network, the first network is set to master control and the second network is set to slave control. If the dynamic QoS comprehensive score of the first network is less than that of the second network, the first network is set to slave control and the second network is set to master control. In the slave control state, the first communication management module in the first network is set as the backup communication management module, and the second communication management module in the second network is set as the master communication management module.
[0027] The system synchronously collects key indicators such as latency, packet loss rate, jitter, and signal strength to construct a multi-dimensional network profile and reduce the probability of misjudgment. Extreme outliers are filtered through thresholds to prevent single spikes from interfering with overall judgment. Windowed statistical averaging is employed to suppress instantaneous fluctuation noise and accurately capture network performance trends. A three-tiered progressive design—quantitative quality assessment, dynamic weight allocation, and a stable decision-making mechanism—achieves a complete closed loop from raw data to reliable decision-making, suitable for scenarios with extremely high real-time and reliability requirements, such as industrial control and vehicle networking. Timed tasks evaluate the quality of two networks in real time, automatically setting the network with better quality as the master and the other as the slave. This dynamic adjustment mechanism avoids the risks of a fixed master-slave mode, ensuring that the optimal network always undertakes critical tasks. If the quality of the master network deteriorates, the system automatically switches to the backup network for seamless takeover, ensuring continuous transmission of control commands and preventing paralysis due to single points of failure. Clock synchronization supports deterministic communication: a clock synchronization protocol ensures alignment of all network devices, guaranteeing strict synchronization of the rising edges of periodic signals, meeting the stringent timing requirements of industrial control. By dividing the signal transmission into periodic and aperiodic time periods, competition between real-time control flow and non-real-time data is avoided, latency jitter is reduced, and the timely arrival of critical instructions is ensured.
[0028] Preferably, the step of determining, based on master-slave configuration data, which of the first communication management modules of the first network and the second communication management modules of the second network is the master communication management module and the other is the backup communication management module through overlap time detection, dynamic arbitration or static arbitration, and master heartbeat detection, further includes: Based on the master-slave configuration data, obtain the master heartbeat timeout time, the first priority and the second priority of the first network and the second network respectively; The first and second communication management modules respectively initiate the first waiting task and the second waiting task, and dynamically obtain the overlap time and waiting time of the first and second waiting tasks, and calculate the expression: t overlap =max(t start1 , t start2 )+min(Δt1, Δt2); In the formula t overlap For the overlapping time, t start1 t start2 These are the start times of the first and second waiting tasks, respectively, and Δt1 and Δt2 are the corresponding values of the first and second waiting tasks during the waiting time.
[0029] Based on the first waiting task, the second waiting task, and the overlapping time, the primary communication management module and the backup communication management module are determined through dynamic arbitration. The specific logic is as follows: if the first communication management module and the second communication management module are detected to have acquired message data at the overlapping time, the primary communication management module and the backup communication management module are determined through dynamic arbitration. If neither the first communication management module nor the second communication management module has acquired message data at the overlapping time, the primary communication management module and the backup communication management module are determined through static arbitration. If either the first communication management module or the second communication management module has acquired message data at the overlapping time, the first communication management module or the second communication management module corresponding to the timed task for receiving message data is updated to the backup communication management module, and the other one becomes the primary communication management module.
[0030] The system locks the time window in which both communication management modules are in an "arbitrable" state to avoid misjudgments due to one party's incomplete readiness. By calculating the overlap time, the arbitration procedure is only initiated after both parties have entered a waiting state. Dynamic / static arbitration (such as priority comparison) is performed within the overlap window to ensure that only one module can become the master at any given time. This mechanism eliminates dual-master contention and ensures the uniqueness of the system control flow. Through mutual exclusion detection of the master clock flag within the overlap window, a yielding mechanism is forcibly triggered when both parties simultaneously declare sovereignty, ensuring that only one master module exists at any given time. The probability of dual-master coexistence is reduced from a theoretical value > 0 to close to 0. The "first to declare" principle is adopted, coupled with precise timing control. The two communication management modules (the first and second communication management modules) update the master / standby control through two waiting tasks (the first and second waiting tasks). If the first and second communication management modules receive a message containing the master clock flag during their respective waiting task cycles, they proactively update the corresponding communication management module to a backup module. If no message is received, the corresponding communication management module is updated to the master module and a master clock message is sent to the other communication management module. This logic ensures that there is ultimately only one master module in the system, avoiding resource contention or instruction conflicts caused by dual master conflicts. In this embodiment, the first preset time and the second preset time are not equal. Based on the clock source of the master module, the backup module and couplers and other devices synchronously adjust their local clocks to achieve nanosecond-level precision alignment, meeting the stringent timing requirements of industrial control and other scenarios. If the master module fails, and the backup module does not receive a message after the waiting task timeout, it will automatically be promoted to the master module and send a new master clock message, achieving fault self-healing and ensuring continuous system operation.
[0031] Preferably, the step of determining the primary communication management module and the backup communication management module through dynamic arbitration further includes: Based on the master-slave configuration data and network switching time, the first dynamic priority and second dynamic priority of the first or second communication management module are obtained, and the calculation expressions are as follows:
[0032]
[0033] In the formula , These are the first dynamic priority and the second dynamic priority, respectively. , These are the first and second static priorities of the master-slave configuration data, respectively. , These are the first and second decay constants of the master-slave configuration data, respectively. , These are the current time and the last time the primary and backup communication management modules were updated sequentially, respectively. Based on the first dynamic priority, the second dynamic priority, and the master-slave configuration data, the primary and backup communication management modules are confirmed through arbitration. The specific logic is as follows: if the first dynamic priority is greater than the second dynamic priority, the first and second communication management modules are respectively the primary and backup communication management modules; if the first dynamic priority is less than the second dynamic priority, the first and second communication management modules are respectively the backup and primary communication management modules; if the first dynamic priority is equal to the second dynamic priority, the first and second communication management modules are respectively the backup and primary communication management modules. The backoff time is constructed for the first and second communication management modules, and the calculation expression is: t_backoff=rand(0,T_max_backoff), where T_max_backoff is the maximum backoff time of the master-slave configuration data. If the backoff times are equal, the backoff time is recalculated; otherwise, the communication management module corresponding to the smaller value of the backoff time is identified as the primary communication management module, and the other is identified as the backup communication management module.
[0034] Modules that have not been selected for a long time gain higher potential priority due to exponential decay, forcing the system to periodically reassess the master-slave relationship. This prevents high-static-priority modules from monopolizing master control for a long time, leading to resource starvation for low-priority modules; it also encourages modules to actively maintain their own state (such as timely heartbeat reporting), otherwise their priority will continue to decline; faulty modules, due to ceasing to update timestamps, experience rapid priority decay, accelerating the rise of standby modules. This quickly filters out most asymmetric competition scenarios, reducing unnecessary fallback computational overhead.
[0035] Preferably, it also includes starting a main heartbeat periodic task after determining the main communication management module. The period of the main heartbeat periodic task is the main heartbeat timeout time. If the heartbeat of the main communication management module is not detected in the periodic task, the network switch is driven.
[0036] Faults are identified using the heartbeat cycle as the smallest unit, achieving the fastest theoretical self-healing speed; the health status of the main module across the entire chain is mapped through a single heartbeat signal; a complete closed loop from detection and judgment to execution is constructed, making the master-slave switchover a predictable and controllable deterministic behavior.
[0037] Preferably, the step of achieving clock synchronization between the first network and the second network respectively by constructing a clock compensation model based on the clock synchronization protocol further includes: Based on the clock synchronization protocol, the clocks of the first communication management module and the second communication management module are updated by constructing a clock compensation model. The specific logic is as follows: the first communication management module and the second communication management module collect the returned response messages and obtain the timestamps of each transmitting and receiving node, and obtain the first one-way delay and the second one-way delay based on the timestamps. The first delay variance and the second delay variance are obtained through a sliding window algorithm based on the first unidirectional delay and the second unidirectional delay. Based on the first one-way delay, the second one-way delay, the first delay variance, and the second delay variance, the first compensation parameter and the second compensation parameter are obtained through a compensation algorithm; Clock synchronization is achieved by updating the corresponding communication couplers through the first communication management module and the second communication management module based on the first compensation parameter and the second compensation parameter, respectively.
[0038] The specific steps are as follows: The first communication management module and the second communication management module respectively collect the return response messages and obtain the timestamps of each transceiver node. The timestamps of each transceiver node include at least the response reception timestamp, the synchronization transmission timestamp, and the response processing timestamp. Based on the timestamps of each transceiver node in the first and second communication management modules, respectively, the first one-way delay and the second one-way delay are obtained, and the calculation expression is as follows: D = (Response reception timestamp - Synchronization transmission timestamp - Response processing timestamp) / 2 In the formula, D represents either the first one-way delay or the second one-way delay; Based on the first unidirectional delay and the second unidirectional delay, the first delay variance and the second delay variance are obtained through a sliding window algorithm. The calculation expression is as follows: σ 2 =Σ(D i -μ) 2 / (n-1) In the formula, Di is the first or second unidirectional delay at index i in the window, μ is the average value within the sliding window, and n is the number of sliding windows.
[0039] Based on the first unidirectional delay, the second unidirectional delay, the first delay variance, and the second delay variance, the first compensation parameter and the second compensation parameter are obtained through a compensation algorithm, and the calculation expression is as follows: C = D_avg + k × σ In the formula, D_avg is the average of the first and second unidirectional delays within the sliding window, k is the dynamic weight parameter, and σ is the variance of the first or second delay.
[0040] Clock synchronization is achieved by updating the corresponding communication couplers through the first communication management module and the second communication management module based on the first compensation parameter and the second compensation parameter, respectively.
[0041] Clock synchronization is achieved by updating the corresponding communication couplers through the first and second communication management modules, respectively, based on the first and second compensation parameters. The calculation expression is as follows: The calibrated clock = timestamp in the response reception timestamp - compensation parameter of the first compensation parameter or the second compensation parameter - other delay parameters.
[0042] A sliding window replaces a fixed threshold, dynamically adapting to changes in network load. It not only corrects current deviations but also reserves margin for future fluctuations. Differentiated compensation allocates greater compensation bandwidth to high-variance links to avoid loss of synchronization in extreme cases. After updating their own clocks via a clock synchronization protocol, the first / second communication management modules send synchronization signals to the first / second communication couplers within their respective networks, eliminating clock skew between the management modules and the couplers and ensuring the consistency of data frame timestamps. The first network (first communication management module and first communication coupler) and the second network (second communication management module and second communication coupler) each form a ring control network, avoiding cross-network clock dependencies.
[0043] Preferably, the step of achieving clock synchronization between the first network and the second network respectively by constructing a clock compensation model based on the clock synchronization protocol further includes: the first network and the second network respectively preset a first calibration task and a second calibration task. The specific logic of the preset number of first waiting tasks and second waiting tasks is as follows: the synchronization errors of the first communication management module and the second communication management module are counted respectively. If a preset number of consecutive errors are hit, a special calibration clock is driven. The specific steps of calibrating the clock include: adjusting the period of the corresponding first waiting task or second waiting task to a preset period time; updating the dynamic coefficient of the compensation algorithm to a constant; adjusting the period time of the corresponding waiting task to the initial value; and triggering an early warning notification if the number of errors reaches a threshold.
[0044] A robust protection system, featuring daily dynamic compensation, periodic proactive calibration, and emergency alarms for anomalies, achieves a simplified and reliable operation. A clock synchronization system, integrating monitoring, calibration, and verification, enhances accuracy by predicting device status based on error rate, enabling manual intervention for equipment maintenance.
[0045] Preferably, the step of transmitting control data or status data during the initiation signal transmission cycle and non-signal transmission cycle further includes: The main communication management module and the backup communication management module send control data during the signal transmission cycle and status data during the non-signal transmission cycle, respectively. Update the data of the first communication coupler of the first network or the second communication coupler of the second network based on control data or status data.
[0046] During signal transmission cycles, the primary and backup communication management modules only send control data to avoid non-critical data interfering with the real-time control flow, ensuring low latency and determinism. During non-signal transmission cycles, the primary and backup modules send status data. This type of data has lower real-time requirements but needs to be updated periodically to reflect network health. Time-domain isolation prevents status data from consuming control channel bandwidth. Both primary and backup modules send control data, and the communication coupler can simultaneously receive two control commands, selecting the valid command for execution through logical decision-making (such as majority voting or priority comparison). If the primary control module fails, the backup module's control data can directly take over, ensuring control continuity.
[0047] Second Embodiment See Figure 2 and Figure 3 A second aspect of the present invention provides a network switching device based on a dual-redundant control network, comprising: The first communication coupling module is used to realize data transmission and processing based on primary and backup control data through redundancy switching and real-time scheduling. It includes a first communication coupler, a second communication coupler, and several controlled modules. The first communication coupler and the second communication coupler are used for data communication between the primary and backup channels, respectively, and the controlled modules are used for sending and receiving data. The first communication management module is used to drive primary / backup switching based on primary / backup control data, synchronize clocks, and achieve redundancy switching based on network adjustment and adaptive switching. The first communication management module includes at least a first controller and a first communication manager. The second communication management module is used to drive primary / backup switching based on primary / backup control data, synchronize clocks, and achieve redundant switching based on network adjustment and adaptive switching. The second communication management module includes at least a second controller and a second communication manager. The first communication manager is signal-connected to the first communication coupler, the second communication manager is signal-connected to the second communication coupler, and the first communication manager is signal-connected to the second communication manager.
[0048] This embodiment can employ multiple rack combinations, including either three racks or two racks. In the two-rack configuration, the first rack includes a first communication management module and a second communication management module; the first rack may or may not include several controlled modules, this embodiment is not limited, and the second rack includes a first communication coupling module. In the three-rack configuration, the third and fourth racks respectively include the first and second communication management modules; the fifth rack includes the first communication coupling module. Additionally, several incremental racks equipped with first communication coupling modules can be configured, with the first and second communication couplers in these incremental racks connected to the first and second communication management modules respectively. Through dual redundancy architecture, clock synchronization, adaptive switching, and real-time scheduling, deterministic latency and dynamic network optimization are achieved, making it suitable for scenarios with extremely high real-time and reliability requirements.
[0049] Preferably, the signals between the first communication manager and the second communication manager are connected via twisted pair cable, optical fiber, backplane connection cable, or differential cable.
[0050] Through twisted-structure or differential signal transmission, common-mode noise and electromagnetic interference can be effectively suppressed, making it suitable for strong electromagnetic environments in industrial settings and ensuring stable transmission of control and status data. Utilizing optical fiber achieves electromagnetic interference isolation, suitable for long-distance, high-interference scenarios, avoiding signal attenuation or bit errors. In a backplane bus architecture, short-distance, low-impedance printed circuits or high-speed connectors enable inter-module communication, reducing signal reflection and crosstalk, and improving the reliability of on-board transmission.
[0051] In the description of this application, it should be noted that the terms "inner" and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product is in use. These terms are used merely for the convenience of describing this application and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application. Furthermore, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0052] It should also be noted that, unless otherwise explicitly specified and limited, the terms "setup" and "connection" should be interpreted broadly, for example, as a fixed connection, a detachable connection, or an integral connection; as a direct connection or an indirect connection through an intermediate medium; or as a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0053] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific identification content executed by the system and device described above can be referred to the corresponding process in the foregoing method embodiments.
[0054] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments. Even if various changes are made to the present invention, if these changes fall within the scope of the claims of the present invention and their equivalents, they shall still fall within the protection scope of the present invention.
Claims
1. A network switching method based on a dual-redundant control network, characterized in that, include: Based on the master-slave configuration data, the first communication management module of the first network and the second communication management module of the second network are determined to be the master communication management module and the other is the backup communication management module through overlap time detection, dynamic arbitration or static arbitration, and master heartbeat detection. Based on the clock synchronization protocol, clock synchronization of the first network and the second network is achieved by constructing a clock compensation model. The clock compensation model obtains the first compensation parameter and the second compensation parameter corresponding to the first network and the second network through sliding window calculation. Periodic signals are obtained through the first communication management module or the second communication management module; Initiate the transmission of control data or status data during both signal transmission cycles and non-signal transmission cycles; Based on the status data, one of the first communication management module and the second communication management module is updated to become the primary communication management module, and the other becomes the backup communication management module.
2. The network switching method based on a dual-redundant control network according to claim 1, characterized in that, It also includes real-time acquisition of the network quality of the first network and the second network and driving switching between the first network and the second network, with the following specific steps: Based on the first network and the second network respectively, network data and the file type of the network data are collected. The network data includes at least network latency, packet loss rate, jitter, and signal strength. Based on the network data, a first data point is obtained by normalizing the network data to eliminate dimensional differences. A dynamic QoS comprehensive score is obtained based on the first data and the file type using a dynamic weighting factor. Specifically, the process involves obtaining a dynamic weighting factor based on the file type, and then obtaining the QoS comprehensive score based on the first data and the weighting factor. The calculation expression is as follows: Q=α×L_norm+β×D_norm+γ×J_norm+δ×B_norm; In the formula, α, β, γ, and δ are the packet loss rate weight, network delay weight, jitter weight, and signal strength weight of the weighting factor, respectively; L_norm, D_norm, J_norm, and B_norm are the packet loss rate, network delay, jitter, and signal strength of the first data, respectively. The network is dynamically switched based on the dynamic QoS comprehensive score. The specific logic is as follows: a timed task monitors the quality of the first network and the quality of the second network. Specifically, if the dynamic QoS comprehensive score of the first network is greater than that of the second network, the first network is set to the master control state and the second network is set to the slave control state; if the dynamic QoS comprehensive score of the first network is less than that of the second network, the first network is set to the slave control state and the second network is set to the master control state.
3. The network switching method based on a dual-redundant control network according to claim 1, characterized in that, The step of determining, based on master-slave configuration data, which involves overlapping time detection, dynamic or static arbitration, and master heartbeat detection, one of the first communication management modules of the first network and the second communication module of the second network is the master communication management module, and the other is the backup communication management module, further includes: Based on the master-slave configuration data, the master heartbeat timeout time, the first priority and the second priority corresponding to the first network and the second network are obtained respectively. The first communication management module and the second communication management module respectively start the first waiting task and the second waiting task, and dynamically obtain the overlap time and waiting time of the first waiting task and the second waiting task, and calculate the expression: t overlap =max(t start1 ,t start2 )+min(Δt1,Δt2); In the formula t overlap For the overlapping time, t start1 t start2 Let Δt1 and Δt2 be the start times of the first waiting task and the second waiting task, respectively, and their corresponding values within the waiting time. Based on the first waiting task, the second waiting task, and the overlapping time, the primary communication management module and the backup communication management module are determined through dynamic arbitration. The specific logic is as follows: if the first communication management module and the second communication management module acquire message data at the overlapping time, the primary communication management module and the backup communication management module are determined through dynamic arbitration. If neither the first communication management module nor the second communication management module acquires message data at the overlapping time, the primary communication management module and the backup communication management module are determined through static arbitration. If either the first communication management module or the second communication management module acquires message data at the overlapping time, the first communication management module or the second communication management module corresponding to the timed task that receives the message data is updated to the backup communication management module, and the other is the primary communication management module.
4. The network switching method based on a dual-redundant control network according to claim 3, characterized in that, The step of determining the primary communication management module and the backup communication management module through dynamic arbitration further includes: Based on the master-slave configuration data and network switching time, the first dynamic priority and second dynamic priority of the first communication management module or the second communication management module are obtained, and the calculation expressions are as follows: In the formula , These are the first dynamic priority and the second dynamic priority, respectively. , These are the first static priority and the second static priority of the master-slave configuration data, respectively. , These are the first and second decay constants of the master-slave configuration data, respectively. , These are the current time and the last time the primary and backup communication management modules were updated sequentially, respectively. Based on the first dynamic priority, the second dynamic priority, and the master-slave configuration data, the primary and backup communication management modules are confirmed through arbitration. The specific logic is as follows: if the first dynamic priority is greater than the second dynamic priority, the first communication management module and the second communication management module are respectively the primary communication management module and the backup communication management module; if the first dynamic priority is less than the second dynamic priority, the first communication management module and the second communication management module are respectively the backup communication management module and the primary communication management module; if the first dynamic priority is equal to the second dynamic priority, the first communication management module and the second communication management module are respectively the backup communication management module and the primary communication management module. A backoff time is constructed for the first communication management module and the second communication management module, and the calculation expression is: t_backoff=rand(0,T_max_backoff), where T_max_backoff is the maximum backoff time of the master-slave configuration data. If the backoff times are equal, the backoff time is recalculated; otherwise, the communication management module corresponding to the smaller backoff time value is identified as the primary communication management module, and the other is identified as the backup communication management module.
5. The network switching method based on a dual-redundant control network according to claim 4, characterized in that, It also includes starting a main heartbeat periodic task after determining the main communication management module. The period of the main heartbeat periodic task is the main heartbeat timeout time. If the heartbeat of the main communication management module is not detected in the periodic task, a network switch is driven.
6. The network switching method based on a dual-redundant control network according to claim 1, characterized in that, The steps of achieving clock synchronization between the first network and the second network by constructing a clock compensation model based on the clock synchronization protocol further include: Based on the clock synchronization protocol, the updated clocks of the first communication management module and the second communication management module are obtained by constructing a clock compensation model. The specific logic is as follows: the first communication management module and the second communication management module collect the returned response messages and obtain the timestamps of each transceiver node, and obtain the first one-way delay and the second one-way delay based on the timestamps. The first delay variance and the second delay variance are obtained through a sliding window algorithm based on the first unidirectional delay and the second unidirectional delay. Based on the first one-way delay, the second one-way delay, the first delay variance, and the second delay variance, a first compensation parameter and a second compensation parameter are obtained through a compensation algorithm; Based on the first compensation parameter and the second compensation parameter, clock synchronization is achieved by updating the corresponding communication couplers through the first communication management module and the second communication management module, respectively.
7. The network switching method based on a dual-redundant control network according to claim 6, characterized in that, The steps for achieving clock synchronization between the first network and the second network based on the clock synchronization protocol and by constructing a clock compensation model further include: the first network and the second network respectively preset a first calibration task and a second calibration task. The specific logic of the preset number of first waiting tasks and second waiting tasks is as follows: the synchronization errors of the first communication management module and the second communication management module are counted respectively. If a preset number of consecutive errors are hit, a special calibration clock is driven. The specific steps of calibrating the clock include: adjusting the period of the corresponding first waiting task or second waiting task to a preset period time; updating the dynamic coefficient of the compensation algorithm to a constant; adjusting the period time of the corresponding waiting task to the initial value; and triggering an early warning notification if the number of errors reaches a threshold.
8. The network switching method based on a dual-redundant control network according to claim 1, characterized in that, The steps of initiating the transmission of control data or status data during signal transmission cycles and non-signal transmission cycles further include: The main communication management module and the backup communication management module respectively send the control data during the signal transmission cycle and send the status data during the non-signal transmission cycle; The data of the first communication coupler of the first network or the second communication coupler of the second network is updated based on the control data or the status data.
9. A network switching device based on a dual-redundant control network, characterized in that, include: The first communication coupling module is used to realize data transmission and processing based on primary and backup control data through redundancy switching and real-time scheduling. It includes a first communication coupler, a second communication coupler, and several controlled modules. The first communication coupler and the second communication coupler are used for data communication between the primary and backup channels, respectively, and the controlled modules are used for sending and receiving data. The first communication management module is used to drive primary / backup switching based on primary / backup control data, synchronize clocks, and achieve redundant switching based on network adjustment and adaptive switching. The first communication module includes at least a first controller and a first communication manager. The second communication management module is used to drive primary / backup switching based on primary / backup control data, synchronize clocks, and achieve redundant switching based on network adjustment and adaptive switching. The second communication module includes at least a second controller and a second communication manager. The first communication manager is signal-connected to the first communication coupler, the second communication manager is signal-connected to the second communication coupler, and the first communication manager is signal-connected to the second communication manager.
10. The network switching device based on a dual-redundant control network according to claim 9, characterized in that, The first communication manager and the second communication manager are connected via twisted pair cable, optical fiber, backplane connection cable, or differential cable.