Collaborative simulation method and device based on multiple simulators
By integrating multiple simulation simulators and developing simulation agents in collaborative simulation, collaborative simulation of huge and complex systems, solving the problem of difficulty simulation of these systems, improved the scalability and stability of the simulation task, stability and stability. sex.
Patent Information
- Application Number
- CN202411216359.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-01-24
AI Technical Summary
It is difficult to effectively simulate large and complex practical systems, especially those involving multiple disciplines and with high nonlinearity, time-varying and uncertainty.
By integrating multiple simulation simulators based on collaborative simulation middleware and using simulation agents for communication and data transmission, collaborative simulation of large and complex systems is achieved. The method includes developing a simulation agent in advance, co-simulating the middleware to promote the simulation process based on preset simulation steps, and performing time synchronization of multiple simulation simulators through the timeline.
The effective simulation of huge and complex systems has been realized, the problem of overcoming a single simulation simulator is difficult to handle complex systems, and the scalability and stability of the simulation task is improved.
Smart Images

Figure CN119356789A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a collaborative simulation method and device based on multiple simulation simulators. Background Art
[0002] Simulation refers to the use of models to reproduce the essential processes that occur in actual systems, and to study existing or designed systems through experiments on system models. Actual systems in reality, such as large and complex actual systems, often involve multiple disciplines and have characteristics such as high nonlinearity, time-varying, and uncertainty. Traditional simulations or single simulation simulators are often difficult to simulate actual systems with such characteristics. Therefore, it is necessary to provide a method that can simulate large and complex actual systems. Summary of the invention
[0003] The present invention provides a collaborative simulation method and device based on multiple simulation simulators, so as to overcome at least one technical problem existing in the prior art.
[0004] According to a first aspect of an embodiment of the present invention, a collaborative simulation method based on multiple simulation simulators is provided, comprising:
[0005] Based on the collaborative simulation middleware, N simulation simulators are integrated to perform collaborative simulation on the collaborative simulation task. The server deploying the collaborative simulation middleware can access the server deploying the simulation simulator. The simulation collaborative middleware communicates with the simulation simulator through a simulation agent, and a corresponding simulation agent is required for each simulation simulator in the N simulations.
[0006] For each of the N simulation simulators, a simulation agent corresponding to each simulation simulator is pre-developed in the collaborative simulation middleware; the corresponding simulation agent starts the simulation simulator or connects to the simulation simulator deployed in the cloud when the collaborative simulation task is started; during the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent;
[0007] The collaborative simulation task is that the collaborative simulation middleware promotes the coupled simulation calculation process of the N simulation simulators based on a preset simulation step size, and synchronizes the coupled simulation calculation process of the N simulation simulators based on the time axis of the collaborative simulation middleware, specifically including:
[0008] For any two adjacent simulation steps S in the coupled simulation calculation process, t and S t+1, set the variable n with an initial value of zero, the variable n is used to count the total number of simulation simulators whose transaction processing status is completed; in the simulation step number S t After being turned on, the collaborative simulation middleware asynchronously calls the simulation agent corresponding to each of the N simulation simulators to check whether each of the N simulation simulators needs to perform transaction processing;
[0009] For the simulation step number S t and S t+1 No transaction is required between the simulation steps S t+1 The simulation steps S are completed before opening t and S t+1 For each simulation simulator of the simulation task, the value of the variable n is increased by one;
[0010] Among all the simulation simulators involved in the variable n, the last one to complete the simulation step number S in terms of time schedule t and S t+1 The time when the simulation simulator of the simulation task completes the simulation task is marked as the current time; comparing the size of the variable n after numerical statistics with the value N;
[0011] If the variable n is equal to the value N, and the current time is less than or equal to the simulation step number S t+1 The estimated start time, the collaborative simulation middleware waits until the simulation step number S is reached. t+1 The N simulation simulators are then driven to perform subsequent simulation work after the expected start time, or the collaborative simulation middleware drives the N simulation simulators to perform the simulation step number S at the current time. t+1 After the simulation work;
[0012] If the variable n is less than the value N, and the current time is equal to the simulation step number S t+1 The co-simulation middleware throws an exception to end the co-simulation task, or the co-simulation middleware waits for the transaction processing status of the N simulation simulators to be completed before pushing the N simulation simulators to perform the simulation step number S. t+1 The subsequent simulation work;
[0013] After the collaborative simulation task is completed, the collaborative simulation middleware integrates the simulation data and disconnects the communication connection with each of the N simulation simulators, and cleans up the legacy data of each simulation simulator during the simulation process.
[0014] Preferably, the decomposing the collaborative simulation task into a plurality of simulation subtasks specifically includes:
[0015] For complex simulation tasks, decomposition according to functional fields is reflected in decomposing the collaborative simulation tasks into first simulation subtasks in different functional fields, which requires synchronization and integration of simulation results of simulation simulators in different functional fields to output a unified collaborative simulation result; decomposition according to granularity is reflected in decomposing the simulation tasks into similar second simulation subtasks of different granularities, and for each subtask in the second simulation subtask, it is decided whether to continue to decompose further according to functional fields as needed to obtain simulation subtasks of the next level, and finally obtain several simulation subtasks of different levels.
[0016] Preferably, the development method of the simulation agent specifically includes:
[0017] For any one of the N simulation simulators, if the any one of the simulation simulators has a client that can be directly used by the collaborative simulation middleware, the simulation agent directly integrates the client that can be directly used;
[0018] For any one of the simulation simulators, if any one of the simulation simulators has an open application programming interface API, then a simulation agent of the any one of the simulation simulators is obtained based on the specification encapsulation of the API;
[0019] If any of the simulation simulators has a client developed in a language different from the development language of the collaborative simulation middleware, the client's functions are developed in the other language to obtain an external API, and then the simulation agent of any of the simulation simulators is obtained based on the specification encapsulation of the external API.
[0020] Preferably, the collaborative simulation middleware is also used to synchronize data of the coupled simulation calculation processes of the N simulation simulators, specifically including:
[0021] After the collaborative simulation middleware is started, the collaborative simulation middleware starts or connects to the N simulation simulators;
[0022] For any one of the N simulation simulators, the any one of the simulation simulators initializes its own simulation agent, and registers with the event message center of the cloud based on its own simulation agent to subscribe to related topics;
[0023] When the collaborative simulation middleware needs to issue instructions to the simulation simulators among the N simulation simulators, the collaborative simulation middleware publishes an event and broadcasts it to the simulation agent subscribed to the relevant topic, which is then processed by the simulation agent;
[0024] For any one of the N simulation simulators, when any one of the simulation simulators has simulation data that needs to be synchronized to other simulation simulators, the simulation agent of any one of the simulation simulators publishes an event to notify the collaborative simulation middleware, which is processed and published by the collaborative simulation middleware so that other simulation simulators among the N simulation simulators except the any one of the simulation simulators can obtain the simulation data, and the other simulation simulators are the simulation simulators that have demand for the simulation data.
[0025] According to a second aspect of an embodiment of the present invention, there is provided a collaborative simulation device based on multiple simulation simulators, comprising:
[0026] A component deployment module is used to integrate N simulation simulators based on the collaborative simulation middleware to perform collaborative simulation on the collaborative simulation task. The server deploying the collaborative simulation middleware can access the server deploying the simulation simulator. The simulation collaborative middleware communicates with the simulation simulator through a simulation agent, and a corresponding simulation agent is required for each simulation simulator in the N simulation tasks.
[0027] A simulation agent deployment module is used to pre-develop a simulation agent corresponding to each of the N simulation simulators in the collaborative simulation middleware; the corresponding simulation agent will start the simulation simulator or connect to the simulation simulator deployed in the cloud when the collaborative simulation task is started; during the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent;
[0028] The simulation time synchronization module is used for the collaborative simulation task, wherein the collaborative simulation middleware promotes the coupled simulation calculation process of the N simulation simulators based on a preset simulation step size, and performs time synchronization on the coupled simulation calculation process of the N simulation simulators based on the time axis of the collaborative simulation middleware, specifically comprising:
[0029] For any two adjacent simulation steps S in the coupled simulation calculation process, t and S t+1 , set the variable n with an initial value of zero, the variable n is used to count the total number of simulation simulators whose transaction processing status is completed; in the simulation step number S t After being turned on, the collaborative simulation middleware asynchronously calls the simulation agent corresponding to each of the N simulation simulators to check whether each of the N simulation simulators needs to perform transaction processing;
[0030] For the simulation step number S t and St+1 No transaction is required between the simulation steps S t+1 The simulation steps S are completed before opening t and S t+1 For each simulation simulator of the simulation task, the value of the variable n is increased by one;
[0031] Among all the simulation simulators involved in the variable n, the last one to complete the simulation step number S in terms of time schedule t and S t+1 The time when the simulation simulator of the simulation task completes the simulation task is marked as the current time; comparing the size of the variable n after numerical statistics with the value N;
[0032] If the variable n is equal to the value N, and the current time is less than or equal to the simulation step number S t+1 The estimated start time, the collaborative simulation middleware waits until the simulation step number S is reached. t+1 The N simulation simulators are then driven to perform subsequent simulation work after the expected start time, or the collaborative simulation middleware drives the N simulation simulators to perform the simulation step number S at the current time. t+1 The subsequent simulation work;
[0033] If the variable n is less than the value N, and the current time is equal to the simulation step number S t+1 The co-simulation middleware throws an exception to end the co-simulation task, or the co-simulation middleware waits for the transaction processing status of the N simulation simulators to be completed before pushing the N simulation simulators to perform the simulation step number S. t+1 The subsequent simulation work;
[0034] The simulation data processing module is used to integrate the simulation data and disconnect the communication connection with each of the N simulation simulators after the collaborative simulation task is completed, and clean up the legacy data of each simulation simulator during the simulation process.
[0035] Preferably, the device also includes a task decomposition module, which is used to decompose complex simulation tasks according to functional fields, which is reflected in decomposing the collaborative simulation task into first simulation sub-tasks in different functional fields, and the simulation results of simulation simulators in different functional fields need to be synchronized and integrated to output a unified collaborative simulation result; decomposition according to granularity, which is reflected in decomposing the simulation task into similar second simulation sub-tasks of different granularities, and for each subtask in the second simulation subtask, it is decided as needed whether to continue to decompose further according to the functional field to obtain the simulation sub-task of the next level, and finally obtain several simulation sub-tasks of different levels.
[0036] An embodiment of the present specification can at least achieve the following beneficial effects: The technical solution of the present application proposes a collaborative simulation method based on multiple simulation simulators, in which N simulation simulators are integrated based on the collaborative simulation middleware to perform collaborative simulation on the collaborative simulation task, the server deploying the collaborative simulation middleware can access the server deploying the simulation simulator, the simulation collaborative middleware communicates with the simulation simulator through the simulation agent, and there is a corresponding simulation agent for each of the N simulation simulators. During the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent. Considering that from the perspective of coupled simulation, each simulation simulator is required to be synchronized and parallel, therefore, in the technical solution of the present application, the time axis of the collaborative simulation middleware is used as the unified time standard when each simulation simulator performs simulation advancement during the simulation advancement process, and the process of multiple simulation simulators executing simulation subtasks is synchronized. At the same time, considering that the time constraints of different specific simulation tasks are different in degree of looseness, different time synchronization schemes are proposed in the technical solution of the present application, which makes the technical solution of the present application wide in scope of application. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 A schematic diagram of a flow chart of a collaborative simulation method based on multiple simulation simulators provided in an embodiment of this specification;
[0039] Figure 2 A schematic diagram of integrating simulation simulators based on collaborative simulation middleware in a collaborative simulation method based on multiple simulation simulators provided in an embodiment of this specification;
[0040] Figure 3 A schematic diagram of data synchronization of multi-domain simulation simulators based on an event message center in a collaborative simulation method based on multiple simulation simulators provided in an embodiment of this specification;
[0041] Figure 4 A schematic diagram of task decomposition of collaborative simulation tasks in a collaborative simulation method based on multiple simulation simulators provided in an embodiment of this specification;
[0042] Figure 5 A schematic diagram of multi-simulation task management of a collaborative simulation middleware in a collaborative simulation method based on multiple simulation simulators provided in an embodiment of this specification;
[0043] Figure 6 A schematic diagram of the functional architecture of a collaborative simulation system in a collaborative simulation method based on multiple simulation simulators provided in an embodiment of this specification;
[0044] Figure 7 A schematic diagram of the structure of a collaborative simulation device based on multiple simulation simulators provided in an embodiment of this specification. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.
[0046] It should be understood that although the terms first, second, third, etc. may be used in this application document to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
[0047] The background technology section of the previous text records actual systems in reality, such as large and complex actual systems, which often involve multiple disciplines and have the characteristics of high nonlinearity, time-varying, uncertainty, etc. Traditional simulation or a single simulation simulator has actual systems with such characteristics and is often difficult to simulate. For example, some technical solutions propose a method for building a complex product collaborative simulation environment, which solves the problem that complex products are difficult to simulate. However, it is actually limited to a single simulation. When the system to be simulated is very large, it still cannot be solved. For example, for the simulation of complex traffic scenes at the regional level, a single traffic simulation software cannot even complete the loading of the regional map. For another example, although some solutions have proposed a multi-domain collaborative simulation method, they do not take into account the linkage between simulators, nor do they consider solutions for time synchronization between the simulation world and the real world. They cannot cope with larger and complex systems or real scenes, and can only coordinate and control multi-domain simulation simulators for general and relatively simple systems and scenes, which has major defects.
[0048] In view of the technical problems existing in the prior art, the technical solution of this application proposes a collaborative simulation solution for coordinating multi-domain simulation simulators, in which the simulation process of multi-domain simulation simulators is coordinated based on collaborative simulation middleware, such as performing time synchronization and other operations. Figure 1 As shown, Figure 1 A collaborative simulation method based on multiple simulation simulators is provided in the embodiments of this specification, such as Figure 1 As shown, the process may include the following steps.
[0049] Step 102: Integrate N simulation simulators based on the collaborative simulation middleware to perform collaborative simulation on the collaborative simulation task. The server deploying the collaborative simulation middleware can access the server deploying the simulation simulator. The simulation collaborative middleware communicates with the simulation simulator through a simulation agent, and a corresponding simulation agent is required for each of the N simulation simulators.
[0050] In this embodiment, the collaborative simulation task can be the huge and complex actual system mentioned in the background technology section above. These actual systems often involve multiple disciplines and have the characteristics of high nonlinearity, time-varying, uncertainty, etc. For example, the complex power communication system existing in the real scene, there is a complex mutual influence between the information system and the power system in this composite system. Alternatively, the development of high-power IGBT devices involves different directions such as power semiconductor physics, circuits, electromagnetic fields, heat, mechanical stress, materials, etc., and the simulation work on them cannot be completed by a single simulation software. In this embodiment, in order to realize the collaborative simulation of multi-domain simulation simulators, a collaborative simulation middleware is used to couple multiple simulation simulators in multiple fields, and they are integrated by developing corresponding simulation agents. Each simulation simulator in N simulations requires a corresponding simulation agent. The server deploying the collaborative simulation middleware can access the server deploying the simulation simulator, and the simulation collaborative middleware communicates with the simulation simulator corresponding to the simulation agent through the simulation agent. If you need to add one more simulation simulator, you only need to integrate it by developing its simulation agent. Its logic can refer to Figure 2 , Figure 2 This is a schematic diagram of an integrated simulation simulator based on collaborative simulation middleware in an embodiment of this specification. This integration method effectively solves the problems of poor scalability and maintainability of collaborative simulation integrated simulation simulators and poor performance of collaborative simulation scheduling simulation simulators in the prior art.
[0051] Step 104: For each of the N simulation simulators, a simulation agent corresponding to each simulation simulator is pre-developed in the collaborative simulation middleware; the corresponding simulation agent will start the simulation simulator or connect to the simulation simulator deployed in the cloud when the collaborative simulation task is started; during the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent.
[0052] In the technical solution of this embodiment, for a certain simulation simulator, its corresponding simulation agent is used to start or stop the certain simulation simulator, or connect or disconnect the cloud simulation simulator and other operations. The development of the simulation agent can be carried out depending on whether the simulation simulator has a client that can be directly used by the collaborative simulation middleware. If so, the simulation agent can directly integrate the client; if the simulation simulator does not have a client that can be directly used by the collaborative simulation middleware, but has an external API or a client in other languages, it can be developed by referring to the API specification encapsulated into a simulation agent.
[0053] Step 106: The collaborative simulation task is that the collaborative simulation middleware promotes the coupled simulation calculation process of the N simulation simulators based on a preset simulation step size, and synchronizes the coupled simulation calculation process of the N simulation simulators based on the time axis of the collaborative simulation middleware, which may specifically include:
[0054] For any two adjacent simulation steps S in the coupled simulation calculation process, t and S t+1 , set the variable n with an initial value of zero, the variable n is used to count the total number of simulation simulators whose transaction processing status is completed; in the simulation step number S t After being turned on, the collaborative simulation middleware asynchronously calls the simulation agent corresponding to each of the N simulation simulators to check whether each of the N simulation simulators needs to perform transaction processing;
[0055] For the simulation step number S t and S t+1 No transaction is required between the simulation steps S t+1 The simulation steps S are completed before opening t and S t+1 For each simulation simulator of the simulation task, the value of the variable n is increased by one;
[0056] Among all the simulation simulators involved in the variable n, the last one to complete the simulation step number S in terms of time schedule t and S t+1 The time when the simulation simulator of the simulation task completes the simulation task is marked as the current time; comparing the size of the variable n after numerical statistics with the value N;
[0057] If the variable n is equal to the value N, and the current time is less than or equal to the simulation step number S t+1 The estimated start time, the collaborative simulation middleware waits until the simulation step number S is reached. t+1 The N simulation simulators are then driven to perform subsequent simulation work after the expected start time, or the collaborative simulation middleware drives the N simulation simulators to perform the simulation step number S at the current time. t+1 The subsequent simulation work;
[0058] If the variable n is less than the value N, and the current time is equal to the simulation step number S t+1 The co-simulation middleware throws an exception to end the co-simulation task, or the co-simulation middleware waits for the transaction processing status of the N simulation simulators to be completed before pushing the N simulation simulators to perform the simulation step number S.t+1 After the simulation work:
[0059] For any two adjacent simulation steps S in the coupled simulation calculation process, t and S t+1 , set the variable n with an initial value of zero, the variable n is used to count the total number of simulation simulators whose transaction processing status is completed; in the simulation step number S t+1 Before starting, the collaborative simulation middleware asynchronously calls the simulation agent corresponding to each of the N simulation simulators to check whether each of the N simulation simulators needs to perform transaction processing;
[0060] For the simulation step number S t and S t+1 No transaction is required between the simulation steps S t+1 The simulation steps S are completed before opening t and S t+1 For each simulation simulator of the simulation task, the value of the variable n is increased by one;
[0061] Among all the simulation simulators involved in the variable n, the last one to complete the simulation step number S in terms of time schedule t and S t+1 The time when the simulation simulator of the simulation task completes the simulation task is marked as the current time; comparing the size of the variable n after numerical statistics with the value N;
[0062] If the variable n is equal to the value N, and the current time is less than or equal to the simulation step number S t+1 The estimated start time, the collaborative simulation middleware waits until the simulation step number S is reached. t+1 The N simulation simulators are then driven to perform subsequent simulation work after the expected start time, or the collaborative simulation middleware drives the N simulation simulators to perform the simulation step number S at the current time. t+1 The subsequent simulation work;
[0063] If the variable n is less than the value N, and the current time is equal to the simulation step number S t+1 The co-simulation middleware throws an exception to terminate the co-simulation task, or the co-simulation middleware waits for the transaction processing status of the N simulation simulators to be completed before pushing the N simulation simulators to perform the simulation steps S. t+1 After the simulation work.
[0064] In the technical solution of this embodiment, considering that from the perspective of coupled simulation, each of the N simulation simulators is required to be synchronously and parallelly advanced, and each of the N simulation simulators has its own clock. If these clocks are not synchronized, it will cause logical confusion in the simulation process. Therefore, it is necessary to design a time synchronization mechanism to ensure the synchronization of the clocks between the simulation simulators and ensure the consistency of the time logic of the time-related events in each simulation simulator node. In the technical solution of this embodiment, in the process of simulation advancement, the time axis of the collaborative simulation middleware is used as the unified time standard for each simulation simulator to advance the simulation, that is, the clock of any collaborative simulation middleware that does not perform a specific simulation task in the entire simulation system is used as the standard clock of the entire simulation system, and the advancement speed of each simulation simulator in multiple simulation simulators to perform simulation subtasks is synchronized. Specifically, before each simulation step starts, the collaborative simulation middleware sends a time advancement request to the simulation agent of each simulation simulator. Only when the collaborative simulation middleware sends a time advancement request, each simulation simulator will process the next number of simulation tasks. Thus, the collaborative simulation middleware can synchronize the time of the entire simulation system. At the same time, considering that different collaborative simulation tasks have different degrees of relaxation of time constraints, two different time constraint standards, strong and weak, are designed in this embodiment.
[0065] Next, we take two simulation steps S that are adjacent in time. t and S t+1 Take the above abstract scheme as an example to illustrate, and assume that there are three simulation simulators in total, that is, N=3.
[0066] In this example, the co-simulation middleware initializes the three simulators in the initial stage and then starts the simulation. t After the start, the collaborative simulation middleware asynchronously calls the simulation agent of each simulator to check whether each simulator has tasks or events to be processed, which can be divided into the following two situations:
[0067] (1) For a certain simulator, if the simulator has tasks or event processing, the simulation step number S t+1 Before starting, the simulator completed the simulation steps S t and S t+1 If the simulation task is between , the transaction status is that the number of completed simulation simulators increases by 1, otherwise it does not increase by 1; if the simulation simulator reports an error during execution, exception handling can be performed. Exception handling can be divided into two cases: directly throwing an exception to end the simulation or performing compensation to postpone the task until re-execution. For the latter, the transaction status of the simulation simulator can be considered completed, the value of the variable n increases by 1, and the simulation task of the simulation simulator is completed in the next simulation step S. t+1 Continue processing.
[0068] (2) For a certain simulation simulator, if the simulation simulator has a simulation step number S t After the start, if there is no task or event to be processed, it will return directly and the simulation step S t The number of simulation simulators with a transaction status of Completed increases by 1.
[0069] For several simulation simulators that increase the value of variable n by 1, the last completed simulation step S can be calculated on the time schedule. t and S t+1 The moment when the simulation simulator completes the simulation task between the simulation tasks is marked as the current time, and then S is compared t The following status shows the number of completed simulators and the total number of simulation simulators N, comparing S t The execution time up to now is the same as S t+1 Estimated start time, simulation time will be advanced as needed:
[0070] (1) The first synchronization method:
[0071] If the number of simulation steps S t The next state is that the number of completed simulators is equal to the total number of simulation simulators N and S t The execution time till now is less than or equal to S t+1 Estimated start time, remaining sleep time T, T≥0;
[0072] If the number of simulation steps S t The next state is that the number of completed simulators is less than the total number of simulation simulators N, and the number of simulation steps S t The execution time to date is equal to the number of simulation steps S t+1 The estimated start time, throwing an exception to end the simulation, at this time you should optimize the task or adjust the simulation step size;
[0073] (2) The second synchronization method:
[0074] If S t The transaction status is that the number of completed simulation simulators is equal to the total number of simulation simulators N and S t The execution time till now is less than or equal to S t+1 Estimated start time, directly start to the next simulation step S t+1 ;
[0075] If S t The next state is that the number of completed simulators is less than the total number of simulation simulators N and S t The execution time to date is equal to the number of simulation steps S t+1 The estimated start time, blocking and waiting for all simulation simulators to return to the completed state before moving to the next simulation step St+1 ;
[0076] Finally, the number of simulation steps S t+1 Start, start a new round of execution.
[0077] The first synchronization method can be regarded as a strong time synchronization method. For simulation applications that require real-time feedback or interaction with the real world (such as digital twins and training simulations), strong time synchronization can ensure the precise correspondence between simulation and real time, facilitate monitoring and control of the simulation process, and achieve efficient decision support. At the same time, through a strict synchronization mechanism, strong time synchronization reduces the uncertainty and inconsistency problems that may occur in the simulation process, enhances the stability and predictability of the simulation system, and is conducive to long-term and large-scale simulation research.
[0078] The first synchronization method can be regarded as a weak time synchronization method. In the weak time synchronization mode, the collaborative simulation middleware ensures that the simulation simulators can work together under relatively loose time constraints, improving the flexibility and stability of the simulation system. Especially when dealing with large-scale and complex systems, it can effectively deal with the processing delays of individual simulators and ensure the continuous advancement of the simulation process.
[0079] Step 108: After the collaborative simulation task is completed, the collaborative simulation middleware integrates the simulation data and disconnects the communication connection with each of the N simulation simulators, and cleans up the legacy data of each simulation simulator during the simulation process.
[0080] In this step, the data is integrated after the collaborative simulation task is completed, and the legacy data of each simulation simulator during the simulation process is cleaned up.
[0081] based on Figure 1The method in the technical solution of the present application proposes a collaborative simulation solution based on multiple simulation simulators, in which N simulation simulators are integrated based on the collaborative simulation middleware to perform collaborative simulation on the collaborative simulation task, the server deploying the collaborative simulation middleware can access the server deploying the simulation simulator, the simulation collaborative middleware communicates with the simulation simulator through the simulation agent, and there is a corresponding simulation agent for each of the N simulation simulators. During the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent. Considering that from the perspective of coupled simulation, each simulation simulator is required to be synchronized and parallel, therefore, in the technical solution of the present application, the time axis of the collaborative simulation middleware is used as the unified time standard when each simulation simulator performs simulation advancement during the simulation advancement process, and the process of multiple simulation simulators executing simulation subtasks is synchronized. At the same time, considering that the time constraints of different specific simulation tasks are different in degree of looseness, different time synchronization schemes are proposed in the technical solution of the present application, which makes the technical solution of the present application wide in scope.
[0082] based on Figure 1 The method, the examples of this specification also provide some specific implementation plans of the method, which are described below.
[0083] Therefore, in an optional embodiment, the decomposition of the collaborative simulation task into multiple simulation sub-tasks may specifically include: for complex simulation tasks, decomposition according to functional fields, which is reflected in decomposing the collaborative simulation task into first simulation sub-tasks in different functional fields, and the simulation results of simulation simulators in different functional fields need to be synchronized and integrated to output a unified collaborative simulation result; decomposition according to granularity, which is reflected in decomposing the simulation task into similar second simulation sub-tasks of different granularities, and for each sub-task in the second simulation sub-task, it is decided as needed whether to continue to be further decomposed according to the functional field to obtain the simulation sub-task of the next level, and finally obtain several simulation sub-tasks of different levels.
[0084] The previous article records actual systems in reality, such as large and complex actual systems, which often involve multiple disciplines and have characteristics such as high nonlinearity, time-varying, and uncertainty. The technical solution of this application is particularly aimed at such large and complex actual systems. When the collaborative simulation task of such an actual system is relatively large, if the disassembled simulation subtasks obtained by a single simulation simulator are still relatively complex, the next level of disassembly can be continued. The disassembly of complex simulation tasks corresponds to the need for multiple simulation tasks to run independently and interconnected, so the collaborative simulation middleware should have the following functions: 1) Support the creation of simulation tasks; 2) Support batch creation of simulation subtasks based on simulation tasks, and subtasks of the same simulation task can communicate with each other; 3) Support the acquisition of simulation results by means of the unique ID of the simulation task; 4) The simulation task asynchronously updates its own task status.
[0085] The collaborative simulation middleware must be deployed in a cluster environment. The specific deployment method can refer to the deployment method of microservices. The database is used to store task status, information, and results, and a unified front-end is supported to display simulation effects and results. Therefore, the functional architecture of the collaborative simulation system constructed based on the distributed collaborative solution of middleware and unified front-end display can be referred to Figure 7 in the way.
[0086] In an optional embodiment, the development method of the simulation agent may specifically include:
[0087] For any one of the N simulation simulators, if the any one of the simulation simulators has a client that can be directly used by the collaborative simulation middleware, the simulation agent directly integrates the client that can be directly used;
[0088] For any one of the simulation simulators, if any one of the simulation simulators has an open application programming interface API, then a simulation agent of the any one of the simulation simulators is obtained based on the specification encapsulation of the API;
[0089] If any of the simulation simulators has a client developed in a language different from the development language of the collaborative simulation middleware, the client's functions are developed in the other language to obtain an external API, and then the simulation agent of any of the simulation simulators is obtained based on the specification encapsulation of the external API.
[0090] In an optional embodiment, the collaborative simulation middleware is further used to synchronize data of the coupled simulation calculation processes of the N simulation simulators, which may specifically include:
[0091] After the collaborative simulation middleware is started, the collaborative simulation middleware starts or connects to the N simulation simulators;
[0092] For any one of the N simulation simulators, the any one of the simulation simulators initializes its own simulation agent, and registers with the event message center of the cloud based on its own simulation agent to subscribe to related topics;
[0093] When the collaborative simulation middleware needs to issue instructions to the simulation simulators among the N simulation simulators, the collaborative simulation middleware publishes an event and broadcasts it to the simulation agent subscribed to the relevant topic, which is then processed by the simulation agent;
[0094] For any one of the N simulation simulators, when any one of the simulation simulators has simulation data that needs to be synchronized to other simulation simulators, the simulation agent of any one of the simulation simulators publishes an event to notify the collaborative simulation middleware, which is processed and published by the collaborative simulation middleware so that other simulation simulators among the N simulation simulators except the any one of the simulation simulators can obtain the simulation data, and the other simulation simulators are the simulation simulators that have demand for the simulation data.
[0095] In order to complete the collaborative simulation method based on multiple simulators described above, the integrated simulation agent must have the following functions: (1) start the local simulator, or connect to the cloud simulator; (2) synchronize simulation data, which is specifically reflected in conveying the instructions of the middleware to change the data of the simulation being performed by the simulator; (3) request time advancement; (4) subscribe to data changes; (5) publish data change events; (6) stop the local simulator and disconnect the cloud simulator.
[0096] At the same time, the collaborative simulation middleware must be deployed in a cluster environment. The specific deployment method can refer to the deployment method of microservices. The database is used to store task status, information, and results, and a unified front-end is supported to display simulation effects and results. Therefore, the functional architecture of the collaborative simulation system constructed based on the distributed collaborative solution of middleware and unified front-end display can be referred to Figure 6 , Figure 6 Schematic diagram of the functional architecture of the collaborative simulation system.
[0097] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 7 The embodiments of this specification provide corresponding to Figure 1 A schematic diagram of the structure of a collaborative simulation device based on multiple simulation simulators. Figure 7 As shown, the device may include:
[0098] The component deployment module 702 is used to integrate N simulation simulators based on the collaborative simulation middleware to perform collaborative simulation on collaborative simulation tasks. The server that deploys the collaborative simulation middleware can access the server that deploys the simulation simulator. The simulation collaborative middleware communicates with the simulation simulator through a simulation agent, and a corresponding simulation agent is required for each of the N simulation simulators.
[0099] The simulation agent deployment module 704 is used to pre-develop a simulation agent corresponding to each of the N simulation simulators in the collaborative simulation middleware; the corresponding simulation agent will start the simulation simulator or connect to the simulation simulator deployed in the cloud when the collaborative simulation task is started; during the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent.
[0100] The simulation time synchronization module 706 is used for the collaborative simulation task, which is that the collaborative simulation middleware promotes the coupled simulation calculation process of the N simulation simulators based on the preset simulation step size, and synchronizes the coupled simulation calculation process of the N simulation simulators based on the time axis of the collaborative simulation middleware, specifically including:
[0101] For any two adjacent simulation steps S in the coupled simulation calculation process, t and S t+1 , set the variable n with an initial value of zero, the variable n is used to count the total number of simulation simulators whose transaction processing status is completed; in the simulation step number S t After being turned on, the collaborative simulation middleware asynchronously calls the simulation agent corresponding to each of the N simulation simulators to check whether each of the N simulation simulators needs to perform transaction processing;
[0102] For the simulation step number S t and S t+1 No transaction is required between the simulation steps S t+1 The simulation steps S are completed before opening t and S t+1 For each simulation simulator of the simulation task, the value of the variable n is increased by one;
[0103] Among all the simulation simulators involved in the variable n, the last one to complete the simulation step number S in terms of time schedule t and S t+1 The time when the simulation simulator of the simulation task completes the simulation task is marked as the current time; comparing the size of the variable n after numerical statistics with the value N;
[0104] If the variable n is equal to the value N, and the current time is less than or equal to the simulation step number S t+1 The estimated start time, the collaborative simulation middleware waits until the simulation step number S is reached. t+1 The N simulation simulators are then driven to perform subsequent simulation work after the expected start time, or the collaborative simulation middleware drives the N simulation simulators to perform the simulation step number S at the current time. t+1 The subsequent simulation work;
[0105] If the variable n is less than the value N, and the current time is equal to the simulation step number S t+1 The co-simulation middleware throws an exception to end the co-simulation task, or the co-simulation middleware waits for the transaction processing status of the N simulation simulators to be completed before pushing the N simulation simulators to perform the simulation step number S. t+1 After the simulation work.
[0106] The simulation data processing module 708 is used for the collaborative simulation middleware to integrate the simulation data and disconnect the communication connection with each of the N simulation simulators after the collaborative simulation task is completed, and to clean up the legacy data of each simulation simulator during the simulation process.
[0107] It is understood that the above modules refer to computer programs or program segments for executing one or more specific functions. In addition, the distinction between the above modules does not mean that the actual program codes must also be separated.
[0108] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.
[0109] Those skilled in the art can understand that the modules in the device in the embodiment can be distributed in the device in the embodiment according to the description of the embodiment, or can be changed accordingly and located in one or more devices different from the embodiment. The modules in the above embodiment can be combined into one module, or can be further divided into multiple sub-modules.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A collaborative simulation method based on multiple simulation simulators, characterized in that: The method comprises: Based on the collaborative simulation middleware, N simulation simulators are integrated to perform collaborative simulation on the collaborative simulation task. The server deploying the collaborative simulation middleware can access the server deploying the simulation simulator. The simulation collaborative middleware communicates with the simulation simulator through a simulation agent, and a corresponding simulation agent is required for each simulation simulator in the N simulations. For each of the N simulation simulators, a simulation agent corresponding to each simulation simulator is pre-developed in the collaborative simulation middleware; the corresponding simulation agent starts the simulation simulator or connects to the simulation simulator deployed in the cloud when the collaborative simulation task is started; during the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent; The collaborative simulation task is that the collaborative simulation middleware promotes the coupled simulation calculation process of the N simulation simulators based on a preset simulation step size, and synchronizes the coupled simulation calculation process of the N simulation simulators based on the time axis of the collaborative simulation middleware, specifically including: For any two adjacent simulation steps S in the coupled simulation calculation process, t and S t+1 , set the variable n with an initial value of zero, the variable n is used to count the total number of simulation simulators whose transaction processing status is completed; in the simulation step number S t After being turned on, the collaborative simulation middleware asynchronously calls the simulation agent corresponding to each of the N simulation simulators to check whether each of the N simulation simulators needs to perform transaction processing; For the simulation step S t and S t+1 No transaction is required between the simulation steps S t+1 The simulation steps S are completed before opening t and S t+1 For each simulation simulator of the simulation task, the value of the variable n is increased by one; Among all the simulation simulators involved in the variable n, the last one to complete the simulation step number S in terms of time schedule t and S t+1 The time when the simulation simulator of the simulation task completes the simulation task is marked as the current time; comparing the size of the variable n after numerical statistics with the value N; If the variable n is equal to the value N, and the current time is less than or equal to the simulation step number S t+1 The estimated start time, the collaborative simulation middleware waits until the simulation step number S is reached. t+1 The N simulation simulators are then driven to perform subsequent simulation work after the expected start time, or the collaborative simulation middleware drives the N simulation simulators to perform the simulation step number S at the current time. t+1 After the simulation work; If the variable n is less than the value N, and the current time is equal to the simulation step number S t+1 The co-simulation middleware throws an exception to end the co-simulation task, or the co-simulation middleware waits for the transaction processing status of the N simulation simulators to be completed before pushing the N simulation simulators to perform the simulation step number S. t+1 After the simulation work; After the collaborative simulation task is completed, the collaborative simulation middleware integrates the simulation data and disconnects the communication connection with each of the N simulation simulators, and cleans up the legacy data of each simulation simulator during the simulation process.
2. The collaborative simulation method based on multiple simulation simulators according to claim 1, characterized in that: The collaborative simulation task is decomposed into multiple simulation subtasks, specifically including: For complex simulation tasks, decomposition according to functional fields is reflected in decomposing the collaborative simulation tasks into first simulation subtasks in different functional fields, which requires synchronization and integration of simulation results of simulation simulators in different functional fields to output a unified collaborative simulation result; decomposition according to granularity is reflected in decomposing the simulation tasks into similar second simulation subtasks of different granularities, and for each subtask in the second simulation subtask, it is decided whether to continue to decompose further according to functional fields as needed to obtain simulation subtasks of the next level, and finally obtain several simulation subtasks of different levels.
3. The simulation agent according to claim 1, characterized in that: The development method of the simulation agent specifically includes: For any one of the N simulation simulators, if the any one of the simulation simulators has a client that can be directly used by the collaborative simulation middleware, the simulation agent directly integrates the client that can be directly used; For any one of the simulation simulators, if any one of the simulation simulators has an open application programming interface API, then a simulation agent of the any one of the simulation simulators is obtained based on the specification encapsulation of the API; If any of the simulation simulators has a client developed in a language different from the development language of the collaborative simulation middleware, the client's functions are developed in the other language to obtain an external API, and then the simulation agent of any of the simulation simulators is obtained based on the specification encapsulation of the external API.
4. The collaborative simulation method based on multiple simulation simulators according to claim 1, characterized in that: The collaborative simulation middleware is also used to synchronize data of the coupled simulation calculation process of the N simulation simulators, specifically including: After the collaborative simulation middleware is started, the collaborative simulation middleware starts or connects to the N simulation simulators; For any one of the N simulation simulators, the any one of the simulation simulators initializes its own simulation agent, and registers with the event message center of the cloud based on its own simulation agent to subscribe to related topics; When the collaborative simulation middleware needs to issue instructions to the simulation simulators among the N simulation simulators, the collaborative simulation middleware publishes an event and broadcasts it to the simulation agent subscribed to the relevant topic, which is then processed by the simulation agent; For any one of the N simulation simulators, when any one of the simulation simulators has simulation data that needs to be synchronized to other simulation simulators, the simulation agent of any one of the simulation simulators publishes an event to notify the collaborative simulation middleware, which is processed and published by the collaborative simulation middleware so that other simulation simulators among the N simulation simulators except the any one of the simulation simulators can obtain the simulation data, and the other simulation simulators are the simulation simulators that have demand for the simulation data.
5. A collaborative simulation device based on multiple simulation simulators, characterized in that: include: A component deployment module is used to integrate N simulation simulators based on the collaborative simulation middleware to perform collaborative simulation on the collaborative simulation task. The server deploying the collaborative simulation middleware can access the server deploying the simulation simulator. The simulation collaborative middleware communicates with the simulation simulator through a simulation agent, and a corresponding simulation agent is required for each simulation simulator in the N simulation tasks. A simulation agent deployment module is used to pre-develop a simulation agent corresponding to each of the N simulation simulators in the collaborative simulation middleware; the corresponding simulation agent will start the simulation simulator or connect to the simulation simulator deployed in the cloud when the collaborative simulation task is started; during the execution of the collaborative simulation task, the instructions that need to control the simulation simulator and the results of the simulation simulator are transmitted through the simulation agent; The simulation time synchronization module is used for the collaborative simulation task, wherein the collaborative simulation middleware promotes the coupled simulation calculation process of the N simulation simulators based on a preset simulation step size, and performs time synchronization on the coupled simulation calculation process of the N simulation simulators based on the time axis of the collaborative simulation middleware, specifically comprising: For any two adjacent simulation steps S in the coupled simulation calculation process, t and S t+1 , set the variable n with an initial value of zero, the variable n is used to count the total number of simulation simulators whose transaction processing status is completed; in the simulation step number S t After being turned on, the collaborative simulation middleware asynchronously calls the simulation agent corresponding to each of the N simulation simulators to check whether each of the N simulation simulators needs to perform transaction processing; For the simulation step S t and S t+1 No transaction is required between the simulation steps S t+1 The simulation steps S are completed before opening t and S t+1 For each simulation simulator of the simulation task, the value of the variable n is increased by one; Among all the simulation simulators involved in the variable n, the last one to complete the simulation step number S in terms of time schedule t and S t+1 The time when the simulation simulator of the simulation task completes the simulation task is marked as the current time; comparing the size of the variable n after numerical statistics with the value N; If the variable n is equal to the value N, and the current time is less than or equal to the simulation step number S t+1 The estimated start time, the collaborative simulation middleware waits until the simulation step number S is reached. t+1 The N simulation simulators are then driven to perform subsequent simulation work after the expected start time, or the collaborative simulation middleware drives the N simulation simulators to perform the simulation step number S at the current time. t+1 After the simulation work; If the variable n is less than the value N, and the current time is equal to the simulation step number S t+1 The co-simulation middleware throws an exception to end the co-simulation task, or the co-simulation middleware waits for the transaction processing status of the N simulation simulators to be completed before pushing the N simulation simulators to perform the simulation step number S. t+1 After the simulation work; The simulation data processing module is used to integrate the simulation data and disconnect the communication connection with each of the N simulation simulators after the collaborative simulation task is completed, and clean up the legacy data of each simulation simulator during the simulation process.
6. The collaborative simulation device based on multiple simulation simulators according to claim 5, characterized in that: The device also includes a task decomposition module, which is used to decompose complex simulation tasks according to functional fields, which is reflected in decomposing the collaborative simulation task into first simulation subtasks in different functional fields, and the simulation results of simulation simulators in different functional fields need to be synchronized and integrated to output a unified collaborative simulation result; Decomposition according to granularity is reflected in decomposing the simulation task into similar second simulation subtasks of different granularity. For each subtask in the second simulation subtask, it is decided as needed whether to further decompose it according to functional field to obtain the next level of simulation subtasks, and finally obtain several simulation subtasks of different levels.
Citation Information
Cited By
Biomass fiber reinforced degradable polyurethane foaming packaging material and preparation method thereof
CN122167997A