Simulation Method, Device, Electronic Device and Readable Storage Medium

By determining the reference step size and error estimation, adjusting the target system step size and correcting the output parameters, the simulation accuracy problem caused by the mismatch between the FMU step size and the platform step size is solved, and the simulation efficiency and accuracy are improved.

CN119938231BActive Publication Date: 2025-07-25ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510425002.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-07-25
Estimated Expiration
2045-04-07

AI Technical Summary

Technical Problem

In joint simulation, the step size supported by the functional simulation unit (FMU) does not match the system step size of the simulation platform, resulting in impairment of simulation accuracy.

Method used

By determining at least two reference step sizes, the error estimation is calculated. If the error meets the setting requirements, the target system step size is adjusted according to the error estimation and the step size range supported by the FMU, and the output parameters are corrected to achieve step size matching.

Benefits of technology

It solves the problem of impaired simulation accuracy and improves simulation efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938231B_ABST
    Figure CN119938231B_ABST
Patent Text Reader

Abstract

The present application provides a simulation method, apparatus, electronic device, and readable storage medium. In the present application, at least two reference step sizes are determined based on the step size range supported by the loaded FMU and the current system step size of the simulation platform. Each reference step size and the input parameters corresponding to the reference step size are input into the FMU to obtain the corresponding output parameters output by the FMU based on the reference step size. An error estimate is determined based on the output parameters corresponding to each reference step size. If the error estimate does not meet the set error requirement, the step of determining at least two reference step sizes is returned. If the error estimate meets the set error requirement, a target system step size is determined based on the error estimate and the step size range supported by the FMU. This method of adjusting the system step size can match the platform with the step size range supported by the FMU, and solve the problem of impaired simulation accuracy caused by the mismatch between the step size supported by the FMU and the system step size of the present platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a simulation method, apparatus, electronic device, and readable storage medium. Background Art

[0002] A Functional Mock-up Unit (FMU) generated based on the Functional Mock-up Interface (FMI) standard has cross-platform compatibility and is widely used in co-simulation.

[0003] However, in practical applications, when a simulation platform needs to use an FMU output by another simulation platform for co-simulation, there may be a mismatch between the step size supported by the FMU and the system step size of this platform, which may lead to a decrease in simulation accuracy. Summary of the Invention

[0004] In view of this, embodiments of this application provide a simulation method, apparatus, electronic device, and readable storage medium to solve the problem of impaired simulation accuracy caused by the mismatch between the step size supported by the FMU and the system step size of this platform.

[0005] Embodiments of this application provide a simulation method. The method is applied to a simulation platform and includes:

[0006] Determine at least two reference step sizes based on the step size range supported by a locally loaded Functional Mock-up Unit (FMU) and the current system step size of the simulation platform; the FMU is obtained by simulating a circuit diagram; the platform where the FMU is simulated is different from the simulation platform;

[0007] For each reference step size, input the reference step size and the input parameters corresponding to the reference step size into the FMU to obtain the corresponding output parameters output by the FMU based on the reference step size; the input parameters corresponding to different reference step sizes are the same;

[0008] Determine an error estimate that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters based on the output parameters corresponding to each reference step size;

[0009] If the error estimate does not meet the set error requirement, return to the step of determining at least two reference step sizes. If the error estimate meets the set error requirement, determine a target system step size based on the error estimate and the step size range supported by the FMU;

[0010] Perform simulation on the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU.

[0011] As an embodiment, determining the target system step size according to the error estimate and the step size range supported by the FMU includes:

[0012] Determining the reference system step size according to the error estimate, a safety factor used to limit the range of step size variation for defining the current system step size, an error threshold used to limit the acceptable range of the estimated error, and the order of the integral operation used to process the output parameters of the FMU during the simulation of this simulation platform;

[0013] Determining the target system step size according to the reference system step size and the specified step size in the step size range supported by the FMU.

[0014] As an embodiment, the reference system step size is obtained through the following formula:

[0015]

[0016] where, Δt sys is the reference system step size;

[0017] α is the safety factor;

[0018] is the error threshold;

[0019] e est is the error estimate;

[0020] p is the order of the integral operation.

[0021] As an embodiment, the target system step size is obtained through the following formula:

[0022]

[0023] where, Δt sys is the reference system step size;

[0024] Δt fmu is the specified step size in the step size range supported by the FMU;

[0025] Δt compatible is the target system step size.

[0026] As an embodiment, determining the error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameters according to the output parameters corresponding to each reference step size includes:

[0027] Obtaining the standard deviation of the output parameters corresponding to each reference step size and determining the standard deviation as the error estimate.

[0028] As an embodiment, when simulating the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU, the method further includes:

[0029] For the output parameters of the FMU at each time point under the target system step size, based on the target system step size, the corrected output parameter of the previous time point of this time point, and the derivative values of the output parameters of the previous M time points of this output parameter, correct this output parameter to obtain the corrected output parameter;

[0030] Perform simulation based on the obtained corrected output parameters.

[0031] As an embodiment, the corrected output parameter corresponding to any output parameter is determined by the following formula:

[0032] y n+1 =y n +1 / 6 Δt(k1 + 2k2 + 2k3 + k4)

[0033] where, y n+1 is the corrected output parameter at the n + 1 time point; n is greater than or equal to 4;

[0034] y n is the corrected output parameter at the n time point;

[0035] Δt is the target system step size;

[0036] k1 is the derivative value of the output parameter of the FMU at the n - 4 time point;

[0037] k2 is the derivative value of the output parameter of the FMU at the n - 3 time point;

[0038] k3 is the derivative value of the output parameter of the FMU at the n - 2 time point;

[0039] k3 is the derivative value of the output parameter of the FMU at the n - 1 time point.

[0040] The embodiment of the present application further provides a simulation device, which is applied to a simulation platform, and the device includes:

[0041] A determination module, configured to determine at least two reference step sizes according to the step size range supported by the locally loaded functional mock-up unit (FMU) and the current system step size of the simulation platform; the FMU is obtained by simulating a circuit diagram; the platform for simulating the FMU is different from the simulation platform;

[0042] An obtaining module, configured to input, for each reference step size, the reference step size and the input parameter corresponding to the reference step size into the FMU to obtain the corresponding output parameter output by the FMU based on the reference step size; the input parameters corresponding to different reference step sizes are the same;

[0043] An error estimation module, configured to determine, according to output parameters corresponding to each reference step size, an error estimation that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters.

[0044] An adjustment module, configured to, if the error estimation does not meet the set error requirement, return to the step of determining at least two reference step sizes; and if the error estimation meets the set error requirement, determine a target system step size according to the error estimation and the step size range supported by the FMU.

[0045] A simulation module, configured to simulate a circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU.

[0046] As an embodiment, determining the target system step size according to the error estimation and the step size range supported by the FMU includes:

[0047] Determining a reference system step size according to the error estimation, a safety factor for limiting the range of step size variation of the current system step size, an error threshold for limiting the acceptable range of the estimated error, and the order of the integral operation for processing the output parameters of the FMU when this simulation platform performs simulation.

[0048] Determining the target system step size according to the reference system step size and a specified step size in the step size range supported by the FMU.

[0049] As an embodiment,

[0050] The reference system step size is obtained through the following formula:

[0051]

[0052] where, Δt sys is the reference system step size;

[0053] α is the safety factor;

[0054] is the error threshold;

[0055] e est is the error estimation;

[0056] p is the order of the integral operation.

[0057] As an embodiment, the target system step size is obtained through the following formula:

[0058]

[0059] where, Δt sys is the reference system step size;

[0060] Δt fmuThe specified step size within the step size range supported by the FMU;

[0061] Δt compatible Is the target system step size.

[0062] As an example, based on the output parameters corresponding to each reference step size, determining the error estimate that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters includes:

[0063] Obtain the standard deviation of the output parameters corresponding to each reference step size, and determine the standard deviation as the error estimate.

[0064] As an example, when simulating the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU, the simulation module is further used for:

[0065] For the output parameter of the FMU at each time point, according to the target system step size, the corrected output parameter of the previous time point of this time point, and the derivative values of the output parameters of the previous M time points of this output parameter, correct this output parameter to obtain the corrected output parameter;

[0066] Perform simulation based on the obtained corrected output parameters.

[0067] As an example, the corrected output parameter corresponding to any output parameter is determined by the following formula:

[0068] y n+1 =y n +1 / 6 Δt(k1 + 2k2 + 2k3 + k4)

[0069] where, y n+1 Is the corrected output parameter at the n + 1 time point; n is greater than or equal to 4;

[0070] y n Is the corrected output parameter at the n time point;

[0071] Δt is the target system step size;

[0072] k1 is the derivative value of the output parameter of the FMU at the n - 4 time point;

[0073] k2 is the derivative value of the output parameter of the FMU at the n - 3 time point;

[0074] k3 is the derivative value of the output parameter of the FMU at the n - 2 time point;

[0075] k3 is the derivative value of the output parameter of the FMU at the n - 1 time point.

[0076] An embodiment of the present application further provides an electronic device, including: a processor and a memory for storing computer program instructions, and when the computer program instructions are run by the processor, the processor is caused to execute the steps of the above method.

[0077] An embodiment of the present application further provides a machine-readable storage medium, and the storage medium stores computer program instructions, and when the computer program instructions are executed, the steps of the above method can be implemented.

[0078] As can be seen from the above technical solutions, in this embodiment, according to the step range supported by the locally loaded functional simulation unit FMU and the current system step of the simulation platform, at least two reference steps are determined. For each reference step, the reference step and the input parameters corresponding to the reference step are input into the FMU to obtain the corresponding output parameters output by the FMU based on the reference step. According to the output parameters corresponding to each reference step, an error estimate for currently indicating the cumulative error caused by numerical integration when the FMU calculates the output parameters is determined. If the error estimate does not meet the set error requirement, the step of determining at least two reference steps is returned. If the error estimate meets the set error requirement, a target system step is determined according to the error estimate and the step range supported by the FMU. This method of adjusting the system step of this platform can enable the platform to perform co-simulation under the target system step that matches the step range supported by the FMU, which solves the problem of impaired simulation accuracy caused by the mismatch between the step supported by the FMU and the system step of this platform. Description of the Drawings

[0079] Figure 1 It is a schematic diagram of the implementation environment provided by an embodiment of the present application;

[0080] Figure 2 It is a schematic flowchart of the simulation method provided by an embodiment of the present application;

[0081] Figure 3 It is a schematic flowchart of obtaining the target system step provided by an embodiment of the present application;

[0082] Figure 4 It is a schematic structural diagram of the device provided by an embodiment of the present application;

[0083] Figure 5 It is a schematic hardware structure diagram of the electronic device provided by an embodiment of the present application. Detailed Embodiment

[0084] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and make the above objects, features, and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be further described in detail below with reference to the drawings.

[0085] Before describing the method provided by this application, first, in combination with Figure 1 the system architecture shown in

[0086] As Figure 1 shown, simulation platform A and simulation platform B use different simulation tools and have different simulation environments. In actual applications, in order to improve simulation efficiency, the simulation model created on simulation platform B is encapsulated as an FMU based on FMI.

[0087] FMI is an open standard and a standardized interface. FMI stipulates the rules that modular components for creating models need to follow, for different simulation environments to simulate and exchange data. It enables system developers to combine simulation models from different simulation platforms for co-simulation. The FMI standard mainly has two types: Model Exchange (ME) and Co-Simulation (CS).

[0088] An FMU is a file generated by a simulation model based on FMI and can be loaded and executed on various simulation platforms that support the FMI standard. An FMU includes: a model description file (modelDescription.xml), a binary library, and API functions.

[0089] Among them, the model description file (modelDescription.xml) is an XML file that contains metadata of the FMU, such as model name, version, input / output interface definition, supported step size range, etc.

[0090] Binary library: contains the mathematical model and calculation logic of the FMU and supports cross-platform operation.

[0091] API functions: FMI defines a series of API functions for realizing the interaction between the FMU and the simulation platform, such as initialization, stepping, data reading and writing, etc.

[0092] After simulation platform B outputs the FMU, simulation platform A uses the FMU output by simulation platform B for co-simulation. However, due to the different simulation tools and simulation environments used by simulation platform A and simulation platform B, there will be a mismatch between the step size supported by the FMU and the system step size of this platform, which will result in impaired simulation accuracy.

[0093] Based on this, to solve the above problems, the embodiments of this application provide a simulation method, device, electronic device, and readable storage medium. The method provided by the embodiments of this application is described below:

[0094] See Figure 2 ,Figure 2 It is a schematic flowchart of the simulation method provided by the embodiment of the present application. This method is applied to a simulation platform. Optionally, the simulation platform can be set on devices such as servers or terminals. The modeling tools used by the simulation platform include, but are not limited to, Modelica, Simulink, etc. The embodiments of the present application do not specifically limit this.

[0095] It should be noted that this method can be applied to Figure 1 any of the simulation platforms shown, as long as it is a simulation platform that uses the FMU output by a simulation platform different from this simulation platform, Figure 1 which is only for illustration and does not constitute a limitation.

[0096] This method is used to simulate circuit diagrams and can be applied in many fields such as automobiles, aerospace, and energy. The embodiments of the present application do not specifically limit this.

[0097] As Figure 2 shown, the process includes the following steps:

[0098] S201, determine at least two reference step sizes according to the step size range supported by the locally loaded functional simulation unit FMU and the current system step size of the simulation platform.

[0099] In this embodiment, the FMU is obtained by simulating the circuit diagram, and the platform on which the FMU is simulated is different from this simulation platform.

[0100] In specific implementation, the step size range supported by the FMU is obtained from the modelDescription.xml file in the FMU. Specifically, the simulation platform loads the FMU through the FMI standard interface, and the intelligent parsing engine of this platform automatically extracts the key information of the modelDescription.xml file, such as the number of input / output pins, data types (such as float64, int32, etc.), parameter configuration items and their default values (such as motor torque, circuit resistance), as well as the step size range and minimum step size supported by the FMU, and stores these parsing results in the form of structured data for use in subsequent steps.

[0101] Preferably, the intelligent parsing engine of this platform supports multi-level XML structure parsing, including nested parameter groups and conditional interfaces.

[0102] The system step size is a dynamic step size, which is adaptively adjusted according to the internal algorithm of the platform based on the convergence of each step of iterative calculation. Therefore, the system step size at the current time point is the current system step size.

[0103] S202. For each reference step, input the reference step and the input parameters corresponding to the reference step into the FMU to obtain the corresponding output parameters output by the FMU based on the reference step; the input parameters corresponding to different reference steps are the same.

[0104] In this embodiment, since a circuit diagram is simulated, the input parameters can be at least one of the following parameters: voltage, temperature, etc. The output parameters of the FMU can also be at least one of the following parameters: current, rotational speed, etc.

[0105] It should be noted that in this embodiment, the output parameters output by the FMU based on the reference step are the solutions obtained for the input parameters at the reference step.

[0106] The above at least two reference steps can be determined in the following manner: Divide the step range supported by the FMU and the current system step to determine the reference step. For example, the step range supported by the FMU

[0107] 10 -6 μs - 10 μs, the current system step is 1 μs, and when the set starting time point is 0 μs, the input parameters are output to the FMU at 1 μs, 2 μs, 3 μs, 4 μs, 5 μs, 6 μs, 7 μs, 8 μs, 9 μs, 10 μs respectively to obtain the output parameters of the FMU. Here, if the input at different time points all starts from 0 μs, it is equivalent to the reference steps being 1 μs, 2 μs, 3 μs, 4 μs... and so on.

[0108] It should be noted that the FMU and this platform can be asynchronous, that is, the data interaction is not completely synchronous, and there may be a situation where this platform may need to wait for the FMU to output the corresponding output parameters, etc.

[0109] S203. Based on the output parameters corresponding to each reference step, determine the error estimate that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters.

[0110] Since the numerical integration method used by the FMU is different from the numerical integration method used by this platform, the error estimate we seek is the cumulative error caused by the difference in the numerical integration used by the platform when the FMU calculates the output parameters. By adjusting the current system step through it, the current system step can be optimized in the direction that is more matched with the step supported by the FMU.

[0111] In specific implementation, the error estimate is obtained through the following steps: Obtain the standard deviation of the output parameters corresponding to each reference step, and determine the standard deviation as the error estimate.

[0112] It should be noted that the error estimation in the embodiments of the present application is different from the traditional local truncation error (LTE), but is improved on this basis. The error estimation obtained by the above method can accurately estimate the cumulative error caused by numerical integration when the FMU calculates the output parameters.

[0113] S204, determine whether the current error meets the set error requirement.

[0114] After calculating the error estimation, if the error estimation does not meet the set error requirement, return to step S201 to determine at least two reference step sizes. If the error estimation meets the set error requirement, execute the following step S205. That is, if the execution result of step S204 is no, return to S201; if the execution result of step S204 is yes, continue to execute S205.

[0115] S205, determine the target system step size based on the error estimation and the step size range supported by the FMU.

[0116] In this embodiment, the specific implementation manner of determining the target system step size based on the error estimation and the step size range supported by the FMU will be described in a specific embodiment later and will not be elaborated here.

[0117] S206, perform simulation on the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU.

[0118] In this embodiment, the specific implementation manner of performing simulation on the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU will be described in a specific embodiment later and will not be elaborated here.

[0119] So far, the Figure 2 shown process is completed.

[0120] Through Figure 2 the shown process, in the embodiments of the present application,

[0121] Determine at least two reference step sizes based on the step size range supported by the locally loaded functional simulation unit FMU and the current system step size of the simulation platform. For each reference step size, input the reference step size and the corresponding input parameters into the FMU to obtain the corresponding output parameters output by the FMU based on the reference step size. Determine the error estimate that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters based on the output parameters corresponding to each reference step size. If the error estimate does not meet the set error requirement, return to the step of determining at least two reference step sizes. If the error estimate meets the set error requirement, determine the target system step size based on the error estimate and the step size range supported by the FMU. This method of adjusting the system step size of this platform can enable the platform to perform co-simulation at the target system step size that matches the step size range supported by the FMU, which solves the problem of impaired simulation accuracy caused by the mismatch between the step size supported by the FMU and the system step size of this platform.

[0122] Furthermore, achieving the matching of the system step size and the step size supported by the FMU can also improve the simulation efficiency.

[0123] The following elaborates in detail the determination of the target system step size based on the error estimate and the step size range supported by the FMU:

[0124] Please refer to Figure 3 , Figure 3 which is the flow chart for obtaining the target system step size provided by the embodiment of this application.

[0125] As Figure 3 shown, this flow includes the following steps:

[0126] S301, determine the reference system step size based on the error estimate, the safety factor used to limit the range of step size changes of the current system step size, the error threshold used to limit the acceptable range of the estimated error, and the order of the integral operation for processing the output parameters of the FMU during the simulation of this simulation platform.

[0127] In this embodiment, the safety factor can be set to a value between 0 and 1 according to the specific application scenario, such as 0.8, etc. The error threshold can be set according to the specific application scenario, such as 1μm. The embodiment of this application does not specifically limit it.

[0128] The integral operation for processing the output parameters of the FMU during the simulation of this simulation platform can be the fourth-order Runge-Kutta method (Runge-Kutta 4th order, RK4), the fifth-order Runge-Kutta method (Runge-Kutta 5th order, RK5), and the corresponding order is 4 or 5.

[0129] When the above-mentioned step S301 is specifically implemented, a reference system step size can be obtained by performing a specified operation on the error estimation, safety factor, error threshold, and order of the integral operation.

[0130] Optionally, as an embodiment, the reference system step size is obtained through the following formula:

[0131]

[0132] where, Δt sys is the reference system step size;

[0133] α is the safety factor;

[0134] is the error threshold;

[0135] e est is the error estimation;

[0136] p is the order of the integral operation.

[0137] S302. Determine the target system step size according to the reference system step size and the specified step size within the step size range supported by the FMU.

[0138] In this embodiment, when the reference system step size is greater than or equal to the specified step size within the step size range supported by the FMU, such as the minimum step size, the reference system step size is used as the target system step size. When the reference system step size is less than the minimum step size within the step size range supported by the FMU, a specified operation is performed on the reference system step size and the above-mentioned minimum step size, and the operation result is used as the target system step size.

[0139] Optionally, as an embodiment,

[0140] the target system step size is obtained through the following formula:

[0141]

[0142] where, Δt sys is the reference system step size;

[0143] Δt fmu is the specified step size within the step size range supported by the FMU;

[0144] Δt compatible is the target system step size.

[0145] Through the above method, the platform performs co-simulation with the target system step size matching the step size range supported by the FMU. Even if it is not exactly equal to the fixed step size of the FMU, within the range supported by the FMU, it can also solve the problem of impaired simulation accuracy caused by the mismatch between the step size supported by the FMU and the system step size of the platform.

[0146] The above has elaborated in detail on determining the target system step size based on the error estimation and the step size range supported by the FMU.

[0147] The following elaborates in detail on simulating the circuit diagram to be simulated on this simulation platform based on the above-mentioned target system step size and FMU:

[0148] Since the current system step size is not exactly the same as the fixed step size when the FMU is output, therefore, the output parameters output by the FMU also need to be corrected under the target system step size.

[0149] Specifically, as an embodiment, for the output parameters of the FMU at each time point, based on the target system step size, the output parameters after correction of the output parameters at the previous time point of this time point, and the derivative values of the output parameters at the previous M time points of this output parameter, this output parameter is corrected to obtain the corrected output parameter; simulation is performed based on the obtained corrected output parameters.

[0150] Optionally, the corrected output parameter corresponding to any output parameter is determined by the following formula:

[0151] y n+1 =y n +1 / 6 Δt(k1 + 2k2 + 2k3 + k4)

[0152] where, y n+1 is the corrected output parameter at the n + 1 time point; n is greater than or equal to 4;

[0153] y n is the corrected output parameter at the n time point;

[0154] Δt is the target system step size;

[0155] k1 is the derivative value of the output parameter of the FMU at the n - 4 time point;

[0156] k2 is the derivative value of the output parameter of the FMU at the n - 3 time point;

[0157] k3 is the derivative value of the output parameter of the FMU at the n - 2 time point;

[0158] k3 is the derivative value of the output parameter of the FMU at the n - 1 time point.

[0159] It should be noted that FUM calculates the output parameters using RK4 to output the corresponding output parameters. When performing simulations on this platform, during the calculation and solution process, not only the output parameters of the FMU are processed, but also the parameters of other components are processed. The output parameters of the FMU are calculated using the RK4 method, and other parameters can be calculated using the Euler, RK4, or RK5 methods. The embodiments of the present application do not specifically limit this. The reason for using the RK4 algorithm for the output reference of the FMU is that the traditional Euler method is difficult to meet the high-precision inversion requirements when performing co-simulations with the FMU.

[0160] Through the above method, the correction of the FMU output parameters is realized, and the co-simulation is performed using the corrected output parameters, which can improve the simulation accuracy.

[0161] The above has elaborated in detail the simulation of the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU.

[0162] So far, the description of the method provided in this embodiment is completed. Next, the device provided in the embodiments of the present application will be described:

[0163] See Figure 4 , Figure 4 which is the structural schematic diagram of the device provided in the embodiments of the present application. This device is applied to a simulation platform. As Figure 4 shown, the device 400 includes: a determination module 401, an acquisition module 402, an error estimation module 403, an adjustment module 404, and a simulation module 405.

[0164] The determination module 401 is configured to determine at least two reference step sizes according to the step size range supported by the locally loaded functional mock-up unit (FMU) and the current system step size of the simulation platform; the FMU is obtained by simulating the circuit diagram; the platform on which the FMU is simulated is different from the simulation platform;

[0165] The acquisition module 402 is configured to, for each reference step size, input the reference step size and the corresponding input parameters to the FMU to obtain the corresponding output parameters output by the FMU based on the reference step size; the input parameters corresponding to different reference step sizes are the same;

[0166] The error estimation module 403 is configured to determine the error estimation that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters based on the output parameters corresponding to each reference step size;

[0167] The adjustment module 404 is configured to, if the error estimation does not meet the set error requirement, return to the step of determining at least two reference step sizes; if the error estimation meets the set error requirement, determine the target system step size according to the error estimation and the step size range supported by the FMU;

[0168] The simulation module 405 is used to simulate the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU.

[0169] As an embodiment, determining the target system step size according to the error estimate and the step size range supported by the FMU includes:

[0170] Determining the reference system step size according to the error estimate, the safety factor used to limit the range of step size variation for the current system step size, the error threshold used to limit the acceptable range of the estimated error, and the order of the integral operation used to process the output parameters of the FMU during the simulation of this simulation platform;

[0171] Determining the target system step size according to the reference system step size and the specified step size in the step size range supported by the FMU.

[0172] As an embodiment, the reference system step size is obtained through the following formula:

[0173]

[0174] where, Δt sys is the reference system step size;

[0175] α is the safety factor;

[0176] is the error threshold;

[0177] e est is the error estimate;

[0178] p is the order of the integral operation.

[0179] As an embodiment, the target system step size is obtained through the following formula:

[0180]

[0181] where, Δt sys is the reference system step size;

[0182] Δt fmu is the specified step size in the step size range supported by the FMU;

[0183] Δt compatible is the target system step size.

[0184] As an embodiment, determining the error estimate that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters according to the output parameters corresponding to each reference step size includes:

[0185] Obtain the standard deviation of the output parameters corresponding to each reference step length, and determine the standard deviation as the error estimate.

[0186] As an example, when simulating the circuit diagram to be simulated on this simulation platform based on the target system step length and the FMU, the simulation module is further configured to:

[0187] For the output parameters of the FMU at each time point, correct the output parameters based on the target system step length, the corrected output parameters of the previous time point of this time point, and the derivative values of the output parameters of the previous M time points of this output parameter, to obtain the corrected output parameters;

[0188] Perform simulation based on the obtained corrected output parameters.

[0189] As an example, the corrected output parameter corresponding to any output parameter is determined by the following formula:

[0190] y n+1 =y n +1 / 6 Δt(k1 + 2k2 + 2k3 + k4)

[0191] where, y n+1 is the corrected output parameter at the n + 1 time point; n is greater than or equal to 4;

[0192] y n is the corrected output parameter at the n time point;

[0193] Δt is the target system step length;

[0194] k1 is the derivative value of the output parameter of the FMU at the n - 4 time point;

[0195] k2 is the derivative value of the output parameter of the FMU at the n - 3 time point;

[0196] k3 is the derivative value of the output parameter of the FMU at the n - 2 time point;

[0197] k3 is the derivative value of the output parameter of the FMU at the n - 1 time point.

[0198] Thus far, the structural description of the Figure 4 shown device is completed.

[0199] Please refer to Figure 5 , Figure 5 which is the structural diagram of the electronic device provided by the embodiment of this application. As Figure 5As shown, the hardware structure may include: a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above examples of the present application.

[0200] Based on the same application concept as the above method, an embodiment of the present application further provides a machine-readable storage medium, on which several computer instructions are stored, and when the computer instructions are executed by a processor, the method disclosed in the above examples of the present application can be implemented.

[0201] Exemplarily, the above machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.

[0202] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A simulation method, characterized in that, The method is applied to a simulation platform, and the method includes: Determine at least two reference step sizes according to the step size range supported by the locally loaded functional simulation unit (FMU) and the current system step size of the simulation platform; the FMU is obtained by simulating a circuit diagram; the platform on which the FMU is simulated is different from the simulation platform; For each reference step size, input the reference step size and the input parameters corresponding to the reference step size into the FMU to obtain the corresponding output parameters output by the FMU based on the reference step size; the input parameters corresponding to different reference step sizes are the same; Determine an error estimate that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters according to the output parameters corresponding to each reference step size; If the error estimate does not meet the set error requirement, return to the step of determining at least two reference step sizes. If the error estimate meets the set error requirement, determine the target system step size according to the error estimate and the step size range supported by the FMU; Based on the target system step size and the FMU, simulate the circuit diagram to be simulated on this simulation platform.

2. The method according to claim 1, characterized in that The determining the target system step size according to the error estimate and the step size range supported by the FMU includes: Determine a reference system step size according to the error estimate, a safety factor for limiting the range of step size changes of the current system step size, an error threshold for limiting the acceptable range of the estimated error, and the order of the integral operation for processing the output parameters of the FMU when this simulation platform performs simulation; Determine the target system step size according to the reference system step size and the specified step size in the step size range supported by the FMU.

3. The method according to claim 2, characterized in that The reference system step size is obtained by the following formula: ; where Δt sys is the step size of the reference system; α is the safety factor; is the error threshold; e est is the error estimate; p is the order of the integral operation.

4. The method according to claim 2, wherein The target system step size is obtained by the following formula: ; where Δt sys is the reference system step size; Δt fmu A specified step size within the step size range supported by the FMU; Δt compatible is the step size of the target system.

5. The method according to claim 1, wherein The determining the error estimate that currently indicates the cumulative error caused by numerical integration when the FMU calculates the output parameters according to the output parameters corresponding to each reference step size includes: Obtain the standard deviation of the output parameters corresponding to each reference step size, and determine the standard deviation as the error estimate.

6. The method according to claim 1, wherein When simulating the circuit diagram to be simulated on this simulation platform based on the target system step size and the FMU, the method further includes: For the output parameters of the FMU at each time point under the target system step size, correct the output parameters according to the target system step size, the corrected output parameters of the output parameters at the previous time point of this time point, and the derivative values of the output parameters at the previous M time points of this output parameter to obtain the corrected output parameters; Perform simulation based on the obtained corrected output parameters.

7. The method according to claim 6, characterized in that, The corrected output parameter corresponding to any output parameter is determined by the following formula: y n+1 = y n + 1 / 6 Δt(k1 + 2k2 + 2k3 + k4) Among them, y n+1 is the corrected output parameter at the (n + 1)-th time point; n is greater than or equal to 4; y n is the corrected output parameter at the nth time point; Δt is the target system step size; k1 is the derivative value of the output parameter of the FMU at the n - 4 time point; k2 is the derivative value of the output parameter of the FMU at the n - 3 time point; k3 is the derivative value of the output parameter of the FMU at the n - 2 time point; $k3$ is the derivative value of the output parameter of the FMU at the $n - 1$ time point.

8. A simulation device, characterized in that, The device is applied to a simulation platform, and the device includes: A determination module, configured to determine at least two reference step sizes according to the step size range supported by the locally loaded Functional Mock-up Unit (FMU) and the current system step size of the simulation platform; the FMU is obtained by simulating a circuit diagram; the platform for simulating the FMU is different from the simulation platform; An acquisition module, configured to input, for each reference step size, the reference step size and the input parameter corresponding to the reference step size into the FMU to obtain the corresponding output parameter output by the FMU based on the reference step size; the input parameters corresponding to different reference step sizes are the same; An error estimation module, configured to determine an error estimation currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter according to the output parameters corresponding to the respective reference step sizes; An adjustment module, configured to, if the error estimation does not meet the set error requirement, return to the step of determining at least two reference step sizes, and if the error estimation meets the set error requirement, determine a target system step size according to the error estimation and the step size range supported by the FMU; A simulation module, configured to simulate a circuit diagram to be simulated on the present simulation platform based on the target system step size and the FMU.

9. One An electronic device, characterized in that, The electronic device includes: A processor; and A computer-readable storage medium, in which computer program instructions are stored, and when the computer program instructions are run by the processor, the processor is caused to execute the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are run by the processor, the processor is caused to execute the steps in the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multi-equipment collaborative task simulation method and device, storage medium and equipment

    CN111796531A

  • Multi-FMU model joint simulation propulsion method and system

    CN114818362A