A coding arrangement method suitable for host and upper computer
By introducing CRC checksum, data encryption, heartbeat mechanism, multi-slave addressing, and emergency data priority, the problems of unreliable, insecure, and inefficient communication in the train monitoring system are solved, achieving reliable, secure, and efficient communication, and supporting multi-slave communication and timely processing of critical data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TIANJIN YUNZHIXING TECHNOLOGY CO LTD
- Filing Date
- 2026-02-14
- Publication Date
- 2026-06-26
AI Technical Summary
Existing train monitoring systems cannot achieve full-process monitoring during shunting and locomotive entry and exit operations, and the communication methods have problems with error detection, data security, connection stability, and low efficiency.
It employs features such as Cyclic Redundancy Check (CRC), data encryption, heartbeat mechanism, multi-slave addressing, and priority for urgent data to enhance the reliability, security, and efficiency of communication.
It improves error detection capabilities, ensures communication security, prevents data leakage, monitors connection status in real time, supports communication with multiple slave devices, ensures timely processing of critical data, and enhances system reliability and response speed.
Smart Images

Figure CN122293263A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of train monitoring systems, specifically relating to an encoding arrangement method applicable to a host computer and a supervisory computer. Background Technology
[0002] Train monitoring devices can monitor train speed, position, acceleration, turning radius, and other data in real time. This data helps train drivers understand the train's status and make appropriate maneuvers such as turning and braking to ensure safe operation. By monitoring the train, the devices can analyze its operating conditions in real time, predict potential future situations, and provide corresponding control suggestions. This helps train drivers make more informed decisions and reduce the occurrence of accidents. The train monitoring devices can monitor various data and statuses of the train in real time, promptly identify potential safety hazards, and adjust the train through the automatic control system to improve its safety performance.
[0003] Currently, during shunting and locomotive entry / exit operations, due to limitations in station equipment, monitoring devices cannot receive ground traffic commands from locomotive signals to monitor train operation as they do on main lines. During shunting operations, locomotive crew and shunting operators primarily rely on confirming ground signals. Errors by these personnel can easily lead to accidents such as collisions, squeezing, and derailments. With the widespread adoption of monitoring devices, almost all locomotive-related accidents have occurred during shunting and locomotive entry / exit operations, making this a pressing issue for safety management in the locomotive department. To ensure the safe and efficient operation of shunting and achieve full-process monitoring of locomotives during operation, we have developed a digital point-based information shunting monitoring system to address the monitoring of lead-out and single-locomotive running operations. Currently, shunting signals at all stations across the railway network are not coded, and many locomotive depots lack shunting signals, making it impossible to monitor single locomotives and train runs. To implement the coded track signaling for shunting at stations, it would require extensive modifications to the station's signaling equipment, including the addition of data acquisition and transmission equipment. This is technically challenging and difficult to achieve.
[0004] Therefore, to solve the above problems, a detailed and in-depth study of radio frequency (RF) technology was conducted. Using specially designed passive sensors, RF technology was employed to transmit shunting signals to the locomotive, which then transmits them to the monitoring device via a RS-485 (or CAN) communication port. The monitoring device then issues corresponding commands to monitor the locomotive. However, existing communication methods have shortcomings in error detection, data security, connection stability, and multi-device support, which may lead to problems such as transmission errors, data leakage, communication interruptions, and low efficiency.
[0005] Therefore, to address the aforementioned technical issues, it is necessary to provide an encoding arrangement method applicable to both the host computer and the upper-level computer.
[0006] The information disclosed in this background section is intended only to enhance the understanding of the overall background of the invention and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention
[0007] The purpose of this invention is to provide an encoding arrangement method applicable to both host and upper-level computers, which can solve the problems of unreliable, insecure, and inefficient communication in existing technologies. This invention enhances the reliability, security, and efficiency of communication by introducing features such as Cyclic Redundancy Check (CRC), data encryption, heartbeat mechanism, multi-slave addressing, and priority for urgent data.
[0008] To achieve the above objectives, a specific embodiment of the present invention provides the following technical solution: An encoding arrangement method applicable to both host and upper computer, comprising the following steps: The monitoring host sends a first data frame, which includes an address field, a data type field, a data content field, and a first verification field. After receiving the first data frame, the slave device sends a second data frame, which includes an address field, a data type field, a data content field, and a second verification field. The first verification field and the second verification field are generated using the Cyclic Redundancy Check (CRC) algorithm. Some or all of the data in the data content field is encrypted.
[0009] In one or more embodiments of the present invention, the encryption process employs an XOR encryption algorithm and uses a pre-shared key to encrypt and decrypt the data content field.
[0010] In one or more embodiments of the present invention, the lower four bits of the data type field of the first data frame represent an inquiry to the shunting monitoring device, and the higher four bits represent the previous reception status; the lower four bits of the data type field of the second data frame represent the response from the shunting monitoring device, and the higher four bits represent the previous reception status.
[0011] In one or more embodiments of the present invention, a heartbeat mechanism is further included, wherein the monitoring host periodically sends heartbeat data frames, and the slave device sends a heartbeat response data frame after receiving the heartbeat data frame to confirm the connection status; the data type fields of the heartbeat data frame and the heartbeat response data frame respectively contain identifiers of the heartbeat request and the heartbeat response.
[0012] In one or more embodiments of the present invention, the lower four bits of the data type field of the heartbeat data frame are set to a specific value to indicate a heartbeat request, and the higher four bits indicate the previous reception status; the lower four bits of the data type field of the heartbeat response data frame are set to a specific value to indicate a heartbeat response, and the higher four bits indicate the previous reception status.
[0013] In one or more embodiments of the present invention, the address field supports multi-slave addressing, wherein the high-order bits of the address field represent the slave group number and the low-order bits represent the slave individual number, thereby allowing the monitoring host to communicate with multiple slaves.
[0014] In one or more embodiments of the present invention, the data type field further includes an emergency flag bit. When the emergency flag bit is set, it indicates that the data frame has a high priority and the monitoring host and slave should process the data frame first.
[0015] In one or more embodiments of the present invention, the data content fields of the first data frame include handle status, train speed, and time information; the data content fields of the second data frame include distance information, ground signal status and field number, ground point sequence number, and station number.
[0016] In one or more embodiments of the present invention, all bytes of the data frame are in binary format, with the low byte of multi-byte data first, and the TB8 bit of the address byte is set to 1, while the TB8 bit of other bytes is set to 0.
[0017] In one or more embodiments of the present invention, a data retransmission mechanism is also included, wherein if the monitoring host does not receive a response from the slave to the first data frame within a predetermined time, the monitoring host automatically retransmits the first data frame until a response is received or the maximum number of retries is reached.
[0018] Compared with existing technologies, the encoding arrangement method of the applicable host and upper computer in this invention improves error detection capability and reduces data transmission errors by using CRC checksum. Data encryption ensures communication security and prevents data leakage. A heartbeat mechanism monitors connection status in real time to prevent communication interruption. Multi-slave addressing supports communication from multiple slave devices, improving system scalability. Prioritizing urgent data ensures timely processing of critical data, improving system response speed. A data retransmission mechanism enhances communication reliability and avoids data loss. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating the communication between a monitoring host and a slave device in an embodiment of the present invention, which describes an encoding arrangement method applicable to both the host and the upper computer. Figure 2 This is a timing diagram of the heartbeat mechanism of an encoding arrangement method applicable to a host computer and a supervisory computer in one embodiment of the present invention; Figure 3 This is a schematic diagram of a multi-slave addressing method for an encoding arrangement method applicable to a host and a supervisory computer in one embodiment of the present invention; Figure 4 This is a data encryption processing flowchart of an encoding arrangement method applicable to both the host computer and the upper computer in one embodiment of the present invention. Detailed Implementation
[0021] To enable those skilled in the art to better understand the technical solutions in this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this disclosure.
[0022] like Figure 1 As shown, an embodiment of the present invention provides an encoding arrangement method applicable to both the host computer and the upper computer, used for communication between the host computer and the slave computer in a train monitoring system.
[0023] The basic communication process between the monitoring host and slave device includes: the monitoring host sends a first data frame – an inquiry frame. After receiving the first data frame, the slave device sends a second data frame – a response frame. The monitoring host receives the second data frame and performs checksum processing.
[0024] The data frame format between the monitoring master and slave includes: address [1 byte], data type [1 byte], data [14 bytes], and checksum [1 byte]. All bytes are in binary format, with the least significant byte first for multi-byte data. The TB8 bit of the address byte is set to 1, and the TB8 bit of other bytes is set to 0.
[0025] The master's transmit address is 0x9B, and the slave's transmit address is 0x3B. For example... Figure 3As shown, to support multi-slave addressing, the address field can be extended: the high-order bits represent the slave group number, and the low-order bits represent the slave individual number. For example, address 0x9B can be decomposed into group number 0x9 and individual number 0xB, allowing the monitoring host to communicate with multiple slaves.
[0026] Data type field: Bit3..0 is the type, and Bit7..4 is the last received status.
[0027] The first data frame is sent by the host. The lower four bits of the type are 0, indicating an inquiry to the shunting monitoring device; the higher four bits of the status are 0xA if the last reception was normal, otherwise 0x5.
[0028] The second data frame is sent by the slave device. The lower four bits of the type are =F, indicating a response from the shunting monitoring device; the higher four bits of the status are 0xA if the previous reception was normal, otherwise 0x5.
[0029] Data content fields: First data frame: Handle [1 byte], Speed [1 byte], Reserved [3 bytes], Hour [1 byte], Minute [1 byte], Second [1 byte], others are 0. Handle format: Bit2—Forward, Bit1—Backward, Bit0—Zero.
[0030] Second data frame: Distance [2 bytes], Ground signal status and site number [1 byte], Ground point sequence number [1 byte], Station number [2 bytes], Reserve [2 bytes], Other [6 bytes], Reserve and Other are filled with 0.
[0031] Distance refers to the distance from a ground point to a control point, in meters.
[0032] Ground signal status and site number: The lower four bits represent the ground signal status (1-white light, 2-blue light, 3-no light, 4-sensor disconnection, 5-red light, 6-no signal warning point, 7-green light, 8-yellow light, 9-flashing yellow light, 10-flashing red light, 11-flashing white light, C-reserved, D-automatic start, E-kilometer marker, F-speed limit, 0-initial state or no point state, others are invalid); the higher four bits represent the site number, 1-14, 0 and 15 are invalid. The ground point sequence number is the unified number stored for that point in a specific station and site. Station numbers range from 1 to 65534.
[0033] The check field is generated using a Cyclic Redundancy Check (CRC) algorithm instead of a simple checksum. For example, a CRC-16-CCITT polynomial is used to calculate the CRC value, covering the address, data type, and data fields. The check field is the low byte of the CRC calculation result. At the receiving end, the CRC is recalculated and compared with the check field; if they do not match, the data frame is discarded.
[0034] To ensure communication security, some or all of the data in the data content field is encrypted. This embodiment uses the XOR encryption algorithm and a pre-shared key, for example, an 8-byte key, stored in the non-volatile memory of both the host and slave devices. The encryption process is as follows: For the data content fields of the first data frame, such as handle, speed, and time, each byte is XORed with the corresponding byte of the key. If the data content length exceeds the key length, the key is reused.
[0035] Similarly, when the slave device sends the second data frame, it performs XOR encryption on data content fields such as distance and ground signal status.
[0036] At the receiving end, the encrypted data is decrypted using the same key via XOR to recover the original data.
[0037] For example, assuming the key is 0xAA and the data byte is 0x55, the encrypted result is 0xFF; during decryption, 0xFF XOR 0xAA = 0x55. This encryption method is simple and efficient, suitable for real-time communication.
[0038] like Figure 2 As shown, to monitor the connection status, this invention introduces a heartbeat mechanism. The heartbeat mechanism includes: The monitoring host periodically sends heartbeat data frames. The address field of the heartbeat data frame is 0x9B, and the lower four bits of the data type field are set to 0xC, indicating a heartbeat request, while the higher four bits represent the previous received status: 0xA for normal and 0x5 for abnormal. The data content field can be empty or contain status information.
[0039] Upon receiving a heartbeat data frame, the slave device immediately sends a heartbeat response data frame. The address field of the heartbeat response data frame is 0x3B, and the lower four bits of the data type field are set to 0xD, indicating a heartbeat response, while the higher four bits represent the previous received status. The data content field can be empty or contain the slave device's status.
[0040] If the monitoring host does not receive a heartbeat response within the predetermined time, it will determine that the connection is interrupted and trigger an alarm or reconnection procedure.
[0041] Define an emergency flag in the data type field. For example, use Bit3 of the data type field, assuming Bit3=1 indicates emergency. Set the emergency flag when the data frame has high priority. For the first data frame, if the train detects an emergency, such as speeding or an obstacle, the monitoring host sets an emergency flag.
[0042] For the second data frame, if the slave device detects an emergency ground signal, such as a red light or red flash, it sets the emergency flag.
[0043] The monitoring master and slave devices prioritize handling urgent data frames, for example, interrupting the current processing queue and responding immediately to the urgent frame.
[0044] To enhance reliability, this invention includes a data retransmission mechanism: After the monitoring host sends the first data frame, it starts a timer.
[0045] If the second data frame is not received before the timer expires, the monitoring host will automatically retransmit the first data frame.
[0046] The message can be resent a maximum of 3 times. If there is still no response, the error will be logged and the operator will be notified.
[0047] During retransmission, the data frame content remains unchanged, but the status bits of the data type field may be updated; for example, they may have been set to 0x5 when the last reception was abnormal.
[0048] During train shunting operations, the monitoring host is installed on the locomotive and communicates with multiple slave-ground sensors. The host periodically sends interrogation frames containing train speed, handle status, and time; the slaves respond with response frames containing distance, signal status, and station number. All communication uses CRC checksum and XOR encryption. A heartbeat mechanism ensures active connection. If a slave reports a red light – an emergency – it sets an emergency flag, which the host prioritizes and triggers the brakes. If communication fails, the host retransmits the interrogation frame.
[0049] This invention achieves reliable, safe, and efficient communication, effectively supporting the safe operation of the train monitoring system.
[0050] This invention significantly improves the reliability, security, and efficiency of communication between the master and slave devices in the train monitoring system by introducing CRC check, data encryption, heartbeat mechanism, multi-slave addressing, emergency data priority, and data retransmission mechanism.
[0051] It will be apparent to those skilled in the art that this disclosure is not limited to the details of the exemplary embodiments described above, and that this disclosure can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of this disclosure is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within this disclosure. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0052] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A coding arrangement method applicable to both host and upper-level computers, characterized in that, Includes the following steps: The monitoring host sends a first data frame, which includes an address field, a data type field, a data content field, and a first verification field. After receiving the first data frame, the slave device sends a second data frame, which includes an address field, a data type field, a data content field, and a second verification field. The first verification field and the second verification field are generated using the Cyclic Redundancy Check (CRC) algorithm. Some or all of the data in the data content field is encrypted.
2. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, The encryption process employs the XOR encryption algorithm, using a pre-shared key to encrypt and decrypt the data content fields.
3. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, The lower four bits of the data type field in the first data frame indicate a query to the shunting monitoring device, and the higher four bits indicate the previous reception status; the lower four bits of the data type field in the second data frame indicate a response from the shunting monitoring device, and the higher four bits indicate the previous reception status.
4. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, It also includes a heartbeat mechanism, in which the monitoring host periodically sends heartbeat data frames, and the slave device sends a heartbeat response data frame after receiving the heartbeat data frame to confirm the connection status; the data type fields of the heartbeat data frame and the heartbeat response data frame respectively contain the identifiers of the heartbeat request and the heartbeat response.
5. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 4, characterized in that, The lower four bits of the data type field of the heartbeat data frame are set to a specific value to indicate a heartbeat request, and the higher four bits indicate the previous reception status; the lower four bits of the data type field of the heartbeat response data frame are set to a specific value to indicate a heartbeat response, and the higher four bits indicate the previous reception status.
6. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, The address field supports multi-slave addressing, where the high-order bits of the address field represent the slave group number and the low-order bits represent the slave individual number, thereby allowing the monitoring host to communicate with multiple slaves.
7. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, The data type field also includes an emergency flag. When the emergency flag is set, it indicates that the data frame has a high priority and the monitoring host and slave should process the data frame first.
8. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, The data content fields of the first data frame include handle status, train speed, and time information; the data content fields of the second data frame include distance information, ground signal status and field number, ground point number, and station number.
9. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, All bytes of the data frame are in binary format, with the least significant byte of multi-byte data first, and the TB8 bit of the address byte is set to 1, while the TB8 bit of other bytes is set to 0.
10. The encoding arrangement method applicable to both the host computer and the upper computer according to claim 1, characterized in that, It also includes a data retransmission mechanism. If the monitoring host does not receive a response from the slave device for the first data frame within a predetermined time, the monitoring host will automatically retransmit the first data frame until a response is received or the maximum number of retries is reached.