A redundant device cycle number synchronization method, device and medium
By adopting the redundant equipment cycle number synchronization method in the rail transit system, the problem of slave equipment being unable to synchronize when the master equipment fails is solved, the stability and reliability of the system are improved, and the continuity and safety of the train are ensured.
Patent Information
- Application Number
- CN202411849677.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-12-16
AI Technical Summary
When the master device or communication link of the existing rail transit system fails, the cycle number of the slave device cannot be synchronized in time, resulting in the system being unable to switch smoothly, affecting normal communication and system stability.
A redundant device cycle number synchronization method is adopted, with the devices at both ends being redundant with each other, independently initializing and maintaining the cycle number, and determining the master-slave relationship based on the train status to ensure that the slave device can quickly take over the task when the master device fails, keeping the system running uninterrupted.
It enhances the stability and reliability of the system, ensures seamless switching when the main equipment fails, reduces the impact of the failure on other parts of the system, and ensures the continuity and safety of train operation.
Smart Images

Figure CN119659698B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a rail transit signal system, and in particular to a redundant equipment period number synchronization method, equipment and medium. Background Art
[0002] In the rail transit sector, safety is the cornerstone of design architecture. Faced with a volatile operating environment, onboard equipment must maintain continuous functionality, placing a higher bar on rigorous system design. To enhance system reliability, one strategy is to introduce redundant system mechanisms. This ensures that if a primary device fails, the system can smoothly switch from dual-machine redundant mode to single-machine operation, with the standby computer taking over control and continuing to process system transactions.
[0003] However, in current rail transit systems, slave devices generally adopt a relatively passive mode for cycle number synchronization. This mode relies on synchronization messages sent by the master device to adjust its own cycle number to ensure consistency with the master device. While this mode works effectively when the communication link is normal, if the master device or the communication link fails, the slave device will not be able to obtain the correct cycle number information in a timely manner, which will affect normal communication with external devices and prevent the system from smoothly completing mode switching.
[0004] After searching, Chinese patent publication number CN105227289A discloses a fast, accurate and safe clock synchronization method and system, which specifically discloses the following: clock synchronization during the process of starting and joining the clock channel to be added; and clock synchronization between the master clock channel and each slave clock channel during operation; when the clock channel to be added starts, it sends a clock synchronization request message to the master clock channel, and the master clock channel replies with its own clock operation information to the clock channel to be added; the clock channel to be added obtains the current clock information and the time to wait through calculation, and after waiting for the time, the clock channel to be added is officially added; during the operation of multiple clock channels, one of the channels is used as the master clock channel, and the other channels are used as slave clock channels, and clock synchronization is performed with the master clock channel, once for each task cycle. However, this existing patent still has the problem of being unable to perform clock synchronization when the main device or communication link fails. Therefore, how to quickly respond and make adjustments in the face of device failure, communication interruption or other potential risks becomes a technical problem that needs to be solved. Summary of the Invention
[0005] The purpose of the present invention is to provide a redundant device cycle number synchronization method, device and medium in order to overcome the defects of the above-mentioned prior art.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] According to a first aspect of the present invention, a method for synchronizing cycle numbers of redundant devices is provided, the method comprising the following steps:
[0008] Step S1: The devices at both ends are redundant. From the moment they are powered on, they initialize and maintain their own cycle numbers based on their own security clocks and the train locomotive positions.
[0009] Step S2: Allocate cycle numbers to the devices at both ends. The allocation principle is that the two ranges are different and non-intersecting. The validity of the message and the destination of the redundant device are determined based on the cycle number in the message.
[0010] In step S3, the devices at both ends determine the master-slave relationship based on the train status information. If the device is confirmed to be the master device, step S4 is executed; otherwise, step S5 is executed;
[0011] Step S4, executing the master device side process;
[0012] Step S5, executing the process from the device side.
[0013] As a preferred technical solution, the cycle number in step S1 is used as a time tag for communicating with the outside world to monitor the timeliness of the communication.
[0014] As a preferred technical solution, the cycle number allocation in step S2 is specifically as follows: the cycle number range of device 1 is 0 to 2 29 -1; the cycle number range of device 2 is 2 29 to 2 30 -1.
[0015] As a preferred technical solution, the step S2 of determining whether the message is valid according to the cycle number in the message is as follows:
[0016] Step S21: Determine whether the message is a reply to the local end or the redundant end based on the cycle number in the new message. If the message is a reply to the local end, execute step S22; otherwise, execute step S23;
[0017] Step S22, verifying the validity of the message replied to the local terminal;
[0018] Step S23, verifying the validity of the message replied to the redundant end;
[0019] Step S24: determine whether the message is the latest.
[0020] As a preferred technical solution, the verification process of step S22 is specifically as follows:
[0021] Compare the local cycle number with the new message cycle number. If the new message cycle number is within the validity period of the local cycle number, the packet message is considered valid. The new message cycle number must meet the following conditions within the validity period of the local cycle number: (1) the local cycle number is greater than the new message cycle number; (2) the sum of the new message cycle number and the maximum transmission delay in the network is greater than the local cycle number.
[0022] As a preferred technical solution, the local cycle number update process is specifically as follows:
[0023] S221) Initialization: Initialize the local cycle number according to the train head position of the local end: if the local end is device 1, initialize the local cycle number to 0; if the local end is device 2, initialize the local cycle number to 2 29 ;
[0024] S222) The cycle number is incremented and reset, and the local cycle number is increased by 1 every cycle: if the local end is device 1, when the local cycle number exceeds 2 29 -1, the cycle number of the local end is reset to the initial value 0; if the local end is device 2, when the cycle number exceeds 2 30 -1, the local cycle number is reset to the initial value 2 29 .
[0025] As a preferred technical solution, the verification process of step S23 is specifically as follows:
[0026] Compare the minimum cycle number and maximum cycle number of the redundant end with the cycle number of the new message. If the cycle number of the new message is within the validity period of the redundant end, the new message is considered valid. The cycle number of the new message needs to meet the following conditions at the same time within the validity period of the redundant end: (1) the cycle number of the new message is greater than the minimum cycle number of the redundant end; (2) the cycle number of the new message should be less than the maximum cycle number of the redundant end.
[0027] As a preferred technical solution, the redundant end minimum cycle number update process is specifically as follows:
[0028] S231) Initializing the minimum cycle number of the redundant end to a default invalid value of -1 according to the train head position of the local end;
[0029] S232) If a new redundant end message is received within the current cycle and the redundant end message is available, updating the redundant end minimum cycle number to the current cycle number in the received redundant end message;
[0030] S233) If no new redundant end message is received in this cycle, but the previous redundant end message is still within the validity period, the redundant end minimum cycle number is incremented. If the local end is device 1, if the incremented redundant end minimum cycle number exceeds 2 30 -1, reset to the initialization value 2 29If the local end is device 2, if the incremented minimum cycle number of the redundant end exceeds 2 29 -1, reset to the initialization value 0;
[0031] S234) If no valid redundant end message is received for a long time, the redundant end minimum cycle number is set to the default invalid-1.
[0032] As a preferred technical solution, the redundant end maximum cycle number update process is specifically as follows:
[0033] When a new message is received from the redundant end, the maximum cycle number of the redundant end is updated. Taking into account the transmission delay in the network, the maximum cycle number is the minimum cycle number of the redundant end plus the maximum transmission delay in the network.
[0034] As a preferred technical solution, in step S3, when device 1 and device 2 communicate normally, the two devices confirm the consistency of the master-slave relationship by sending synchronization information;
[0035] (1) When communication between devices is normal, the master device will periodically send information containing the master-slave status to the slave device;
[0036] (2) If any device fails to receive the confirmation message within the preset time, it is considered that the message has failed, indicating that the connection with the redundant device is disconnected. In this case, the two devices will re-evaluate and determine a new master-slave relationship.
[0037] As a preferred technical solution, step S4 is specifically as follows:
[0038] Step S41: At the beginning of each cycle, the master device updates the cycle number of the local end according to its internal security clock;
[0039] Step S42, the master device receives the communication information of the external device and the master-slave synchronization information sent by the slave device through the communication protocol;
[0040] Step S43: The master device updates the cycle number of the redundant end according to the cycle number in the received message and verifies the validity of the communication information of the external device;
[0041] Step S44: If the new message is deemed valid, the master device updates the external communication status and train status information according to the message information in the new message, and sends the master-slave synchronization information and communication status data to the slave device through the network protocol.
[0042] As a preferred technical solution, step S5 is specifically as follows:
[0043] Step S51: At the beginning of each cycle, the slave device updates its own cycle number based on its internal secure clock.
[0044] Step S52, the slave device receives the communication information of the external device and the master-slave synchronization information sent by the master device through the network protocol;
[0045] Step S53: The slave device needs to verify the validity of the master-slave synchronization message sent by the master device. If the message is valid, the slave device updates its own external communication status according to the external communication status of the master device in the message to maintain consistency of the external communication status.
[0046] Step S54, the slave device updates the cycle number of the redundant end according to the cycle number in the received message, and verifies the validity of the communication information of the external device;
[0047] Step S55: If the new message is deemed valid, the slave device updates the external communication status and train status information according to the message information in the new message, and sends its master-slave synchronization information to the master device through the network protocol.
[0048] According to a second aspect of the present invention, an electronic device is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the method when executing the program.
[0049] According to a third aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method described above is implemented.
[0050] Compared with the prior art, the present invention has the following advantages:
[0051] 1) The present invention enhances the stability of the system. The devices at both ends are redundant. When the master device fails, the slave device can quickly and seamlessly take over the task, keeping the system running uninterrupted. The use of different cycle numbers ensures no communication interference during the takeover process, ensuring a smooth transition of the system.
[0052] 2) The present invention maintains system reliability. Since the slave devices use independent cycle numbers, the cycle number synchronization problem of the master device will not spread to the entire system, reducing the impact of the failure on other parts of the system.
[0053] 3) The present invention improves system security. The redundant device cycle number synchronization method effectively solves the problem of synchronization lag between the master and slave device cycle numbers, avoids external communication interruptions, ensures that at least one redundant device operates independently, and reduces the impact of single point failures on the entire system.
[0054] 4) The present invention ensures the continuity of train operation. The system dynamically adjusts the master and slave roles of redundant devices according to the train's running conditions, ensuring that the train can maintain normal operation in the event of a controller failure.
[0055] 5) The present invention improves the overall reliability, security and maintainability of the system by implementing an independent yet interdependent cycle number synchronization method. In the face of equipment failure, communication interruption or other potential risks, the system can respond quickly and make adjustments. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a flow chart of synchronization of redundant devices in the vehicle control system of the present invention;
[0057] Figure 2 This is a flowchart of the master-slave device synchronization per cycle of the present invention;
[0058] Figure 3 This is a flow chart of message validity determination in the present invention;
[0059] Figure 4 This is a flow chart of the local end cycle number update of the present invention;
[0060] Figure 5 This is a flowchart of updating the minimum cycle number of the redundant end of the present invention. DETAILED DESCRIPTION
[0061] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0062] This invention proposes a redundant device cycle number synchronization method specifically designed for onboard control systems. The devices at both ends are redundant, each independently and accurately maintaining its own cycle number based on its built-in safety clock and the train's current locomotive position. This cycle number plays a key role in inter-device synchronization and serves as an important identifier for time synchronization with external devices. Importantly, the device at this end also maintains the cycle number of the other end (i.e., the redundant end). This enables the system to accurately determine the status of the redundant end device and ensures the timeliness of external communications.
[0063] like Figure 1 and Figure 2 As shown, the present invention is directed to the synchronization process of redundant devices in the vehicle control system:
[0064] Step S1: Initial setup. The devices at both ends are redundant. From power-on, they initialize and maintain their own cycle numbers based on their local security clock and the train locomotive location. The cycle number serves as a time tag for external communication and is used to monitor the timeliness of communication.
[0065] Step S2: Allocation principle. The cycle number ranges used by the devices at both ends are different and have no intersection; the cycle number range of device 1 is 0 to 2 29 -1; the cycle number range of device 2 is 2 29 to 2 30 -1; In this way, it is possible to tell whether a message is valid and which redundant device it comes from or is sent to based on the cycle number in the message;
[0066] Step S3: Determine the master-slave relationship. The devices at both ends send synchronization information through the synchronization protocol and determine the master-slave relationship based on the train status information. If a device is confirmed to be the master device, then execute step S4; otherwise, execute step S5;
[0067] Step S4: Master-side process. The master receives the synchronization information sent by the slave, maintains the cycle numbers of the local (master) and redundant (slave) ends, processes external communication requests, and updates the communication status between the master and external devices. Finally, it forwards a data packet containing the latest synchronization information and communication status to the slave.
[0068] Step S5: Slave-side process. The slave receives the synchronization information and data packets containing the communication status from the master, maintains the cycle numbers of the local end (slave) and the redundant end (master), synchronizes its own communication status to the same as that of the master, and finally forwards the latest synchronization information to the master.
[0069] The step S2 is as follows: Figure 3 As shown in the figure, a method is proposed to determine the validity of new messages based on the cycle number of redundant devices. The following are detailed steps:
[0070] Step S21: Identify the source of the message. Determine whether the message is a reply to the local end or the redundant end based on the cycle number in the new message. If the message is a reply to the local end, execute step S22; otherwise, execute step S23.
[0071] Step S22: Verify the message sent back to the local terminal. If the new message is sent back to the local terminal, the local terminal cycle number and the new message cycle number must be compared. The new message cycle number should be within the validity period of the local terminal, i.e.:
[0072] (1) The new message cycle number is greater than the local cycle number;
[0073] (2) The sum of the new message cycle number and the communication delay of the external device is greater than the local cycle number.
[0074] If the above conditions are met, the message packet is considered valid.
[0075] Step S23: Verify the message sent back to the redundant end. If the new message is sent back to the redundant end, compare the minimum and maximum cycle numbers of the redundant end with the cycle number of the new message. The cycle number of the new message should be within the validity period of the redundant end, that is:
[0076] (1) The new message cycle number is greater than the minimum cycle number of the redundant end;
[0077] (2) The new message cycle number is less than the maximum cycle number of the redundant end.
[0078] Since the redundant end cycle number has already taken the communication delay into account, a new message is considered valid only if the above conditions are met.
[0079] Step S24: Determine whether the message is the latest:
[0080] (1) If the new message received is within the validity period whether it is replied to the local end or the redundant end;
[0081] (2) If there is a record of the previous cycle number, that is, the cycle number of the new message should be greater than the cycle number of the previous cycle;
[0082] (3) If there is no recorded cycle number of the previous cycle, the package is considered to be the latest cycle number and no comparison is required.
[0083] The step S2 proposes a method for determining the validity of a new message based on the cycle number of the device.
[0084] like Figure 4 As shown in the figure, the cycle number of each cycle of the device maintaining the local end (device 1 or device 2) is as follows:
[0085] 1. Equipment 1 end cycle number maintenance:
[0086] (1) Initialize the cycle number of device 1 to 0;
[0087] (2) The cycle number of device 1 increases every cycle;
[0088] (3) When the cycle number of device 1 is greater than 2 29 -1, the cycle number of device 1 is reset to 0.
[0089] 2. Cycle number maintenance on device 2:
[0090] (1) Initialize the cycle number of device 2 to 2 29 ;
[0091] (2) The cycle number at device 2 increases every cycle;
[0092] (3) When the cycle number of device 2 is greater than 2 30 -1, the local cycle number is reset to 2 29 .
[0093] The step S23 describes a method for determining the validity of redundant end messages by managing the minimum cycle number and the maximum cycle number of the redundant end. Assume that the cycle numbers of device 1 and device 2 range from 0 to 2 respectively. 29 -1 and 2 29 to 2 30 -1. Figure 5 As shown, the minimum cycle number rule for the redundant end is as follows:
[0094] 1. The minimum cycle number for device 1 to maintain device 2:
[0095] (1) Initialize the minimum cycle number of device 2 to -1;
[0096] (2) Assume that a new message is received from device 2 and the current cycle number is 2 29 +5, the minimum cycle number is updated to 2 29 +5;
[0097] (3) If no new message is received but the previous communication is valid, the minimum cycle number is incremented by: 2 29 +6;
[0098] (4) If more than 2 30 -1, reset to 2 29 ;
[0099] (5) If no valid message is received for a long time, the minimum cycle number is reset to the default value of -1.
[0100] 2. The minimum cycle number for device 2 to maintain device 1:
[0101] (1) Initialize the minimum cycle number of device 2 to -1;
[0102] (2) Assuming that a new message is received from device 1 and the current cycle number is 5, the minimum cycle number is updated to 5;
[0103] (3) If no new message is received but the previous communication is valid, the minimum cycle number is incremented: 6;
[0104] (4) If more than 2 29 -1, reset to 0;
[0105] (5) If no valid message is received for a long time, the minimum cycle number is reset to the default value of -1.
[0106] For device 1 and device 2, assuming the maximum transmission delay in the network is T, the maximum cycle number rule for the redundant end is as follows:
[0107] 1) When device 1 receives a new message from device 2, the current cycle number is 2 29 +5, then the maximum cycle number is 229 +5+T;
[0108] 2) When device 2 receives a new message from device 1, the current cycle number is 5, and the maximum cycle number is 5+T.
[0109] In step S3, to ensure the master-slave status of both devices remains consistent, if device 1 and device 2 are communicating normally, both devices confirm the consistency of the master-slave relationship through a synchronization protocol, namely, by sending synchronization information. When communication between the devices is normal, the master device periodically sends information containing the master-slave status to the slave device. If either device fails to receive the confirmation message within a preset time, it deems the message invalid, indicating that the connection with the redundant device is broken. In this case, the two devices reassess and determine a new master-slave relationship.
[0110] Steps S4 and S5 are for the synchronization process between the master device and the slave device in the vehicle control system. The master device end process includes:
[0111] Step S41: Cycle initialization. At the beginning of each cycle, the master device updates the cycle number of the local end (master device) according to its internal security clock;
[0112] Step S42: Receiving information. The master device receives the communication information from the external device and the master-slave synchronization information sent by the slave device through the communication protocol;
[0113] Step S43: Update the cycle number and verify the message. The master device updates the cycle number of the redundant end (slave device) according to the cycle number in the received message and verifies the validity of the communication information of the external device.
[0114] Step S44: Update status and send information. If the new message is deemed valid, the master device updates the external communication status and train status information according to the message information in the new message, and sends the master-slave synchronization information and communication status data to the slave device via the network protocol.
[0115] The process from the device side includes:
[0116] Step S51: Cycle initialization. At the beginning of each cycle, the slave device updates its cycle number based on its internal secure clock.
[0117] Step S52: Receive information. The slave device receives the communication information of the external device and the master-slave synchronization information sent by the master device through the network protocol;
[0118] Step S53: Verify the validity of the master-slave synchronization message. The slave device needs to verify the validity of the master-slave synchronization information sent by the master device. If the message is valid, it will update the external communication status of the local end (slave device) accordingly based on the external communication status of the master device in the message to maintain consistency of the external communication status.
[0119] Step S54: Update the cycle number and verify the message. The slave device updates the cycle number of the redundant end (master device) according to the cycle number in the received message and verifies the validity of the communication information of the external device.
[0120] Step S55: Update status and send information. If the new message is deemed valid, the slave device updates the external communication status and train status information according to the message information in the new message, and sends its master-slave synchronization information to the master device via the network protocol.
[0121] It should be understood that the redundant device cycle number synchronization method described in this invention can be implemented as software running on various units of a train's onboard controller. For example, the invention can be implemented as a data processing program code within an automatic protection unit (ATP). This method ensures that in the event of a master device failure, the slave device can quickly take over, maintaining uninterrupted system operation. Those skilled in the art can appropriately adjust and optimize the above method and parameters based on the needs of different projects to adapt to the communication standards and safety regulations of specific railway systems.
[0122] The above is an introduction to a method embodiment. The following further illustrates the solution of the present invention through an electronic device and a storage medium embodiment.
[0123] An embodiment of the present invention further provides an electronic device including a central processing unit (CPU), which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or computer program instructions loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for device operation can also be stored. The CPU, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0124] Many components in a device are connected to the I / O interface, including: input units, such as a keyboard and mouse; output units, such as various types of displays and speakers; storage units, such as magnetic disks and optical disks; and communication units, such as network cards, modems, and wireless communication transceivers. The communication unit allows the device to exchange information / data with other devices via computer networks such as the Internet and / or various telecommunication networks.
[0125] The processing unit performs the various methods and processes described above, such as methods S1 to S5. For example, in some embodiments, methods S1 to S5 are implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program can be loaded and / or installed on the device via a ROM and / or a communication unit. When the computer program is loaded into the RAM and executed by the CPU, one or more steps of methods S1 to S5 described above can be performed. Alternatively, in other embodiments, the CPU can be configured to execute methods S1 to S5 by any other appropriate means (for example, by means of firmware).
[0126] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0127] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0128] In the context of the present invention, machine-readable medium can be a tangible medium that can contain or store a program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0129] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A method for synchronizing cycle numbers of redundant devices, characterized in that: The method comprises the following steps: Step S1: The devices at both ends are redundant. From the moment they are powered on, they initialize and maintain their own cycle numbers based on their own security clocks and the train locomotive positions. Step S2: Allocate cycle numbers to the devices at both ends. The allocation principle is that the cycle numbers are different and non-intersecting. The validity of the message is determined based on the cycle number in the message, and whether the message comes from or is sent to the redundant end device. In step S3, the devices at both ends determine the master-slave relationship based on the train status information. If the device is confirmed to be the master device, step S4 is executed; otherwise, step S5 is executed. Step S4, executing the master device side process; Step S5, executing the process from the device side; The step S4 is specifically as follows: Step S41: At the beginning of each cycle, the master device updates the cycle number of the local end according to its internal security clock; Step S42, the master device receives the communication information of the external device and the master-slave synchronization information sent by the slave device through the communication protocol; Step S43: The master device updates the cycle number of the redundant end according to the cycle number in the received message and verifies the validity of the communication information of the external device; Step S44: If the new message is deemed valid, the master device updates the external communication status and train status information according to the message information in the new message, and sends the master-slave synchronization information and communication status data to the slave device via the network protocol; The step S5 is specifically as follows: Step S51: At the beginning of each cycle, the slave device updates its own cycle number based on its internal secure clock. Step S52, the slave device receives the communication information of the external device and the master-slave synchronization information sent by the master device through the network protocol; Step S53: The slave device needs to verify the validity of the master-slave synchronization message sent by the master device. If the message is valid, the slave device updates its own external communication status according to the external communication status of the master device in the message to maintain consistency of the external communication status. Step S54, the slave device updates the cycle number of the redundant end according to the cycle number in the received message, and verifies the validity of the communication information of the external device; Step S55: If the new message is deemed valid, the slave device updates the external communication status and train status information according to the message information in the new message, and sends its master-slave synchronization information to the master device through the network protocol.
2. A redundant device cycle number synchronization method according to claim 1, characterized in that: The cycle number in step S1 is used as a time tag for communicating with the outside world and is used to monitor the timeliness of the communication.
3. A redundant device cycle number synchronization method according to claim 1, characterized in that: The cycle number allocation in step S2 is specifically as follows: the cycle number range of device 1 is 0 to 2 29 -1; the cycle number range of device 2 is 2 29 to 2 30 -1.
4. A redundant device cycle number synchronization method according to claim 3, characterized in that: In step S2, determining whether the message is valid according to the cycle number in the message is specifically as follows: Step S21: Determine whether the message is a reply to the local end or the redundant end based on the cycle number in the new message. If the message is a reply to the local end, execute step S22; otherwise, execute step S23; Step S22, verifying the validity of the message replied to the local terminal; Step S23, verifying the validity of the message replied to the redundant end; Step S24: determine whether the message is the latest.
5. A redundant device cycle number synchronization method according to claim 4, characterized in that: The verification process of step S22 is specifically as follows: Compare the local cycle number with the new message cycle number. If the new message cycle number is within the validity period of the local cycle number, the packet message is considered valid. The new message cycle number must meet the following conditions within the validity period of the local cycle number: 1) The local cycle number is greater than the new message cycle number; 2) The sum of the new message cycle number and the maximum transmission delay in the network is greater than the local cycle number.
6. A redundant device cycle number synchronization method according to claim 5, characterized in that: The local cycle number update process is specifically as follows: S221) Initialization: Initialize the local cycle number according to the train head position of the local end: if the local end is device 1, initialize the local cycle number to 0; if the local end is device 2, initialize the local cycle number to 2 29 ; S222) The cycle number is incremented and reset, and the local cycle number is increased by 1 every cycle: if the local end is device 1, when the local cycle number exceeds 2 29 -1, the cycle number of the local end is reset to the initial value 0; if the local end is device 2, when the cycle number exceeds 2 30 -1, the local cycle number is reset to the initial value 2 29 .
7. A redundant device cycle number synchronization method according to claim 4, characterized in that: The verification process of step S23 is specifically as follows: Compare the minimum cycle number and maximum cycle number of the redundant end with the new message cycle number. If the new message cycle number is within the validity period of the redundant end, the new message is considered valid. The new message cycle number needs to meet the following conditions at the same time within the validity period of the redundant end: 1) The new message cycle number is greater than the minimum cycle number of the redundant end; 2) The new message cycle number should be less than the maximum cycle number of the redundant end.
8. A redundant device cycle number synchronization method according to claim 7, characterized in that: The specific updating process of the redundant end minimum cycle number is as follows: S231) Initializing the minimum cycle number of the redundant end to a default invalid value of -1 according to the train head position of the local end; S232) If a new redundant end message is received within the current cycle and the redundant end message is available, updating the redundant end minimum cycle number to the current cycle number in the received redundant end message; S233) If no new redundant end message is received in this cycle, but the previous redundant end message is still within the validity period, the redundant end minimum cycle number is incremented. If the local end is device 1, if the incremented redundant end minimum cycle number exceeds 2 30 -1, reset to the initialization value 2 29 If the local end is device 2, if the incremented redundant end minimum cycle number exceeds 2 29 -1, reset to the initialization value 0; S234) If no valid redundant end message is received for a long time, the redundant end minimum cycle number is set to the default invalid-1.
9. A redundant device cycle number synchronization method according to claim 7, characterized in that: The specific updating process of the maximum cycle number of the redundant end is as follows: When a new message is received from the redundant end, the maximum cycle number of the redundant end is updated. Taking into account the transmission delay in the network, the maximum cycle number is the minimum cycle number of the redundant end plus the maximum transmission delay in the network.
10. A redundant device cycle number synchronization method according to claim 3, characterized in that: In step S3, when device 1 and device 2 communicate normally, the two end devices confirm the consistency of the master-slave relationship by sending synchronization information: 1) When the communication between the devices is normal, the master device will periodically send information containing the master-slave status to the slave device; 2) If either end device fails to receive the confirmation message within the preset time, it is considered that the message has expired, indicating that the connection with the redundant end device is interrupted. In this case, the two end devices will re-evaluate and determine a new master-slave relationship.
11. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 10 is implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Rapid, accurate and safe clock synchronization method and system
CN105227289A
Triple-modular redundancy computer software data synchronization method
CN114385757A
Verification of time synchronization
CN116235433A