A method and device for constructing an efficient discrete event simulation engine for complex information systems

By adopting a time-based and priority-based event scheduling mechanism in complex information systems, combining event queues and simulation clocks, the problems of information explosion and insufficient priorities in the existing technology are solved, and efficient and accurate event scheduling and simulation are achieved. Time management meets the efficient simulation needs of complex information systems.

CN117909036BActive Publication Date: 2024-12-03INST OF SOFTWARE - CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311665948.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2024-12-03
Estimated Expiration
2043-12-06

AI Technical Summary

Technical Problem

The existing discrete event simulation scheduling methods are prone to information explosion when processing complex information systems, and cannot effectively consider the priority attributes of events, resulting in the inability to meet event scheduling requirements of the same time but different priority levels.

Method used

Adopt the time and priority-based event scheduling mechanism, and use event queue initialization and simulation clock initialization, combining timestamps and priority to schedule events, provide efficient event storage and scheduling methods, and realize simulation time calculation through the concept of minimum time advance window .

Benefits of technology

It realizes high-precision and efficient scheduling of complex information system events, reduces the time complexity of event insertion and query, meets the scheduling needs of multiple time and priority, and provides an efficient simulation platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117909036B_ABST
    Figure CN117909036B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and device for constructing an efficient discrete event simulation engine for complex information systems. The steps of the method include: engine initialization, mainly including event queue initialization and simulation clock initialization; message reception, if the simulation start message is successfully received, the event is executed, otherwise the simulation ends; when the event is executed, all types of event queues are traversed in a loop, if the event queue is empty, the simulation ends, if the event queue is not empty, the event with the smallest timestamp is taken out, if there are multiple events with the smallest timestamp, the event with the highest priority is selected from them to be executed first; the simulation time is updated during the event execution process. The method for constructing an efficient discrete event simulation engine for complex information systems provided by the present invention provides an efficient event scheduling method and a flexible time management method, which can meet the high-precision and high-efficiency scheduling requirements of complex information systems for events, and provides a support platform for efficient simulation of complex information systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of information technology, and in particular relates to a method and device for constructing an efficient discrete event simulation engine for complex information systems. Background Art

[0002] With the rapid development of computer technology and network technology, traditional information systems are constantly evolving into large and complex systems. This evolution process has led to the emergence of large and complex information systems. Complex information systems are highly complex information systems with a huge number of entity units and complex interactions between entity units. At present, complex information systems are widely used in scientific research, engineering design, and decision support in the military and civilian fields.

[0003] The difficulty in studying complex information systems lies in how to characterize the integrity of the system and the emergence of the whole. The basic idea of ​​traditional research methods, such as the Cartesian reduction method, is to decompose the whole into parts for research, believing that once the parts are figured out, the whole will be solved. However, the problem is far from that simple, because the overall nature of the system is greater than the sum of its parts. Therefore, simulation research must be carried out to solve the problems of complex information systems. Simulation is to map certain characteristics or behavioral rules of the actual system to a virtual system, and calculate and simulate the virtual system through a computer. The basic methods of simulation include discrete event simulation, continuous system simulation and hybrid simulation. The present invention mentions a method for constructing an efficient discrete event simulation engine for complex information systems based on the discrete event simulation method. The method constructs the state, events and interactive behaviors of entities based on the ideas of time discretization and space discretization, and the complex information system constructed based on this method has high execution efficiency.

[0004] The discrete event simulation engine is a platform for executing discrete event simulation systems. It provides event-driven and time management functions. The efficient discrete event simulation engine in the present invention can be implemented in a variety of programming languages ​​such as JAVA, C++, C, PYTHON and SIMSCRIPT.

[0005] Chinese Patent: Method and Device for Scheduling Discrete Event Simulation (CN 103377082 A) provides a method for scheduling discrete event simulation, which describes the creation or time dependency between two or more event types through a correlation graph, and schedules events based on the time dependency. The event scheduling method in this patent requires the construction of a correlation graph. When there are many event types, it is easy to produce information explosion, which is very unfriendly to complex information systems based on discrete event simulation. In addition, the event scheduling method in this method only considers the time dependency between events, and does not consider the event priority attribute, and cannot meet the scheduling requirements of events of the same time but different priorities. Summary of the invention

[0006] The purpose of the present invention is to provide a method for constructing an efficient discrete event simulation engine for complex information systems, to provide an event scheduling mechanism based on two strategies, time and priority, to provide an efficient storage and scheduling method for massive events, to provide a custom simulation time calculation method, to provide an operation support platform for complex information systems based on discrete event simulation, and to provide a guarantee for the high-precision and high-efficiency scheduling requirements of complex information systems for events.

[0007] The technical solution adopted by the present invention is as follows:

[0008] A method for constructing an efficient discrete event simulation engine for complex information systems comprises the following steps:

[0009] Initialize the engine, including event queue initialization and simulation clock initialization;

[0010] Receive external messages and control the simulation process according to the type of external messages;

[0011] During the event execution process of the simulation flow, all types of event queues are traversed in a loop. If the event queue is empty, the simulation ends. If the event queue is not empty, the event with the smallest timestamp is taken out. If at least two events have the same timestamp, the event with the highest priority is taken out and executed first.

[0012] The simulation time is updated during the execution of events in the simulation process.

[0013] Furthermore, the event queue initialization includes: defining multiple types of discrete events, storing all events in different event queues according to event types, and inserting events in each event queue in order from small to large timestamps; the simulation clock initialization includes: setting the simulation clock to the initial simulation time.

[0014] Furthermore, the external message includes starting simulation, setting simulation rate, and stopping simulation.

[0015] Furthermore, the control of the simulation process according to the type of the external message includes: if the external message is to start the simulation, then start executing the events in the event queue; if the external message is to set the simulation rate, then modify the minimum advancement time window; if the external message is to stop the simulation, then end the simulation.

[0016] Furthermore, in the event queue, the event queue head pointer and tail pointer of different types of events are respectively stored in two arrays. When an event is inserted, the head pointer of the corresponding event queue is found according to the event type, and the insertion position of the event is found based on the timestamp of the event. The events in the event queue are arranged in ascending order according to the timestamp.

[0017] Furthermore, a decision is made before the event is executed. If the timestamp of the event to be executed is less than or equal to the sum of the current simulation time and the minimum time advancement window, the event is allowed to be executed, otherwise the event is not executed. If the event is allowed to be executed after the decision, the simulation engine executes the callback function of the event. After the event is executed, the simulation engine updates the system simulation time.

[0018] Furthermore, the simulation time is calculated using the following steps:

[0019] Get the timestamp of the event to be executed;

[0020] Determine whether the timestamp of the event to be executed is greater than the sum of the current simulation time and the minimum time advancement window;

[0021] If yes, set the simulation time to the sum of the current simulation time and the minimum time advance window, if no, set the simulation time to the timestamp of the execution event.

[0022] An efficient discrete event simulation engine construction device for complex information systems, comprising:

[0023] The engine initialization module is responsible for engine initialization, including event queue initialization and simulation clock initialization;

[0024] A message receiving module is responsible for receiving external messages, including starting simulation, setting simulation rate, and stopping simulation;

[0025] Event management module, responsible for the storage and efficient scheduling of discrete events;

[0026] The time management module is responsible for simulation time calculation and simulation time setting.

[0027] The beneficial effects of the present invention are as follows:

[0028] The method for constructing an efficient discrete event simulation engine for complex information systems provided by the present invention provides three functions: first, event definitions include time attributes and priority attributes, which can meet the complex information system's requirements for accurate scheduling of events of different times and different priorities; second, classified storage of events in an event queue can effectively reduce the time complexity of event insertion and query, and help achieve efficient scheduling of discrete events; third, providing a minimum time advancement window concept and a simulation time calculation method can achieve a multiple-speed fast-forwarding effect.

[0029] The present invention provides a method for constructing an efficient discrete event simulation engine for complex information systems. It does not require the construction of an event correlation graph, but only requires the definition of the time and priority of different event types to achieve event scheduling, which can better meet the complex information system's requirements for high-precision and high-efficiency scheduling of events.

[0030] In summary, the method for constructing an efficient discrete event simulation engine for complex information systems provided by the present invention provides an efficient event scheduling method and a flexible time management method, which can meet the complex information system's requirements for high-precision and high-efficiency scheduling of events, and provides a support platform for efficient simulation of complex information systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is the overall structural diagram of the method of the present invention.

[0032] Figure 2 It is a functional flow chart of the method of the present invention.

[0033] Figure 3 This is a schematic diagram of event definition.

[0034] Figure 4 It is the flow chart of the message receiving module.

[0035] Figure 5 This is a schematic diagram of the event storage structure.

[0036] Figure 6 It is an event scheduling flow chart.

[0037] Figure 7 It is the simulation time calculation flow chart.

[0038] Figure 8 This is a time progression diagram. DETAILED DESCRIPTION

[0039] 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 through specific embodiments and drawings.

[0040] The present invention provides a method for constructing an efficient discrete event simulation engine for complex information systems. The efficient discrete event simulation engine mainly includes an engine initialization module, a message receiving module, an event management module and a time management module. The overall structure is as follows: Figure 1 As shown. The engine initialization module is responsible for the initialization of the event queue and the simulation clock; the message receiving module is responsible for receiving system external messages, including "start simulation", "set simulation rate", and "stop simulation"; the event management module is responsible for the storage and efficient scheduling of discrete events; and the time management module is responsible for the simulation time calculation. These four modules constitute an efficient discrete event simulation engine construction device for complex information systems of the present invention.

[0041] The method for constructing an efficient discrete event simulation engine for complex information systems of the present invention has the following process: Figure 2 As shown, the following steps are included:

[0042] Step 1: Engine initialization, which mainly includes event queue initialization and simulation clock initialization. The efficient discrete event simulation engine of the present invention can support complex information systems to define multiple types of discrete events, and all events can be stored in different event queues according to event types after being created.

[0043] Step 2: Message reception. The complex information system needs to wait for the start message before starting the simulation program. If the "start simulation" message is successfully received, step 3 is executed, otherwise the simulation ends.

[0044] Step 3: Event execution, loop through all types of event queues. If the event queue is empty, the simulation ends. If the event queue is not empty, take out the event with the smallest timestamp. If there are multiple events with the smallest timestamp, select the event with the highest priority to execute first.

[0045] Step 4: Update the simulation time. During the event execution, the system simulation time will also advance. The overall functional flow is as follows Figure 2 shown.

[0046] 1. Engine initialization module

[0047] The engine initialization module includes two functions: event queue initialization and simulation clock initialization. The efficient discrete event simulation engine of the present invention can support complex information systems to define various types of discrete events. Discrete events are defined by callback functions (callback functions are used to implement event business logic). Taking C language as an example, the structure of an event is as follows: Figure 3 As shown in the figure. After all events are created, they can be stored in different event queues according to the event type. Events in each event queue are inserted in ascending order according to the timestamp (the timestamp of the event is the simulation time when the event is executed). Assuming that a complex information system defines M types of events, M event queues are constructed during the engine initialization phase. The event queue can be implemented through a bidirectional linked list.

[0048] The simulation clock records the system simulation time (simulation time is the simulation time in the simulation system). During the engine initialization phase, the simulation clock is set to the system initial simulation time.

[0049] 2. Message receiving module

[0050] The message receiving module is responsible for receiving external messages of the system, including "start simulation", "set simulation rate", and "stop simulation". The message receiving module is implemented in the form of network communication, and receives external messages in real time through the monitoring thread. The operation process of the message receiving module is as follows Figure 4 shown.

[0051] Step 1: Create a socket and establish a network connection.

[0052] Step 2: Bind the port, start monitoring, and obtain external messages from the system.

[0053] Step 3: Process external messages of the system, including "start simulation", "set simulation rate", and "stop simulation". The engine controls the simulation process according to the type of external message. If the external message is "start simulation", the engine starts to execute events in the event queue; if the external message is "set simulation rate", the engine modifies the minimum advancement time window (the minimum advancement time window is the minimum advancement unit of simulation time); if the external message is "stop simulation", the simulation ends.

[0054] 3. Event Management Module

[0055] The event management module is responsible for the storage and efficient scheduling of discrete events. In the present invention, different types of events are stored in different event queues. Figure 5 It is the storage structure of the event queue. Figure 5 As shown in the figure, the event queue head pointer and tail pointer of different types of events are stored in two arrays respectively. When inserting an event, find the head pointer of the corresponding event queue according to the event type, find the insertion position of the event based on the timestamp of the event, and the events in the event queue need to be arranged in ascending order according to the timestamp.

[0056] Event scheduling includes three parts: event selection, event judgment and event execution. The process is as follows: Figure 6 As shown, the following steps are included:

[0057] Step 1: Event selection, loop through the event queue of class M events, if the event queue is empty, the simulation ends, if the event queue is not empty, take out the event with the smallest timestamp, if two events have the same timestamp, take out the event with the highest priority.

[0058] Step 2: Event adjudication: Before an event is executed, adjudication is required. If the timestamp of the event to be executed is less than or equal to the sum of the current simulation time and the minimum time advancement window, the event is allowed to be executed. Otherwise, the event is not executed.

[0059] Step 3: Event execution, if the event is allowed to be executed after the event is adjudicated, the simulation engine executes the callback function of the event. After the event is executed, the simulation engine updates the system simulation time and continues to execute step 1 until all events are executed and the simulation ends.

[0060] 4. Time Management Module

[0061] The time management module is responsible for simulation time calculation and simulation time setting (simulation time is the simulation time in the simulation system, and physical time is the time in the real world). The conversion formula between simulation time and physical time can be expressed as:

[0062] Physical time = simulation time * conversion factor

[0063] If the simulation time is calculated in seconds and the conversion factor is 1, then 1 second in the simulation system is equal to 1 second in the real world. The minimum time advancement window (the minimum advancement time window is the smallest advancement unit of the simulation time) is also 1 second. If the simulation rate is set to 10 times the speed, the conversion factor is 0.1, which means that 10 seconds in the simulation system is equal to 1 second in the real world. The minimum time advancement window is 10 seconds. The calculation formula for the minimum time advancement window is as follows:

[0064] Minimum time advancement window = 1 / conversion factor

[0065] The simulation time calculation process is as follows Figure 7 As shown, it includes the following three steps:

[0066] Step 1: Get the timestamp of the event to be executed.

[0067] Step 2: Determine whether the timestamp of the event to be executed is greater than the sum of the current simulation time and the minimum time advancement window.

[0068] Step 3: If the condition in step 2 is met, set the simulation time to the sum of the current simulation time and the minimum time advancement window. If the condition in step 2 is not met, set the simulation time to the timestamp of the execution event.

[0069] The simulation time calculation method of the efficient discrete event simulation engine proposed by the present invention is as follows: Figure 7 As shown. Assume that in a complex information system, an event needs to be scheduled at 1 second, 15 seconds, 21 seconds and 36 seconds respectively. If the minimum advancement time window is not considered, the time sequence of the simulation system is 1 second, 15 seconds, 21 seconds and 36 seconds. If the minimum time window is considered and the minimum advancement time window is 10 seconds, the time sequence of the simulation system is 1 second, 11 seconds, 15 seconds, 21 seconds, 31 seconds and 36 seconds. The time advancement diagram is shown in Figure 8 shown.

[0070] The key points of the present invention are:

[0071] The present invention proposes a method and device for constructing an efficient discrete event simulation engine for complex information systems, and realizes the engine function through an engine initialization module, a message receiving module, an event management module and a time management module. Among them, the engine initialization defines the initialization method of the event queue and the simulation time; the message receiving module defines the method for the engine to receive and process system external messages; the event management module defines the storage and efficient scheduling method of discrete events; and the time management module defines the simulation time calculation method.

[0072] Another embodiment of the present invention provides a computer device (computer, server, smart phone, etc.), which includes a memory and a processor, 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.

[0073] 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.

[0074] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and implement it accordingly. It can be understood by those skilled in the art that various replacements, 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 contents disclosed in the embodiments of this specification, and the scope of protection of the present invention shall be subject to the scope defined in the claims.

Claims

1. A method for constructing an efficient discrete event simulation engine for complex information systems, characterized in that: The following steps are involved: Initialize the engine, including event queue initialization and simulation clock initialization; Receive external messages and control the simulation process according to the type of external messages; During the event execution process of the simulation flow, all types of event queues are traversed in a loop. If the event queue is empty, the simulation ends. If the event queue is not empty, the event with the smallest timestamp is taken out. If at least two events have the same timestamp, the event with the highest priority is taken out and executed first. updating simulation time during execution of events in the simulation process; The event queue initialization includes: defining multiple types of discrete events, storing all events in different event queues according to event types, and inserting events in each event queue in the order of timestamps from small to large; the simulation clock initialization includes: setting the simulation clock to the initial simulation time; In the event queue, the event queue head pointer and tail pointer of different types of events are stored in two arrays respectively. When an event is inserted, the head pointer of the corresponding event queue is found according to the event type, and the insertion position of the event is found based on the timestamp of the event. The events in the event queue are arranged in ascending order according to the timestamp; Before the event is executed, a decision is made. If the timestamp of the event to be executed is less than or equal to the sum of the current simulation time and the minimum time advancement window, the event is allowed to be executed, otherwise the event is not executed. If the event is allowed to be executed after the decision, the simulation engine executes the callback function of the event. After the event is executed, the simulation engine updates the system simulation time. The simulation time is calculated using the following steps: Get the timestamp of the event to be executed; Determine whether the timestamp of the event to be executed is greater than the sum of the current simulation time and the minimum time advancement window; If yes, set the simulation time to the sum of the current simulation time and the minimum time advancement window; if no, set the simulation time to the timestamp of the execution event; The calculation formula of the minimum time advancement window is as follows: Physical time = simulation time * conversion factor, where simulation time is the simulation time in the simulation system, and physical time is the time in the real world; Minimum time advancement window = 1 / scaling factor.

2. The method according to claim 1, characterized in that The external messages include starting simulation, setting simulation rate, and stopping simulation.

3. The method according to claim 2, characterized in that The controlling of the simulation process according to the type of the external message comprises: If the external message is to start simulation, the events in the event queue will be executed; if the external message is to set the simulation rate, the minimum advancement time window will be modified; if the external message is to stop simulation, the simulation will end.

4. A device for constructing an efficient discrete event simulation engine for complex information systems using the method described in any one of claims 1 to 3, characterized in that: include: The engine initialization module is responsible for engine initialization, including event queue initialization and simulation clock initialization; The message receiving module is responsible for receiving external messages, including starting simulation, setting simulation rate, and stopping simulation; Event management module, responsible for the storage and efficient scheduling of discrete events; The time management module is responsible for simulation time calculation and simulation time setting.

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.