Multi-device orderly collaborative simulation method, device, storage medium and program product
By constructing a multi-device ordered collaborative simulation method and assigning sequence numbers and step sizes based on device dependencies, the efficiency and accuracy issues of traditional simulation methods in componentized signal-level devices are solved, and efficient and accurate simulation calculations are achieved.
Patent Information
- Application Number
- CN202510539737.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-04-27
AI Technical Summary
Traditional simulation methods make it difficult to efficiently complete component-based signal-level device simulation. Timer drivers cannot meet time step requirements, and distributed driver hardware requirements are high and complex to manage.
Based on the dependencies between multiple devices, the model is constructed and sequence numbers are assigned to generate an ordered list. The explicit and implicit step models are distinguished. The simulation time is optimized by iterative step size to ensure the time synchronization and accuracy of model calculation.
It improves the accuracy and efficiency of simulation, simplifies collaborative logic, reduces development complexity and hardware requirements, and supports simulation of variable step-size scenarios.
Smart Images

Figure CN120448032B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of simulation technology, and in particular to a method, apparatus, storage medium, and program product for orderly collaborative simulation of multiple devices. Background Art
[0002] In the simulation field, there are two common driver methods: timer and distributed. Timer drivers are triggered at a fixed step size. They are fast to develop, easy to use, and suitable for single machines or local area networks. However, they have high model requirements and must complete calculations within a specified time. In componentized signal-level device simulation (over 30 models), they cannot meet the time step requirements. Signal-level simulation takes far longer than the timer trigger time. The operating system trigger accuracy is milliseconds, while the signal level requires microseconds, and it cannot handle variable step size scenarios.
[0003] Distributed drivers are based on a local area network and are driven by simulation time iteration and model state feedback. They are model-independent and support distributed simulation, but engine development is difficult and hardware requirements are high. Distributed systems still operate in a networked mode in a single-machine environment, consuming more time on distributed management. Furthermore, single-machine systems do not require the serialization and deserialization steps required for network transmission. Consequently, traditional simulation methods struggle to efficiently simulate component-based signal-level devices. Summary of the Invention
[0004] In view of this, the embodiments of the present disclosure provide a method, apparatus, storage medium and program product for orderly collaborative simulation of multiple devices, which can optimize the scheduling and driving of the simulation engine for componentized signal-level device simulation in a single-machine environment, realize orderly calculation of each model, and improve simulation efficiency.
[0005] In a first aspect, the embodiments of the present disclosure provide a multi-device ordered collaborative simulation method, which adopts the following technical solutions:
[0006] Based on the dependency relationship between multiple devices to be simulated, a model of each device to be simulated is constructed, and a sequence number is assigned to each model;
[0007] Instantiate each of the models, generate a model list, and map the sequence number to an index value in the model list;
[0008] Sort the models in the model list based on the index value to obtain an ordered list;
[0009] Distinguish the models into explicit step-size models and implicit step-size models;
[0010] Obtaining a registered step size of the explicit step size model, and obtaining an iteration step size based on the registered step size;
[0011] The simulation time is increased according to the iterative step size, and at the initial time and after each increase, the simulation calculation is performed on the model in sequence according to the arrangement order in the ordered list.
[0012] Optionally, sorting the models in the model list based on the index value to obtain an ordered list includes:
[0013] Traverse all models in sequence according to the index value in the model list;
[0014] Verify the input port of the current model being traversed;
[0015] If the verification is successful, the post-model of the current model is determined, where the post-model refers to a model that receives the output data of the current model;
[0016] If the index values of all subsequent models are greater than the index value of the current model, the index value of the current model is inserted before the index value of the first subsequent model. After the insertion operation is completed, the next model is traversed;
[0017] If the verification fails or there is any subsequent model whose index value is less than or equal to the index value of the current model, the next model is traversed until the current model list is traversed and an ordered list is generated.
[0018] Optionally, the input port verification of the current model being traversed includes:
[0019] Obtain all input port identifiers of the post-model;
[0020] Matching the input port identifier with a preset port list;
[0021] If any input port identifier successfully matches the preset port list, it is determined that the verification of the current model has failed;
[0022] If all input port identifiers fail to match the preset port list, it is determined that the verification of the current model is passed.
[0023] Optionally, obtaining the registered step size of the explicit step size model includes:
[0024] Sending a '-1' time instruction to all models in sequence according to the index value in the model list;
[0025] After the model receives the '-1' time instruction, it performs initialization operation and data pointer transfer operation successively;
[0026] After the initialization operation and the data pointer transfer operation are completed, if the model is an explicit step model, the registration step is sent to the simulation engine.
[0027] Optionally, acquiring the iteration step length based on the registration step length includes:
[0028] Calculate the greatest common divisor of all registered step lengths, where the iteration step length is equal to the greatest common divisor;
[0029] When there is a new registration step size, the greatest common divisor is recalculated, and the iteration step size is updated based on the new greatest common divisor.
[0030] Optionally, increasing the simulation time according to the iterative step size, and performing simulation calculations on the models in sequence according to the order of arrangement in the ordered list at the initial time and after each increment, includes:
[0031] Taking the iteration step as the time interval, gradually increasing from the initial time, at the initial time and the moment after each increment, traversing all models in sequence according to the index values in the ordered list;
[0032] If the current model being traversed is an explicit step-size model, then internal simulation calculation is performed on the current model according to the registered step-size of the current model;
[0033] If the current model being traversed is an implicit step-size model, determining the predecessor model of the current model, where the predecessor model is a model that transfers data to the current model;
[0034] Performing internal simulation calculation on the current model according to the maximum step size in the predecessor model;
[0035] After the current model completes the internal simulation calculation, the state is updated according to the internal simulation calculation result, and the output data is determined based on the previous internal simulation calculation result;
[0036] The output data is sent to a subsequent model through an output port of the current model, and the subsequent model refers to a model that receives the output data of the current model.
[0037] Optionally, the multi-device ordered collaborative simulation method further includes:
[0038] Creating a model base class, wherein the model base class includes an execution interface;
[0039] Based on the model base class, create a derived class of each model, wherein the derived class rewrites the execution interface;
[0040] The execution interface of the current model is called to complete the internal simulation calculation.
[0041] In a second aspect, the embodiments of the present disclosure further provide a multi-device ordered collaborative simulation system, which adopts the following technical solutions:
[0042] A model building module is used to build a model of each device to be simulated based on the dependency relationship between multiple devices to be simulated, and assign a sequence number to each model;
[0043] A list generation module, configured to instantiate each of the models, generate a model list, and map the sequence number to an index value in the model list;
[0044] A model sorting module, configured to sort the models in the model list based on the index value to obtain an ordered list;
[0045] Model differentiation module, used to distinguish the model into explicit step size model and implicit step size model;
[0046] A step length acquisition module, configured to acquire a registered step length of the explicit step length model, and acquire an iteration step length based on the registered step length;
[0047] The simulation calculation module is used to increase the simulation time according to the iterative step size, and to simulate the model in sequence according to the arrangement order in the ordered list at the initial time and after each increase.
[0048] In a third aspect, the embodiments of the present disclosure further provide a computer device that adopts the following technical solution:
[0049] The computer device comprises:
[0050] at least one processor; and,
[0051] a memory communicatively connected to the at least one processor; wherein,
[0052] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform any of the above-mentioned multi-device ordered collaborative simulation methods.
[0053] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute any of the multi-device ordered collaborative simulation methods described above.
[0054] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, comprising a computer program / instruction, which implements the steps of any of the above methods when executed by a processor.
[0055] The multi-device orderly collaborative simulation method provided by the embodiment of the present disclosure builds a model based on the dependency relationship between devices, clearly sorts out the relationship between each device in the simulation, and makes the subsequent simulation calculations conform to the actual logic. Assigning a sequence number to each model lays the foundation for subsequent model sorting and orderly simulation, avoids erroneous results caused by confusion in the model calculation order, and improves the accuracy of the simulation. The model is instantiated and a model list is generated to facilitate unified management of all models. The sequence number is mapped to an index value so that the model has a clear position identifier in the list, and the model can be quickly located and operated through the index later, which improves the efficiency of data processing. By sorting the model list according to the index value, an ordered list is obtained. The arrangement order of each model in this ordered list strictly follows its dependency relationship, thereby providing a clear and reliable basis for the subsequent accurate calling of the model to carry out simulation calculations. By obtaining the registered step size of the explicit step size model and calculating the iteration step size, the simulation step size can be flexibly adjusted, the step size management can be optimized, the signal-level simulation needs for high-precision step size can be met, and the accuracy of the simulation can be improved. Increasing the simulation time according to the iteration step size and calculating the model in sequence according to the ordered list ensures the time synchronization of model calculations, avoids simulation errors caused by time asynchrony, simplifies the collaborative logic, and improves the reliability of the simulation results.
[0056] The above description is only an overview of the technical solution of the present disclosure. In order to more clearly understand the technical means of the present disclosure, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the following specifically cites preferred embodiments and describes them in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0058] Figure 1 A schematic diagram of a flow chart of a multi-device ordered collaborative simulation method provided by an embodiment of the present disclosure;
[0059] Figure 2 A flow chart of a model ranking method provided in an embodiment of the present disclosure;
[0060] Figure 3 A flow chart of an input port verification method provided in an embodiment of the present disclosure;
[0061] Figure 4 A schematic diagram of adjusting the model sorting position provided in an embodiment of the present disclosure;
[0062] Figure 5 Another flowchart of the model sorting method provided by the embodiment of the present disclosure;
[0063] Figure 6 A flowchart of a registration step length method provided in an embodiment of the present disclosure;
[0064] Figure 7 A schematic diagram of a flow chart of an ordered simulation calculation method provided in an embodiment of the present disclosure;
[0065] Figure 8 A schematic diagram of a flow chart of a model sequential simulation method provided by an embodiment of the present disclosure;
[0066] Figure 9 A principle block diagram of a multi-device ordered collaborative simulation system provided by an embodiment of the present disclosure;
[0067] Figure 10 A schematic diagram of the structure of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0068] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0069] It should be clear that the following embodiments of the present disclosure are described through specific concrete examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other in the absence of conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.
[0070] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on this disclosure, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0071] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The illustrations only show components related to the present disclosure and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type may also be more complicated.
[0072] Additionally, in the following description, specific details are provided to provide a thorough understanding of the examples. However, one skilled in the art will appreciate that the aspects described can be practiced without these specific details.
[0073] Reference Figure 1 The present disclosure provides a multi-device ordered collaborative simulation method, comprising the following steps:
[0074] S1: Based on the dependency relationship between multiple devices to be simulated, build a model for each device to be simulated and assign a sequence number to each model;
[0075] S2: Instantiate each model, generate a model list, and map the sequence number to the index value in the model list;
[0076] S3: Sort the models in the model list based on the index value to obtain an ordered list;
[0077] S4: The model is divided into explicit step-size model and implicit step-size model;
[0078] S5: Obtain the registered step size of the explicit step size model, and obtain the iteration step size based on the registered step size;
[0079] S6: Increase the simulation time according to the iterative step size. At the initial time and after each increment, the model is simulated and calculated in the order of arrangement in the ordered list.
[0080] The multi-device orderly collaborative simulation method provided by the present disclosure is triggered by a timer driver at a fixed step size. In the componentized signal-level device simulation, the dependencies between numerous models are difficult to accurately handle within a fixed time step. The method provided by the present disclosure can build a model based on the dependencies between devices, clearly sort out the relationships between the devices in the simulation, and make the subsequent simulation calculations conform to the actual logic. Assigning a sequence number to each model lays the foundation for subsequent model sorting and orderly simulation, avoids erroneous results caused by confusion in the model calculation order, and improves the accuracy of the simulation. In addition, by clarifying the model dependencies and assigning sequence numbers in advance, there is no need for complex distributed management to coordinate the dependencies between models in subsequent simulations, which reduces the complexity of development and hardware requirements.
[0081] The model is instantiated and a model list is generated to facilitate unified management of all models. The sequence number is mapped to an index value so that the model has a clear position identifier in the list. The model can be quickly located and operated through the index later, which improves the efficiency of data processing. This organization in the form of a list avoids the serialization and deserialization steps in the distributed system, reduces time consumption, and improves simulation efficiency. By sorting the model list according to the index value, an ordered list is obtained. The arrangement order of each model in this ordered list strictly follows its dependency relationship, thus providing a clear and reliable basis for the subsequent accurate calling of the model to carry out simulation calculations.
[0082] Categorizing models into explicit and implicit step-size models provides a foundation for adopting different step-size strategies for different model types, enhancing the simulation's adaptability to varying model step-size requirements and resolving the issue of inability to handle variable step-size scenarios. By obtaining the registered step-size of the explicit step-size model and calculating the iteration step-size, the simulation step-size can be flexibly adjusted, optimizing step-size management to meet the high-precision step-size requirements of signal-level simulations and improving simulation accuracy.
[0083] Increasing the simulation time according to the iteration step size and calculating the model in sequence according to the ordered list ensures the time synchronization of model calculations, avoids simulation errors caused by time asynchrony, simplifies the collaborative logic, and improves the reliability of the simulation results.
[0084] In S1, the device information of each device to be simulated is obtained. This information includes parameter ports such as input ports (e.g., signal receiving ports such as "echo signal (CS)" and "reference signal (CS)"), output ports (e.g., signal transmitting ports such as "signal (CS)"), device simulation parameters (e.g., device type, performance indicators, etc.), and the data flow between devices. Based on this information, a directed data flow graph (DFG) is constructed, where nodes represent the devices to be simulated and edges represent the data flow between devices. Based on the dependencies between devices shown in the directed data flow graph, a sequence number is assigned to each device to be simulated. The sequence number assignment follows the data flow, ensuring that devices that rely on the output of other devices have higher sequence numbers.
[0085] In S2, the device information, sequence number, and data flow directed graph are stored in the assumption file. The simulation engine (also known as the simulation system) reads the assumption file and instantiates each model based on the information in the file. The instantiation process includes allocating memory space for each model and initializing the model's properties and behaviors. At the same time, the instantiation data of the model is stored in the model list, retaining the sequence number previously assigned to each model and mapping it to the index value in the model list. The size of the index value can be used to clarify the order in which the models are executed, making it easier for the engine to efficiently manage and operate the models. However, because the instantiation process mainly focuses on model loading and is not arranged according to the connection relationship, the model list at this time is unordered.
[0086] Furthermore, to reduce duplication of code and improve code maintainability throughout the simulation process, a model base class is constructed before the simulation begins. Common properties and abstract methods are defined within this model base class, and corresponding interfaces are implemented for each abstract method. These interfaces include a list return interface (nextBeRequiredModels()), a query interface (isRequiredParam()), and an execution interface (running()). Based on this model base class, derived classes of specific models are created. Within these derived classes, the interfaces of the model base class are rewritten to implement functionality that meets the requirements of the specific model. These interfaces make it easier to call the model's related functions, allowing for efficient completion of model tasks.
[0087] Among them, the structure of the model base class is defined as follows:
[0088]
[0089]
[0090] In S3, to ensure the correctness of simulation calculations, the models in the model list need to be sorted according to the data flow. Since the index value is essentially a mapping of the sequence number in the model list, it not only retains the sorting function of the sequence number but also serves as the index of the model list. Therefore, the model can be sorted quickly and accurately based on the index value.
[0091] In one embodiment, referring to Figure 2 The flow diagram of the model sorting method shown in the figure, "Sort the models in the model list based on the index value to obtain an ordered list", includes the following steps:
[0092] S31: Traverse all models in sequence according to the index value in the model list;
[0093] S32: Verify the input port of the current model being traversed; if the verification passes, execute S33; if the verification fails, execute S36;
[0094] S33: determining a post-model of the current model;
[0095] S34: Determine whether the index values of all subsequent models are greater than the index value of the current model; if so, execute S35; if not, execute S36;
[0096] S35: insert the index value of the current model before the index value of the first subsequent model, and after completing the insertion operation, traverse the next model;
[0097] S36: Traverse the next model until the current model list is traversed and an ordered list is generated.
[0098] An algebraic ring structure means that the starting point and the end point of the current path are the same node, and the other nodes in this path are not repeated, that is, a loop occurs. For example, for the path A→B→N→B, B→N→B constitutes an algebraic ring structure. This loop situation may cause the simulation system (also known as the simulation engine) to fall into an infinite loop, resulting in simulation errors or even simulation system crashes. Therefore, before determining whether the current model needs to adjust the sorting position, it is necessary to perform the input port verification task of the current model by calling the query interface of the current model, refer to Figure 3 The flow diagram of the input port validation method shown in the figure shows that "validating the input port of the current model being traversed" includes the following steps:
[0099] S321: Obtain all input port identifiers of the post-model;
[0100] S322: Match the input port identifier with the preset port list; if any input port identifier successfully matches the preset port list, execute S323; if all input port identifiers fail to match the preset port list, execute S324;
[0101] S323: Determine that the verification of the current model fails;
[0102] S324: Determine whether the verification of the current model is successful.
[0103] The preset port list refers to a set of input ports that have been detected or are known to cause algebraic loop problems. This list is obtained from previous model analysis or experience summary and contains information about input ports that are prone to cause algebraic loops.
[0104] The post-model is the model that receives the output data of the current model. For example, if the data flow is A→B→C→A, forming a loop, and the current model is C, all input port identifiers of A are obtained and checked. Because the models in this loop structure are interdependent, and A is the receiver of C's output and the starting model, the status of its input ports can provide key information on whether an algebraic loop exists.
[0105] By calling the list return interface of the current model, the collection list of subsequent models is automatically obtained, and then the input port of each subsequent model is obtained. If any input port of the subsequent model is consistent with a port in the input port list, it indicates that the output of the current model will introduce an algebraic loop problem. If the current model is allowed to participate in subsequent operations such as sorting, an algebraic loop may be triggered in subsequent calculations or processing, causing the system to fail to solve normally or produce incorrect results.
[0106] Model sorting aims to optimize the order of computations, improving efficiency and accuracy. If a model contains a risk of algebraic loops, including it in the sorting process could disrupt the logic of the entire sorting algorithm, preventing subsequent computations from proceeding properly. For example, in a complex multi-model system, the goal of sorting is to sequentially calculate models based on their dependencies. If models with algebraic loops are included in the sorting process, the computation could become stuck in an infinite loop, preventing the correct result from being obtained.
[0107] Therefore, by using the input port verification method to exclude models with algebraic loop risks from the ranking, unnecessary calculations and processing can be avoided for these models, thereby saving computing resources, ensuring the stability of the system calculations, and avoiding calculation errors caused by algebraic loops. In large-scale model simulations or calculations, the calculation of each model consumes a certain amount of resources. Excluding problematic models can improve overall computing efficiency.
[0108] When the input port of the current model is verified, it means that there is no algebraic loop risk in the current model. At this time, the current model is further judged by the post-model to see whether the current sorting position of the current model is correct. Get the index value of the post-model and compare the index value of the post-model with the index value of the current model to determine whether the sorting position of the current model is correct. If the index values of all post-models are greater than the index value of the current model, it means that the sorting position of the current model is incorrect. The index value of the current model needs to be inserted before the index value of the first post-model to adjust the sorting position of the current model correctly. For example, refer to Figure 4The diagram shows adjusting the model sorting position, where the current model is model 11, and the subsequent models of model 11 include models 2 to 12. If it is detected that the index values of models 2 to 12 are all greater than the index value of model 11, models 2 to 12 are moved backward one position in turn, and model 11 is placed in the original position of model 2. Similarly, the models in the model list are sorted, and when all the sorting is completed, an ordered list is generated.
[0109] When the model system is relatively complex and there are a lot of indirect data transmission and mutual influence, the output of one model may affect multiple other models through multiple intermediate links. In order to more comprehensively reflect the logical relationship and data dependency between models, the present disclosure also provides another embodiment. In another embodiment, referring to Figure 5 Another flowchart of the model sorting method shown, "Sort models in a model list based on index values to obtain an ordered list," includes the following steps:
[0110] S37: Traverse all models in sequence according to the index value in the model list;
[0111] S38: Verify the input port of the current model being traversed; if the verification passes, execute S39; if the verification fails, execute S312;
[0112] S39: determining the downstream model of the current model;
[0113] S310: Determine whether the index values of all downstream models are greater than the index value of the current model; if so, execute S311; if not, execute S312;
[0114] S311: insert the index value of the current model before the index value of the first downstream model. After the insertion operation is completed, traverse the next model.
[0115] S312: Traverse the next model until the current model list is traversed and an ordered list is generated.
[0116] When the input port verification of the current model passes, it indicates that the current model does not have algebraic loop risks. Downstream models are then used to further determine whether the current model's current ranking position is correct. Downstream models refer to all models that follow the current model and directly or indirectly receive the current model's output data and are affected by the current model's simulation results. These models have data transmission, causal relationships, or logical dependencies with the current model, and their inputs, states, or behaviors will change accordingly due to changes in the current model's output or state. Downstream models include not only models that directly receive the current model's output data, but also models that indirectly receive or are affected by the current model's data through intermediate models. Together, these models form a model sequence associated with the current model to complete the simulation task of the entire simulation system. The current model's simulation results refer to the comprehensive information generated by the current model throughout the entire simulation process. They include intermediate calculation results and status information from each link within the model, as well as the final output data. The current model's simulation results provide a broad description of the current model's overall performance and information generated during the simulation, reflecting the entire process of the current model from start to finish.
[0117] Obtain the index value of the downstream model and compare it with the index value of the current model to determine whether the sorting position of the current model is correct. If the index values of all downstream models are greater than the index value of the current model, it means that the sorting position of the current model is incorrect. You need to insert the index value of the current model before the index value of the first downstream model to adjust the sorting position of the current model correctly. Similarly, sort the models in the model list. When all the models are sorted, an ordered list is generated.
[0118] In practical applications, the appropriate method can be selected based on the complexity of the model system. For complex model systems with a large number of indirect dependencies, comparing the index values of downstream models can better ensure the correctness of model sorting; while for simple model systems that mainly rely on direct data transfer relationships, comparing the index values of subsequent models can improve sorting efficiency.
[0119] The sorted model list will reflect the order in which the models are calculated during the simulation process, thus obtaining an ordered model list. This order ensures the correctness of data flow and dependencies, providing support for subsequent simulation calculations.
[0120] In S4, explicit step-size models are capable of autonomously determining and registering their own step size with the simulation engine. This step size can be calculated using built-in algorithms based on the model's characteristics, the problem being addressed, and related parameters, or it can be set in advance by the user based on practical circumstances and experience. During the simulation run, explicit step-size models advance the system state updates and evolution simulation according to their step size, executing calculations and state changes based on this step size in each simulation cycle.
[0121] An implicit step-size model, in a simulation system, does not independently determine its own step-size, but instead relies on the step-size of its predecessor model to run the simulation. This model automatically obtains the maximum step-size among all its predecessor models and uses this maximum step-size as its own step-size during the simulation. In this way, the implicit step-size model ensures consistency with the predecessor model on the time scale, ensuring the consistency and accuracy of data transfer and state updates throughout the simulation system.
[0122] In S5, at the beginning of the simulation phase, the time driver triggers the simulation moment and then traverses the ordered list to perform the calculation operations of each model. At the same time, the calculation iteration process of the time driver is assigned to the sub-thread of the simulation engine, which means that the iterative calculation of the simulation moment and the calculation of each module are completed in the same thread. Among them, the simulation moment includes the '-1' moment, which is before the initial time (i.e., 0 time). By adding the '-1' moment, the simulation warm-up phase can be completed efficiently and fully, ensuring that the simulation system enters a stable and accurate operating state.
[0123] Reference Figure 6 The flowchart of the registration step method shown in the figure shows that "Obtaining the registration step of the explicit step model" includes the following steps:
[0124] S41: Sending a '-1' time instruction to all models in sequence according to the index value in the model list;
[0125] S42: After the model receives the '-1' time instruction, it performs initialization operations and data pointer transfer operations in sequence;
[0126] S43: After the initialization operation and the data pointer transfer operation are completed, if the model is an explicit step model, the registration step is sent to the simulation engine.
[0127] Among them, the "-1" time instruction is a special instruction, sent by the simulation engine at time "-1" and can be triggered by the user clicking the simulation button. After receiving this instruction, the model will perform initialization operations and data pointer transfer operations according to the preset program. The initialization operation is mainly for model initialization. During the model instantiation process, if the simulation engine fails to fully complete the memory space allocation for the model, the subsequent memory allocation work will continue. This method can reduce the workload of the simulation engine in instantiating the model when executing the scenario file, postpone some memory allocation work to the warm-up phase, and ensure that model memory allocation is not missed. The data pointer transfer operation is that each model sends empty data to the subsequent model through its output port and passes the pointer of the model's output port to the subsequent model to realize the labeling of the output port, thereby clarifying the connection relationship between models and facilitating subsequent sequential simulation.
[0128] For explicit step models, after completing initialization and data pointer transfer, they send their simulation step to the simulation engine to complete the step registration operation. To distinguish it from the system step, the simulation step of the explicit step model is called the registration step. For implicit step models, after completing initialization and data pointer transfer, they can seamlessly enter the simulation phase and wait for the triggering of simulation instructions to ensure the continuity and accuracy of the simulation.
[0129] When the simulation engine receives the registered step sizes of all explicit step models, it calculates the greatest common divisor of all registered step sizes through the step size register. The iteration step size is equal to the greatest common divisor. The simulation engine writes the calculated iteration step size into the time driver to facilitate the time driver to advance the system simulation time.
[0130] In S6, refer to Figure 7 The flowchart of the ordered simulation method, which shows "increasing the simulation time by an iterative step size, and simulating the model in the order of the ordered list at the initial time and after each increment," includes the following steps:
[0131] S61: Using the iteration step as the time interval, gradually increasing from the initial time, at the initial time and after each increment, traverse all models in sequence according to the index values in the ordered list;
[0132] S62: Determine whether the current model being traversed is an explicit step-size model or an implicit step-size model; if it is an explicit step-size model, execute S63; if it is an implicit step-size model, execute S64;
[0133] S63: Perform internal simulation calculation on the current model according to the registration step size of the current model;
[0134] S64: determining a predecessor model of the current model;
[0135] S65: Perform internal simulation calculation on the current model according to the maximum step length in the predecessor model;
[0136] S66: After the current model completes the internal simulation calculation, the state is updated according to the internal simulation calculation result, and the output data is determined based on the previous internal simulation calculation result;
[0137] S67: Send the output data to the subsequent model through the output port of the current model. The subsequent model refers to the model that receives the output data of the current model.
[0138] By incrementally increasing the initial time by the iteration step size, we can accurately simulate the time progression of the simulation engine. At each time point (including the initial time and the moment after each increment), we perform a round of traversal of the ordered list, driving the simulation of each model strictly according to the sorted order of the ordered list.
[0139] Explicit and implicit step-size models differ in the principles used for internal simulation calculations. If the current model is an explicit step-size model, it has its own independent step-size. Therefore, the model's internal time can be directly advanced based on this registered step-size. When the model's internal time increments by one registered step-size, the running function is executed by calling the current model's execution interface, initiating the internal simulation calculation process for the current model. If the current model is an implicit step-size model, since it does not have its own independent step-size, the following steps are required to determine the current model's step-size: The following steps are required: All predecessor models of the current model are identified (predecessor models are models that pass data to the current model), the step-sizes of all predecessor models are obtained, and the largest step-size is selected as the current model's step-size. The internal time of the model is advanced based on this step-size. Each time the model is advanced, an internal simulation calculation is performed by calling the execution interface, and the corresponding internal simulation results are obtained. The internal simulation results refer to the detailed computational data and intermediate state information generated by the current model at each computational step and link during the simulation run, based on the input data, according to its built-in algorithms and logic. These results are the product of the model's internal calculation process and provide support for the model's subsequent calculations, state updates, and other operations.
[0140] During the operation of a simulation system, regardless of whether the current model is an explicit or implicit step-size model, it must follow a specific set of data processing and transmission mechanisms after completing internal simulation calculations. State updates are operations performed by the current model based on the results of the recently completed internal simulation calculations. During the simulation process, various state variables exist within the model, describing the characteristics and behavior of the current model at different moments. By analyzing and processing the results of the internal simulation calculations, the current model adjusts and modifies these state variables so that they accurately reflect the actual situation at the current moment. For example, in a model simulating mechanical motion, state variables may include the position, velocity, and acceleration of an object. The internal simulation calculations calculate the new values of these variables based on physical laws and input conditions, and the current model updates its own state based on these new values.
[0141] To address output delays on devices, the simulation engine introduces a "unit time delay" mechanism. Under this mechanism, after the current model completes a state update, its internal simulation calculation results are not immediately forwarded. Instead, output data is extracted from the previous simulation calculation results based on preset rules. Output data refers to data filtered, processed, and refined from internal simulation calculation results based on the current model's design objectives and the needs of external systems or post-models. This data is used to drive subsequent simulations, calculations, or other operations and is key to the information exchange between the current model and the outside world.
[0142] The current model sends output data to the subsequent model through its output port. This mechanism makes the simulation process more closely aligned with the actual device's operating conditions, ensuring that the entire simulation system can more accurately simulate the dynamic characteristics and delay effects of the actual system, allowing various models to collaborate and jointly complete complex simulation tasks. For example, in communication system simulation, there is a transmission delay between the transmitter and the receiver. The "unit time delay" mechanism can effectively simulate this process, making the simulation results more realistic and reliable. Using this method, after the current model completes the calculation, it stores the data to be transmitted to its corresponding output port. When the subsequent model uses the data, it can directly find the data pointer corresponding to the output port of the current module based on the name of its input port and then read the data therein. This process reduces the time and memory overhead caused by data copying, serialization, and deserialization.
[0143] During the simulation process, if an explicit step model needs to change its registered step, the simulation engine will respond to the new registered step, recalculate the greatest common divisor, update the iteration step based on the new greatest common divisor, and write the new iteration step into the time driver. The time driver will continue to increase the simulation time according to the new iteration step.
[0144] Reference Figure 8This flowchart shows the model-ordered simulation method. By traversing the ordered list, the step register collects all registered step sizes and calculates the iteration step size. The time driver thread is an independent execution path within the computer system to execute the time driver function. It is the specific implementation of the time driver at the computer resource level, allowing the time driver function to execute in parallel or concurrently within the system. After the time driver thread triggers the "-1" time, the simulation engine generates a "-1" time instruction, which notifies each model to prepare. Once each model is ready, the time driver thread increments the system's simulation step size from 0, increasing the simulation time by the iteration step size. Each increment of the iteration step size triggers a new simulation time, which in turn triggers another traversal of the ordered list. Following the ordered list, the model's running interface is called sequentially, executing the model's running function to complete the model simulation. If a model does not need to respond at the current time, the calculation is automatically skipped. After the ordered list traversal is completed, the response continues to the next simulation time until the simulation ends. The simulation end condition can be set according to actual needs. For example, the simulation is determined to be ended when the user clicks the end button or when the simulation time of the simulation engine reaches a preset time.
[0145] Through this method, the simulation engine can support multiple devices to perform simulation calculations in the same scenario, and can achieve signal synchronization of multiple devices. The time step required for different devices varies depending on the device mechanism (such as the pulse repetition interval of the active device), and the engine uses the device registration mechanism to complete the simulation step calculation. This method also supports multi-device and variable step simulation at the signal level and functional level, and supports the simulation of componentized device models and integrated device models, with no limit on the number of models. In addition, the model list has been sorted before the simulation starts. Since the system simulation steps need to be superimposed, the engine scheduling time can be ignored, thereby improving the accuracy of the simulation acceleration ratio.
[0146] Reference Figure 9 The present disclosure provides a multi-device ordered collaborative simulation system, comprising:
[0147] The model building module 101 is used to build a model of each device to be simulated based on the dependency relationship between multiple devices to be simulated, and assign a sequence number to each model;
[0148] A list generation module 102 is used to instantiate each model, generate a model list, and map the sequence number to an index value in the model list;
[0149] A model sorting module 103 is used to sort the models in the model list based on the index value to obtain an ordered list;
[0150] A model distinguishing module 104, configured to distinguish the model into an explicit step-size model and an implicit step-size model;
[0151] A step length acquisition module 105 is configured to acquire a registered step length of the explicit step length model and acquire an iteration step length based on the registered step length;
[0152] The simulation calculation module 106 is used to increase the simulation time according to the iteration step size, and to perform simulation calculations on the model in sequence according to the arrangement order in the ordered list at the initial time and after each increase.
[0153] The various variations and specific examples of the multi-device ordered collaborative simulation method provided above are also applicable to the multi-device ordered collaborative simulation system provided in the present disclosure. Through the above detailed description of the multi-device ordered collaborative simulation method, those skilled in the art can clearly know the implementation method of the multi-device ordered collaborative simulation system. For the sake of brevity of the specification, it will not be described in detail here.
[0154] The computer device according to an embodiment of the present disclosure includes a memory and a processor. The memory is used to store non-transitory computer-readable instructions. Specifically, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache). The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, a flash memory, etc.
[0155] The processor may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the computer device to perform desired functions. In one embodiment of the present disclosure, the processor is configured to execute the computer-readable instructions stored in the memory, causing the computer device to execute all or part of the steps of the multi-device ordered collaborative simulation method of each embodiment of the present disclosure.
[0156] Those skilled in the art should understand that in order to solve the technical problem of how to obtain a good user experience, this embodiment may also include well-known structures such as a communication bus and an interface, and these well-known structures should also be included in the scope of protection of this disclosure.
[0157] like Figure 10 The present invention provides a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Figure 10 The computer device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0158] like Figure 10 As shown, the computer device may include a processor (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). Various programs and data required for the operation of the computer device are also stored in the RAM. The processor, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0159] Typically, the following devices can be connected to the I / O interface: input devices such as sensors or visual information acquisition devices; output devices such as display screens; storage devices such as tapes and hard disks; and communication devices. The communication device can allow the computer device to communicate with other devices (such as edge computing devices) wirelessly or by wire to exchange data. Figure 10 A computer device having various devices is shown, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0160] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processor, all or part of the steps of the multi-device ordered collaborative simulation method of the embodiment of the present disclosure are executed.
[0161] For detailed description of this embodiment, please refer to the corresponding description in the aforementioned embodiments, which will not be repeated here.
[0162] According to the computer-readable storage medium of the embodiment of the present disclosure, non-transitory computer-readable instructions are stored thereon. When the non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the multi-device ordered co-simulation method of each embodiment of the present disclosure are executed.
[0163] The above-mentioned computer-readable storage media include, but are not limited to, optical storage media (e.g., CD-ROMs and DVDs), magneto-optical storage media (e.g., MOs), magnetic storage media (e.g., magnetic tapes or mobile hard disks), media with built-in rewritable non-volatile memory (e.g., memory cards), and media with built-in ROM (e.g., ROM cartridges).
[0164] For detailed description of this embodiment, please refer to the corresponding description in the aforementioned embodiments, which will not be repeated here.
[0165] The basic principles of the present disclosure have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, and effects mentioned in this disclosure are merely illustrative and not restrictive, and should not be construed as necessarily possessed by each embodiment of the present disclosure. Furthermore, the specific details disclosed above are provided for illustrative purposes and to facilitate understanding, rather than as limitations. These details do not limit the present disclosure to necessarily being implemented using these specific details.
[0166] In the present disclosure, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. The block diagrams of the devices, devices, equipment, and systems involved in the present disclosure are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, devices, equipment, and systems can be connected, arranged, or configured in any manner. Words such as "including," "comprising," "having," and the like are open-ended words, meaning "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or" and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0167] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0168] It should also be noted that in the system and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0169] Various changes, substitutions, and modifications may be made to the technology described herein without departing from the teachings defined by the appended claims. Moreover, the scope of the claims of this disclosure is not limited to the specific aspects of the processes, machines, manufactures, compositions of things, means, methods, and actions described above. Currently existing or later developed processes, machines, manufactures, compositions of things, means, methods, or actions that perform substantially the same function or achieve substantially the same results as the corresponding aspects described herein may be utilized. Accordingly, the appended claims include within their scope such processes, machines, manufactures, compositions of things, means, methods, or actions.
[0170] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0171] The above description has been provided for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A multi-device ordered collaborative simulation method, characterized in that: include: Based on the dependency relationship between multiple devices to be simulated, a model of each device to be simulated is constructed, and a sequence number is assigned to each model; Instantiate each of the models, generate a model list, and map the sequence number to an index value in the model list; Sort the models in the model list based on the index value to obtain an ordered list; Distinguish the models into explicit step-size models and implicit step-size models; Obtaining a registered step size of the explicit step size model, and obtaining an iteration step size based on the registered step size; The step of obtaining the registered step size of the explicit step size model includes: Sending a '-1' time instruction to all models in sequence according to the index value in the model list; After the model receives the '-1' time instruction, it performs initialization operation and data pointer transfer operation successively; After the initialization operation and the data pointer transfer operation are completed, if the model is an explicit step size model, sending the registration step size to the simulation engine; The obtaining of the iteration step length based on the registration step length includes: Calculate the greatest common divisor of all registered step lengths, where the iteration step length is equal to the greatest common divisor; When there is a new registration step length, the greatest common divisor is recalculated, and the iteration step length is updated based on the new greatest common divisor; The simulation time is increased according to the iterative step size, and at the initial time and after each increase, the simulation calculation is performed on the model in sequence according to the arrangement order in the ordered list.
2. The multi-device ordered collaborative simulation method according to claim 1, characterized in that: Sorting the models in the model list based on the index value to obtain an ordered list includes: Traverse all models in sequence according to the index value in the model list; Verify the input port of the current model being traversed; If the verification is successful, the post-model of the current model is determined, where the post-model refers to a model that receives the output data of the current model; If the index values of all subsequent models are greater than the index value of the current model, the index value of the current model is inserted before the index value of the first subsequent model. After the insertion operation is completed, the next model is traversed; If the verification fails or there is any subsequent model whose index value is less than or equal to the index value of the current model, the next model is traversed until the current model list is traversed and an ordered list is generated.
3. The multi-device ordered collaborative simulation method according to claim 2, characterized in that: The input port verification of the current model being traversed includes: Obtain all input port identifiers of the post-model; Matching the input port identifier with a preset port list; If any input port identifier successfully matches the preset port list, it is determined that the verification of the current model has failed; If all input port identifiers fail to match the preset port list, it is determined that the verification of the current model is passed.
4. The multi-device ordered collaborative simulation method according to claim 1, characterized in that: The step of increasing the simulation time according to the iterative step size, and performing simulation calculations on the model in sequence according to the arrangement order in the ordered list at the initial time and after each increase, includes: Taking the iteration step as the time interval, gradually increasing from the initial time, at the initial time and the moment after each increment, traversing all models in sequence according to the index values in the ordered list; If the current model being traversed is an explicit step-size model, then internal simulation calculation is performed on the current model according to the registered step-size of the current model; If the current model being traversed is an implicit step-size model, determining the predecessor model of the current model, where the predecessor model is a model that transfers data to the current model; Performing internal simulation calculation on the current model according to the maximum step size in the predecessor model; After the current model completes the internal simulation calculation, the state is updated according to the internal simulation calculation result, and the output data is determined based on the previous internal simulation calculation result; The output data is sent to a subsequent model through an output port of the current model, and the subsequent model refers to a model that receives the output data of the current model.
5. The multi-device ordered collaborative simulation method according to claim 4, characterized in that: Also includes: Creating a model base class, wherein the model base class includes an execution interface; Based on the model base class, create a derived class of each model, wherein the derived class rewrites the execution interface; The execution interface of the current model is called to complete the internal simulation calculation.
6. A computer device, characterized in that: The computer device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the multi-device ordered collaborative simulation method according to any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the multi-device ordered collaborative simulation method according to any one of claims 1 to 5.
8. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Simulation step length determination method and device, equipment, storage medium and program product
CN117973093A
Method and device for carrying out clock synchronization on simulation model and computing equipment
CN118821482A