Simulation solving method and device based on adaptive solver step length, and electronic equipment

Through the structure identification of the simulation model and the adaptive step size calculation, the solver step size is automatically adjusted, which solves the problem of low efficiency and error-prone fixed-step length solver, and realizes efficient and accurate simulation calculation.

CN120296948APending Publication Date: 2025-07-11BEITAI ZHENHUAN (CHONGQING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510335718.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In the prior art, when using a fixed-step solver for simulation model calculation, it is necessary to manually set the solver step size, which is inefficient and prone to errors, making it difficult to balance between accuracy and efficiency.

Method used

By identifying the structure of the target simulation model, the solver step size is automatically calculated, and the step size is dynamically adjusted according to the model category and related parameters to realize adaptive solution.

Benefits of technology

It improves the accuracy and efficiency of simulation calculations, reduces the time consumption of users in step size selection, simplifies the operation process, lowers the threshold for use, and allows more non-professional personnel to efficiently simulate the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120296948A_ABST
    Figure CN120296948A_ABST
Patent Text Reader

Abstract

The invention discloses a simulation solving method and device based on self-adaptive solver step length and electronic equipment, and relates to the technical field of simulation model calculation or other related technical fields, the method comprises the following steps: identifying a model structure of a target simulation model, and obtaining step length calculation data based on a structure identification result, the structure recognition result at least comprises a model category; calculating a solver step length corresponding to the target simulation model based on the model category and the step length calculation data; and according to the solver step length, performing simulation calculation solution on the target simulation model to obtain a simulation solution result. According to the method and the device, the technical problems that the step size of the solver needs to be manually set in the simulation model calculation by using the fixed step size solver in the related technology, the efficiency is low, and errors are easily caused are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of model simulation or other related fields. Specifically, it relates to a simulation solving method, device, and electronic device based on an adaptive solver step size. Background Art

[0002] In modern engineering and scientific research, the construction and analysis of simulation models are indispensable links, which are widely used in multiple fields such as automatic control, signal processing, and electronic engineering. To accurately solve these models, the use of a solver becomes crucial. A solver is a software tool that can calculate the behavior of a model within a given time range based on the set model parameters and initial conditions. Among them, the step size parameter is a key setting in the solver, which determines the time interval for the solver to calculate during the simulation process.

[0003] In related technologies, generally a fixed-step solver is used for simulation, and the user needs to manually set the solver step size. If the step size is set too large, the solver may miss key instantaneous changes in the model, resulting in a decrease in the accuracy of the simulation results; conversely, if the step size is set too small, although the simulation accuracy can be improved, it will greatly increase the computational amount and reduce the computational efficiency. Therefore, choosing a suitable step size is extremely challenging and often requires the user to determine it through repeated attempts and adjustments.

[0004] In practical engineering applications, due to the complexity and diversity of models, manually adjusting the step size is a time-consuming and resource-intensive process. Especially when faced with large-scale or highly complex models, the efficiency of this manual adjustment method is low and it is prone to errors.

[0005] In addition, in existing simulation solving schemes, users often need to make a trade-off between computational accuracy and computational efficiency. A fixed and overly large step size can ensure the computational speed but sacrifices the accuracy of the simulation results; while an overly small step size improves the accuracy of the results but also brings waste of computational resources and prolongation of computational time.

[0006] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention

[0007] Embodiments of the present invention provide a simulation solving method, device, and electronic device based on an adaptive solver step size to at least solve the technical problems in related technologies that when using a fixed-step solver for simulation model calculation, it is necessary to manually set the solver step size, with low efficiency and being prone to errors.

[0008] According to one aspect of the embodiments of the present invention, a simulation solving method based on an adaptive solver step size is provided, including: identifying the model structure of a target simulation model, and obtaining step size calculation data based on the structure identification result, where the structure identification result at least includes: model category; calculating a solver step size corresponding to the target simulation model based on the model category and the step size calculation data; and performing simulation calculation and solving on the target simulation model according to the solver step size to obtain a simulation solving result.

[0009] Optionally, the step of identifying the model structure of a target simulation model includes: obtaining the attribute parameters of all calculation units in the model, and determining whether each calculation unit has a discrete attribute based on the attribute parameters; in the case where any one of the calculation units has a discrete attribute, determining that the model category of the target simulation model is a discrete model; and in the case where all calculation units do not have a discrete attribute, determining that the model category of the target simulation model is a non-discrete model to obtain the structure identification result.

[0010] Optionally, the step of obtaining step size calculation data based on the structure identification result includes: in the case where the model category of the target simulation model is a discrete model, obtaining the sampling time parameters of the calculation units, and calculating the greatest common divisor of the integer multiples of all sampling time parameters.

[0011] Optionally, the step of calculating a solver step size corresponding to the target simulation model based on the model category and the step size calculation data includes: in the case where the model category of the target simulation model is a discrete model, determining that the greatest common divisor of the integer multiples of all sampling time parameters is the solver step size corresponding to the target simulation model.

[0012] Optionally, the step of obtaining step size calculation data based on the structure identification result includes: in the case where the model category of the target simulation model is a non-discrete model, obtaining the model simulation duration; calculating an initial solver step size based on the model simulation duration and a preset time solving width; and recording the initial solver step size into the step size calculation data.

[0013] Optionally, the step of calculating a solver step size corresponding to the target simulation model based on the model category and the step size calculation data includes: determining whether there is a signal frequency parameter in the calculation unit; in the case where there is a signal frequency parameter in the calculation unit, obtaining the maximum value among all frequency parameters; calculating a Nyquist sampling period based on the maximum value among all frequency parameters; and selecting the minimum value from the Nyquist sampling period and the initial solver step size, and determining the selected minimum value as the solver step size corresponding to the target simulation model.

[0014] Optionally, after determining whether there is a signal frequency parameter in the calculation unit, it further includes: in the case that there is no signal frequency parameter in the calculation unit, determining the initial solver step size as the solver step size corresponding to the target simulation model.

[0015] According to another aspect of the embodiments of the present invention, there is also provided a simulation solving device based on an adaptive solver step size, including: a model structure recognition unit, configured to recognize the model structure of a target simulation model and obtain step size calculation data based on the structure recognition result, where the structure recognition result at least includes: a model category; a step size calculation unit, configured to calculate the solver step size corresponding to the target simulation model based on the model category and the step size calculation data; and a simulation solving unit, configured to perform simulation calculation and solution on the target simulation model according to the solver step size to obtain a simulation solution result.

[0016] Optionally, the model structure recognition unit includes: an attribute parameter acquisition module, configured to acquire the attribute parameters of all calculation units in the model and determine whether each calculation unit has a discrete attribute based on the attribute parameters; a first determination module, configured to determine that the model category of the target simulation model is a discrete model in the case that any one of the calculation units has a discrete attribute; and a second determination module, configured to determine that the model category of the target simulation model is a non-discrete model in the case that all calculation units do not have a discrete attribute, so as to obtain a structure recognition result.

[0017] Optionally, the model structure recognition unit further includes: a step size calculation data acquisition module, configured to, in the case that the model category of the target simulation model is a discrete model, acquire the sampling time parameters of the calculation unit and calculate the greatest common divisor of the integer multiples of all sampling time parameters.

[0018] Optionally, the step size calculation unit includes: a first step size determination module, configured to, in the case that the model category of the target simulation model is a discrete model, determine the greatest common divisor of the integer multiples of all sampling time parameters as the solver step size corresponding to the target simulation model.

[0019] Optionally, the model structure recognition unit further includes: a simulation duration acquisition module, configured to, in the case that the model category of the target simulation model is a non-discrete model, acquire the model simulation duration; an initial step size calculation module, configured to calculate an initial solver step size based on the model simulation duration and a preset time solution width; and a step size recording module, configured to record the initial solver step size into the step size calculation data.

[0020] Optionally, the step size calculation unit includes: a signal frequency parameter judgment module, configured to judge whether there is a signal frequency parameter in the calculation unit; a maximum value acquisition module, configured to acquire the maximum value among all frequency parameters when there is a signal frequency parameter in the calculation unit; a sampling period calculation module, configured to calculate the Nyquist sampling period based on the maximum value among all frequency parameters; a second step size determination module, configured to select the minimum value from the Nyquist sampling period and the initial solver step size, and determine the selected minimum value as the solver step size corresponding to the target simulation model.

[0021] Optionally, the simulation solving device based on the adaptive solver step size further includes: a third step size determination module, configured to, after judging whether there is a signal frequency parameter in the calculation unit, when there is no signal frequency parameter in the calculation unit, determine the initial solver step size as the solver step size corresponding to the target simulation model.

[0022] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the simulation solving method based on the adaptive solver step size as described in any one of the above.

[0023] According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors and a memory, where the memory is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the simulation solving method based on the adaptive solver step size as described in any one of the above.

[0024] According to another aspect of the embodiments of the present invention, there is also provided a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the steps of the simulation solving method based on the adaptive solver step size as described in any one of the above.

[0025] In the present disclosure, the model structure of the target simulation model is identified, and step size calculation data is obtained based on the structure identification result, where the structure identification result at least includes: a model category, and based on the model category and the step size calculation data, the solver step size corresponding to the target simulation model is calculated, and according to the solver step size, the target simulation model is subjected to simulation calculation and solution to obtain a simulation solution result.

[0026] According to the above disclosure, the solver step size can be automatically calculated based on the specific structure and parameters of the model to achieve adaptive step size calculation without manual operation, so as to ensure the accuracy of the simulation results and improve the calculation efficiency, reduce the user's step size selection time, and improve the R & D efficiency, thereby solving the technical problems in the related art that in the simulation model calculation using a fixed-step solver, it is necessary to manually set the solver step size, with low efficiency and prone to errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0028] Figure 1 is a flowchart of an optional simulation solution method based on an adaptive solver step size according to an embodiment of the present invention;

[0029] Figure 2 is a flowchart of another optional solver adaptive step size calculation based on the model structure according to an embodiment of the present invention;

[0030] Figure 3 is a schematic diagram of a model of an optional step size calculation example 1 according to an embodiment of the present invention;

[0031] Figure 4 is a schematic diagram of a model of an optional step size calculation example 2 according to an embodiment of the present invention;

[0032] Figure 5 is a schematic diagram of an optional simulation solution device based on an adaptive solver step size according to an embodiment of the present invention;

[0033] Figure 6 is a hardware structure block diagram of an electronic device (or mobile device) for a simulation solution method based on an adaptive solver step size according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0034] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0035] It should be noted that the terms "first", "second", etc. in the specification, claims and above-mentioned drawings of the present invention are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0036] It should be noted that the simulation solution method and its device based on the adaptive solver step size in the present disclosure can be used in the technical field of simulation model calculation. In the case of realizing the adaptive step size calculation of the solver and the simulation model solution based on the simulation model structure, it can also be used in any field other than the technical field of simulation model calculation. In the case of realizing the adaptive step size calculation of the solver and the simulation model solution based on the simulation model structure, the application field of the simulation solution method and its device based on the adaptive solver step size in the present disclosure is not limited.

[0037] It should be noted that the information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected in the present disclosure are information and data authorized by the user or fully authorized by all parties. And the processing of relevant data such as collection, storage, use, processing, transmission, provision, disclosure and application complies with the relevant laws, regulations and standards of the relevant regions, takes necessary confidentiality measures, does not violate public order and good customs, and provides corresponding operation entrances for users to choose to authorize or refuse. For example, an interface is set between the present system and relevant users or institutions. Before obtaining relevant information, a request for obtaining needs to be sent to the aforementioned users or institutions through the interface, and after receiving the consent information feedback from the aforementioned users or institutions, the relevant information is obtained.

[0038] It should be noted that in the present disclosure, when collecting customer information, analyzing customer information, an operation entrance is provided for users to choose to agree or refuse the automated decision-making result; if the user chooses to refuse, the expert decision-making process will be entered.

[0039] The following embodiments of the present invention can be applied to various systems / applications / devices for simulation solution based on the adaptive solver step size. The present invention provides a solver adaptive step size solution method based on the model structure, which is applicable to simulation scenarios that require high precision and computational efficiency, such as model simulations in the fields of automation control, signal processing, circuit simulation, bioinformatics, etc.

[0040] It should be noted that the adaptive step-size solving method provided by the present invention can significantly improve the efficiency and accuracy of simulation calculations. By automatically identifying the model structure and parameters, the present invention can intelligently calculate the most appropriate solver step size, avoiding repeated attempts and resource waste caused by users manually adjusting the step size. Compared with traditional fixed-step solvers, this method can significantly reduce the number of ineffective calculations while ensuring simulation accuracy, thereby improving the calculation efficiency. Compared with traditional fixed-step solvers that require users to have certain professional knowledge and experience to manually set the step-size parameters of the solver, the present invention automatically calculates the step size through intelligent algorithms, greatly simplifying the user operation process, reducing the usage threshold, and enabling more non-professional personnel to efficiently perform model simulations.

[0041] The adaptive step-size algorithm provided by the present invention can promote the speed of simulation iteration and accelerate the design optimization process by reducing the time consumption of users in step-size selection, thereby improving the overall R & D efficiency.

[0042] The present invention will be described in detail below in conjunction with each embodiment.

[0043] Embodiment 1

[0044] According to an embodiment of the present invention, an embodiment of a simulation solving method based on an adaptive solver step size is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0045] Figure 1 is a flowchart of an optional simulation solving method based on an adaptive solver step size according to an embodiment of the present invention. As Figure 1 shown, the method includes the following steps:

[0046] Step S101, identify the model structure of the target simulation model, and obtain step-size calculation data based on the structure identification result, where the structure identification result at least includes: model category.

[0047] Optionally, the step of identifying the model structure of the target simulation model includes: obtaining the attribute parameters of all calculation units in the model, and determining whether each calculation unit has a discrete attribute based on the attribute parameters; in the case where any calculation unit has a discrete attribute, determining that the model category of the target simulation model is a discrete model; in the case where all calculation units do not have a discrete attribute, determining that the model category of the target simulation model is a non-discrete model to obtain the structure identification result.

[0048] First, the algorithm deeply analyzes the architecture of the target simulation model to determine the type of the model, i.e., the model category. This identification process is mainly based on the attribute parameters of the computing units within the model, especially whether they have discrete attributes. Discrete attributes usually refer to those computing characteristics that are discontinuous in time and are updated or triggered at specific time intervals. Then the algorithm traverses all the computing units within the model and collects their attribute parameters. These parameters may include but are not limited to sampling time, signal frequency, update period, etc., which are crucial for determining the model category and subsequent step size calculation. Based on the collected attribute parameters, if any computing unit is found to have discrete attributes, i.e., its behavior is updated in a discontinuous manner over time, then the model is classified as a discrete model. Conversely, if the behavior of all computing units is continuous and no discrete attributes are found, the model is classified as a non-discrete model. The accurate identification of the model category is the basis for the selection of subsequent step size calculation strategies.

[0049] It should be noted that in the field of simulation, the processing methods of discrete models and non-discrete models are essentially different. Discrete models usually involve event-driven or state machine logic, and their computing states are updated at specific sampling time points, while non-discrete models pay more attention to continuously changing physical processes or mathematical functions. Therefore, for discrete models, the selection of the step size should be closely related to the sampling time to ensure that no critical time points are missed; for non-discrete models, the selection of the step size takes more into account the balance between computing accuracy and computing efficiency.

[0050] The algorithm of the present invention is applicable not only to discrete models but also to non-discrete models. It can automatically identify the type of the model and adopt corresponding step size calculation strategies according to different types of models, which makes the algorithm have high robustness and versatility and can be widely applied to various simulation scenarios.

[0051] Optionally, the step of obtaining step size calculation data based on the structure recognition result includes: when the model category of the target simulation model is a discrete model, obtaining the sampling time parameters of the computing units and calculating the greatest common divisor of the integer multiples of all sampling time parameters.

[0052] After determining that the model is a discrete model, all the computing units in the model will be further traversed to extract their sampling time parameters. The sampling time parameter refers to the time interval at which the computing unit performs the update operation, which is one of the most basic attributes of a discrete model.

[0053] After obtaining the sampling time parameters of the computing units, the greatest common divisor (GCD) of the integer multiples of these sampling time parameters will be calculated next to find the smallest time interval that can be evenly divided by the sampling times of all computing units as the solver step size. The calculation of the greatest common divisor of integer multiples ensures that the solver can accurately match the sampling time points of all computing units in the model at each time step, thus avoiding data omission or duplication.

[0054] Step S102: Calculate the solver step size corresponding to the target simulation model based on the model category and the step size calculation data.

[0055] In a simulation model, each component constituting the model is a computing unit. The simulation calculation of the model needs to execute each computing unit in sequence according to the time sequence and signal flow direction under the solver framework to obtain the final calculation result.

[0056] Optionally, the step of calculating the solver step size corresponding to the target simulation model based on the model category and the step size calculation data includes: when the model category of the target simulation model is a discrete model, determining the greatest common divisor of the integer multiples of all sampling time parameters as the solver step size corresponding to the target simulation model.

[0057] In a discrete model, the sampling times of computing units may not be the same, but they are usually multiples of some basic time units. By calculating the greatest common divisor of the integer multiples of these sampling times, a time step size can be found such that the solver can not only perform calculations at the sampling time points of each computing unit but also be the smallest time step size that can cover all sampling time points. This not only improves the accuracy of the simulation calculation but also ensures the calculation efficiency.

[0058] For non-discrete models, the present invention proposes a flexible and efficient method to obtain the key data related to calculating the solver step size and finally determine a step size value that not only ensures the calculation accuracy but also takes into account the calculation efficiency.

[0059] Optionally, the step of obtaining the step size calculation data based on the structure recognition result includes: when the model category of the target simulation model is a non-discrete model, obtaining the model simulation duration; calculating the initial solver step size based on the model simulation duration and the preset time solution width; and recording the initial solver step size into the step size calculation data.

[0060] After determining that the target simulation model is a non-discrete model, the primary task is to obtain the simulation duration of the entire model. The simulation duration is an important parameter in the model simulation process. It defines the time range for the model to simulate from the initial state to the final state, ensuring that the simulation can be completed within the preset time range. After obtaining the model simulation duration, the algorithm will use this information and the preset time solution width (such as 1 / 100 of the total simulation duration) to calculate a preliminary solver step size. The selection of the preset time solution width is to ensure that the model can be fully resolved during the simulation, avoiding the omission of key dynamic processes due to too large a step size, and at the same time not overly refining the step size, resulting in unnecessary computational burden. The calculation of the initial solver step size is achieved by dividing the model simulation duration by the preset time solution width, which lays the foundation for subsequent more accurate step size adjustment.

[0061] Optionally, the step of calculating the solver step size corresponding to the target simulation model based on the model category and step size calculation data includes: determining whether there is a signal frequency parameter in the calculation unit; in the case where there is a signal frequency parameter in the calculation unit, obtaining the maximum value among all frequency parameters; calculating the Nyquist sampling period based on the maximum value among all frequency parameters; selecting the minimum value from the Nyquist sampling period and the initial solver step size, and determining the selected minimum value as the solver step size corresponding to the target simulation model.

[0062] In a non-discrete model, in addition to time continuity, the signal frequency parameter is also an important factor affecting the setting of the solver step size. The presence of the signal frequency parameter means that there may be periodically changing signals in the model, which for the solver means that there need to be sufficient sampling points within the period of signal change to accurately capture its dynamics. Therefore, in this embodiment, it will be checked whether the calculation unit in the model contains a signal frequency parameter. If it exists, the next step of frequency-related calculation will be performed.

[0063] If the calculation unit in the model contains a signal frequency parameter, further obtain the maximum frequency value among them. The determination of the maximum frequency value is to meet the basic requirements of the Nyquist sampling theorem, that is, the sampling frequency should be at least twice the highest frequency of the signal to avoid the phenomenon of signal aliasing and ensure the accurate restoration of the signal. In the scenario of a non-discrete model, this requirement is particularly important because signal aliasing may lead to misjudgment of the model behavior.

[0064] According to the obtained maximum signal frequency, the algorithm will calculate the minimum sampling period that meets the Nyquist sampling theorem, that is, the Nyquist sampling period (the reciprocal of the Nyquist sampling frequency). The calculation of the Nyquist sampling period provides another reference value for the solver step size setting, ensuring that even in the case where the model contains high-frequency signals, the solver can accurately capture the dynamic changes of the signal.

[0065] In the scenario of non-discrete models, the algorithm compares the Nyquist sampling period and the initial solver step size calculated based on the simulation duration, and selects the minimum value as the final solver step size. This step ensures that the solver step size can meet the basic requirements of signal sampling while taking into account the overall simulation efficiency. If there is no signal frequency parameter in the model, that is, there is no Nyquist sampling period, then the algorithm will directly use the initial solver step size as the final step size, which provides a flexible and intelligent step size setting scheme for different types of non-discrete models.

[0066] Optionally, after determining whether there is a signal frequency parameter in the calculation unit, it further includes: in the case where there is no signal frequency parameter in the calculation unit, determining the initial solver step size as the solver step size corresponding to the target simulation model.

[0067] In the process of structure identification and analysis of non-discrete models, the algorithm checks all calculation units in the model to determine whether there is a signal frequency parameter. The signal frequency parameter is a quantitative description of the periodic change frequency of signals in the model. For models containing periodic signals, it is crucial for the setting of the solver step size because it affects the sampling density of signals in the model. However, not all non-discrete models contain periodic signals. Therefore, the signal frequency parameter may not exist in some models.

[0068] For non-discrete models without signal frequency parameters, the algorithm will calculate the initial solver step size using the model simulation duration and a preset time solution width. The preset time solution width is usually set as a certain proportion of the simulation duration, such as 1 / 100, which helps to ensure that the model can be fully analyzed during the simulation process, avoid missing key dynamic processes due to too large a step size, and at the same time will not overly refine the step size, resulting in waste of computing resources.

[0069] If it is detected that the calculation unit in the model does not contain any signal frequency parameters, then the calculation related to the Nyquist sampling period will no longer be performed. At this time, the initial solver step size calculated based on the model simulation duration and the preset time solution width is regarded as the optimal step size and is directly used in the simulation calculation of the model. The adoption of this strategy avoids unnecessary calculation steps and simplifies the process of setting the solver step size. Especially in the scenario where the model does not contain periodic signals, it greatly improves the simulation efficiency.

[0070] The adaptive step size algorithm of the present invention can dynamically adjust the solver step size according to the characteristics of the model (such as whether it is a discrete model, signal frequency, etc.), ensuring sufficient computational density at critical moments of the model, thereby avoiding calculation errors caused by improper step size setting and improving the accuracy of the simulation results.

[0071] Step S103: Perform simulation calculation and solution on the target simulation model according to the solver step size to obtain the simulation solution result.

[0072] Through the above steps, the model structure of the target simulation model can be identified, and the step size calculation data can be obtained based on the structure identification result. Among them, the structure identification result at least includes: the model category. Based on the model category and the step size calculation data, calculate the solver step size corresponding to the target simulation model. According to the solver step size, perform simulation calculation and solution on the target simulation model to obtain the simulation solution result. In this embodiment, the solver step size can be automatically calculated according to the specific structure and parameters of the model to achieve adaptive step size calculation without manual operation, so as to achieve the goal of ensuring the accuracy of the simulation result and improving the calculation efficiency, reducing the user's step size selection time, improving the R & D efficiency, and thus solving the technical problems in the related art that in the simulation model calculation using a fixed-step solver, it is necessary to manually set the solver step size, with low efficiency and easy to make mistakes.

[0073] The following is a detailed description in combination with another optional specific implementation manner.

[0074] In the embodiment of the present invention, aiming at the problem that the fixed-step solver requires the user to configure the step size by himself, an adaptive step size algorithm based on the model structure is proposed. The whole algorithm is divided into three layers. The first layer is model structure identification; the second layer is the adaptive step size solution algorithm; the third layer is simulation calculation and solution. The first layer is responsible for identifying the overall simulation model structure to obtain the necessary information for adaptive step size calculation; the second layer calculates the solver step size suitable for this model calculation based on the information obtained from the analysis of the first layer; the third layer performs simulation calculation and solution of the model according to the step size calculated in the second layer.

[0075] Figure 2 is a flowchart of another optional solver adaptive step size calculation based on the model structure according to the embodiment of the present invention, as Figure 2 shown, including:

[0076] The first layer: Model analysis to obtain the information required for calculating the step size.

[0077] Step 1: Determine the model type. Obtain the attribute parameters of all calculation units in the model. If there are calculation units with discrete attributes, it is determined as a discrete model; otherwise, it is determined as a non-discrete model. If it is a discrete model, execute Step 2-1; if it is a non-discrete model, execute Step 2-2.

[0078] Step 2-1: Obtain the sampling time parameters of the calculation units and calculate the greatest common divisor sampleTime_gcd of the integer multiples of all sampling times.

[0079] Step 2-2: Obtain the model simulation duration Time, and calculate h = Time / 100; determine whether there is a signal frequency parameter (unit: Hz) in the model calculation unit, obtain the maximum value maxFrequency (Hz) among all frequency parameters, and calculate the Nyquist sampling period T = 1 / (4 * maxFrequency).

[0080] The second layer: Step size calculation.

[0081] 1. If it is a discrete model, then the solver step size is equal to sampleTime_gcd in the first layer;

[0082] 2. If it is a non-discrete model, then the solver step size is equal to the smaller value of T and h in the first layer; if there is no signal frequency parameter in this model, that is, there is no T, then the solver step size is equal to h.

[0083] The third layer: Simulation calculation and solution. Calculate all calculation units of the model according to the step size obtained in the second layer.

[0084] Figure 3 It is a schematic diagram of a model of an optional step size calculation example 1 according to an embodiment of the present invention, as Figure 3 shown, the model of this example 1 includes: Component 1, Component 2, and Component 3.

[0085] During the implementation, the simulation duration is 12s, the parameters of Component 1 are frequency 10Hz and sampling time 0.15s, the parameters of Component 2 include a sampling time parameter of 0.2s, and the parameters of Component 3 do not include frequency and sampling time. As Figure 3 shown, execute Step 1. Through model analysis, it is determined that the model is a discrete model. Execute the above Step 2-1, and obtain that all sampling times are [0.1, 0.2]. Calculate the greatest common divisor of its integer multiples as 0.1. Therefore, the solver step size is 0.1, and the solver performs calculations every 0.1s.

[0086] Figure 4 It is a schematic diagram of a model of an optional step size calculation example 2 according to an embodiment of the present invention, as shown in the appendix Figure 4 shown, the model of this example 2 includes: Component 1, Component 2, Component 3, and Component 4.

[0087] During the implementation, the simulation duration is 12s, the parameters of Component 1 are frequency 10Hz and do not include a sampling time parameter, the parameters of Component 2 and Component 3 do not include frequency and sampling time, and the parameters of Component 4 are frequency 20Hz and do not include a sampling time parameter.

[0088] Execute Step 1. Through model analysis, it is determined that the model is a non-discrete model.

[0089] Execute step 2-2. Obtain the simulation time Time = 12s, calculate Time / 100 to get h as 0.12s; determine that there is a frequency parameter, obtain the maximum frequency as 20Hz, and calculate 1 / (4*20) to get T as 0.0125s.

[0090] Compare the magnitudes of h and T. T is less than h, so the solver step size is 0.0125, and the solver performs calculations every 0.0125s.

[0091] The example simulation results show that the algorithm with adaptive step size has the characteristics of high calculation accuracy and fast speed. This method solves the problem that the fixed-step solver requires the user to configure the step size by themselves, reduces the user's step size selection time, and improves the corresponding R & D efficiency.

[0092] The following will be described in detail in combination with another embodiment.

[0093] Embodiment 2

[0094] A simulation solving device based on an adaptive solver step size provided in this embodiment includes multiple implementation units, and each implementation unit corresponds to each implementation step in Embodiment 1 above.

[0095] Figure 5 It is a schematic diagram of an optional simulation solving device based on an adaptive solver step size according to an embodiment of the present invention. As Figure 5 shown, the simulation solving device based on an adaptive solver step size may include: a model structure recognition unit 51, a step size calculation unit 52, and a simulation solving unit 53.

[0096] Among them, the model structure recognition unit 51 is used to recognize the model structure of the target simulation model and obtain step size calculation data based on the structure recognition result, where the structure recognition result at least includes: the model category.

[0097] The step size calculation unit 52 is used to calculate the solver step size corresponding to the target simulation model based on the model category and the step size calculation data.

[0098] The simulation solving unit 53 is used to perform simulation calculation and solution on the target simulation model according to the solver step size to obtain the simulation solving result.

[0099] The above simulation solving device based on the adaptive solver step size can identify the model structure of the target simulation model through the model structure identification unit 51, and obtain step size calculation data based on the structure identification result. Among them, the structure identification result at least includes: the model category. Then, the step size calculation unit 52 calculates the solver step size corresponding to the target simulation model based on the model category and the step size calculation data. Finally, the simulation solving unit 54 performs simulation calculation and solving on the target simulation model according to the solver step size to obtain the simulation solving result. In this embodiment, the solver step size can be automatically calculated according to the specific structure and parameters of the model, realizing adaptive step size calculation without manual operation, so as to achieve the goal of ensuring the accuracy of the simulation result and improving the calculation efficiency, reducing the user's step size selection time, improving the R & D efficiency, and thus solving the technical problems in the related art that in the simulation model calculation using a fixed-step solver, it is necessary to manually set the solver step size, with low efficiency and easy to make mistakes.

[0100] Optionally, the model structure identification unit includes: an attribute parameter acquisition module, configured to acquire the attribute parameters of all calculation units in the model, and determine whether each calculation unit has a discrete attribute based on the attribute parameters; a first determination module, configured to determine that the model category of the target simulation model is a discrete model when any one of the calculation units has a discrete attribute; and a second determination module, configured to determine that the model category of the target simulation model is a non-discrete model when none of the calculation units has a discrete attribute, to obtain the structure identification result.

[0101] Optionally, the model structure identification unit further includes: a step size calculation data acquisition module, configured to, when the model category of the target simulation model is a discrete model, acquire the sampling time parameters of the calculation units and calculate the greatest common divisor of the integer multiples of all sampling time parameters.

[0102] Optionally, the step size calculation unit includes: a first step size determination module, configured to, when the model category of the target simulation model is a discrete model, determine that the greatest common divisor of the integer multiples of all sampling time parameters is the solver step size corresponding to the target simulation model.

[0103] Optionally, the model structure identification unit further includes: a simulation duration acquisition module, configured to, when the model category of the target simulation model is a non-discrete model, acquire the model simulation duration; an initial step size calculation module, configured to calculate the initial solver step size based on the model simulation duration and a preset time solving width; and a step size recording module, configured to record the initial solver step size into the step size calculation data.

[0104] Optionally, the step size calculation unit includes: a signal frequency parameter judgment module, configured to judge whether there is a signal frequency parameter in the calculation unit; a maximum value acquisition module, configured to acquire the maximum value of all frequency parameters when there is a signal frequency parameter in the calculation unit; a sampling period calculation module, configured to calculate the Nyquist sampling period based on the maximum value of all frequency parameters; a second step size determination module, configured to select the minimum value from the Nyquist sampling period and the initial solver step size, and determine the selected minimum value as the solver step size corresponding to the target simulation model.

[0105] Optionally, the simulation solving device based on the adaptive solver step size further includes: a third step size determination module, configured to, after judging whether there is a signal frequency parameter in the calculation unit, when there is no signal frequency parameter in the calculation unit, determine the initial solver step size as the solver step size corresponding to the target simulation model.

[0106] The above-mentioned simulation solving device based on the adaptive solver step size may further include a processor and a memory. The above-mentioned model structure recognition unit 51, step size calculation unit 52, simulation solving unit 53, etc. are all stored in the memory as program units, and the corresponding functions are implemented by the processor executing the above program units stored in the memory.

[0107] The above-mentioned processor includes a kernel, and the kernel retrieves the corresponding program unit from the memory. One or more kernels can be set, and by adjusting the kernel parameters, the solver adaptive step size calculation based on the model structure and the simulation result calculation are realized.

[0108] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash RAM (flash RAM), and the memory includes at least one storage chip.

[0109] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, which includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the simulation solving method based on the adaptive solver step size according to any one of the above-mentioned first embodiments.

[0110] According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors and a memory, where the memory is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the simulation solving method based on the adaptive solver step size according to any one of the above-mentioned first embodiments.

[0111] The present application also provides a computer program product, including a computer program which, when executed by a processor, implements the steps of the simulation solution method based on an adaptive solver step size in each embodiment of the present application.

[0112] The present application also provides a computer program product, including a non-volatile computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the simulation solution method based on an adaptive solver step size in each embodiment of the present application.

[0113] Figure 6 is a hardware structural block diagram of an electronic device (or mobile device) for a simulation solution method based on an adaptive solver step size according to an embodiment of the present invention. As Figure 6 shown, the electronic device may include one or more ( Figure 6 602a, 602b,..., 602n are used in the figure to illustrate) processors (the processor may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 604 for storing data. In addition, it may further include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply, and / or a camera. Those of ordinary skill in the art can understand that Figure 6 the structure shown is only schematic and does not limit the structure of the above-mentioned electronic device. For example, the electronic device may further include more or fewer components than Figure 6 shown in the figure, or have a different configuration from Figure 6 shown in the figure.

[0114] The serial numbers of the above-mentioned embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.

[0115] In the above embodiments of the present invention, the descriptions of the respective embodiments have their own emphases. For parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0116] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units may be a logical function division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other may be through some interfaces, and the indirect coupling or communication connection of the units or modules may be in an electrical or other form.

[0117] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed over multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0118] In addition, each functional unit in various embodiments of the present invention may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0119] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: USB flash drives, read-only memory (ROM), random access memory (RAM), mobile hard disks, magnetic disks, or optical discs and other various media that can store program codes.

[0120] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.

Claims

1. A simulation solution method based on an adaptive solver step size, characterized in that, including: identifying the model structure of the target simulation model, and obtaining step size calculation data based on the structure identification result, where the structure identification result at least includes: model category; calculating a solver step size corresponding to the target simulation model based on the model category and the step size calculation data; performing simulation calculation and solution on the target simulation model according to the solver step size to obtain a simulation solution result.

2. The simulation solution method according to claim 1, wherein The step of identifying the model structure of the target simulation model includes: obtaining the attribute parameters of all calculation units in the model, and determining whether each calculation unit has a discrete attribute based on the attribute parameters; when any of the calculation units has a discrete attribute, determining that the model category of the target simulation model is a discrete model; when none of the calculation units has a discrete attribute, determining that the model category of the target simulation model is a non-discrete model to obtain a structure identification result.

3. The simulation solution method according to claim 2, wherein, The step of obtaining step size calculation data based on the structure identification result includes: when the model category of the target simulation model is a discrete model, obtaining the sampling time parameters of the calculation unit and calculating the greatest common divisor of the integer multiples of all sampling time parameters.

4. The simulation solution method according to claim 3, wherein The step of calculating a solver step size corresponding to the target simulation model based on the model category and the step size calculation data includes: when the model category of the target simulation model is a discrete model, determining that the greatest common divisor of the integer multiples of all sampling time parameters is the solver step size corresponding to the target simulation model.

5. The simulation solution method according to claim 2, wherein The step of obtaining step size calculation data based on the structure identification result includes: when the model category of the target simulation model is a non-discrete model, obtaining the model simulation duration; calculating an initial solver step size based on the model simulation duration and a preset time solution width; recording the initial solver step size into the step size calculation data.

6. The simulation solution method according to claim 5, wherein, The step of calculating a solver step size corresponding to the target simulation model based on the model category and the step size calculation data includes: judging whether there is a signal frequency parameter in the calculation unit; when there is a signal frequency parameter in the calculation unit, obtaining the maximum value among all frequency parameters; calculating a Nyquist sampling period based on the maximum value among all frequency parameters; selecting the minimum value from the Nyquist sampling period and the initial solver step size, and determining the selected minimum value as the solver step size corresponding to the target simulation model.

7. The simulation solution method according to claim 6, wherein After judging whether there is a signal frequency parameter in the calculation unit, it further includes: when there is no signal frequency parameter in the calculation unit, determining the initial solver step size as the solver step size corresponding to the target simulation model.

8. A simulation solution device based on an adaptive solver step size, characterized in that, including: a model structure identification unit for identifying the model structure of the target simulation model and obtaining step size calculation data based on the structure identification result, where the structure identification result at least includes: model category; a step size calculation unit for calculating a solver step size corresponding to the target simulation model based on the model category and the step size calculation data; The simulation solving unit is configured to perform simulation calculation and solution on the target simulation model according to the solver step size to obtain a simulation solution result.

9. An electronic device, characterized in that, It includes one or more processors and a memory. The memory is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the simulation solving method based on an adaptive solver step size according to any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the simulation solving method based on an adaptive solver step size according to any one of claims 1 to 7.