Simulation method and device, electronic equipment and readable storage medium

By determining the reference step size, calculating error estimation and adjusting the system step size in the simulation platform, the problem of mismatch between the FMU step size and the step size of the simulation platform is solved, and the simulation accuracy and efficiency are improved.

CN119938231AActive Publication Date: 2025-05-06ZHEJIANG LAB
View PDF 8 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

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

Method used

By determining at least two reference steps, input to the FMU for each reference step to obtain the output parameters, an error estimate is calculated, and the target system step size is determined based on the error estimate and the step size range supported by the FMU to match the step size range of the FMU.

Benefits of technology

It effectively solves the problem of impaired simulation accuracy caused by step size mismatch, and improves simulation efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938231A_ABST
    Figure CN119938231A_ABST
Patent Text Reader

Abstract

The invention provides a simulation method and device, electronic equipment and a readable storage medium. According to the method, at least two reference step lengths are determined according to a loaded step length range supported by an FMU and a current system step length of a simulation platform, each reference step length and an input parameter corresponding to the reference step length are input to the FMU to obtain a corresponding output parameter output by the FMU based on the reference step length, and the output parameter corresponding to each reference step length is calculated according to the output parameter corresponding to each reference step length. The method comprises the steps of determining a set error requirement, determining error estimation, if the error estimation does not meet the set error requirement, returning to the step of determining at least two reference step lengths, and if the error estimation meets the set error requirement, determining a target system step length according to the error estimation and a step length range supported by the FMU. The platform can be matched with the step length range supported by the FMU, and the problem that the simulation precision is damaged due to the fact that the step length supported by the FMU is not matched with the system step length of the platform is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] The functional mock-up unit (FMU) generated based on the functional mock-up interface (FMI) standard has cross-platform compatibility and is widely used in joint simulation.

[0003] However, in practical applications, when a simulation platform needs to use the FMU output by other simulation platforms for joint simulation, there will be a mismatch between the step size supported by the FMU and the system step size of this platform, which will lead to a loss of simulation accuracy. Summary of the invention

[0004] In view of this, embodiments of the present application provide a simulation method, an apparatus, an electronic device, and a 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] The present application provides a simulation method, which is applied to a simulation platform and includes: 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; the FMU is obtained by simulating the circuit diagram; the platform simulated by the FMU is different from the simulation platform; For each reference step length, the reference step length and the input parameters corresponding to the reference step length are input into the FMU to obtain the corresponding output parameters output by the FMU based on the reference step length; the input parameters corresponding to different reference steps are the same; Determining, based on the output parameters corresponding to each reference step, an error estimate currently used to indicate a cumulative error caused by numerical integration when the FMU calculates the output parameter; 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. Based on the target system step size and FMU, the circuit diagram to be simulated on this simulation platform is simulated.

[0006] As an embodiment, determining the target system step size according to the error estimate and the step size range supported by the FMU includes: Determine the reference system step size based on the error estimate, the safety factor for limiting the range of step size variation of the current system step size, the 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 simulating on the simulation platform; The target system step size is determined based on the reference system step size and the specified step size in the step size range supported by the FMU.

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

[0008] Among them, Δt sys is the reference system step length; α is the safety factor; is the error threshold; e est is the error estimate; p is the order of the integration operation.

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

[0010] Among them, Δt sys is the reference system step length; Δt fmu The specified step size is within the range of step sizes supported by the FMU; Δt compatible is the target system step size.

[0011] As an embodiment, determining, based on the output parameters corresponding to each reference step, the error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter includes: The standard deviation of the output parameter corresponding to each reference step is obtained, and the standard deviation is determined as the error estimate.

[0012] As an embodiment, when simulating a circuit diagram to be simulated on the simulation platform based on the target system step size and the FMU, the method further includes: For the output parameter of the FMU at each time point under the target system step, the output parameter is corrected according to the target system step, the output parameter of the previous time point before the time point after being corrected, and the derivative value of the output parameter of the previous M time points of the output parameter, to obtain the corrected output parameter; A simulation is performed based on the obtained corrected output parameters.

[0013] As an embodiment, 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 time point n+1; n is greater than or equal to 4; y n is the corrected output parameter at time point n; Δt is the target system step size; k1 is the derivative value of the output parameter of the FMU at time point n-4; k2 is the derivative value of the output parameter of the FMU at time point n-3; k3 is the derivative value of the output parameter of the FMU at time point n-2; k3 is the derivative value of the output parameter of the FMU at time point n-1.

[0014] The embodiment of the present application also provides a simulation device, which is applied to a simulation platform, and includes: A determination module is used to determine at least two reference step sizes according to a step size range supported by a locally loaded functional simulation unit FMU and a current system step size of a simulation platform; the FMU is obtained by simulating a circuit diagram; and the platform simulated by the FMU is different from the simulation platform; An acquisition module, for inputting, for each reference step length, the reference step length and an input parameter corresponding to the reference step length into the FMU, so as to obtain a corresponding output parameter output by the FMU based on the reference step length; the input parameters corresponding to different reference steps are the same; An error estimation module is used to determine an error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter based on the output parameter corresponding to each reference step; An adjustment module, for returning to the step of determining at least two reference step sizes if the error estimate does not meet the set error requirement, and determining the target system step size based on the error estimate and the step size range supported by the FMU if the error estimate meets the set error requirement; The simulation module is used to simulate the circuit diagram to be simulated on this simulation platform based on the target system step size and FMU.

[0015] As an embodiment, determining the target system step size according to the error estimate and the step size range supported by the FMU includes: Determine the reference system step size based on the error estimate, the safety factor for limiting the range of step size variation of the current system step size, the 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 simulating on the simulation platform; The target system step size is determined based on the reference system step size and the specified step size in the step size range supported by the FMU.

[0016] As an example, The reference system step size is obtained by the following formula:

[0017] Among them, Δt sys is the reference system step length; α is the safety factor; is the error threshold; e est is the error estimate; p is the order of the integration operation.

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

[0019] Among them, Δt sys is the reference system step length; Δt fmu The specified step size is within the range of step sizes supported by the FMU; Δt compatible is the target system step size.

[0020] As an embodiment, determining, based on the output parameters corresponding to each reference step, the error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter includes: The standard deviation of the output parameter corresponding to each reference step is obtained, and the standard deviation is determined as the error estimate.

[0021] As an embodiment, when simulating a circuit diagram to be simulated on the simulation platform based on the target system step size and the FMU, the simulation module is further used to: For each output parameter of the FMU at each time point, the output parameter is corrected according to the target system step size, the output parameter after the output parameter at the previous time point is corrected, and the derivative value of the output parameter at the previous M time points of the output parameter, to obtain the corrected output parameter; A simulation is performed based on the obtained corrected output parameters.

[0022] As an embodiment, 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 time point n+1; n is greater than or equal to 4; y n is the corrected output parameter at time point n; Δt is the target system step size; k1 is the derivative value of the output parameter of the FMU at time point n-4; k2 is the derivative value of the output parameter of the FMU at time point n-3; k3 is the derivative value of the output parameter of the FMU at time point n-2; k3 is the derivative value of the output parameter of the FMU at time point n-1.

[0023] An embodiment of the present application also provides an electronic device, including: a processor and a memory for storing computer program instructions, and when the computer program instructions are executed by the processor, the processor executes the steps of the above method.

[0024] An embodiment of the present application also provides a machine-readable storage medium, which stores computer program instructions. When the computer program instructions are executed, the steps of the above method can be implemented.

[0025] It can be seen from the above technical solution that in this embodiment, at least two reference step sizes are determined 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, the 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. According to the output parameters corresponding to each reference step size, the error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter is determined. 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, the 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 of this platform enables the platform to perform joint simulation under 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. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A schematic diagram of an implementation environment provided for an embodiment of the present application; Figure 2 A schematic diagram of a simulation method according to an embodiment of the present invention; Figure 3 A schematic diagram of a process for obtaining a target system step size provided in an embodiment of the present application; Figure 4 A schematic diagram of the structure of the device provided in the embodiment of the present application; Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.

[0028] Before describing the method provided by this application, Figure 1 The system architecture shown in the figure elaborates on the problems existing in the prior art: like Figure 1 As 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 will be packaged as FMU based on FMI.

[0029] FMI is an open standard and a standardized interface. FMI specifies the rules that need to be followed to create modular components of models for simulation and data exchange in different simulation environments. It enables system developers to combine simulation models from different simulation platforms for joint simulation. There are two main types of FMI standards: Model Exchange (ME) and Co-Simulation (CS).

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

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

[0032] Binary library: Contains the mathematical model and calculation logic of FMU, and supports cross-platform operation.

[0033] API function: FMI defines a series of API functions to realize the interaction between FMU and simulation platform, such as initialization, stepping, data reading and writing, etc.

[0034] After simulation platform B outputs FMU, simulation platform A performs joint simulation using the FMU output by simulation platform B. However, due to the different simulation tools and simulation environments used by simulation platform A and simulation platform B, there is a mismatch between the step size supported by the FMU and the system step size of this platform, which will lead to a loss of simulation accuracy.

[0035] Based on this, in order to solve the above problems, the embodiments of the present application provide a simulation method, a device, an electronic device and a readable storage medium. The method provided by the embodiments of the present application is described below: See also Figure 2 , Figure 2 The flowchart of the simulation method provided in the embodiment of the present application is shown in FIG. The method is applied to a simulation platform. Optionally, the simulation platform can be set on a device such as a server or a terminal, and the modeling tools used by the simulation platform include, but are not limited to, Modelica, Simulink, etc. The embodiment of the present application is not specifically limited.

[0036] It should be noted that this method can be applied to Figure 1 Any simulation platform shown in the figure can be used as long as it is a simulation platform that uses the FMU output by a simulation platform different from the present simulation platform. Figure 1 This is merely an example and is not intended to be limiting.

[0037] This method is used to simulate a circuit diagram and can be applied in many fields such as automobiles, aerospace, energy, etc., and is not specifically limited in the embodiments of the present application.

[0038] like Figure 2 As shown, the process includes the following steps: S201, determining at least two reference step sizes according to a step size range supported by a locally loaded functional simulation unit FMU and a current system step size of a simulation platform.

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

[0040] In the specific implementation, the step range supported by FMU is obtained from the modelDescription.xml file in FMU. Specifically, the simulation platform loads FMU through the FMI standard interface, and the intelligent parsing engine of this platform automatically extracts 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), and the step range and minimum step size supported by FMU, and stores these parsing results in the form of structured data for use in subsequent steps.

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

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

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

[0044] In this embodiment, since the circuit diagram is simulated, the input parameter may be at least one of the following sampling parameters: voltage, temperature, etc. The output parameter of the FMU may also be at least one of the following sampling parameters: current, speed, etc.

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

[0046] The at least two reference step sizes can be determined by dividing the step size range supported by the FMU and the current system step size to determine the reference step size. 10 -6 μs-10μs, the current system step size is 1μs, and when the starting time point is set to 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, and 10μs to obtain the output parameters of the FMU. Here, if the input at different time points is calculated starting from 0μs, it is equivalent to a reference step size of 1μs, 2μs, 3μs, 4μs, and so on.

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

[0048] S203 , determining, according to the output parameters corresponding to each reference step, an error estimate currently used to indicate the accumulated error caused by numerical integration when the FMU calculates the output parameters.

[0049] Since the numerical integration method used by FMU is different from that used by this platform, the error estimate we are looking for is the cumulative error caused by the difference in numerical integration used by the platform when FMU calculates the output parameters. By adjusting the current system step size, we can achieve reverse optimization to make the current system step size more compatible with the step size supported by FMU.

[0050] In a specific implementation, the error estimate is obtained by the following steps: obtaining the standard deviation of the output parameter corresponding to each reference step length, and determining the standard deviation as the error estimate.

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

[0052] S204, determining whether the current error meets the set error requirement.

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

[0054] S205, determining the target system step size based on the error estimate and the step size range supported by the FMU.

[0055] In this embodiment, the error estimation and the step size range supported by the FMU, and the specific implementation method of determining the step size of the target system will be described in the following text in the form of specific embodiments, which will not be described here.

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

[0057] In this embodiment, the specific implementation method of simulating the circuit diagram to be simulated on this simulation platform based on the target system step size and FMU will be described in the following text in the form of a specific embodiment and will not be described here.

[0058] So far, completed Figure 2 The process shown.

[0059] pass Figure 2 In the process shown in the embodiment of the present application, 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 step sizes are determined. For each reference step size, the 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. According to the output parameters corresponding to each reference step size, the error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter is determined. 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, the target system step size is determined according to the error estimate and the step range supported by the FMU. This method of adjusting the system step size of this platform enables the platform to perform joint simulation under the target system step size that matches the step 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.

[0060] Furthermore, matching the system step size with the step size supported by the FMU can also improve simulation efficiency.

[0061] The following is a detailed description of the above-mentioned determination of the target system step size based on the error estimation and the step size range supported by the FMU: See also Figure 3 , Figure 3 A schematic diagram of a process for obtaining a target system step size provided in an embodiment of the present application.

[0062] like Figure 3 As shown, the process includes the following steps: S301, determine the reference system step size based on the error estimate, the safety factor for limiting the range of step size variation of the current system step size, the 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 simulating on this simulation platform.

[0063] 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 the present application is not specifically limited.

[0064] When simulating on this simulation platform, the integral operation used to process the output parameters of the FMU can be the fourth-order Runge-Kutta method (Runge-Kutta 4th order, RK4) or the fifth-order Runge-Kutta method (Runge-Kutta 5th order, RK5), and the corresponding order is 4 or 5.

[0065] When the above step S301 is specifically implemented, the reference system step length can be obtained by performing specified operations on the error estimate, the safety factor, the error threshold, and the order of the integral operation.

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

[0067] Among them, Δt sys is the reference system step length; α is the safety factor; is the error threshold; e est is the error estimate; p is the order of the integration operation.

[0068] S302, determining a target system step size according to a reference system step size and a specified step size in a step size range supported by the FMU.

[0069] In this embodiment, when the reference system step size is greater than or equal to a specified step size in 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 in the step size range supported by the FMU, a specified operation is performed on the reference system step size and the minimum step size, and the operation result is used as the target system step size.

[0070] Optionally, as an embodiment, The target system step size is obtained by the following formula:

[0071] Among them, Δt sys is the reference system step length; Δt fmu The specified step size is within the range of step sizes supported by the FMU; Δt compatible is the target system step size.

[0072] Through the above method, this platform can perform joint simulation under the target system step size that matches the step size range supported by the FMU. Even if it is not completely equivalent to the fixed step size of the FMU, it can solve the problem of damaged simulation accuracy caused by the mismatch between the step size supported by the FMU and the system step size of this platform within the range supported by the FMU.

[0073] The above describes in detail the determination of the target system step size based on the error estimation and the step size range supported by the FMU.

[0074] The following is a detailed description of the simulation of the circuit diagram to be simulated on this simulation platform based on the target system step size and FMU: Since the current system step size is not completely consistent with the fixed step size when the FMU is output, the output parameters of the FMU output at the target system step size also need to be corrected.

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

[0076] Optionally, 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 time point n+1; n is greater than or equal to 4; y n is the corrected output parameter at time point n; Δt is the target system step size; k1 is the derivative value of the output parameter of the FMU at time point n-4; k2 is the derivative value of the output parameter of the FMU at time point n-3; k3 is the derivative value of the output parameter of the FMU at time point n-2; k3 is the derivative value of the output parameter of the FMU at time point n-1.

[0077] It should be noted that FUM uses RK4 to calculate the output parameters to output the corresponding output parameters. When simulating on this platform, in the process of calculation and solution, not only the output parameters of FMU are processed, but also the parameters of other components are processed. The output parameters of FMU are calculated using RK4, and other parameters can be calculated by Euler, RK4 or RK5, which is not specifically limited in the embodiment of the present application. The RK4 algorithm is used for the output reference of FMU because the traditional Euler method is difficult to meet the high-precision requirements when co-simulating with FMU.

[0078] Through the above method, the FMU output parameters are corrected, and the corrected output parameters are used for joint simulation, which can improve the simulation accuracy.

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

[0080] At this point, the description of the method provided in this embodiment is completed. The following describes the device provided in this embodiment of the application: See also Figure 4 , Figure 4 This is a schematic diagram of the structure of the device provided in the embodiment of the present application. The device is applied to a simulation platform, such as Figure 4 As 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.

[0081] The determination module 401 is used to 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 the circuit diagram; the platform simulated by the FMU is different from the simulation platform; An obtaining module 402 is used for inputting, for each reference step length, the reference step length and an input parameter corresponding to the reference step length into the FMU to obtain a corresponding output parameter output by the FMU based on the reference step length; the input parameters corresponding to different reference steps are the same; The error estimation module 403 is used to determine the error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter based on the output parameter corresponding to each reference step; An adjustment module 404 is configured to return to the step of determining at least two reference step sizes if the error estimate does not meet the set error requirement, and determine a target system step size based on the error estimate and a step size range supported by the FMU if the error estimate meets the set error requirement; The simulation module 405 is used to simulate the circuit diagram to be simulated on the simulation platform based on the target system step size and FMU.

[0082] As an embodiment, determining the target system step size according to the error estimate and the step size range supported by the FMU includes: Determine the reference system step size based on the error estimate, the safety factor for limiting the range of step size variation of the current system step size, the 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 simulating on the simulation platform; The target system step size is determined based on the reference system step size and the specified step size in the step size range supported by the FMU.

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

[0084] Among them, Δt sys is the reference system step length; α is the safety factor; is the error threshold; e est is the error estimate; p is the order of the integration operation.

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

[0086] Among them, Δt sys is the reference system step length; Δt fmu The specified step size is within the range of step sizes supported by the FMU; Δt compatible is the target system step size.

[0087] As an embodiment, determining, based on the output parameters corresponding to each reference step, the error estimate currently used to indicate the cumulative error caused by numerical integration when the FMU calculates the output parameter includes: The standard deviation of the output parameter corresponding to each reference step is obtained, and the standard deviation is determined as the error estimate.

[0088] As an embodiment, when simulating a circuit diagram to be simulated on the simulation platform based on the target system step size and the FMU, the simulation module is further used to: For each output parameter of the FMU at each time point, the output parameter is corrected according to the target system step size, the output parameter after the output parameter at the previous time point is corrected, and the derivative value of the output parameter at the previous M time points of the output parameter, to obtain the corrected output parameter; A simulation is performed based on the obtained corrected output parameters.

[0089] As an embodiment, 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 time point n+1; n is greater than or equal to 4; y n is the corrected output parameter at time point n; Δt is the target system step size; k1 is the derivative value of the output parameter of the FMU at time point n-4; k2 is the derivative value of the output parameter of the FMU at time point n-3; k3 is the derivative value of the output parameter of the FMU at time point n-2; k3 is the derivative value of the output parameter of the FMU at time point n-1.

[0090] So far, completed Figure 4 Structural description of the device shown.

[0091] See also Figure 5 , Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing 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 example of this application.

[0092] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.

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

[0094] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in 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 comprises: 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 the circuit diagram; the platform simulated by the FMU is different from the simulation platform; For each reference step length, the reference step length and an input parameter corresponding to the reference step length are input into the FMU to obtain a corresponding output parameter output by the FMU based on the reference step length; the input parameters corresponding to different reference steps are the same; Determining, based on the output parameters corresponding to each reference step, an error estimate currently used to indicate a cumulative error caused by numerical integration when the FMU calculates the output parameter; If the error estimate does not meet the set error requirement, returning to the step of determining at least two reference step sizes; if the error estimate meets the set error requirement, determining a target system step size based on the error estimate and a step size range supported by the FMU; Based on the target system step size and the FMU, the circuit diagram to be simulated on this simulation platform is simulated.

2. The method according to claim 1, characterized in that Determining the target system step size based on the error estimate and the step size range supported by the FMU includes: Determine the reference system step size based on the error estimate, 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 the simulation platform performs simulation; The target system step size is determined according to the reference system step size and a specified step size in a 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: Among them, Δt sys is the reference system step size; α is the safety factor; is the error threshold; e est is the error estimate; p is the order of the integration operation.

4. The method according to claim 2, characterized in that: The target system step size is obtained by the following formula: Among them, Δt sys is the reference system step size; Δt fmu is a specified step size in the step size range supported by the FMU; Δt compatible is the target system step size.

5. The method according to claim 1, characterized in that Determining, based on the output parameters corresponding to each reference step, an error estimate currently used to indicate a cumulative error caused by numerical integration when the FMU calculates the output parameter comprises: The standard deviation of the output parameter corresponding to each reference step size is obtained, and the standard deviation is determined as the error estimate.

6. The method according to claim 1, characterized in that When simulating the circuit diagram to be simulated on the simulation platform based on the target system step size and the FMU, the method further includes: For the output parameter of the FMU at each time point under the target system step, the output parameter is corrected according to the target system step, the output parameter of the previous time point before the time point after being corrected, and the derivative value of the output parameter of the previous M time points of the output parameter, so as to obtain the corrected output parameter; A simulation is performed 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 time point n+1; n is greater than or equal to 4; y n is the corrected output parameter at time point n; Δt is the target system step size; k1 is the derivative value of the output parameter of the FMU at time point n-4; k2 is the derivative value of the output parameter of the FMU at time point n-3; k3 is the derivative value of the output parameter of the FMU at time point n-2; k3 is the derivative value of the output parameter of the FMU at time point n-1.

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

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

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, enable the processor to perform the steps of any one of the methods of claims 1 to 7.

Citation Information

Patent Citations

  • Interactive 3D experiences on the basis of data

    CN105843978A

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

    CN111796531A

  • Simulation test method and device and electronic equipment

    CN112084668A

  • Multi-FMU model joint simulation propulsion method and system

    CN114818362A

  • Cross-system real-time simulation scheduling method and system

    CN117997761A