Simulation model importing method and device, electronic equipment and computer program product
By generating and packaging the intermediate structure files of the simulation model, the compatibility problem of simulation model under FMI is solved, and the unified import and operation of models in the simulation simulation software under different environments is realized, improving the efficiency and flexibility of model conversion.
Patent Information
- Application Number
- CN202510578150.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2025-08-19
AI Technical Summary
In the prior art, when importing simulation models based on the functional simulation interface FMI, there is a problem that the functional simulation interface is incompatible with the simulation model to be imported.
By obtaining the intermediate structure file of the simulation model, a description file that meets the requirements of the functional simulation interface is generated, and the description file and simulation model are packaged to form a functional simulation model unit that complies with the simulation standards, and parsing and adding it in the simulation simulation software to achieve model conversion and compatibility.
It realizes compatibility of simulation models in different native environments in simulation simulation software, improves cross-platform model reuse efficiency and flexibility, simplifies the model conversion process, and reduces the need for professional skills.
Smart Images

Figure CN120508312A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a method, device, electronic equipment and computer program product for importing a simulation model. Background Art
[0002] Simulation is a model-based activity used when system analysis methods cannot be used to obtain relevant information based on the system's mathematical model. Model-based simulation utilizes modern computer technology to digitally simulate the real world. It involves creating a virtual environment and system model, then performing numerical calculations and simulations on these models to simulate the system's behavior and performance.
[0003] Model-based simulation can be applied across a wide range of fields, including engineering, manufacturing, transportation, and healthcare. In engineering, it can be used to design, test, and evaluate various products and systems, such as robots, aircraft, automobiles, and rockets. In healthcare, it can be used to simulate the function of human organs to better understand disease progression and treatment options. In transportation, it can be used to simulate urban traffic flow and congestion, aiding in the development of transportation plans and policies.
[0004] Functional Mock-up Interface (FMI) is a tool for building model interactions. It's an open standard that enables collaboration between different simulation software and development tools. FMI allows models to be integrated into a common simulation environment, allowing different models to interact and run within the same simulation software. This saves time and costs and improves model repeatability and reliability.
[0005] In the actual FMI compatibility process, because different simulation software has different technical paths, implementation architectures, and solver algorithms, it is not necessarily possible to directly use the FMI standard interface. Therefore, there are certain difficulties when importing the Functional Mock-up Unit (FMU) and combining it with other simulation models for calculation.
[0006] Regarding the above-mentioned situation of importing simulation models based on the functional simulation interface FMI, there is a problem of incompatibility between the functional simulation interface and the simulation model to be imported, and no effective solution has been proposed yet. Summary of the Invention
[0007] Embodiments of the present invention provide a method, device, electronic device and computer program product for importing a simulation model, so as to at least solve the technical problem of incompatibility between the functional simulation interface FMI and the simulation model to be imported when importing a simulation model based on the functional simulation interface FMI.
[0008] According to one aspect of an embodiment of the present invention, a method for importing a simulation model is provided, comprising: obtaining a simulation model to be imported, wherein the simulation model includes at least: an intermediate structure file for describing the internal working principle of the simulation model in a native environment; generating a description file that complies with the simulation standard required by a functional simulation interface based on the intermediate structure file, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into a method that complies with the simulation standard; packaging the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit complies with the simulation standard; in the simulation software, using an import function pre-designed according to the simulation standard to parse the functional simulation model unit, and adding the simulation model to the simulation software based on the parsed description file.
[0009] Optionally, generating a description file that complies with the simulation standard required by the functional simulation interface based on the intermediate structure file includes: obtaining a preset description file template, wherein the preset description file target at least describes a conversion method for converting the internal working principle in the native environment into a file that complies with the simulation standard; and converting the intermediate structure file into the description file according to the preset description text template.
[0010] Optionally, packaging the description file and the simulation model to obtain a functional simulation model unit includes: placing the simulation model into a preset folder; compiling the preset folder using a preset compiler to generate a dynamic link library; and packaging the description file and the dynamic link library to obtain the functional simulation model unit.
[0011] Optionally, placing the simulation model into a preset folder includes: obtaining an interface file pre-configured for the simulation model, wherein the interface file supports the functional simulation interface; placing the interface file and the intermediate structure file into the preset folder, wherein the intermediate structure file can be called by the simulation software with the support of the interface file.
[0012] Optionally, in the simulation software, the functional simulation model unit is parsed using an import function pre-designed according to the simulation standard, and the simulation model is added to the simulation software based on the parsed description file, including: in the simulation software, the functional simulation model unit is parsed using the import function to obtain the description file and the simulation model; the intermediate structure file in the simulation model is parsed using the description file to obtain variable information that meets the simulation standard, wherein the variable information is determined based on the variables of the simulation model that describe the working principle of the content in the native scenario; and the simulation model is added to the simulation software according to the variable information.
[0013] Optionally, after using the description file to parse the intermediate structure file in the simulation model to obtain variable information that meets the simulation standard, the method also includes: using an information configuration page to display the variable information; receiving setting instructions for the variable information through the information configuration page; and updating the variable information based on the setting instructions.
[0014] Optionally, in the simulation software, after the functional simulation model unit is parsed using an import function designed in advance according to the simulation standard, and the simulation model is added to the simulation software based on the parsed description file, the method further includes: combining the simulation model with a preset model through the simulation software to obtain a joint model, wherein the preset model meets the simulation standard; determining the combination relationship between the simulation model and the preset model in the joint model, wherein the combination relationship is at least used to indicate that the output end of the simulation model is connected to the input end of the preset model, or the output end of the preset model is connected to the input end of the simulation model; assigning priorities to the simulation model and the preset model according to the combination relationship, wherein, when the output end of the simulation model is connected to the input end of the preset model, the priority of the simulation model is higher than the priority of the preset model, and when the output end of the preset model is connected to the input end of the simulation model, the priority of the preset model is higher than the priority of the simulation model; and calculating the simulation results of the simulation model and the preset model one by one in descending order of the priorities.
[0015] According to another aspect of an embodiment of the present invention, a simulation model importing device is also provided, including: an acquisition module for acquiring the simulation model to be imported, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in a native environment; a generation module for generating a description file that complies with the simulation standard required by the functional simulation interface based on the intermediate structure file, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into a method that complies with the simulation standard; a packaging module for packaging the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit complies with the simulation standard; an import module for parsing the functional simulation model unit in the simulation software using an import function pre-designed according to the simulation standard, and adding the simulation model to the simulation software based on the parsed description file.
[0016] According to another aspect of an embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-mentioned simulation model importing method through the computer program.
[0017] According to another aspect of an embodiment of the present invention, a computer program product is further provided, comprising computer instructions, which implement the steps of the above-mentioned simulation model importing method when executed by a processor.
[0018] In an embodiment of the present invention, a simulation model to be imported is obtained, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in a native environment; based on the intermediate structure file, a description file that meets the simulation standard required by the functional simulation interface is generated, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into one that meets the simulation standard; the description file and the simulation model are packaged to obtain a functional simulation model unit, wherein the functional simulation model unit meets the simulation standard; in the simulation software, the functional simulation model unit is parsed using an import function pre-designed according to the simulation standard, and the simulation model is added to the simulation software based on the parsed description file, thereby achieving the purpose of converting the internal working principle of the simulation model into a unified simulation standard, and importing simulation models in different native environments into the simulation software, thereby achieving the technical effect of compatibility with simulation models in different native environments, thereby solving the situation where the simulation model is imported based on the functional simulation interface FMI, and there is a technical problem of incompatibility between the functional simulation interface and the simulation model to be imported. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0020] Figure 1 is a flow chart of a method for importing a simulation model according to an embodiment of the present invention;
[0021] Figure 2 is a schematic diagram of a method for generating a functional prototype unit and importing it into simulation software according to an embodiment of the present invention;
[0022] Figure 3 This is a schematic diagram of a method for importing a functional prototype unit into simulation software according to an embodiment of the present invention. Figure 1 ;
[0023] Figure 4 This is a schematic diagram of a method for importing a functional prototype unit into simulation software according to an embodiment of the present invention. Figure 2 ;
[0024] Figure 5 is a schematic diagram of an introduction device for a simulation model according to an embodiment of the present invention;
[0025] Figure 6 It is a structural block diagram of a computer terminal according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] According to an embodiment of the present invention, an embodiment of a method for importing a simulation model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0029] Figure 1 is a flow chart of a method for importing a simulation model according to an embodiment of the present invention, such as Figure 1 As shown, the method includes the following steps:
[0030] Step S102: obtaining a simulation model to be imported, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in a native environment;
[0031] Step S104: generating a description file that complies with the simulation standard required by the functional simulation interface based on the intermediate structure file, wherein the description file is at least used to indicate a conversion method for converting the internal working principle of the native environment into one that complies with the simulation standard;
[0032] Step S106, packaging the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit complies with the simulation standard;
[0033] Step S108 , in the simulation software, using the import function designed in advance according to the simulation standard to parse the functional simulation model unit, and adding the simulation model to the simulation software based on the parsed description file.
[0034] In an embodiment of the present invention, a simulation model to be imported is obtained, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in a native environment; based on the intermediate structure file, a description file that meets the simulation standard required by the functional simulation interface is generated, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into one that meets the simulation standard; the description file and the simulation model are packaged to obtain a functional simulation model unit, wherein the functional simulation model unit meets the simulation standard; in the simulation software, the functional simulation model unit is parsed using an import function pre-designed according to the simulation standard, and the simulation model is added to the simulation software based on the parsed description file, thereby achieving the purpose of converting the internal working principle of the simulation model into a unified simulation standard, and importing simulation models in different native environments into the simulation software, thereby achieving the technical effect of compatibility with simulation models in different native environments, thereby solving the situation where the simulation model is imported based on the functional simulation interface FMI, and there is a technical problem of incompatibility between the functional simulation interface and the simulation model to be imported.
[0035] For example, when a power system model originally running in the Matlab / Simulink environment needs to be imported into a general system simulation software, the model's architecture, parameters, and algorithm logic can be recorded in detail by using a specific intermediate structure file (such as an XML description file); then, according to the requirements of the functional simulation interface, a description file is generated. This file contains information on how to map variables and functions in the native environment to the target simulation software. This process not only realizes the format conversion of the model, but also ensures the accurate and lossless transmission of the model functions; finally, by packaging and importing it into the simulation software, users can run and compare models from different native environments on a unified platform, greatly improving the efficiency and flexibility of cross-platform model reuse.
[0036] In addition, the above method is also applicable to various types of simulation models, including but not limited to mechanical, electronic, chemical and biological system models, further broadening its application scope.
[0037] In the above step S102, the intermediate structure file in the simulation model generally refers to the internal architecture of the model or the intermediate computing layer of the model, which is used to describe the internal working principle of the model, including the various components in the model, the connections between these components, and how they interact to simulate the behavior of the system.
[0038] In the above step S104, the functional simulation interface is Functional Mock-up Interface (FMI), and the simulation standard is the FMI standard.
[0039] In the above step S106 , the functional simulation model unit is a Functional Mock-up Unit (FMU).
[0040] As an optional embodiment, generating a description file that meets the simulation standards required by the functional simulation interface based on the intermediate structure file includes: obtaining a preset description file template, wherein the preset description file target at least describes a conversion method for converting the internal working principles in the native environment into one that meets the simulation standards; and converting the intermediate structure file into a description file according to the preset description text template.
[0041] In the above-mentioned embodiment of the present application, the use of a preset description file template greatly simplifies the description file creation process and ensures the accuracy and consistency of the conversion. Through this template, even users who are unfamiliar with the target simulation software can easily complete the conversion and avoid errors introduced by manually writing description files. This method not only improves the efficiency of model conversion, but also reduces the need for professional skills, thereby promoting the sharing and application of simulation models in a wider range of fields.
[0042] For example, when importing a vehicle dynamics model from the CarSim environment into other simulation software, the preset description file template can contain a set of standardized tags and attributes to describe the model's physical properties, input and output ports, and how it connects to other models.
[0043] This method is also applicable to architectural physics models, fluid dynamics models, etc. Its standardized conversion process ensures the accuracy and reliability of the model.
[0044] As an optional embodiment, packaging the description file and the simulation model to obtain a functional simulation model unit includes: placing the simulation model into a preset folder; using a preset compiler to compile the preset folder to generate a dynamic link library; packaging the description file and the dynamic link library to obtain a functional simulation model unit.
[0045] In the above embodiments of the present application, the process of packaging the simulation model and description file into a functional simulation model unit ensures the integrity and portability of the model. The simulation model and description file are packaged together to form a functional simulation model unit that can be directly recognized and loaded by the simulation software. This not only simplifies the deployment and management of the model, but also allows the model to run on different hardware and operating systems, improving the versatility and usability of the model. This packaging strategy is also applicable to robot kinematic models, signal processing models, etc. Its encapsulation helps protect the intellectual property rights of the model while promoting the efficient distribution and use of the model.
[0046] For example, a complex aircraft control model might contain a large amount of C / C++ code and detailed parameter configuration. Placing it in a preset folder and compiling it with a preset compiler (such as GCC) generates a dynamic link library (DLL) that encapsulates all the model's functionality while maintaining compatibility with the native environment.
[0047] As an optional embodiment, placing the simulation model into a preset folder includes: obtaining an interface file pre-configured for the simulation model, wherein the interface file supports a functional simulation interface; placing the interface file and the intermediate structure file into a preset folder, wherein the intermediate structure file can be called by the simulation software with the support of the interface file.
[0048] In the above embodiments of the present application, the configuration of the interface file is a key step to ensure that the model is correctly loaded and run. The interface file will guide the simulation software on how to correctly call the model to ensure that the model can run stably in the new environment. By including the interface file and the intermediate structure file in the preset folder at the same time, the model import process becomes more automated and reliable, reducing the need for human intervention and improving the success rate and efficiency of model import.
[0049] For example, for a Python-based machine learning model, a pre-configured interface file can define the model's input and output formats, required library file paths, and initialization and termination functions.
[0050] The configuration strategy of the above interface file is also applicable to models built in programming languages such as Java and Rust. Its standardized interface definition helps the cross-platform compatibility of the model and promotes the integration and collaborative work of multidisciplinary simulation models.
[0051] As an optional embodiment, in the simulation software, an import function designed in advance according to the simulation standard is used to parse the functional simulation model unit, and the simulation model is added to the simulation software based on the parsed description file, including: in the simulation software, the functional simulation model unit is parsed using the import function to obtain a description file and a simulation model; the intermediate structure file in the simulation model is parsed using the description file to obtain variable information that meets the simulation standard, wherein the variable information is determined based on the variables that describe the working principle of the content of the simulation model in the native scenario; according to the variable information, the simulation model is added to the simulation software.
[0052] In the above-mentioned embodiment of the present application, the import function of the simulation software can automatically identify and load the model by parsing the functional simulation model unit. This process is based on the variable information recorded in the description file. In this way, even if there are differences between the native environment of the model and the target software, the core functions and parameters of the model can be accurately retained. This not only simplifies the model import process, but also ensures the accuracy and consistency of the model, providing a convenient model exchange and cooperation platform for experts in different fields.
[0053] For example, the description file of an electromagnetic field model native to ANSYS will list in detail all the variables in the model, including mesh size, material properties, boundary conditions, etc., and explain how these variables are mapped to the standard variables of the target simulation software.
[0054] The above technology is also applicable to importing CAD models, finite element models, etc. into general simulation software. Its automated variable mapping mechanism significantly improves the efficiency and accuracy of model import.
[0055] As an optional embodiment, after using the description file to parse the intermediate structure file in the simulation model to obtain variable information that meets the simulation standard, the method also includes: using the information configuration page to display the variable information; receiving the setting instructions of the variable information through the information configuration page; and updating the variable information based on the setting instructions.
[0056] In the above-mentioned embodiments of the present application, the introduction of the information configuration page enables users to intuitively view and adjust the parameters of the model, thereby enhancing the configurability of the model and the user experience. The setting instructions obtained through the information configuration page can update the variable information in the model in real time without recompiling the model, which greatly improves the speed of model debugging and optimization. It not only improves the convenience of model use, but also promotes the personalized customization of the model to meet the specific needs of different researchers and engineers.
[0057] For example, when simulating a complex climate model, the information configuration page can display key variables in the model, such as temperature, humidity, wind speed, etc., and allow users to adjust the values of these variables according to experimental requirements or hypothetical scenarios.
[0058] This technology is also applicable to economic models, ecological models, etc. Its dynamic parameter adjustment capability helps to deeply explore the behavior of the model under different conditions and promotes the development of simulation science.
[0059] As an optional embodiment, in the simulation software, after using the import function designed in advance according to the simulation standard to parse the functional simulation model unit, and adding the simulation model to the simulation software based on the parsed description file, the method also includes: combining the simulation model with the preset model through the simulation software to obtain a joint model, wherein the preset model meets the simulation standard; determining the combination relationship between the simulation model and the preset model in the joint model, wherein the combination relationship is at least used to indicate that the output end of the simulation model is connected to the input end of the preset model, or the output end of the preset model is connected to the input end of the simulation model; assigning priorities to the simulation model and the preset model according to the combination relationship, wherein when the output end of the simulation model is connected to the input end of the preset model, the priority of the simulation model is higher than the priority of the preset model, and when the output end of the preset model is connected to the input end of the simulation model, the priority of the preset model is higher than the priority of the simulation model; and calculating the simulation results of the simulation model and the preset model one by one in order of priority from high to low.
[0060] In the above-mentioned embodiment of the present application, the introduction of the information configuration page enables users to intuitively view and adjust the parameters of the model, thereby enhancing the configurability of the model and the user experience. The setting instructions obtained through the information configuration page can update the variable information in the model in real time without recompiling the model, which greatly improves the speed of model debugging and optimization. This method not only improves the convenience of model use, but also promotes the personalized customization of the model to meet the specific needs of different researchers and engineers.
[0061] For example, when simulating a complex climate model, the information configuration page can display key variables in the model, such as temperature, humidity, wind speed, etc., and allow users to adjust the values of these variables according to experimental requirements or hypothetical scenarios.
[0062] This technology is also applicable to economic models, ecological models, etc. Its dynamic parameter adjustment capability helps to deeply explore the behavior of the model under different conditions and promotes the development of simulation science.
[0063] The present invention also provides an optional embodiment, which provides a model encapsulation, import, calculation and joint simulation method based on the FunctionalMock-up Interface standard.
[0064] Figure 2 FIG. 1 is a schematic diagram of a method for generating a functional prototype unit and importing it into simulation software according to an embodiment of the present invention. Figure 2 As shown, the method includes the following steps:
[0065] Step S201 : determining a simulation model to be packaged, wherein the simulation model includes: a model body, an intermediate structure, and an interface file of a Functional Mock-up Interface (FMI).
[0066] Step S202: Generate a description file using the description file template of the FMI standard and the intermediate structure file corresponding to the intermediate structure.
[0067] Step S203, adding the intermediate structure file, FMI interface file and user code to a designated folder;
[0068] Step S204: calling a compiler to compile the contents in the designated folder to generate a dynamic link library file.
[0069] Step S205 : According to the user's operation instruction, the description file and the dynamic link library file are packaged to obtain a Functional Mock-up Unit (ie, FMU).
[0070] In step S206, in the simulation software, the import function designed according to the Functional Mock-up Interface standard is used to parse the Functional Mock-up Unit content, add it to the calculation unit of the simulation software, and submit the underlying calculation as a whole.
[0071] The above-mentioned embodiments of the present application realize the encapsulation of user code into a Functional Mock-up Unit, wherein the Functional Mock-up Unit can be imported and run by simulation software, thereby realizing joint simulation of multiple simulations.
[0072] As an optional embodiment, a method for importing a functional prototype unit into simulation software includes the following steps:
[0073] Step S1: Generate a description file for the simulation model to be packaged.
[0074] Step S2, generating a dynamic link library using the intermediate structure file, the FMI interface file and the user code file.
[0075] Step S3: Pack the description file and the dynamic link library to obtain the FMU.
[0076] Step S4: Design the import function according to the FMI standard and import it into the simulation software.
[0077] Step S5: submit the bottom layer to perform simulation calculations in conjunction with other simulation models.
[0078] In the above step S1, the model file to be encapsulated (i.e., the simulation model) needs to include: the model body, intermediate structure and Functional Mock-up Interface interface of the simulation model. On this basis, the file template and intermediate structure described by the FMI standard are used to generate the intermediate structure file.
[0079] Figure 3 This is a schematic diagram of a method for importing a functional prototype unit into simulation software according to an embodiment of the present invention. Figure 1 ,like Figure 3 As shown, the specific process of the above step S4 includes:
[0080] In step S301 , the user selects an FMU file to be imported into the simulation software, opens the FMU file selected by the user, and prepares to read data.
[0081] Step S302, find the description file in the FMU, read the variable information of the simulation model from the description file, mainly read the name of the variable, the variable type used to determine whether the variable is a parameter, intermediate variable, input variable or output variable, and the data type of the variable.
[0082] Step S303: The read variable information is presented to the user. The user sets the value of the variable according to the information and selects the variable to be input or output (ie, determines the user code file).
[0083] In step S304, the user connects the output of other models to the input of the FMU, or connects the output of the FMU to the input of other models, to achieve joint operation of multiple solution models.
[0084] Figure 4 This is a schematic diagram of a method for importing a functional prototype unit into simulation software according to an embodiment of the present invention. Figure 2,like Figure 4 As shown, the specific process of the above step S5 includes:
[0085] Step S401 : Integrate the complete FMU model and other models into a new model.
[0086] Step S402 : Calculate the simulation priority according to the input and output connection relationship of the units in the new model.
[0087] Step S403 , the simulation results are calculated one by one according to the priority, wherein the units imported by the FMU call the dynamic link library to calculate the results, and the units inside the simulation software use their own methods to calculate the results.
[0088] Step S404: Select information required by the solver from the calculation results and provide it to the solver to advance the simulation.
[0089] In step S405, the solver determines whether the simulation has reached the end time. If so, the simulation ends; if not, the solver returns to step S402.
[0090] According to an embodiment of the present invention, an embodiment of a device for importing a simulation model is also provided. It should be noted that the device for importing a simulation model can be used to execute the method for importing a simulation model in an embodiment of the present invention, and the method for importing a simulation model in an embodiment of the present invention can be executed in the device for importing a simulation model.
[0091] Figure 5 is a schematic diagram of an introduction device for a simulation model according to an embodiment of the present invention, such as Figure 5 As shown, the device may include: an acquisition module 52, used to acquire the simulation model to be imported, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in the native environment; a generation module 54, used to generate a description file that meets the simulation standard required by the functional simulation interface based on the intermediate structure file, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into one that meets the simulation standard; a packaging module 56, used to package the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit meets the simulation standard; an import module 58, used to parse the functional simulation model unit in the simulation software using an import function pre-designed according to the simulation standard, and add the simulation model to the simulation software based on the parsed description file.
[0092] It should be noted that the acquisition module 52 in this embodiment can be used to execute step S102 in the embodiment of the present application, the generation module 54 in this embodiment can be used to execute step S104 in the embodiment of the present application, the packaging module 56 in this embodiment can be used to execute step S106 in the embodiment of the present application, and the import module 58 in this embodiment can be used to execute step S108 in the embodiment of the present application. The examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments.
[0093] In an embodiment of the present invention, a simulation model to be imported is obtained, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in a native environment; based on the intermediate structure file, a description file that meets the simulation standard required by the functional simulation interface is generated, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into one that meets the simulation standard; the description file and the simulation model are packaged to obtain a functional simulation model unit, wherein the functional simulation model unit meets the simulation standard; in the simulation software, the functional simulation model unit is parsed using an import function pre-designed according to the simulation standard, and the simulation model is added to the simulation software based on the parsed description file, thereby achieving the purpose of converting the internal working principle of the simulation model into a unified simulation standard, and importing simulation models in different native environments into the simulation software, thereby achieving the technical effect of compatibility with simulation models in different native environments, thereby solving the situation where the simulation model is imported based on the functional simulation interface FMI, and there is a technical problem of incompatibility between the functional simulation interface and the simulation model to be imported.
[0094] As an optional embodiment, the generation module includes: an acquisition unit for acquiring a preset description file template, wherein the preset description file target at least describes a conversion method for converting the internal working principle of the native environment into one that complies with the simulation standard; a conversion unit for converting the intermediate structure file into a description file according to the preset description text template.
[0095] As an optional embodiment, the packaging module includes: a placement unit for placing the simulation model into a preset folder; a generation unit for compiling the preset folder using a preset compiler to generate a dynamic link library; and a packaging unit for packaging the description file and the dynamic link library to obtain a functional simulation model unit.
[0096] As an optional embodiment, the placement unit includes: an acquisition sub-unit, used to obtain an interface file pre-configured for the simulation model, wherein the interface file supports a functional simulation interface; a placement sub-unit, used to place the interface file and the intermediate structure file into a preset folder, wherein the intermediate structure file can be called by the simulation software with the support of the interface file.
[0097] As an optional embodiment, the import module includes: a first parsing unit, used to use the import function to parse the functional simulation model unit in the simulation software to obtain a description file and a simulation model; a second parsing unit, used to use the description file to parse the intermediate structure file in the simulation model to obtain variable information that meets the simulation standard, wherein the variable information is determined based on the variables that describe the working principle of the content of the simulation model in the native scenario; and an adding unit, used to add the simulation model to the simulation software according to the variable information.
[0098] As an optional embodiment, the device also includes: a display unit, which is used to parse the intermediate structure file in the simulation model using the description file, obtain variable information that meets the simulation standard, and then use the information configuration page to display the variable information; a receiving unit, which is used to receive the setting instructions of the variable information through the information configuration page; and an updating unit, which is used to update the variable information based on the setting instructions.
[0099] As an optional embodiment, the device also includes: a combining submodule, which is used to parse the functional simulation model unit in the simulation software using an import function designed in advance according to the simulation standard, and after adding the simulation model to the simulation software based on the parsed description file, combine the simulation model with the preset model through the simulation software to obtain a combined model, wherein the preset model meets the simulation standard; a determining submodule, which is used to determine the combination relationship between the simulation model and the preset model in the combined model, wherein the combination relationship is at least used to indicate that the output end of the simulation model is connected to the input end of the preset model, or the output end of the preset model is connected to the input end of the simulation model; an allocating submodule, which is used to allocate priorities to the simulation model and the preset model according to the combination relationship, wherein when the output end of the simulation model is connected to the input end of the preset model, the priority of the simulation model is higher than the priority of the preset model, and when the output end of the preset model is connected to the input end of the simulation model, the priority of the preset model is higher than the priority of the simulation model; a calculating submodule, which is used to calculate the simulation results of the simulation model and the preset model one by one in order of priority from high to low.
[0100] An embodiment of the present invention may provide an electronic device, which may be a computer terminal, and the computer terminal may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced by a terminal device such as a mobile terminal.
[0101] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of a computer network.
[0102] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the simulation model import method: obtaining the simulation model to be imported, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in the native environment; generating a description file that complies with the simulation standard required by the functional simulation interface based on the intermediate structure file, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into one that complies with the simulation standard; packaging the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit complies with the simulation standard; in the simulation software, using the import function designed in advance according to the simulation standard to parse the functional simulation model unit, and adding the simulation model to the simulation software based on the parsed description file.
[0103] Figure 6 is a structural block diagram of a computer terminal according to an embodiment of the present invention, such as Figure 6 As shown, the computer terminal 600 may include: one or more (only one is shown in the figure) processors 602 and a memory 604.
[0104] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and device for importing the simulation model in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method for importing the simulation model. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the terminal 600 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0105] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: obtain the simulation model to be imported, wherein the simulation model at least includes: an intermediate structure file for describing the internal working principle of the simulation model in the native environment; based on the intermediate structure file, generate a description file that meets the simulation standard required by the functional simulation interface, wherein the description file is at least used to indicate the conversion method of converting the internal working principle in the native environment into one that meets the simulation standard; package the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit meets the simulation standard; in the simulation software, use the import function designed in advance according to the simulation standard to parse the functional simulation model unit, and add the simulation model to the simulation software based on the parsed description file.
[0106] Optionally, the processor may also execute the program code of the following steps: obtaining a preset description file template, wherein the preset description file target at least describes a conversion method for converting the internal working principle in the native environment into one that complies with the simulation standard; and converting the intermediate structure file into a description file according to the preset description text template.
[0107] Optionally, the processor may also execute the program code of the following steps: placing the simulation model into a preset folder; compiling the preset folder using a preset compiler to generate a dynamic link library; packaging the description file and the dynamic link library to obtain a functional simulation model unit.
[0108] Optionally, the above-mentioned processor can also execute the program code of the following steps: obtaining an interface file pre-configured for the simulation model, wherein the interface file supports a functional simulation interface; placing the interface file and the intermediate structure file into a preset folder, wherein the intermediate structure file can be called by the simulation software with the support of the interface file.
[0109] Optionally, the above-mentioned processor can also execute the program code of the following steps: in the simulation software, use the import function to parse the functional simulation model unit to obtain a description file and a simulation model; use the description file to parse the intermediate structure file in the simulation model to obtain variable information that meets the simulation standard, wherein the variable information is determined based on the variables that describe the working principle of the content of the simulation model in the native scenario; according to the variable information, the simulation model is added to the simulation software.
[0110] Optionally, the processor may further execute program code of the following steps: displaying variable information using an information configuration page; receiving a setting instruction for the variable information through the information configuration page; and updating the variable information based on the setting instruction.
[0111] Optionally, the processor may also execute the program code of the following steps: combining the simulation model and the preset model through simulation software to obtain a joint model, wherein the preset model meets the simulation standard; determining the combination relationship between the simulation model and the preset model in the joint model, wherein the combination relationship is at least used to indicate that the output end of the simulation model is connected to the input end of the preset model, or the output end of the preset model is connected to the input end of the simulation model; assigning priorities to the simulation model and the preset model according to the combination relationship, wherein, when the output end of the simulation model is connected to the input end of the preset model, the priority of the simulation model is higher than the priority of the preset model, and when the output end of the preset model is connected to the input end of the simulation model, the priority of the preset model is higher than the priority of the simulation model; and calculating the simulation results of the simulation model and the preset model one by one in descending order of priority.
[0112] It can be understood by those skilled in the art that Figure 6 The structure shown is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 6 It does not limit the structure of the above electronic device. For example, the computer terminal 60 may also include Figure 6 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 6 Different configurations shown.
[0113] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a computer program. The computer program can be stored in a non-volatile medium. The non-volatile storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0114] The embodiment of the present invention further provides a non-volatile storage medium. Optionally, in this embodiment, the non-volatile storage medium can be used to store the program code executed by the simulation model importing method provided in the above embodiment.
[0115] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0116] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for executing the following steps: obtaining a simulation model to be imported, wherein the simulation model includes at least: an intermediate structure file for describing the internal working principle of the simulation model in a native environment; generating a description file that complies with the simulation standard required by the functional simulation interface based on the intermediate structure file, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into one that complies with the simulation standard; packaging the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit complies with the simulation standard; in the simulation software, using an import function pre-designed according to the simulation standard to parse the functional simulation model unit, and adding the simulation model to the simulation software based on the parsed description file.
[0117] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: obtaining a preset description file template, wherein the preset description file target at least describes a conversion method for converting the internal working principle in the native environment into one that complies with the simulation standard; and converting the intermediate structure file into a description file according to the preset description text template.
[0118] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: placing the simulation model into a preset folder; compiling the preset folder using a preset compiler to generate a dynamic link library; packaging the description file and the dynamic link library to obtain a functional simulation model unit.
[0119] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for executing the following steps: obtaining an interface file pre-configured for the simulation model, wherein the interface file supports a functional simulation interface; placing the interface file and the intermediate structure file into a preset folder, wherein the intermediate structure file can be called by the simulation software with the support of the interface file.
[0120] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for executing the following steps: in the simulation software, use the import function to parse the functional simulation model unit to obtain a description file and a simulation model; use the description file to parse the intermediate structure file in the simulation model to obtain variable information that meets the simulation standard, wherein the variable information is determined based on the variables that describe the working principle of the content of the simulation model in the native scenario; according to the variable information, add the simulation model to the simulation software.
[0121] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for executing the following steps: displaying variable information using an information configuration page; receiving setting instructions for variable information through the information configuration page; and updating variable information based on the setting instructions.
[0122] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: combining the simulation model and the preset model through simulation software to obtain a joint model, wherein the preset model meets the simulation standard; determining the combination relationship between the simulation model and the preset model in the joint model, wherein the combination relationship is at least used to indicate that the output end of the simulation model is connected to the input end of the preset model, or the output end of the preset model is connected to the input end of the simulation model; assigning priorities to the simulation model and the preset model according to the combination relationship, wherein when the output end of the simulation model is connected to the input end of the preset model, the priority of the simulation model is higher than the priority of the preset model, and when the output end of the preset model is connected to the input end of the simulation model, the priority of the preset model is higher than the priority of the simulation model; and calculating the simulation results of the simulation model and the preset model one by one in order of priority from high to low.
[0123] An embodiment of the present invention further provides a computer program product, including a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, the steps of the simulation model importing method provided in the above embodiment are implemented.
[0124] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0125] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0126] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0127] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0128] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0129] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a non-volatile storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program code.
[0130] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for importing a simulation model, characterized in that: include: Acquire a simulation model to be imported, wherein the simulation model at least includes: an intermediate structure file for describing an internal working principle of the simulation model in a native environment; Generating, based on the intermediate structure file, a description file that complies with the simulation standard required by the functional simulation interface, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into a method that complies with the simulation standard; Packaging the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit complies with the simulation standard; In the simulation software, the functional simulation model unit is parsed using an import function pre-designed according to the simulation standard, and the simulation model is added to the simulation software based on the parsed description file.
2. The method according to claim 1, characterized in that Generating a description file that complies with the simulation standard required by the functional simulation interface according to the intermediate structure file includes: Obtaining a preset description file template, wherein the preset description file target at least describes a conversion method for converting the internal working principle in the native environment into a method that complies with the simulation standard; According to the preset description text template, the intermediate structure file is converted into the description file.
3. The method according to claim 1, characterized in that The description file and the simulation model are packaged to obtain a functional simulation model unit including: Put the simulation model into a preset folder; Compile the preset folder using a preset compiler to generate a dynamic link library; The description file and the dynamic link library are packaged to obtain the functional simulation model unit.
4. The method according to claim 3, characterized in that Placing the simulation model into a preset folder includes: Obtaining an interface file pre-configured for the simulation model, wherein the interface file supports the functional simulation interface; The interface file and the intermediate structure file are placed in the preset folder, wherein the intermediate structure file can be called by the simulation software with the support of the interface file.
5. The method according to claim 1, wherein In the simulation software, using an import function pre-designed according to the simulation standard to parse the functional simulation model unit, and adding the simulation model to the simulation software based on the parsed description file includes: In the simulation software, the functional simulation model unit is parsed using the import function to obtain the description file and the simulation model; Parsing the intermediate structure file in the simulation model using the description file to obtain variable information that meets the simulation standard, wherein the variable information is determined based on variables in the simulation model that describe a working principle of the content in the native scenario; According to the variable information, the simulation model is added to the simulation software.
6. The method according to claim 5, characterized in that After parsing the intermediate structure file in the simulation model using the description file to obtain variable information that meets the simulation standard, the method further includes: Use the information configuration page to display the variable information; receiving a setting instruction for the variable information through the information configuration page; The variable information is updated based on the setting instruction.
7. The method according to claim 1, characterized in that In the simulation software, after parsing the functional simulation model unit using an import function pre-designed according to the simulation standard and adding the simulation model to the simulation software based on the parsed description file, the method further includes: Combining the simulation model with a preset model using the simulation software to obtain a joint model, wherein the preset model meets the simulation standard; Determining a combination relationship between the simulation model and the preset model in the joint model, wherein the combination relationship is at least used to indicate that an output end of the simulation model is connected to an input end of the preset model, or an output end of the preset model is connected to an input end of the simulation model; Assigning priorities to the simulation model and the preset model according to the combination relationship, wherein, when the output end of the simulation model is connected to the input end of the preset model, the priority of the simulation model is higher than the priority of the preset model; and when the output end of the preset model is connected to the input end of the simulation model, the priority of the preset model is higher than the priority of the simulation model; The simulation results of the simulation model and the preset model are calculated one by one in descending order of the priorities.
8. A device for introducing a simulation model, characterized in that: include: An acquisition module, configured to acquire a simulation model to be imported, wherein the simulation model at least includes: an intermediate structure file for describing an internal working principle of the simulation model in a native environment; a generating module, configured to generate, based on the intermediate structure file, a description file that complies with the simulation standard required by the functional simulation interface, wherein the description file is at least used to indicate a conversion method for converting the internal working principle in the native environment into a method that complies with the simulation standard; a packaging module, configured to package the description file and the simulation model to obtain a functional simulation model unit, wherein the functional simulation model unit complies with the simulation standard; An import module is used to parse the functional simulation model unit in the simulation software using an import function pre-designed according to the simulation standard, and add the simulation model to the simulation software based on the parsed description file.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the simulation model importing method according to any one of claims 1 to 7 through the computer program.
10. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the simulation model importing method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Simulation control model generation method and device and computer equipment
CN120928724A
Simulation control model generation method and device and computer equipment
CN120928724B