Metro equipment Web end automatic simulation method and system
By binding virtual serial ports to simulation module IDs, using natural language control, and employing automated test scripts, the limitations of abnormal scenario simulation and the cumbersome maintenance of automated scripts in subway equipment development and testing have been resolved. This has enabled efficient batch scenario testing and fully controllable equipment simulation, improving testing efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-24
AI Technical Summary
The development and testing of subway equipment suffers from limitations in simulating abnormal scenarios, cumbersome maintenance of automated scripts, and low testing efficiency. In particular, the interface differences between projects in different cities lead to low reuse rates of automated test scripts, and it is difficult to simulate abnormal situations with real equipment.
By establishing a binding relationship between the virtual serial port and the simulation module ID, the data forwarding link is obtained, and the business logic and abnormal state simulation of the subway equipment is realized. Batch scenario testing is carried out by using natural language control processes and automated test scripts, and automated test scripts are generated by combining the simulation equipment knowledge base and the multi-dimensional test knowledge base.
It enables comprehensive reproduction of abnormal scenarios and full-process control of subway equipment in hardware-free environments, improves the efficiency and accuracy of development, debugging and testing, reduces the maintenance cost of automated scripts, reduces the risk of misoperation, and meets the automated testing needs of multi-project and multi-interface scenarios.
Smart Images

Figure CN121722690A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the field of simulation technology of rail transit equipment, in particular to a subway equipment Web-side automatic simulation method and system. BACKGROUND
[0002] In the process of software debugging, system commissioning and testing of subway equipment, real hardware devices are usually needed to participate in the verification of communication protocols and business logic. For example, a subway TVM automatic ticket vending machine includes coin module devices, banknote module devices, card issuing devices, etc. However, the number of hardware devices is limited, the deployment is complex, and the maintenance cost is high, which requires continuous spending of a large amount of funds for purchasing new devices of different models. Moreover, it is difficult to simulate abnormal conditions with real devices, such as simulating the card ticket condition of the card issuing module device, which is difficult to operate on real hardware.
[0003] Due to the large number of modules and the large difference in protocols between different manufacturers, it is difficult for development and testing to be familiar with the data interaction and workflow of all modules. When automating the related business of subway equipment, there are differences in interface calls between different city projects, and it is difficult to maintain the automation script. In addition, during the testing process, the test personnel often need to spend a lot of time manually recording the completion results of the functions and the encountered abnormal states.
[0004] Patent "Intelligent digital rail transit simulation test system and method" (CN119370159A) discloses: a digital rail simulation platform, a digital rail internal test platform and a central digital rail server, the digital rail simulation platform is a visual digital rail 3D scene model combined with a rubber-tyred train vehicle dynamics model, and is built by relying on rubber-tyred train vehicle dynamics model data and digital rail urban construction coordinate maps. The digital rail internal test platform includes a test navigation control unit, which is pre-installed with a digital rail mathematical model, an electronic map, magnetic code data and environment perception simulation information. Not only can the train equipment state be monitored, but also the train equipment state change can be controlled in real time. Artificial intelligence machine learning technology is introduced to improve the test effectiveness. However, this scheme does not have the generation, adaptation and maintenance mechanism of the automatic test script, and the script reuse rate is low due to the differences in interfaces of different projects, which cannot meet the automatic test requirements in the multi-project and multi-interface scenarios. SUMMARY
[0005] The purpose of this application is to address the limitations of abnormal scenario simulation, cumbersome maintenance of automated scripts, and low testing efficiency in the development and testing of subway equipment. It proposes a web-based automated simulation method and system for subway equipment. By establishing a virtual serial port to acquire and forward data, it can be compatible with devices using different communication protocols, meeting the parallel simulation requirements of multiple modules in complex subway systems. Through simulating the business logic and abnormal states of the equipment, as well as natural language control processes and automated test scripts, it enables business simulation operations and batch scenario testing of subway equipment. This achieves abnormal scenario reproduction and full process controllability, improving operational efficiency, flexibility, and testing efficiency.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows: In a first aspect, embodiments of this application provide a web-based automated simulation method for subway equipment, the method comprising: Establish a virtual serial port for communication and interaction between the device software and the forwarding client; establish a binding relationship between the virtual serial port and the simulation module ID based on the current user's simulation module list to obtain the data forwarding link; simulate the business logic and abnormal state of the subway equipment based on the data forwarding link, perform business operations based on natural language control processes, and realize batch scenario testing of the subway equipment through automated test scripts and reporting processes.
[0007] In this solution, a virtual serial port is established between the device software and the forwarding client to bind the device software to the code module used for device simulation (in this embodiment, the simulation module, bound to the virtual serial port via an ID). This ensures that the simulation server accurately identifies the target simulation module, enabling targeted data distribution. Simultaneously, it guarantees bidirectional communication between the device software's command issuance and the simulation platform's (i.e., the simulation system) response. Business operations, including abnormal state simulation, are performed through natural language control processes, utilizing AI-assisted control to simplify user operation processes and reduce erroneous actions. During development and debugging, single-point functions can be quickly triggered via natural language, allowing the device software to complete functional debugging even without hardware. This solves the problem of real equipment being unable to fully reproduce various abnormal scenarios, improving the efficiency and accuracy of subway equipment simulation and testing. Automated test scripts combined with reporting processes upgrade single-point function verification to automated testing of batch scenarios, linking the device simulation capabilities and report generation capabilities of the simulation module. This improves test coverage while achieving a closed-loop automated testing system, reducing manual intervention and ensuring testing efficiency and reliability.
[0008] Preferably, establishing a virtual serial port for communication and interaction between the device software and the forwarding client includes: creating virtual serial ports based on the operating system type of the device software, with each set of virtual serial ports corresponding to the module communication port of the device software and the receiving port of the forwarding client.
[0009] Preferably, the step of establishing a binding relationship between the virtual serial port and the simulation module ID based on the current user's simulation module list and obtaining the data forwarding link includes: obtaining the list of simulation modules created by the current user; establishing a binding relationship between the virtual serial port and the simulation module instance ID according to a preset configuration; and after obtaining the binding relationship between the virtual serial port and the simulation module instance ID, establishing a WebSocket connection between the virtual serial port and the simulation server to obtain the data forwarding link between the device software, the forwarding client, and the simulation server.
[0010] Preferably, the simulation of the business logic and abnormal states of the subway equipment based on the data forwarding link includes: based on the data forwarding link, encapsulating the serial port data of the equipment software and transmitting it to the simulation server via the forwarding client; the serial port data includes at least serial port binary instructions, user identity, and module metadata; the simulation server extracts the module ID based on the module metadata, locates the specific simulator instance based on the module ID, and obtains the specific module model from the simulator instance; and starts a specified task chain based on the module model to simulate the business logic and abnormal states.
[0011] Preferably, the step of initiating a specified task chain based on the module model to simulate business logic and abnormal states includes: forwarding serial port data to the target module according to the module model; unpacking the serial port data according to the serial port protocol; and converting the byte array obtained from the unpacking into a standardized command object; constructing a manufacturer instruction adaptation layer based on the general virtual device corresponding to the simulation module of various subway equipment; converting the standardized command object into a general instruction through the manufacturer instruction adaptation layer; and calling the standard method of the common module to complete the business logic of subway equipment operation.
[0012] Preferably, the step of initiating a specified task chain based on the module model to simulate business logic and abnormal states further includes: registering processing methods corresponding to various abnormal states through annotation scanning based on an exception handling mechanism, and dynamically proxying and enhancing the business classes of common modules; when the device software sends a business instruction, verifying the state of the common module, and if an abnormal state exists, triggering the corresponding exception handling logic, executing the corresponding processing method, and obtaining the business failure response and error code; converting the processed business response object into a binary command, encapsulating it with the serial communication protocol header and verification header of the corresponding manufacturer, and sending it to the forwarding client through a WebSocket connection, and then forwarding it to the device software by the forwarding client.
[0013] Preferably, the business operation based on the natural language control process includes: constructing a simulation device knowledge base; responding to the user's natural language command, converting it into a vector and performing similarity matching with the simulation device knowledge base to obtain the user's control intent and the target simulation module; based on the user's control intent, determining the target device control method labeled with functional descriptions and parameter specifications through the target simulation module ID, and calling the target device control method to complete the device control; wherein, if the user's control intent is a device abnormal state setting command, then calling the corresponding state control method to add an abnormal marker to the device.
[0014] Preferably, the process of implementing batch scenario testing of subway equipment through automated test scripts and reporting includes: responding to the user's script generation instruction, encoding the script, and then performing similarity matching in a multi-dimensional test knowledge base according to filtering rules to obtain the module configuration, interface information, and corresponding business template of the target project; generating an automated test script by combining the module configuration, interface information, and corresponding business template of the target project with sample code and customized prompts; running the automated test script, retrieving the corresponding script and business template based on the running log containing interface request and response data, and generating a test report containing interface interaction details, business call chain, and abnormal node location based on the matched business template, running log, and corresponding code combined with the report sample format.
[0015] Preferably, the multidimensional test knowledge base includes at least the interaction interface documents between the device software and the simulation platform, target project configuration information, business templates, and test script examples.
[0016] Secondly, embodiments of this application provide a web-based automated simulation system for subway equipment, comprising: a virtual serial port module for establishing a virtual serial port for communication and interaction between the equipment software and the forwarding client; and a data forwarding module for establishing a binding relationship between the virtual serial port and the simulation module ID based on the current user's list of simulation modules, and obtaining the data forwarding link; The equipment simulation module is used to simulate the business logic and abnormal states of subway equipment based on the data forwarding link, perform business operations based on natural language control processes, and realize batch scenario testing of subway equipment through automated test scripts and reporting processes.
[0017] The beneficial effects of this application are: 1. By simulating various subway equipment, it replaces the real equipment from various subway manufacturers. Through natural language control processes and automated test scripts, it reduces the cost of development, debugging, and testing. It transforms the development and testing personnel from being tightly bound to the equipment to being able to freely customize according to development and testing needs, thereby meeting the testing requirements of different subway module equipment. It accelerates the development efficiency and quality of subway equipment software, making some abnormal functions that could not be tested possible. It also reduces the maintenance cost of automated scripts. 2. By responding to the user's control intentions to perform business logic operations, the difficulty of use for users is reduced, thereby reducing the risk of misoperation and realizing the automation of the operation process; and through abnormal state simulation, the abnormal scenarios of subway equipment can be controlled and reproduced without relying on random failures of real equipment, solving the problem that it is difficult to reproduce abnormal scenarios or the abnormal coverage is limited in existing technologies. 3. By establishing a virtual serial port and data transmission link, the bidirectional flow of instructions from the equipment software and responses from the simulation platform is ensured, thereby meeting the real-time interaction requirements of subway equipment for instructions and responses. At the same time, through data encapsulation, the simulation server can accurately identify the target simulation module, avoid data crosstalk in multi-user, multi-module scenarios, and achieve targeted data distribution. Attached Figure Description
[0018] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. The drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings.
[0019] Figure 1 A flowchart of the automated simulation method for subway equipment on the web terminal provided in this application embodiment.
[0020] Figure 2 This is a schematic diagram of a natural language manipulation process provided in an embodiment of this application.
[0021] Figure 3 A schematic diagram of the automated simulation system module for subway equipment on the web interface provided in this application embodiment. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description of this application is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely one preferred embodiment of this application and are only used to explain this application. They do not limit the scope of protection of this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] Example 1: As Figure 1 As shown, a web-based automated simulation method for subway equipment includes steps S1-S3, wherein: S1. Establish a virtual serial port for communication and interaction between the device software and the forwarding client; It should be noted that the subway equipment simulation mainly simulates the serial communication and business logic of real subway equipment, realizing the interaction of instructions with the equipment software. The simulation can start from the serial port message sent by the equipment software and end with the response message returned by the simulation system. Therefore, before the simulation is carried out, a virtual serial port is established to realize the serial port data transmission between the equipment software and the simulation system.
[0024] As an optional implementation, establishing a virtual serial port for communication and interaction between the device software and the forwarding client includes: Virtual serial ports are created based on the operating system type of the device software. Each set of virtual serial ports corresponds to the module communication port of the device software and the receiving port of the forwarding client.
[0025] In this embodiment, virtual serial port channels are built for different operating systems of the device software. For example, in the Windows system, the com0com tool is used to create virtual serial port pairs, and in the Linux system, the socat command is used to create pseudo-terminal (Pseudo-TTY) virtual serial ports. Each set of virtual serial ports corresponds to the module communication port of the device software and the receiving port of the forwarding client, ensuring that the serial port data sent by the device software can be accurately forwarded to the forwarding client.
[0026] S2. Based on the current user's list of simulation modules, establish a binding relationship between the virtual serial port and the simulation module ID, and obtain the data forwarding link.
[0027] As an optional implementation, step S2 includes: Get the list of simulation modules created by the current user, and establish the binding relationship between the virtual serial port and the simulation module instance ID according to the preset configuration; After obtaining the binding relationship between the virtual serial port and the simulation module instance ID, a WebSocket connection is established between the virtual serial port and the simulation server to obtain the data forwarding link between the device software, the forwarding client, and the simulation server.
[0028] In some embodiments, after logging into the system, the forwarding client first obtains a list of simulation modules created by the current user, establishes a binding relationship between the serial port and the simulation module instance ID (i.e., the simulation module ID) according to a preset configuration, and then establishes a WebSocket connection with the simulation server based on the STOMP protocol. During the data transmission phase, the forwarding client sends the binary commands of the device software to the corresponding serial port, encapsulates the user identity, module ID, and other metadata, and then forwards them to the simulation server. The simulation server maintains the "user-connection" mapping relationship by reading the user identifier header information, and locates the target simulator instance from the cache or database by combining extended data such as the serial port number, thereby realizing the targeted distribution of serial port data.
[0029] The simulation module list is a collection of modules (i.e., business code modules used to simulate the operation of subway equipment, which are configured and can be used to simulate the operation of subway equipment under the dimension of the currently logged-in user.) The simulation module list includes at least: basic information of subway equipment, virtual serial port configuration information, and module status information. The basic information of subway equipment includes at least: module name (e.g., TIM004C card issuing module), manufacturer name (e.g., Siemens), equipment type (e.g., TVM ticket vending machine sub-module) and protocol version. The virtual serial port configuration information includes at least: the preset bound virtual serial port number (e.g., COM3), communication baud rate, and data bits / parity bits (e.g., 8N1). The module status information includes at least: whether the module is online, the current simulation status (e.g., idle / processing instructions), and anomaly flags (e.g., none / ticket outlet blocked).
[0030] It should be noted that obtaining the list of simulation modules created by the current user is for the purpose of providing a basis for binding virtual serial port ports with simulation modules and providing a visual data foundation for user interaction. Specifically, the forwarding client needs to know which modules the current user can simulate in order to associate the local virtual serial port number (such as COM3) with the specific modules in the list, ensuring that the instructions issued by the device software from COM3 correspond to the "TIM004C card issuing module". The front end will display the modules that the user can operate based on this list, making it convenient for the user to select the device module to be simulated (i.e., the simulation module in the system corresponding to the target device), while also providing feedback on the real-time status of the module (such as whether it is online).
[0031] Furthermore, the simulation module ID is a globally unique identifier generated for each entry in the simulation module list. It is used to distinguish different modules, even those of the same model and manufacturer (such as two TIM004C card issuing modules), which will be assigned different IDs to ensure that data is distributed in a targeted manner without confusion. For example, COM3 is bound to TIM004C-01. When the device software sends a command from COM3, the forwarding client will encapsulate the command with the module ID "TIM004C-01" and send it to the simulation server via WebSocket. After receiving the serial port data, the simulation server only needs to read the module ID to quickly identify which module the command should be sent to, thereby avoiding data crosstalk in multiple users and scenarios. For example, a TIM004C module command from user A will not be sent to the same model module from user B.
[0032] Furthermore, a target simulator instance refers to a "virtual device entity" in the simulation server that is configured based on the list of simulation modules and runs with the module ID as its identifier. It is a virtual device with complete business logic (such as card issuance, coin insertion, and exception handling) and real-time status. It is the core carrier for the simulation module to realize device simulation. The subsequent business logic and exception state simulation are completed through this carrier, and finally a response message is generated.
[0033] S3. Simulate the business logic and abnormal states of subway equipment based on the data forwarding link, perform business operations based on natural language control processes, and realize batch scenario testing of subway equipment through automated test scripts and reporting processes.
[0034] As an optional implementation, step S3 involves simulating the business logic and abnormal states of the subway equipment based on the data forwarding link, including: Based on the data forwarding link, the serial port data of the device software is encapsulated and then transmitted to the simulation server via the forwarding client. The serial port data includes at least serial port binary instructions, user identity, and module metadata. The simulation server extracts the module ID based on the module metadata, locates the specific simulator instance based on the module ID, and obtains the specific module model from the simulator instance; The specified task chain is started according to the module model to simulate business logic and abnormal states.
[0035] As an optional implementation, a specified task chain is initiated based on the module model to simulate business logic and abnormal states, including: Based on the module model, the serial port data is forwarded to the target module to unpack the serial port data according to the serial port protocol and convert the unpacked byte array into a standardized command object; Based on the simulation modules of various subway equipment, a manufacturer instruction adaptation layer is built to correspond to the general virtual equipment. The manufacturer instruction adaptation layer converts standardized command objects into general instructions, so as to call the standard methods of the common module to complete the business logic of subway equipment operation.
[0036] In some embodiments, the simulation server locates the target simulator instance based on the module ID in the serial port data, obtains the specific module model from the instance, enters the specified task chain, and then runs the business logic and abnormal state simulation, specifically including: binary decoding, business logic processing, and abnormal state handling. The business logic represents the method flow for simulating the operation scenario of subway equipment, and is expressed in the form of program code.
[0037] It should be noted that different manufacturers of different module devices have their own serial communication protocols. At the data encapsulation level, the main considerations are the start, end, and verification parts of the module command data. Therefore, the binary decoding steps in this embodiment include: first, unpacking according to the protocol marker bits (DLE / STX / ETX), and then converting the byte array into a standardized command object to adapt to the protocols of different manufacturers. Specifically, the main serial data unpacking logic is extracted based on differences. For example, the start and end of some modules are determined by specific marker bits, such as DLE (0x10) representing an escape character, STX (0x02) representing a start marker, and ETX (0x03) representing an end marker; the start and end of the byte array are determined for different module models, and the actual command data part in the middle is extracted to achieve the extraction of command data for different protocols. After removing the start and end markers, the length and type of the command data are determined by the attribute type and position order in the program object. For example, if the first byte of a certain command protocol of a certain module is the command code and the second byte is the card box number, a command object with two byte attributes can be constructed. The byte array is split in order and injected into the command object in the program. Then, business distribution is performed according to the command to control the behavior of the simulation module device.
[0038] Furthermore, each type of subway equipment is abstracted into a virtual device at the simulation level. This device supports the general operation of that type of module. The system builds a manufacturer instruction adaptation layer based on the virtual device. The adaptation layer converts the private instructions of different manufacturers into general instructions, calls the common module methods (i.e., the functions of the common program code module, which contain business logic, such as the process of card issuance and coin counting) to complete the business logic (such as implementing the deduction of the number of cards in the card box of the card issuance module), and then converts the response result of the common module into the private error code of the corresponding manufacturer, so as to achieve unified adaptation of cross-manufacturer protocols.
[0039] Specifically, because different manufacturers of the same type of equipment implement different development interface protocols, the code running business logic needs to be adapted to the equipment of different manufacturers. The specific commands need to be adapted before calling the methods exposed by the public module to implement the business processing of the device module (simulation module). For example, in the card issuing module's card issuing operation, the abstract virtual public card issuing device accepts custom card issuing commands, returns a success response and a custom error code. The system, at the adaptation layer, converts the instructions for a specific model into public instructions and passes them to the virtual public module, then converts the generated response into an error code specific to that model module.
[0040] As an optional implementation, step S3, which involves starting a specified task chain based on the module model to simulate business logic and abnormal states, further includes: Based on the exception handling mechanism, the corresponding handling methods for various exception states are registered through annotation scanning, and the business classes of the public module are dynamically proxyed and enhanced. When the device software sends a service instruction, it verifies the status of the common module. If an abnormal status exists, it triggers the corresponding exception handling logic, executes the corresponding processing method, and obtains the service failure response and error code. The completed business response object is converted into a binary command, encapsulated with the corresponding manufacturer's serial communication protocol header and checksum header, and then sent to the forwarding client via a WebSocket connection. The forwarding client then forwards the command to the device software.
[0041] In this embodiment, the virtual device needs to simulate abnormal states to support development and testing under abnormal scenarios. The simulation system determines whether to enter abnormal logic by maintaining the device state. For example, if a ticket outlet blockage state is added to the card issuing module, and a blockage state is found in the module's state list when the card issuing method is executed, the card issuing action should enter abnormal logic, and the card issuing method should return a card issuing failure and response error code.
[0042] The simulation system is built using Spring Boot, a rapid application development framework. It registers exception handling methods (functions) corresponding to abnormal states of the subway equipment by scanning annotations within the Spring Boot framework. Then, it dynamically proxies the business processing classes (functions) of common modules, implementing the switching of exception logic within the dynamic proxies. When the equipment software sends a card-issuing command, it enters the card-issuing method of the simulation device. Before executing the original card-issuing logic code, it checks if there are any states affecting the execution of this method. If so, it enters the registered corresponding exception logic method. A blocking state here will cause the card-issuing command to fail, causing the sensor status acquisition method to return a sensor status blocking error, and finally returning the error code from the compatible manufacturer.
[0043] Furthermore, after completing the business logic processing and abnormal state simulation, the business response or abnormal result is converted into binary instructions, encapsulated with a protocol header, and fed back to the device software via WebSocket.
[0044] In other embodiments, the task chain supports data flow pause / release throughout, and the front end simultaneously displays two views: a hexadecimal byte array and JSON. Developers can use artificial intelligence to assist in operation or manually modify the data to verify device response in special scenarios, enabling flexible intervention in development and debugging.
[0045] Specifically, the task chain establishes a WebSocket connection with the frontend, which can control the pause and release of the binary data stream. Since the data in the task chain has multiple stages, such as the binary byte array stage and the object stage, each task chain has a blocking flag. The frontend can control this flag to block the data stream and display it on the frontend interface. Sometimes developers need to modify the lowest-level byte array to verify certain scenarios. The platform provides the command in hexadecimal byte array format, such as FFD1 3F 74. When users want to make simple modifications to the command interface data, the simulation system also provides a JSON view of the object, such as {"commandCode":1,"boxATicketNum":100,"boxBTicketNum":200,"recycleTicketNum":10}. Users can visually modify the command based on the fields. After modification, clicking "Release" allows the data to be changed freely and continue flowing.
[0046] In this embodiment, the flexibility and applicability of the subway equipment automation simulation system are enhanced by providing customized support for pausing or releasing the task chain data flow. Since the serial communication between subway equipment software and hardware is real-time and continuous, in traditional debugging based on real hardware, developers find it difficult to capture the intermediate states of command interactions. For example, after the equipment software issues a card-issuing command, the hardware returns abnormal byte data, but the interaction is completed instantly, making it impossible to freeze and analyze. Therefore, this embodiment provides customized data flow support, allowing the data flow to be paused at any stage of module simulation, such as after decoding, before business execution, or before encoding. This allows developers to fully view the current data parsing results and equipment status (such as card box ticket quantity and anomaly markers), thereby locating issues such as "protocol decoding errors," "business logic calculation deviations," and "manufacturer error code adaptation errors," avoiding difficulties in tracing problems caused by real-time data flow. Simultaneously, by temporarily modifying business parameters, a customized business scenario verification channel is provided, eliminating the need to reconfigure the basic parameters of the simulation module and improving scenario verification efficiency.
[0047] As an optional implementation, step S3 involves performing business operations based on natural language control processes, including: Build a knowledge base for simulation equipment; In response to the user's natural language commands, the commands are vectorized and then matched with the simulation device knowledge base to obtain the user's control intention and the target simulation module. Based on the user's control intent, the target device control method, which is labeled with functional descriptions and parameter specifications, is determined through the target simulation module ID, and the target device control method is called to complete the device control; wherein, if the user's control intent is a device abnormal state setting instruction, the corresponding state control method is called to add an abnormal marker to the device.
[0048] Specifically, based on the model, function, protocol rules, and control logic of the subway equipment, the data is divided into modules, cleaned, and transformed into vectors before being stored in a vector database to obtain a simulation equipment knowledge base. Each data block is bound to a simulation module ID, and data segmentation facilitates data retrieval, improves the efficiency of recognizing user control intentions, and thus improves user control efficiency.
[0049] In some embodiments, such as Figure 2 As shown, in response to the user's natural language commands, the commands are vectorized and then matched with the simulation device knowledge base for similarity analysis to obtain the user's control intent and the target simulation module, including: The system performs semantic parsing and encoding of the user's natural language commands, queries and matches the encoded command text in the simulation device knowledge base, and calculates the vector similarity between the command text and the matching knowledge base information. The user's control intention and the target simulation module are determined based on vector similarity, and relevant information of the target simulation module is obtained.
[0050] Furthermore, the target simulation module ID is extracted based on the relevant information of the target simulation module, and the corresponding target device control method is called based on the target simulation module ID. The target device control method represents the function used to implement the business logic of the target device.
[0051] Furthermore, the function description and parameter description marked on the target device control method respectively indicate the function to be performed by the method and the parameter information to be passed when calling the method. For example, the method description is "obtain simulation module ID according to model" and the parameter description is "device model".
[0052] In some examples, the simulation system performs semantic parsing, encoding, and vector similarity matching on the user's natural language commands to obtain the device model. Based on the device model, it calls a method to obtain the target simulation module ID, and after obtaining the target simulation module ID, it determines the function for the business logic.
[0053] It should be noted that, in addition to interacting with the equipment software, subway equipment also interacts with personnel actions and undergoes changes in its own abnormal state. In this embodiment, these situations are unified as equipment software-related business. The simulation system provides business operation functions to the outside world, supporting personnel operations such as coin insertion and module response-related operations such as module anomalies. When users want to operate the equipment at the business level or control changes in the equipment's state, they can input the corresponding requirements on the console, such as "make the 004c card issuing module issue cards". Using artificial intelligence-assisted methods such as natural language control processes, users can complete their needs without switching pages to search for functions, thereby quickly completing equipment operation.
[0054] As an optional implementation, step S3 involves using automated test scripts and reporting processes to perform batch scenario testing of subway equipment, including: In response to the user's script generation command, the script is encoded and then similarity matching is performed in the multidimensional test knowledge base according to the filtering rules to obtain the target project's module configuration, interface information and corresponding business template. The module configuration, interface information, corresponding business templates and sample code, and customized prompts of the target project are used to generate automated test scripts. By running the automated test script, the corresponding script and business template are retrieved based on the running log containing interface request and response data. Based on the matched business template, running log, and corresponding code, a test report containing interface interaction details, business call chain, and abnormal node location is generated in the form of a report sample.
[0055] As an optional implementation, the multidimensional test knowledge base includes at least the interaction interface documents between the device software and the simulation platform, target project configuration information, business templates, and test script examples.
[0056] Understandably, during the development and testing phase of device software, automated scripts are needed to perform basic functional testing. While the overall workflow is relatively fixed across different device software projects, the specific software method names, parameters, and the manufacturer and model of the modules used by the device often differ, making it difficult to maintain automated scripts. Therefore, in this embodiment, automated scripts are automatically generated using a multi-dimensional test knowledge base to achieve automated testing in batch scenarios.
[0057] In some embodiments, the user inputs a test requirement (such as "Generate an automated script for purchasing tickets on TVM for Line 24 in City A: buy two 4-yuan tickets, insert one 10-yuan coin, the second ticket fails to be issued, and verify the change amount"). After semantic parsing and vector encoding of the test requirement, the system matches the project configuration, business template, and interface information in the test knowledge base according to filtering rules (such as target project configuration information + business template). Based on this data, sample code, and customized prompts, an automated test script adapted to the project is generated.
[0058] Furthermore, after the user runs the automated script, the system imports the runtime log containing interface request and response data. The corresponding script and business template are retrieved by the current session ID. The system then integrates the business template, automated code, runtime log, and report sample format to generate a complete test report containing interface interaction details, business call chain, and abnormal node location, thereby achieving automation and refinement of test records.
[0059] In this embodiment, the problem of large differences in interfaces between subway projects in different cities and high script maintenance costs is overcome by using an automated test script generation mechanism. This enables rapid generation of test scripts. At the same time, single-point function verification is upgraded to automated testing of batch scenarios. When testing a single function of a device, the system can test the entire process of implementing that single function, improving test coverage. After the test is completed, a test report is automatically generated, reducing manual intervention, ensuring the reliability of test results, and enabling test traceability, further improving test efficiency.
[0060] Example 2: This application also provides a web-based automated simulation system for subway equipment corresponding to the web-based automated simulation method for subway equipment, such as... Figure 3 As shown, the system includes: The virtual serial port module is used to establish a virtual serial port for communication and interaction between the device software and the forwarding client; The data forwarding module is used to establish a binding relationship between virtual serial port ports and simulation module IDs based on the current user's list of simulation modules, and to obtain the data forwarding link; The equipment simulation module is used to simulate the business logic and abnormal states of subway equipment based on the data forwarding link, perform business operations based on natural language control processes, and realize batch scenario testing of subway equipment through automated test scripts and reporting processes.
[0061] In this embodiment, a virtual serial port is established between the device software and the forwarding client to bind the device software to the code module used to implement device simulation (in this embodiment, the simulation module, bound to the virtual serial port via an ID). This ensures that the simulation server accurately identifies the target simulation module, enabling targeted data distribution. Simultaneously, it ensures bidirectional flow between the device software's command issuance and the simulation platform's response feedback. Business operations, including abnormal state simulation, are performed through natural language control processes. This utilizes AI-assisted control, simplifying user operation processes and reducing misoperations. During development and debugging, single-point functions can be quickly triggered via natural language, allowing the device software to complete functional debugging even without hardware. This solves the problem of real equipment being unable to fully reproduce various abnormal scenarios, improving the efficiency and accuracy of subway equipment simulation and testing. Automated test scripts combined with reporting processes upgrade single-point function verification to automated testing of batch scenarios. The device simulation capabilities and report generation capabilities of the simulation module are linked, improving test coverage while achieving an automated testing closed loop, reducing manual intervention, and ensuring testing efficiency and reliability.
[0062] The above-described embodiments are preferred embodiments of this application and are not intended to limit the specific scope of this application. The scope of this application includes but is not limited to the specific embodiments described above. All equivalent changes made in accordance with the shape, structure, and method of this application are within the protection scope of this application.
Claims
1. A web-based automated simulation method for subway equipment, characterized by: Includes the following steps: Establish a virtual serial port for communication and interaction between the device software and the forwarding client; Establish a binding relationship between virtual serial port ports and simulation module IDs based on the current user's simulation module list, and obtain the data forwarding link; The system simulates the business logic and abnormal states of subway equipment based on the data forwarding link, performs business operations based on natural language control processes, and realizes batch scenario testing of subway equipment through automated test scripts and reporting processes.
2. The automated simulation method for subway equipment via the web interface according to claim 1, characterized in that: The establishment of the virtual serial port for communication and interaction between the device software and the forwarding client includes: Virtual serial ports are created based on the operating system type of the device software. Each set of virtual serial ports corresponds to the module communication port of the device software and the receiving port of the forwarding client.
3. The automated simulation method for subway equipment via the web interface according to claim 1, characterized in that: The process of establishing a binding relationship between virtual serial port ports and simulation module IDs based on the current user's simulation module list, and obtaining the data forwarding link, includes: Get the list of simulation modules created by the current user, and establish the binding relationship between the virtual serial port and the simulation module instance ID according to the preset configuration; After obtaining the binding relationship between the virtual serial port and the simulation module instance ID, a WebSocket connection is established between the virtual serial port and the simulation server to obtain the data forwarding link between the device software, the forwarding client, and the simulation server.
4. The automated simulation method for subway equipment via the web interface according to claim 3, characterized in that: The simulation of the business logic and abnormal states of subway equipment based on the data forwarding link includes: Based on the data forwarding link, the serial port data of the device software is encapsulated and then transmitted to the simulation server via the forwarding client. The serial port data includes at least serial port binary instructions, user identity, and module metadata. The simulation server extracts the module ID based on the module metadata, locates the specific simulator instance based on the module ID, and obtains the specific module model from the simulator instance; The specified task chain is started according to the module model to simulate business logic and abnormal states.
5. The automated simulation method for subway equipment via the web interface according to claim 4, characterized in that: The step of initiating a specified task chain based on the module model to simulate business logic and abnormal states includes: Based on the module model, the serial port data is forwarded to the target module to unpack the serial port data according to the serial port protocol and convert the unpacked byte array into a standardized command object; Based on the simulation modules of various subway equipment, a manufacturer instruction adaptation layer is built to correspond to the general virtual equipment. The manufacturer instruction adaptation layer converts standardized command objects into general instructions, so as to call the standard methods of the common module to complete the business logic of subway equipment operation.
6. The automated simulation method for subway equipment via the web interface according to claim 5, characterized in that: The step of initiating a specified task chain based on the module model to simulate business logic and abnormal states also includes: Based on the exception handling mechanism, the corresponding handling methods for various exception states are registered through annotation scanning, and the business classes of the public module are dynamically proxyed and enhanced. When the device software sends a service instruction, it verifies the status of the common module. If an abnormal status exists, it triggers the corresponding exception handling logic, executes the corresponding processing method, and obtains the service failure response and error code. The completed business response object is converted into a binary command, encapsulated with the corresponding manufacturer's serial communication protocol header and checksum header, and then sent to the forwarding client via a WebSocket connection. The forwarding client then forwards the command to the device software.
7. The automated simulation method for subway equipment via the web interface according to claim 1, characterized in that: Business operations are conducted based on natural language manipulation processes, including: Build a knowledge base for simulation equipment; In response to the user's natural language commands, the commands are vectorized and then matched with the simulation device knowledge base to obtain the user's control intention and the target simulation module. Based on the user's control intent, the target device control method, which is labeled with functional descriptions and parameter specifications, is determined through the target simulation module ID, and the target device control method is called to complete the device control; wherein, if the user's control intent is a device abnormal state setting instruction, the corresponding state control method is called to add an abnormal marker to the device.
8. The automated simulation method for subway equipment via the web interface according to claim 1, characterized in that: The process of implementing batch scenario testing of subway equipment through automated test scripts and reporting workflows includes: In response to the user's script generation command, the script is encoded and then similarity matching is performed in the multidimensional test knowledge base according to the filtering rules to obtain the target project's module configuration, interface information and corresponding business template. The module configuration, interface information, corresponding business templates and sample code, and customized prompts of the target project are used to generate automated test scripts. By running the automated test script, the corresponding script and business template are retrieved based on the running log containing interface request and response data. Based on the matched business template, running log, and corresponding code, a test report containing interface interaction details, business call chain, and abnormal node location is generated in the form of a report sample.
9. The automated simulation method for subway equipment via the web interface according to claim 8, characterized in that: The multidimensional test knowledge base includes at least the interaction interface documents between the device software and the simulation platform, target project configuration information, business templates, and test script examples.
10. A web-based automated simulation system for subway equipment, applicable to the web-based automated simulation method for subway equipment as described in any one of claims 1-9, characterized in that: include: The virtual serial port module is used to establish a virtual serial port for communication and interaction between the device software and the forwarding client; The data forwarding module is used to establish a binding relationship between virtual serial port ports and simulation module IDs based on the current user's list of simulation modules, and to obtain the data forwarding link; The equipment simulation module is used to simulate the business logic and abnormal states of subway equipment based on the data forwarding link, perform business operations based on natural language control processes, and realize batch scenario testing of subway equipment through automated test scripts and reporting processes.
Citation Information
Patent Citations
Intelligent digital rail transit simulation test system and method
CN119370159A