A method and device for adapting a discrete event simulation engine to a war game simulation system
By building a model interface rule template, extracting the interface list and performing automatic mapping integration, the performance bottleneck of the native engine of the war game simulation system was solved, and adaptation with an efficient discrete event simulation engine was achieved to meet the needs of large-scale simulation.
Patent Information
- Application Number
- CN202410654621.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2044-05-24
AI Technical Summary
The native discrete event simulation engine of existing wargaming systems faces severe performance bottlenecks when faced with large-scale simulation needs, and the upgrade cost is high or impossible to upgrade, making it difficult to meet the needs of efficiently scheduling a large number of engaged entities and complex confrontation environments.
The model interface rule template is constructed through the rule adaptation module, and the model interface list is extracted by combining with the code scanning module. The engine automatic integration module is used to realize the automatic adaptation of the war game simulation system and the efficient discrete event simulation engine, including the automatic mapping and integration of entity management, time management and event management interfaces.
It achieves the decoupling and adaptation of the wargaming system and the high-performance discrete event simulation engine, meets the efficient event scheduling requirements of large-scale wargaming systems, and reduces the cost and complexity of engine upgrades.
Smart Images

Figure CN118551554B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information technology, and in particular relates to a method and device for adapting a discrete event simulation engine to a war game simulation system. Background Art
[0002] Discrete event simulation is an event-driven simulation method used to simulate and analyze discrete events and state changes in a system. In discrete event simulation, the behavior of a system is modeled as a series of discrete events that occur at specific points in time and cause changes in the system's state. Discrete event simulation is widely used in fields such as logistics management, medical systems, financial risk assessment, and combat simulation. The discrete event simulation engine is the engine of the discrete event simulation system, providing event management, time management, and entity management capabilities. It can execute discrete events generated by the system and advance the system's simulation time. The computing power of the discrete event simulation engine determines the performance of the discrete event simulation system.
[0003] A wargame system is a combat simulation system with chess-like attributes, typically consisting of a board, pieces, and rules. The board represents the battlefield environment, the pieces represent the opposing forces, and the rules encompass the pieces' movements and the effects of decisions. Large-scale wargame systems involve massive numbers of engaged entities and a global combat environment. They are typically constructed using discrete event simulation methods. The system discretizes the interactive behaviors of entities based on a discrete grid, and the discrete events generated by the system are scheduled and executed by a discrete event simulation engine.
[0004] With the development of new quality and domain models, the number of discrete events generated by wargaming systems has increased dramatically. Native engines have reached performance bottlenecks and cannot meet the needs of large-scale wargaming. Therefore, it is urgent to upgrade or replace native engines. Considering the high cost or even inability to upgrade engines (some engines are developed in niche languages and have limited upgrades), this paper proposes a method and device for adapting a discrete event simulation engine to a wargaming system. This method can decouple the wargaming system from the native simulation engine and adapt it to a high-efficiency discrete event simulation engine.
[0005] Chinese Patent: A Wargame Simulation System (CN 115618649B) provides a method for managing simulation instructions, simulation plans, and simulation turn information for a turn-based computer wargame system. This patent does not analyze the discrete event simulation engine of the wargame system, nor does it describe a method for adapting the discrete event simulation engine to the wargame system. This patent describes a method and device for adapting a discrete event simulation engine to a wargame system. This method and device utilizes a rule adaptation module, a code scanning module, and an engine automatic integration module to decouple the wargame system from the native simulation engine and automatically adapt it to a high-efficiency discrete event simulation engine. Summary of the Invention
[0006] The present invention aims to provide a method and apparatus for adapting a discrete event simulation engine to a wargaming system. This method, through a rule adaptation module and a code scanning module, decouples the wargaming system model from the native simulation engine. Furthermore, through an automatic engine integration module, it automatically integrates the wargaming system model with a highly efficient discrete event simulation engine. This method enables automatic engine adaptation for existing wargaming systems, resolving the issue of high engine upgrade costs or even inaccessibility.
[0007] The technical solution adopted in the present invention is as follows:
[0008] A method for adapting a discrete event simulation engine to a war game simulation system includes the following steps:
[0009] Use regular expressions to construct rule templates for entity management interface, time management interface, and event management interface in the war game simulation system model;
[0010] Scan the declaration and definition files of the wargaming system model code to extract the entity type and event type lists in the declaration files. Combined with the constructed rule template, scan the definition files to extract the interface lists of the entity management interface, time management interface, and event management interface.
[0011] The interfaces in the discrete event simulation engine are automatically mapped with the interfaces in the interface list extracted from the war game system model, and the automatic integration of the discrete event simulation engine is achieved based on a custom script.
[0012] Furthermore, the entity management interface includes creating an entity interface and destroying an entity interface, and rule templates for creating an entity interface and destroying an entity interface are constructed through regular expressions.
[0013] Furthermore, the time management interface includes a time setting interface and a time query interface, and rule templates of the time setting interface and the time query interface are constructed by regular expressions.
[0014] Furthermore, the event management interface includes an event creation interface, an event cancellation interface, an event rescheduling interface, an event loop traversal interface, and an event quantity query interface, and rule templates of the five interfaces are constructed through regular expressions.
[0015] Furthermore, the method of extracting a list of entity types and event types in a declaration file includes: scanning and segmenting the code in the declaration file line by line, constructing a segmentation set of the declaration file based on the lexical and grammatical structure of the model implementation language, extracting the entity types and event types in the declaration file, and obtaining a list of entity types and event types in the declaration file.
[0016] Furthermore, the combination of the constructed rule template and the definition file is scanned, including:
[0017] Scan the code in the main function file line by line, and extract the interface list in the main function file based on the rule template. Each interface information in the interface list includes the interface type, interface name, file name where the interface is located, and the line number where the interface is located;
[0018] Determine whether the main function calls other sub-functions. If so, continue scanning the sub-function file and extract the interface list in the sub-function file based on the rule template.
[0019] Furthermore, the interfaces in the discrete event simulation engine are automatically mapped with the interfaces in the interface list extracted from the war game simulation system model, and the interface mapping rules adopted include one-to-one and one-to-many.
[0020] Furthermore, the event loop traversal interface in the interface list is mapped to a combination of two interfaces of the discrete event simulation engine to implement a loop traversal function.
[0021] A method and device for adapting a discrete event simulation engine to a war game simulation system, comprising:
[0022] A rule adaptation module is used to construct rule templates for the entity management interface, time management interface, and event management interface in the war game simulation system model through regular expressions;
[0023] The code scanning module is used to scan the declaration files and definition files of the wargaming system model code, extract the entity type and event type lists in the declaration files based on the lexical and grammatical rules of the model implementation language, and scan the definition files in combination with the rule template output by the rule adaptation module to extract the interface lists of the entity management interface, time management interface, and event management interface;
[0024] The engine automatic integration module is used to automatically map the interfaces in the discrete event simulation engine with the interfaces in the interface list extracted from the war game simulation system model, and realize the automatic integration of the discrete event simulation engine based on custom scripts.
[0025] The beneficial effects of the present invention are as follows:
[0026] The present invention provides a method and device for adapting a discrete event simulation engine to a wargame simulation system, which provides three functions: first, based on the characteristics of the model language, a rule template for the entity management interface, time management interface, and event management interface in the model is constructed through regular expressions; second, based on the lexical and grammatical rules of the model implementation language, a list of entity types and event types in the declaration file is extracted, and on this basis, the definition file is scanned in combination with the rule template output by the rule adaptation module to extract the interface list of entities, events, and simulation time; third, the interface in the discrete event simulation engine is automatically mapped to the interface extracted by the code scanning module of the model, and the automatic integration of the discrete event simulation engine is realized based on a custom script. In summary, the method and device for adapting a discrete event simulation engine to a wargame simulation system provided by the present invention provides a method for adapting a wargame simulation system to a high-performance discrete event simulation engine, meeting the efficient scheduling requirements of large-scale wargame simulation systems for events. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is an overall structural diagram of an adaptation device for a discrete event simulation engine and a war game simulation system according to the present invention.
[0028] Figure 2 The present invention is a flowchart of a method for adapting a discrete event simulation engine to a war game simulation system.
[0029] Figure 3 It is a code scanning flow chart.
[0030] Figure 4 This is a diagram of interface mapping. DETAILED DESCRIPTION
[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to specific embodiments and accompanying drawings.
[0032] The present invention provides an adaptation device for a discrete event simulation engine and a war game simulation system, which mainly includes a rule adaptation module, a code scanning module, and an engine automatic integration module. The overall structure is as follows: Figure 1 . The war game simulation system model is based on entity modeling. The entity will perform activities, and events will be generated during the execution of activities. Events will affect the change of entity states, and the execution of events will advance the simulation time. The entities, events and time in the war game simulation system model are managed by a discrete event simulation engine. Traditional war game simulation system models and engines are tightly coupled, and engine replacement is difficult. The adaptation method proposed in the present invention can realize the automatic integration of war game simulation system models and multiple discrete event simulation engines.
[0033] The rule adaptation module can construct rule templates for the entity management interface, time management interface, and event management interface in the model through regular expressions based on the characteristics of the model language (here and in the following text, "model" refers to the "war game simulation system model"). The code scanning module can scan the declaration files and definition files of the model code, extract the entity type and event type list in the declaration file based on the lexical and grammatical rules of the model implementation language, and then scan the definition file in combination with the rule template output by the rule adaptation module to extract the interface list of entities, events, and simulation time; the engine automatic integration module can automatically map the interface in the engine with the interface extracted by the code scanning module of the model, and realize automatic integration of the engine based on custom scripts.
[0034] Corresponding to the above-mentioned device of the present invention, the adaptation method of the discrete event simulation engine and the war game simulation system of the present invention has the following steps: Figure 2 As shown, it includes five steps:
[0035] Step 1: Use regular expressions to construct rules for the entity management interface, time management interface, and event management interface in the model, and output rule templates for all interfaces. This step is completed by the rule adaptation module.
[0036] Step 2: Extract entity types and event types from the model code declaration file using the model code's lexical and grammatical rules, and output a list of entity types and event types. This step is completed by the code scanning module.
[0037] Step 3: Based on the output of steps 1 and 2, extract the entity management interface, event management interface, and time management interface from the model code definition file and output a list of all interfaces. This step is completed by the code scanning module.
[0038] Step 4: Construct the mapping relationship between the discrete event simulation engine interface and the interface output in step 3. This step is completed by the engine automatic integration module.
[0039] Step 5: Automatically replace and integrate the engine interface based on the custom script. This step is completed by the engine automatic integration module.
[0040] The rule adaptation module, code scanning module, and engine automatic integration module of the present invention are described in detail as follows:
[0041] 1. Rule Adaptation Module
[0042] The rule adaptation module can construct rule templates for the entity management interface, time management interface, and event management interface in the model through regular expressions based on the characteristics of the model language. The rule adaptation module is applicable to various programming languages. Taking the SIMSCRIPT language as an example, the interface rule construction method is as follows:
[0043] 1. Entity Management Interface Rules
[0044] The entity management interface includes the create entity interface and the destroy entity interface. In the SIMSCRIPT simulation language, entity creation is implemented through the CREATE interface, and entity destruction is implemented through the DESTROY interface. The rule templates for these two interfaces are constructed using regular expressions, as shown in Table 1.
[0045] Table 1 Example of entity management interface
[0046]
[0047] 2. Time Management Interface Rules
[0048] The time management interface includes the time setting interface and the time query interface. The rule templates of the two interfaces are constructed through regular expressions, as shown in Table 2.
[0049] Table 2 Time management interface example
[0050] Interface Example Interface rule template GET_SYNCTIME GET_SYNCTIME\([a-zA-Z]+\) SET_SYNCTIME SET_SYNCTIME\([a-zA-Z]+\)
[0051] 3. Event Management Interface Rules
[0052] The event management interface includes the create event interface, cancel event interface, reschedule event interface, event loop traversal interface, and event number query interface. In the SIMSCRIPT simulation language, event creation is implemented through the SCHEDULE interface, event cancellation is implemented through the CANCEL interface, event rescheduling is implemented through the RESCHEDULE interface, event loop traversal is implemented through the FOR EACH / EVERY P (P represents the variable name) IN EV.S interface, and event number query interface is implemented through the N.EV.S interface. Regular expression rule templates for these five interfaces are constructed, as shown in Table 3.
[0053] Table 3 Time management interface example
[0054]
[0055]
[0056] 2. Code scanning module
[0057] The code scanning module can extract the entity type and event type list in the declaration file based on the lexical and grammatical rules of the model implementation language. On this basis, it combines the rule template output by the rule adaptation module to scan the definition file and extract the interface list of entities, events and simulation time. The code scanning process is as follows Figure 3 shown.
[0058] Step 1: Scan and segment the code in the declaration file line by line. Build a segmentation set for the declaration file based on the lexical structure and grammar of the model implementation language, and extract the entity types and event types in the declaration file.
[0059] Step 2: Scan the code in the main function file line by line (the main function file is a globally unique file that must be included in every model program. Local variables can be defined in the main function, and the business logic of the main function can be implemented through logical control statements, assignment statements, and sub-function call statements). Based on the rule template of the rule adaptation module, extract the interface list in the main function file. Each interface information in the interface list should include the interface type, interface name, file name (including file path) where the interface is located, and the line number where the interface is located, as shown in Table 4.
[0060] Table 4 Interface list
[0061]
[0062] Step 3: Determine whether the main function in step 2 calls other sub-functions. If so, continue scanning the sub-function files (sub-functions can define local variables and implement the sub-function's business logic through logical control statements, assignment statements, and sub-function call statements). Based on the rule template of the rule adaptation module, extract the interface list in the sub-function file.
[0063] 3. Engine automatic integration module
[0064] The engine automatic integration module can automatically map the interfaces in the efficient discrete event simulation engine with the interfaces extracted by the model through the code scanning module, such as Figure 4 As shown ( Figure 4 The model extraction interface and discrete event simulation engine interface are used as examples only. The model extraction interface uses the SIMSCRIPT language as an example. The discrete event simulation engine interface can also be modified according to the actual engine interface. The interface mapping rules include one-to-one and one-to-many. For example, the event loop traversal interface in the model extraction interface requires a combined mapping of two interfaces of the discrete event simulation engine to implement the loop traversal function. After the interface mapping rules are created, the engine interface is automatically integrated based on the custom script. The custom script can be implemented in programming languages such as Python / JAVA / C++, and the old interfaces in the model code are replaced with new interfaces in batches based on the interface mapping rules.
[0065] The key points of the present invention are:
[0066] This invention proposes a method and device for adapting a discrete event simulation engine to a wargaming system. This method utilizes a rule adaptation module, a code scanning module, and an engine automatic integration module to decouple the wargaming system model from the native simulation engine and adapt it to a high-efficiency discrete event simulation engine. The rule adaptation module defines the interface rules between the wargaming system model and the native engine; the code scanning module defines the scanning method for the wargaming system model and the interface list extraction method; and the engine automatic integration module defines the automatic integration method for the discrete event simulation engine.
[0067] Another embodiment of the present invention provides a computer device (computer, server, smart phone, etc.), which includes a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program includes instructions for executing each step in the method of the present invention.
[0068] Another embodiment of the present invention provides a computer-readable storage medium (such as ROM / RAM, magnetic disk, optical disk), wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the steps of the method of the present invention are implemented.
[0069] The specific embodiments of the present invention disclosed above are intended to facilitate understanding and implementation of the present invention. Those skilled in the art will appreciate that various substitutions, changes, and modifications are possible without departing from the spirit and scope of the present invention. The present invention should not be limited to the embodiments disclosed in this specification; the scope of protection of the present invention shall be determined by the scope defined in the claims.
Claims
1. A method for adapting a discrete event simulation engine to a war game simulation system, characterized in that: The following steps are involved: Based on the SIMSCRIPT simulation language, regular expressions are used to construct rule templates for the entity management interface, time management interface, and event management interface in the war game system model. Scan the declaration and definition files of the wargaming system model code to extract the entity type and event type lists in the declaration files. Combined with the constructed rule template, scan the definition files to extract the interface lists of the entity management interface, time management interface, and event management interface. Automatically map the interfaces in the discrete event simulation engine to the interfaces in the interface list extracted from the war game system model, and automatically integrate the discrete event simulation engine based on a custom script; The rule templates for the entity management interface, time management interface, and event management interface in the war game simulation system model are constructed using regular expressions based on the SIMSCRIPT simulation language, including: The entity management interface includes a create entity interface and a destroy entity interface, and a rule template for creating an entity interface and destroying an entity interface is constructed through a regular expression; the create entity interface is implemented through the CREATE interface, and the destroy entity interface is implemented through the DESTROY interface; The time management interface includes a time setting interface and a time query interface, and the rule templates of the time setting interface and the time query interface are constructed by regular expressions; The event management interface includes a create event interface, a cancel event interface, a rescheduling event interface, an event loop traversal interface, and an event quantity query interface. The rule templates of the five interfaces are constructed through regular expressions; the create event interface is implemented through the SCHEDULE interface, the cancel event interface is implemented through the CANCEL interface, the re-call event interface is implemented through the RESCHEDULE interface, the event loop traversal interface is implemented through the FOR EACH / EVERY PIN EV.S, where P represents the variable name, and the event quantity query interface is implemented through the N.EV.S interface; The extracting of the entity type and event type list in the declaration file includes: scanning and segmenting the code in the declaration file line by line, constructing a segmentation set of the declaration file based on the lexical structure and grammar of the model implementation language, extracting the entity type and event type in the declaration file, and obtaining the entity type and event type list in the declaration file; The combination of the constructed rule template and the definition file is scanned, including: Scan the code in the main function file line by line, and extract the interface list in the main function file based on the rule template. Each interface information in the interface list includes the interface type, interface name, file name where the interface is located, and the line number where the interface is located; Determine whether the main function calls other sub-functions. If so, continue scanning the sub-function file and extract the interface list in the sub-function file based on the rule template.
2. The method according to claim 1, characterized in that The interfaces in the discrete event simulation engine are automatically mapped with the interfaces in the interface list extracted from the war game simulation system model, and the interface mapping rules adopted include one-to-one and one-to-many.
3. The method according to claim 2, characterized in that The event loop traversal interface in the interface list is mapped to a combination of two interfaces of the discrete event simulation engine to implement a loop traversal function.
4. An adaptation device for a discrete event simulation engine and a war game system using the method according to any one of claims 1 to 3, characterized in that: include: A rule adaptation module is used to construct rule templates for the entity management interface, time management interface, and event management interface in the war game simulation system model through regular expressions; The code scanning module is used to scan the declaration files and definition files of the wargaming system model code, extract the entity type and event type lists in the declaration files based on the lexical and grammatical rules of the model implementation language, and scan the definition files in combination with the rule template output by the rule adaptation module to extract the interface lists of the entity management interface, time management interface, and event management interface; The engine automatic integration module is used to automatically map the interfaces in the discrete event simulation engine with the interfaces in the interface list extracted from the war game simulation system model, and realize the automatic integration of the discrete event simulation engine based on custom scripts.
5. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
A war game simulation system
CN115618649B
Simulation model management system supporting multiple simulation engines and simulation model scheduling method
CN115964131A