A redundant gateway failover method and system

By using a mirrored dual-queue and time stamp mechanism, the problems of data loss and out-of-order delivery during gateway redundancy switching are solved, enabling continuous data transmission and accurate reception during switching, thus improving the reliability and real-time performance of the communication system.

CN122137730APending Publication Date: 2026-06-02XJ ELECTRIC CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XJ ELECTRIC CO LTD
Filing Date
2026-03-10
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, gateway redundancy switching suffers from problems such as uneven switching, data loss, or duplication, leading to communication interruptions and incorrect judgments by the master station.

Method used

By employing a mirrored dual-queue and parallel transmission mechanism, events are assembled and assigned time stamps at the sending end to ensure continuous data transmission during switching, and duplicate data is removed at the receiving end based on the time stamps, thus ensuring that data is neither lost nor out of order.

Benefits of technology

It significantly shortens the handover latency, ensures data continuity and accuracy, reduces false alarms and malfunctions, and improves the reliability and real-time performance of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122137730A_ABST
    Figure CN122137730A_ABST
Patent Text Reader

Abstract

This invention belongs to the field of gateway redundancy control, specifically relating to a method and system for lossless switching of redundant gateways. The method includes: before each message enters the transmission process, it is assembled into an event containing the message's content; each event is simultaneously written into an active queue and a mirror queue set by the sender; under normal circumstances, only the active queue is controlled to send events; when a triggering condition causing communication channel switching occurs, the mirror queue and the active queue are controlled to send in parallel; before an event enters the transmission port, a corresponding time stamp is assigned to the event according to its entry order, with the same time stamp for the same event in the mirror queue and the active queue being identical; the receiver removes duplicate data based on the time stamp; if, based on the time stamp of the received events, an abnormal situation of packet loss or out-of-order events is determined, the sender controls the mirror queue to resend all events within a set time window corresponding to the abnormal situation to the receiver according to the event entry order.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of gateway redundancy control, and specifically relates to a method and system for lossless switching of redundant gateways. Background Technology

[0002] In power systems, most remote control communication systems currently adopt the IEC 60870-5-104 (referred to as 104) protocol. To ensure uninterrupted communication, the common gateway redundancy method is a dual-machine setup, i.e., two gateway devices, one as the master and the other as the backup. The master is responsible for maintaining communication with the dispatch master station, while the backup only monitors the status of the master. Once the master fails or the network is disconnected, the backup takes over the communication, and the master station reconnects to the backup.

[0003] The aforementioned problems and deficiencies include: 1) The handover is not smooth. When switching from the primary to the backup machine, or from one link to another, there are often interruptions of several hundred milliseconds or even several seconds. During this period, the primary station does not receive data, which can easily lead to the mistaken belief that the equipment has suffered a more serious failure. The main reason for this is that the handover requires re-establishing the connection, and 104 communication relies on a "stable connection". Once a handover occurs, the connection must be disconnected and then re-established, which naturally results in a gap in the process.

[0004] 2) Packet loss or duplication is common. During the switchover process, some data may be lost, or the same data may be sent twice. If the master station does not handle this properly, it will display an incorrect on / off status or value. The main reason is the lack of unified sequence control. After the switchover, the order of data transmission and reception will be disrupted; some devices may retransmit the most recent batch of data, causing the master station to receive duplicate information. Furthermore, there is a lack of a backup channel parallel mechanism. Most gateways only use one channel normally, with the other channel idle. Therefore, during the switchover, there is no pre-prepared data, and the channel must be re-established, causing delays.

[0005] Chinese invention patent application CN111786866A discloses a redundant communication method for seamless switching between multiple communication buses. The communication buses include at least two, with each communication terminal connected to each bus. The redundant communication method includes the following steps: S1: Each time the sender sends a message, it simultaneously pushes messages with identical content into the message sending queues of each communication bus; S2: Each communication bus retrieves data from its message sending queue and sends it; S3: The receiver places the messages received through each communication bus into the same queue. For multiple redundant messages with identical content, the system uses the first arriving message and discards the later-arriving redundant messages. This invention achieves zero loss of bus communication messages, continuous communication data, and no data loss or duplication during multi-bus switching, thereby realizing seamless switching between multiple communication buses and improving the safety, reliability, and availability of traffic control systems. Summary of the Invention

[0006] The purpose of this invention is to provide a method and system for seamless switching of redundant gateways, which solves the problems of uneven switching and easy packet loss or duplication in the primary and backup dual-machine gateway redundancy mode in the prior art.

[0007] To achieve the above objectives, the present invention provides a method for lossless switching of redundant gateways, comprising: Before each message enters the sending process, it is assembled into an event containing the content of the message itself. Each event is simultaneously written to the active queue and mirror queue set by the sender. Under normal circumstances, only the active queue is controlled to send events; when a triggering condition occurs that causes the communication channel to switch, the mirror queue and the active queue are controlled to send events in parallel; before an event enters the sending port, the event is assigned a corresponding time stamp according to the order in which the events enter, and the time stamp of the same event in the mirror queue and the active queue are the same; The receiving end removes duplicate data based on the timestamp; if the timestamp of the received event indicates an event packet loss or out-of-order event, the sending end controls the mirror queue to resend all events within the set time window corresponding to the abnormal situation to the receiving end in the order in which the events entered.

[0008] Furthermore, the event also includes the sequence number corresponding to the message; the order in which the events are entered is determined based on the sequence number.

[0009] Furthermore, based on the timestamp of the received events, the methods for determining whether event packet loss or out-of-order events has occurred include: The receiving end compares the order of the received events with the order of the timestamps corresponding to the order in which the events entered. If the order is inconsistent, it determines that the events have been lost or out of order, and returns the abnormal situation judgment result to the sending end.

[0010] Furthermore, the event also includes a point number corresponding to the message; the point number is used to characterize the data point to which the event belongs, so that the receiving end or subsequent processing module can obtain the description information of the data point based on the point number.

[0011] Furthermore, the message is an IEC 60870-5-104 message.

[0012] The above-described technical solution of the present invention provides a novel method for lossless switching of redundant gateways, the beneficial effects of which include: By employing a mirrored dual-queue and parallel transmission mechanism during master / slave or link switching, continuous data transmission is ensured during the switching period, making the interruption virtually imperceptible to the master station and eliminating communication "windows." Furthermore, a unified timestamp is introduced to uniformly sort transmitted data. The receiving end uses timestamps for deduplication and short-term replay within a time window to avoid duplicate and out-of-order packets. Retransmission via a mirrored queue guarantees no data loss or out-of-order delivery. This improves the accuracy of the master station's judgment, avoids remote signaling jitter, SOE sequence disorder, or telemetry jumps caused by packet loss or duplicate data during switching, and ensures continuous and correctly ordered data received by the master station, thereby reducing false alarms and malfunctions.

[0013] The present invention also provides a redundant gateway lossless switching system, including a transmission control module at the transmitting end and a reception control module at the receiving end; The sender assembles each message into an event containing the message content itself before the message enters the sending process, and then writes each event into the activity queue and mirror queue set by the sender. The sending end is also used to control the active queue to send events under normal circumstances; when a triggering condition that causes the communication channel to switch occurs, it controls the mirror queue and the active queue to send in parallel; and before an event enters the sending port, it assigns the corresponding time stamp to the event according to the order in which the events enter, and the time stamp of the same event in the mirror queue and the active queue are the same. The receiving end is used to remove duplicate data based on the time stamp; the sending end is also used to control the mirror queue to resend all events within the set time window corresponding to the abnormal situation to the receiving end in the order of event entry when it obtains the judgment result of the abnormal situation of event packet loss or event out of order based on the time stamp of the received event.

[0014] Furthermore, the event also includes the sequence number corresponding to the message; the order in which the events are entered is determined based on the sequence number.

[0015] Furthermore, the receiving end is also used to compare the order of the received events with the order of the timestamps corresponding to the order in which the events entered. If the order is inconsistent, it is determined that the event packet is lost or the events are out of order, and the abnormal situation judgment result is returned to the sending end.

[0016] Furthermore, the event also includes a point number corresponding to the message; the point number is used to characterize the data point to which the event belongs, so that the receiving end or subsequent processing module can obtain the description information of the data point based on the point number.

[0017] Furthermore, the message is an IEC 60870-5-104 message.

[0018] The technical solution of the redundant gateway lossless switching system described above in this invention can achieve the same beneficial effects as the redundant gateway lossless switching method described above. Attached Figure Description

[0019] Figure 1 This is a schematic diagram illustrating the principle of the lossless switching method for redundant gateways in an embodiment of the present invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0021] Implementation of lossless switching method for redundant gateways This embodiment presents a technical solution for a lossless switching method for redundant gateways. By using a mirrored dual-queue and parallel transmission mechanism during primary / backup switching or link switching, it ensures continuous data transmission during the switching process and guarantees that data is not lost or out of order.

[0022] The method includes: Before each message enters the sending process, it is assembled into an event containing the content of the message itself. Each event is simultaneously written to the active queue and mirror queue set by the sender. Under normal circumstances, only the active queue is controlled to send events; when a triggering condition occurs that causes the communication channel to switch, the mirror queue and the active queue are controlled to send events in parallel; before an event enters the sending port, the event is assigned a corresponding time stamp according to the order in which the events enter, and the time stamp of the same event in the mirror queue and the active queue are the same; The receiving end removes duplicate data based on the timestamp; if the timestamp of the received event indicates an event packet loss or out-of-order event, the sending end controls the mirror queue to resend all events within the set time window corresponding to the abnormal situation to the receiving end in the order in which the events entered.

[0023] In this system, the sending end refers to the gateway side, and the receiving end refers to the master station side. Through mirrored dual-queue and parallel transmission mechanisms during master-slave or link switching, continuous data transmission is ensured during the switching period, making the interruption virtually imperceptible to the master station and significantly reducing communication downtime. Furthermore, a unified time stamp is introduced to uniformly sort transmitted data, and deduplication and short-term replay of abnormal event intervals are implemented based on the time stamp, avoiding duplicate and out-of-order packets. Retransmission via mirrored queues ensures no data loss or out-of-order transmission. This improves the accuracy of the master station's judgment, avoiding remote signal jitter, SOE sequence disorder, or telemetry jumps caused by packet loss or duplicate data during switching, and ensuring continuous and correct data reception by the master station, thereby reducing false alarms and malfunctions. Compared to traditional disconnection reconnection methods that require millisecond-level recovery, this implementation's redundant gateway lossless switching method, through dual-channel parallelism and deduplication mechanisms, can control recovery time to the millisecond level, significantly shortening switching latency. This method is not dependent on a specific network type; it can be implemented on ordinary TCP / IP networks as well as in conjunction with industrial redundant networks such as PRP and HSR. Specifically, it can be applied to various scenarios such as substation communication gateways, dispatch front-end systems, and regional energy control systems.

[0024] Triggering conditions for communication channel switching may include primary / backup role switching, link quality degradation, TCP session interruption, etc.; communication channel switching includes communication switching between gateways or between links.

[0025] In this embodiment, refer to Figure 1 Under normal operating conditions, the sending end only retrieves events sequentially from the active queue and sends them. When a primary / backup role switch, link quality degradation, TCP session interruption, or other triggering conditions that may lead to a communication channel switch are detected, the sending end starts a mirror queue, enabling both the mirror queue and the active queue to output events to the receiving end simultaneously, achieving parallel transmission through dual channels. The receiving end performs duplicate event filtering (i.e., deduplication) and sequence integrity checks based on the timestamps. If the receiving end finds interruptions, reverse order, or jumps in the received timestamps, indicating event loss or out-of-order issues, it feeds back the received timestamp range to the sending end (no feedback is needed if no event loss or out-of-order issues occur, reducing unnecessary communication operations). Based on this, the sending end extracts historical events within a specified time window from the mirror queue and retransmits them in the order they entered, achieving short-term replay compensation for abnormal intervals.

[0026] In one specific embodiment, events are assigned corresponding time stamps according to their arrival order. Specifically, the first event entering the sending port can have its time stamp set to 1; subsequently, the time stamps of each event are incremented by 1 in the order of their arrival. For example, the second event entering the sending port has its time stamp set to 2, the third event has its time stamp set to 3, and so on. In other embodiments, other methods can also be used to assign time stamps to events according to their arrival order, as long as it ensures that the time stamps of the same event in the mirror queue and the active queue are the same. Logical time stamps ensure that data from different channels ("active queue" and "mirror queue") can be restored to a strict chronological order at the receiving end.

[0027] Specifically, refer to Figure 1 Based on the timestamp of the received events, the methods for determining whether event packet loss or out-of-order events has occurred include: The receiving end compares the order of the received events with the order of the timestamps corresponding to the order in which the events entered. If the order is inconsistent, it determines that the events have been lost or out of order, and returns the abnormal situation judgment result to the sending end.

[0028] In other implementations, the sending end can obtain the sequence of timestamps corresponding to the arrival order of all events from the receiving end, and then compare the sequence of timestamps of the received events returned by the receiving end with the sequence of timestamps of these events at the sending end. If the sequence is inconsistent, it is determined that event packet loss or event out-of-order delivery has occurred, and the sending end can directly obtain the abnormal situation determination result. Alternatively, a third party can perform the comparison between the sequence of timestamps of the events received by the receiving end and the sequence of timestamps corresponding to the event arrival order at the sending end. If the sequence is inconsistent, it is determined that event packet loss or event out-of-order delivery has occurred.

[0029] In this embodiment, the event also includes the sequence number corresponding to the message; the entry order of the events is determined based on the sequence number corresponding to the message. In one specific embodiment, the sequence number corresponding to the message can be directly used as the entry order of the events. In other embodiments, other methods can be used to determine the entry order of events based on the sequence number corresponding to the message.

[0030] In addition, in this embodiment, the event also includes the point number corresponding to the message (e.g., the Information Object Address (IOA) in the IEC 60870-5-104 protocol); this point number is used to characterize the data point to which the event belongs, making it easier for the receiving end or subsequent processing module to obtain the description information of the data point based on the point number. However, the point number is not a necessary technical feature for implementing the lossless switching mechanism in this embodiment, and can be selectively added according to actual application requirements.

[0031] In this embodiment, the gateway in question is an IEC 60870-5-104 gateway, that is, a gateway that uses the IEC 60870-5-104 communication protocol, and therefore the message is an IEC 60870-5-104 message. In other embodiments, gateways using other communication protocols may also be adapted.

[0032] In summary, this method, by introducing event abstraction (i.e., assembling messages into events), dual-queue mirroring, unified timing stamp marking, deduplication and replay mechanisms, can reduce data interruption during link switching or device switching in IEC 60870-5-104 communication, avoid packet loss or out-of-order delivery, maintain the integrity of the event sequence, and thus ensure the high reliability and real-time performance of telecom communication.

[0033] Implementation of a lossless switching system for redundant gateways This embodiment provides a technical solution for a redundant gateway lossless switching system, including a transmission control module at the transmitting end and a reception control module at the receiving end. The sender assembles each message into an event containing the message content itself before the message enters the sending process, and then writes each event into the activity queue and mirror queue set by the sender. The sending end is also used to control the sending of events only in the active queue under normal circumstances; when entering the state of switching between gateways or links, it controls the mirror queue and the active queue to send in parallel; and before the event enters the sending port, it assigns the corresponding time stamp to the event according to the order of the event's entry, and the time stamp of the same event in the mirror queue and the active queue are the same. The receiving end is used to remove duplicate data based on the time stamp; the sending end is also used to control the mirror queue to resend all events within the set time window corresponding to the abnormal situation to the receiving end in the order of event entry when it obtains the judgment result of the abnormal situation of event packet loss or event out of order based on the time stamp of the received event.

[0034] In this system, the sending end refers to the gateway side, and the receiving end refers to the master station side. Through mirrored dual-queue and parallel transmission mechanisms during master-slave or link switching, continuous data transmission is ensured during the switching period, making the interruption virtually imperceptible to the master station and significantly reducing communication "window periods." Furthermore, a unified time stamp is introduced to uniformly sort transmitted data, and deduplication is performed based on the time stamp, along with short-term replay of abnormal event intervals within a time window. This avoids duplicate and out-of-order packets, and retransmission via mirrored queues ensures no data loss or out-of-order delivery. This improves the accuracy of the master station's judgment, avoiding remote signal jitter, SOE sequence disorder, or telemetry jumps caused by packet loss or duplicate data during the switching process. It also ensures that the data received by the master station is continuous and in the correct order, thereby reducing false alarms and malfunctions. Compared to traditional disconnection reconnection methods that require millisecond-level recovery, the redundant gateway lossless switching system in this implementation, through dual-channel parallelism and deduplication mechanisms, can control the recovery time to the millisecond level, significantly shortening the switching latency. This method is not dependent on a specific network type. It can be implemented on ordinary TCP / IP networks and can also be used in conjunction with industrial redundant networks such as PRP and HSR. Specifically, it can be applied to various scenarios such as substation communication gateways, dispatch front-end machines, and regional energy control systems.

[0035] Triggering conditions for communication channel switching may include primary / backup role switching, link quality degradation, TCP session interruption, etc.; communication channel switching includes communication switching between gateways or between links.

[0036] In this implementation, under normal operating conditions, the sending end only retrieves events sequentially from the active queue and sends them. When a primary / backup role switch, link quality degradation, TCP session interruption, or other triggering conditions that may lead to a communication channel switch are detected, the sending end starts a mirror queue, enabling both the mirror queue and the active queue to simultaneously output events to the receiving end, achieving parallel transmission through dual channels. The receiving end performs duplicate event filtering (i.e., deduplication) and sequence integrity checks based on the timestamps. If the receiving end finds that the received timestamps are interrupted, reversed, or jumpy, indicating event loss or out-of-order issues, the receiving end feeds back the received timestamp range to the sending end (no feedback is needed if no event loss or out-of-order issues occur, reducing unnecessary communication operations). Based on this, the sending end extracts historical events within a specified time window from the mirror queue and retransmits them according to the event entry order, achieving short-term replay compensation for abnormal intervals.

[0037] In one specific embodiment, events are assigned corresponding time stamps according to their arrival order. Specifically, the first event entering the sending port can have its time stamp set to 1; subsequently, the time stamps of each event are incremented by 1 in the order of their arrival. For example, the second event entering the sending port has its time stamp set to 2, the third event has its time stamp set to 3, and so on. In other embodiments, other methods can also be used to assign time stamps to events according to their arrival order, as long as it ensures that the time stamps of the same event in the mirror queue and the active queue are the same. Logical time stamps ensure that data from different channels ("active queue" and "mirror queue") can be restored to a strict chronological order at the receiving end.

[0038] Specifically, the receiving end also compares the order of the received events with the order of the timestamps corresponding to the order in which the events entered. If the order is inconsistent, it determines that the events have been lost or out of order, and returns the abnormal situation judgment result to the sending end.

[0039] In other implementations, the sending end can obtain the sequence of timestamps corresponding to the arrival order of all events from the receiving end, and then compare the sequence of timestamps of the received events returned by the receiving end with the sequence of timestamps of these events at the sending end. If the sequence is inconsistent, it is determined that event packet loss or event out-of-order delivery has occurred, and the sending end can directly obtain the abnormal situation determination result. Alternatively, a third party can compare the sequence of timestamps of the events received by the receiving end with the sequence of timestamps corresponding to the arrival order of the events at the sending end. If the sequence is inconsistent, it is determined that event packet loss or event out-of-order delivery has occurred.

[0040] In this embodiment, the event also includes the sequence number corresponding to the message; the entry order of the events is determined based on the sequence number corresponding to the message. In one specific embodiment, the sequence number corresponding to the message can be directly used as the entry order of the events. In other embodiments, other methods can be used to determine the entry order of events based on the sequence number corresponding to the message.

[0041] In addition, in this embodiment, the event also includes the point number corresponding to the message (e.g., the Information Object Address (IOA) in the IEC 60870-5-104 protocol); this point number is used to characterize the data point to which the event belongs, making it easier for the receiving end or subsequent processing module to obtain the description information of the data point based on the point number. However, the point number is not a necessary technical feature for implementing the lossless switching mechanism in this embodiment, and can be selectively added according to actual application requirements.

[0042] In this embodiment, the gateway in question is an IEC 60870-5-104 gateway, that is, a gateway that uses the IEC 60870-5-104 communication protocol, and therefore the message is an IEC 60870-5-104 message. In other embodiments, gateways using other communication protocols may also be adapted.

[0043] In summary, by introducing event abstraction (i.e., assembling messages into events), dual-queue mirroring, unified timing stamp marking, deduplication and replay mechanisms, this system can reduce data interruptions during link switching or device switching in IEC 60870-5-104 communication, avoid packet loss or out-of-order delivery, maintain the integrity of the event sequence, and thus ensure the high reliability and real-time performance of telecom communication.

[0044] It should be understood that the above-described specific embodiments of the present invention are merely illustrative or explanatory of the principles of the present invention, and do not constitute a limitation thereof.

Claims

1. A method for lossless switching of redundant gateways, characterized in that, include: Before each message enters the sending process, it is assembled into an event containing the content of the message itself. Each event is simultaneously written to the active queue and mirror queue set by the sender. Under normal circumstances, only the active queue is controlled to send events; when a triggering condition occurs that causes the communication channel to switch, the mirror queue and the active queue are controlled to send events in parallel; before an event enters the sending port, the event is assigned a corresponding time stamp according to the order in which the events enter, and the time stamp of the same event in the mirror queue and the active queue are the same; The receiving end removes duplicate data based on the timestamp; If, based on the timestamps of the received events, it is determined that there is an abnormal situation of event packet loss or event out-of-order delivery, the sending end controls the mirror queue to resend all events within the set time window corresponding to the abnormal situation to the receiving end in the order in which the events entered.

2. The method for lossless switching of redundant gateways according to claim 1, characterized in that, The event also includes the sequence number corresponding to the message; the order in which the events are entered is determined based on the sequence number.

3. The method for lossless switching of redundant gateways according to claim 1 or 2, characterized in that, Based on the timestamp of the received events, the methods for determining whether event packet loss or out-of-order events has occurred include: The receiving end compares the order of the received events with the order of the timestamps corresponding to the order in which the events entered. If the order is inconsistent, it determines that the events have been lost or out of order, and returns the abnormal situation judgment result to the sending end.

4. The method for lossless switching of redundant gateways according to claim 1 or 2, characterized in that, The event also includes a point number corresponding to the message; the point number is used to characterize the data point to which the event belongs, so that the receiving end or subsequent processing module can obtain the description information of the data point based on the point number.

5. The method for lossless switching of redundant gateways according to claim 1 or 2, characterized in that, The message is an IEC60870-5-104 message.

6. A redundant gateway lossless switching system, characterized in that, This includes a transmission control module at the sending end and a reception control module at the receiving end; The sender assembles each message into an event containing the message content itself before the message enters the sending process, and then writes each event into the activity queue and mirror queue set by the sender. The sending end is also used to control the active queue to send events under normal circumstances; when a triggering condition that causes the communication channel to switch occurs, it controls the mirror queue and the active queue to send in parallel; and before an event enters the sending port, it assigns the corresponding time stamp to the event according to the order in which the events enter, and the time stamp of the same event in the mirror queue and the active queue are the same. The receiving end is used to remove duplicate data based on the timestamp; The sending end is also used to control the mirror queue to resend all events within the set time window corresponding to the abnormal situation to the receiving end in the order of event entry when it obtains the judgment result of the abnormal situation, which is determined by the time stamp of the received event.

7. The redundant gateway lossless switching system according to claim 6, characterized in that, The event also includes the sequence number corresponding to the message; the order in which the events are entered is determined based on the sequence number.

8. The redundant gateway lossless switching system according to claim 6 or 7, characterized in that, The receiving end is also used to compare the order of the received events with the order of the timestamps corresponding to the order in which the events entered. If the order is inconsistent, it is determined that the event packet is lost or the events are out of order, and the abnormal situation judgment result is returned to the sending end.

9. The redundant gateway lossless switching system according to claim 6 or 7, characterized in that, The event also includes a point number corresponding to the message; the point number is used to characterize the data point to which the event belongs, so that the receiving end or subsequent processing module can obtain the description information of the data point based on the point number.

10. The redundant gateway lossless switching system according to claim 6 or 7, characterized in that, The message is an IEC60870-5-104 message.