US20260103225A1
2026-04-16
19/115,235
2023-11-16
Smart Summary: A method for simulating train operations combines message communication and database storage to create a more efficient system. It uses a lightweight messaging system and a fast memory database to ensure real-time synchronization during simulations. This approach simplifies the overall structure, making it easier to manage and maintain. It also improves data consistency and speeds up access, while enhancing network communication efficiency. Additionally, the system is designed to be more stable and easier to deploy, avoiding complications from different programming languages and network issues. π TL;DR
A train operation scenario general simulation method. By means of a Redis lightweight message publishing and subscription mechanism and the high performance of a memory database, database storage access and message communication functions are combined into one, and the execution of simulation scenarios is synchronized in real time while simulating the running state of a train, thus realizing the rapid construction of a train operation simulation system. Compared with the prior art, the present disclosure simplifies the system structure, guarantees the data consistency and high-speed access, optimizes the network communication efficiency, realizes decoupling between applications (system), also avoids the system complexity caused by network isolation and inconsistent development languages, and improves the deployment convenience and operation stability of a simulation system. Further provided are a train operation scenario general simulation system, a device and a medium.
Get notified when new applications in this technology area are published.
B61L27/04 » CPC main
Central railway traffic control systems; Trackside control; Communication systems specially adapted therefor Automatic systems, e.g. controlled by train; Change-over to manual control
B61L27/60 » CPC further
Central railway traffic control systems; Trackside control; Communication systems specially adapted therefor Testing or simulation
The present invention relates to a train signal control system, and in particular to a general simulation method for a train operation scenario, a system, a device, and a medium.
In the context of modern railway transportation development, train operation and running are increasingly becoming automated and intelligent, with an increasing number of systems involved. As operation systems are increasingly larger and are designed more complexly, handling each fault and addressing every scenario require coordination across a plurality of professions. An entire simulation system needs to be deployed in a complicated network environment with frequent message exchanges to function properly. In current technology implementation, a remote communication module is developed or a message queue product is used, which is then deployed alongside a database. Such software structure makes the system increasingly bloated. In case of subsystems with different programming languages or a network access limitation, the deployment and operation of an entire simulation environment become extremely challenging, and it becomes difficult to troubleshoot an issue. Moreover, scenario design of a simulation system needs to be rapidly adjusted, and a resulting change in software design usually leads to significant development and testing pressures. A traditional SQL database is weak in objectifying a data structure, and is incapable of storing a plurality of states of a complex device. Additionally, the train simulation data includes a large number of Boolean values, and traditional databases require extensive storage space, leading to high laboratory setup costs. Another challenge is that the train simulation system demands an extremely fast data reading speed and high real-time requirements, which traditional SQL databases cannot meet.
Therefore, how to implement a complex scenario simulation that meets an increasingly growing demand for railway transportation system simulations, while ensuring that the system does not become overly bulky, has become a key technical challenge to address.
The present invention provides a general simulation method for a train operation scenario, a system, a device, and a medium to overcome the defects in the prior art.
The purpose of the present invention can be realized by the following technical schemes:
According to a first aspect of the present invention, a general simulation method for a train operation scenario is provided. In the method, with the help of a Redis lightweight message releasing and subscribing mechanism and high performance of a memory database, database storage access and message communication functions are combined, and while a train running state is simulated, real-time synchronization of the execution of various simulation scenarios is implemented, so that rapid establishment of a train operation simulation system is implemented.
In a preferred technical solution, the method specifically includes the following steps:
In a preferred technical solution, the instruction channel is specifically as follows:
In a preferred technical solution, the result return channel is specifically as follows:
In a preferred technical solution, the subscription channel is specifically as follows:
In a preferred technical solution, a format of the identification code in step 2 is specifically as follows:
In a preferred technical solution, the instruction format in step 4 is specifically as follows:
In a preferred technical solution, the instruction execution mode is specifically as follows:
In a preferred technical solution, a format of the execution result in step 6 is specifically as follows:
According to a second aspect of the present invention, a system of the general simulation method for a train operation scenario is provided, including:
According a third technical aspect of the present invention, an electronic device is provided, including a memory and a processor, where a computer program is stored in the memory, and when the processor executes the program, the above method is implemented.
According to a fourth aspect of the present invention, a computer-readable storage medium that stores a computer program is provided, and when the program is executed by a processor, the above method is implemented.
Compared with the conventional technologies, the present invention has the following advantages:
(1) The system structure is simplified, and data consistency and high-speed access are ensured. Network communication efficiency is optimized, decoupling between applications (systems) is implemented, system complexity caused by network isolation and development language inconsistency are prevented, and simplicity of simulation system deployment and operation stability are improved.
(2) In the present invention, release of a subscription mechanism and access to a memory database are integrated. If a current technology is used for implementation, usually, a remote communication module is developed or a message queue product is used, which is then deployed alongside a database. Such software structure makes the system increasingly bloated. In the present invention, a scale of the simulation system can be greatly reduced, and decoupling between heterogeneous applications (systems) can be implemented. Each subsystem can be developed in different languages, and message interaction can be completed by calling a Redis' lightweight releasing and subscription mechanism. Each subsystem does not need to communicate directly, reducing the complexity of system development and debugging. Data generation and the message sending are decoupled. The data generation is corresponding to a service data model stored in Redis, while message sending can be customized.
(3) In the present invention, network deployment is performed efficiently. Because the deployment of all subsystems requires a specific network plan for each node, networks between all subsystems usually need to be isolated. However, as long as a public Redis service can be accessed, message interconnection can be implemented between all subsystems. For this kind of simulation system, the complexity of network planning can be greatly reduced, and the simulation system can be quickly and flexibly deployed.
(4) In the present invention, the efficiency and reliability of the Redis' lightweight releasing and subscribing mechanism are used, so that a message can be passed rapidly. Redis releasing and subscribing are simple and lightweight with low delay, which can ensure fast integration of services. As long as a publisher of a message pushes the message to a channel, a client can quickly obtain the message from the channel.
(5) In the present invention, a characteristic of Redis memory data storage is fully used to implement great objectification and high performance of the data structure. Redis supports a variety of data types, which can meet the needs for storing various data structures, especially hash data, which can highly integrate a plurality of states of a complex device. The Redis also has an advantage in data storage space, and the use of a bitmap greatly reduces storage space. An entire database is loaded in the memory, which can provide a data access speed that a disk database cannot provide.
FIG. 1 is a schematic diagram of a general simulation structure for a train operation scenario according to the present invention; and
FIG. 2 is a flow chart of a general simulation method for the train operation scenario according to the present invention.
The following is a clear and complete description of technical solutions in embodiments of the present invention in combination with drawings attached to the embodiments of the present invention. Obviously, the embodiments described are a part of the embodiments of the present invention, but not the whole embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative labor shall fall within the scope of protection of the present invention.
The present invention provides a method for a more reliable and efficient, simple and easy-to-use lightweight train simulation system based on a memory database, which can implement complex scenario simulation and meet current increasing demands for rail transit system simulation, while ensuring that the system cannot be extremely bulky. The method can implement decoupling of various subsystems, ensuring that the development, testing, deployment, and maintenance of the simulation system can be completed efficiently.
The present invention provides a simulation method for a train operation scenario. In the method, a database and a network communication function are combined with the help of a Redis lightweight message releasing and subscribing mechanism and a simulation method for memory database performance, to implement a simple and lightweight the simulation system of the operation scenario. In the present invention, a system structure is simplified, and the high performance of a key-value memory database is used to ensure the consistency and high-speed access of data, an object structured data model of train information can be established, and data changes of a train can be simulated in real time to simulate a running state of the train. Messages are quickly and reliably sent to relevant nodes through transit of a Redis server. Network communication efficiency is optimized, decoupling between applications (systems) is implemented, system complexity caused by network isolation and development language inconsistency is prevented, and simplicity of simulation system deployment and running stability are improved.
As shown in FIG. 1 and FIG. 2, a general simulation method for an urban rail transit train operation scenario includes the following steps.
Step 1: After simulation software is started, three channels of a simulation system of the train operation scenario are respectively created: a subscription channel, an instruction channel, and an execution return channel. A scale and setting of each channel can be flexibly customized based on an actual service, and mode subscription can be used. For example, dividing (into [train 1, service 1], [train 1, service 2], and the like) can be performed based on a subsystem of each train device.
Step 2: Each node, as a client of the simulation system of the train operation scenario, is connected to a Redis server, is allocated with a unique identification code, and subscribes to a required channel (the client can subscribe to a plurality channels). The subscription channel is subscribed in a use mode to implement isolation of a plurality of pieces of train information. Usually, a node identifier is uniquely identified by a [group number. node number].
Step 3: Simulation data of the simulation software starts to generate data periodically and simulates an actual running state. Data-generating strategies can provide random and timing scenarios. For example, a scenario is simulated in which a train runs on a main line, and a door is opened and closed after the train reaches a platform. Such scenario simulation is more similar to a real operation situation.
Step 4: A scenario-driven module of the simulation software starts to work, and releases a first set of instructions to the instruction channel. A specific instruction is related to scenario design, and a scenario flow is defined in the form of a flowchart to be more intuitive.
Step 5: After obtaining instruction information through the subscribed instruction channel, each node analyzes whether the node is a receiver of the instruction. If the node is the receiver of the instruction, the node parses and executes the instruction; or if the node is not the receiver of the instruction, the node ignores the instruction.
Step 6: A node, as the instruction receiver, issues an execution result to an execution result channel after executing the instruction. In a specific case, if the execution result does not have a write-back message channel, a scenario flow module addresses the problem based on a timeout rule.
Step 7: A scenario flow-driven module of the simulation software subscribes to an execution result channel. After receiving the execution result, the scenario flow-driven module first iterates through a definition of a simulation flow, determines a current execution branch, selects a next instruction or operation, and releases the next instruction or operation to an instruction subscription channel. Scenario determining needs to be determined by the scenario-driven module to record an execution state of a scenario and a simulation state of a current device.
Step 8: The simulation system performs step 5 and step 6 again.
Step 9: After receiving the execution result, the scenario flow-driven module determines that a scenario flow is complete, and execution of the current scenario is completed.
The above is an introduction to the method embodiments. The following further describes the solutions in the present invention through system embodiments.
As shown in FIG. 1, a system of the present invention includes a simulation data-driven module, a data subscription module, and a scenario flow-driven module. The simulation data-driven module simulates a real scenario in real time and can generate random or preset simulation data. The data subscription module releases data changes to a subscription channel, and a client subscribing to the channel obtains real-time changes in a state of a simulation device. The scenario flow-driven module releases the latest instruction to another node based on preset steps of the scenario, and receives an execution result to drive a next execution action. Compared with the prior art, in the present invention, a system structure is simplified, and data consistency and high-speed access are ensured. Network communication efficiency is optimized, decoupling between applications (systems) is implemented, system complexity caused by network isolation and development language inconsistency is prevented, and simplicity of simulation system deployment and running stability are improved.
A technical person in the field can clearly understand that for the convenience and simplicity of description, for a specific working process of the described module, reference may be made to a corresponding process in the above embodiments of the method, which is not repeated herein.
The electronic device of the present invention includes a central processing unit (CPU) that can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for an operation of the device 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.
A plurality of components in the device are connected to the I/O interface, including: input units, such as a keyboard and a mouse; output units, such as various types of displays and speakers; storage units, such as a disk and an optical disc; and communication units, such as a network card, a modem and a wireless communication transceiver. The communication unit allows the device to exchange information/data with other devices through a computer network such as the Internet and/or various telecommunications networks.
The processing unit performs each of the methods and processes described above, such as the method of the present invention. For example, in some embodiments, the method in the present invention may be implemented as a computer software program that is tangibly included in a machine-readable medium, such as a storage unit. In some embodiments, some or all of the computer programs may be loaded and/or installed onto the device via the ROM and/or communication unit. When the computer programs are loaded into the RAM and executed by the CPU, one or more of the steps of the method in the present invention described above can be performed. Alternatively, in other embodiments, the CPU may be configured to perform the method in the present invention in any other proper manner (for example, with the help of firmware).
Functions described above in the specification can be performed, at least in part, by one or more hardware logic components. For example, hardware logic components that can be used as examples include, unlimitedly, a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), an application-specific standard product (ASSP), a system-on-chip (SOC), a complex programmable logic device (CPLD), and the like.
The program codes for implementing the method in the present invention may be written in any combination of one or more pieces of programming language. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or another programmable data processing device so that the program codes, when executed by the processor or controller, implements the functions/operations specified in the flow chart and/or block diagram. The program codes can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine as a standalone software package, or entirely on a remote machine or server.
In the context of the present invention, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, an apparatus, or a device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above. More specific examples of the machine readable storage medium may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable ROM (EPROM or flash memory), an optical fiber, a convenient compact disk ROM (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
The foregoing descriptions are merely implementations of the present invention, but are not intended to limit the protection scope of the present invention. Any equivalent variation or replacement readily figured out by a person skilled in the art within the technical scope disclosed in the present invention shall fall within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
1. A general simulation method for a train operation scenario, comprising with a help of a Redis lightweight message releasing and subscribing mechanism and high performance of a memory database, combining database storage access and message communication functions, and while a train running state is simulated, implementing real-time synchronization of an execution of various simulation scenarios, so that rapid establishment of a train operation simulation system is implemented.
2. The general simulation method for a train operation scenario according to claim 1, wherein the method specifically comprises the following steps:
step 1: after simulation software is started, three channels of a simulation system of the train operation scenario are respectively created: a subscription channel, an instruction channel, and an execution return channel;
step 2: each node, as a client of a train simulation system, is connected to a Redis server, is allocated with a unique identification code, and subscribes to a required channel;
step 3: a simulation data module of the simulation software starts to generate data periodically and simulates an actual running state;
step 4: a scenario-driven module of the simulation software starts to work, and releases a first set of instructions to the instruction channel;
step 5: after obtaining instruction information through a subscribed instruction channel, each of nodes analyzes whether the nodes are a receiver of the instructions, and if the nodes is the receiver of the instructions, node parses and executes the instructions; or if the nodes are not the receiver of the instruction, the nodes ignore the instruction;
step 6: a node, as instruction receiver, releases an execution result to an execution result channel after executing the instructions;
step 7: a scenario flow-driven module of the simulation software subscribes to the execution result channel, after receiving the execution result, first iterates through a definition of a simulation flow, determines a current execution branch, selects a next instruction or operation, and releases the next instruction or operation to an instruction subscription channel;
step 8: the simulation system performs the step 5 and the step 6 again; and
step 9: after receiving the execution result, the scenario flow-driven module determines whether an entire scenario is completely executed, and if an entire scenario is completely executed, an execution of the current scenario is completed.
3. The general simulation method for a train operation scenario according to claim 2, wherein the instruction channel is specifically as follows:
information released by the instruction channel is an action to be completed at a specific node in a scenario flow.
4. The general simulation method for a train operation scenario according to claim 2, wherein a result return channel is specifically as follows:
a message released by the result return channel is an execution result of an instruction, a return result of the instruction is not limited to completion or failure, a specific return code is capable of being defined to represent different execution results, and the result is capable of being recognized by a scenario flow control module that receives the message.
5. The general simulation method for a train operation scenario according to claim 2, wherein the subscription channel is specifically as follows:
information released by subscription channel is data changes stored in Redis; and a range of data changes is divided based on a specific train.
6. The general simulation method for a train operation scenario according to claim 2, wherein a format of the identification code in step 2 is specifically as follows:
node group number: node device number.
7. The general simulation method for a train operation scenario according to claim 2, wherein a format of the instruction in the step 4 is specifically as follows:
receiver identification code, the number of instructions, instruction execution modes, instruction 1, instruction 2, instruction 3.
8. The general simulation method for a train operation scenario according to claim 7, wherein the instruction execution modes are specifically as follows:
a single execution, a plurality of executions, and circulated executions.
9. The general simulation method for a train operation scenario according to claim 2, wherein a format of the execution result in step 6 is specifically as follows:
executor identification code, the number of return results, instruction 1, result 1, instruction 2, result 2.
10. A system of a general simulation method for a train operation scenario according to claim 1, comprising:
a simulation data-driven module, configured to simulate a real scenario in real time and to be capable of generating random or preset simulation data;
a data subscription module, configured to release data changes to a subscription channel, wherein a client subscribing to the channel obtains real-time changes in a state of a simulation device; and
a scenario flow-driven module, configured to release a latest instruction to another node based on preset steps of scenario, and receive an execution result to drive a next execution action.
11. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 1 is implemented.
12. An non-transitory computer-readable storage medium on which a computer program is stored, wherein when the program is executed by a processor, the method according to claim 1 is implemented.
13. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 2 is implemented.
14. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 3 is implemented.
15. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 4 is implemented.
16. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 5 is implemented.
17. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 6 is implemented.
18. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 7 is implemented.
19. An electronic device, comprising a processor and a memory on which a computer program is stored, wherein when the processor executes program, the method according to claim 8 is implemented.