Modelica-Based FMU Integration Method, System, Device and Medium

Through the FMU integration method based on the Modelica language, the maintenance problem of modeling and simulation tools when facing the update of FMI specifications is solved, and efficient and flexible model text generation and cross-platform system model construction are achieved.

CN120029654BActive Publication Date: 2025-07-18武汉鼎元同立科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing modeling and simulation tools have increased maintenance difficulty and complexity when facing the constantly updated FMI specifications, making it difficult to efficiently support the needs of the latest specifications.

Method used

The FMU integration method based on the Modelica language is adopted, and the original FMU file is configured in response to user configuration instructions, the FMU configuration file is generated, and the Modelica model text framework content, model description file and FMU configuration file in the target import template are integrated to generate Modelica model text that meets the updated FMI specifications or specific needs.

Benefits of technology

It realizes that when the FMI specification version is updated, there is no need to modify the tool itself, but only needs to adjust the import template, which reduces the difficulty and complexity of tool maintenance, and supports the construction of complex system models across multiple fields and across platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029654B_ABST
    Figure CN120029654B_ABST
Patent Text Reader

Abstract

The present application relates to the field of industrial Internet system modeling and simulation technologies, and discloses an FMU integration method, system, device, and medium based on Modelica, including: responding to a user configuration instruction, configuring an original FMU file to generate an FMU configuration file; integrating the Modelica model text framework content defined in an import template, the model description file in the original FMU file, and the FMU configuration file to obtain a Modelica model text. The present application can, under the condition of FMI specification version update or specific requirements, only add or adjust the import template to generate a Modelica model text that conforms to the updated FMI specification or specific requirements, realizing efficient and flexible support for the continuously updated FMI specification and specific requirements. The present application can be seamlessly integrated with other Modelica models, facilitating the construction of multi-domain cross-platform system models.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of industrial Internet system modeling and simulation, and particularly to an FMU integration method, system, device, and medium based on Modelica. Background Art

[0002] With the progress of modeling and simulation technology, changes in industry requirements, and the continuous advancement of standardization work, the FMI specification has been continuously updated. Therefore, modeling and simulation tools need to continuously adapt to the new specification content to support the latest specification, which increases the maintenance difficulty and complexity of the tools. Therefore, how to efficiently support the continuously updated FMI specification has become an important challenge faced by current modeling and simulation tools. Summary of the Invention

[0003] The main purpose of this application is to provide an FMU integration method, system, device, and medium based on Modelica, aiming to solve the technical problem of how to flexibly and efficiently perform FMU integration to support the continuously updated FMI specification or user requirements.

[0004] The first aspect of this application provides an FMU integration method based on the Modelica language. The FMU integration method based on the Modelica language includes:

[0005] Responding to a user configuration instruction, configuring the original FMU file to generate an FMU configuration file;

[0006] Integrating the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file to obtain the target Modelica model text, where the target import template can be adjusted according to the updated FMI specification or user requirements.

[0007] This application also provides an FMU integration system based on the Modelica language. The FMU integration system based on the Modelica language includes: an FMU integration configuration module and a conversion module;

[0008] The FMU integration configuration module is used to respond to a user configuration instruction, configure the original FMU file, and generate an FMU configuration file;

[0009] The conversion module is used to integrate the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file to obtain the target Modelica model text, where the target import template can be adjusted according to the updated FMI specification or user requirements.

[0010] A third aspect of the present application provides a computer device, including: a memory and at least one processor, wherein instructions are stored in the memory; the at least one processor invokes the instructions in the memory to cause the computer device to execute the above-mentioned FMU integration method based on the Modelica language.

[0011] A fourth aspect of the present application provides a computer-readable storage medium, in which instructions are stored, and when it runs on a computer, it causes the computer to execute the above-mentioned FMU integration method based on the Modelica language.

[0012] The FMU integration solution based on the Modelica language provided by the present application is applicable to the FMU integration system of complex system models. When the FMI specification version is updated or under specific requirements, without modifying the tool itself, only by adding or adjusting the import template, it is possible to generate Modelica model texts that conform to the updated FMI specification or specific requirements, thereby realizing efficient and flexible support for the continuously updated FMI specification and specific requirements, and reducing the maintenance difficulty and complexity of the tool. Based on the Modelica language, this embodiment can be seamlessly integrated with other Modelica models, facilitating the construction of complex system models across multiple domains and platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a schematic flowchart of the first embodiment of the FMU integration method based on the Modelica language in the embodiments of the present application;

[0014] Figure 2 It is a schematic flowchart of the second embodiment of the FMU integration method based on the Modelica language in the embodiments of the present application;

[0015] Figure 3 It is a schematic diagram of a visualization configuration interface in an embodiment of the present application;

[0016] Figure 4 It is a schematic diagram of the functional modules of an embodiment of the FMU integration system based on the Modelica language in the embodiments of the present application;

[0017] Figure 5 It is an integration schematic diagram of the FMU integration system based on the Modelica language in the embodiments of the present application;

[0018] Figure 6 It is a schematic diagram of an embodiment of the computer device in the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

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

[0020] With the wide application of system modeling and simulation technology in industrial fields such as aviation, aerospace, automotive, and marine, the industrial community's demand for high-precision and high-efficiency system modeling and simulation tools is becoming increasingly urgent. However, the model compatibility between different modeling and simulation tools has become a bottleneck restricting technological development. As an equation-based modeling language, Modelica has gradually become the standard language in the field of system modeling and simulation due to its powerful cross-domain modeling ability and openness. To solve the model compatibility problem between different modeling and simulation tools, the Modelica Association has proposed the FMI (Functional Mock-up Interface) specification, which defines a standardized interface and file format (FMU, Functional Mock-Up Unit), and at the same time clarifies the meaning of all interfaces and how to call these interfaces for simulation. An FMU is a file format based on the FMI standard, which internally contains a model description file (modelDescription.xml) and a standardized interface implementation file (source code or binary library). Modeling and simulation tools can achieve model exchange and co-simulation between different modeling and simulation tools by integrating FMU files generated by other tools.

[0021] With the progress of modeling and simulation technology, the change of industry needs, and the continuous promotion of standardization work, the FMI specification has been continuously updated. Therefore, modeling and simulation tools need to continuously adapt to the new specification content to support the latest specification, which increases the maintenance difficulty and complexity of the tools. Therefore, how to efficiently support the continuously updated FMI specification has become an important challenge faced by current modeling and simulation tools.

[0022] Based on this, this application provides an FMU integration solution based on the Modelica language.

[0023] Refer to Figure 1, this application provides an FMU integration method based on the Modelica language. The FMU integration method based on the Modelica language includes:

[0024] S100: In response to a user configuration instruction, configure the original FMU file to generate an FMU configuration file.

[0025] Specifically, the original FMU file is the FMU file to be configured. The FMU file, i.e., the FMU model (Functional Mock-up Unit), is a model format based on the FMI (Functional Mock-up Interface) standard, mainly used for cross-platform simulation, debugging, and integration. The FMU model can encapsulate the functional model, making the model exchange and co-simulation between different platforms more efficient and standardized.

[0026] The original FMU file includes a model description file. By decompressing the original FMU file, the model description file (modelDescription.xml) can be extracted and parsed to obtain FMU-related information. The FMU-related information includes: the platform where the FMU file is generated, the version of the FMU, the model integration method, the implementation form, the simulation configuration, and variable information, etc.

[0027] For example, each field or variable in the original FMU file contains all selectable field values. For example, the original FMU file contains all field values of the FMU version: 1.0, 2.0, 3.0; the model integration method corresponds to field values such as ModelExchange (model exchange), Co-Simulation (co-simulation), etc.; the implementation form corresponds to field values such as binary, source code, etc.; the platform where the FMU file is generated corresponds to field values such as win32, win64, etc.

[0028] Before applying the FMU file to model simulation, it is necessary to configure the original FMU file first. Different users have different requirements for the FMU file. Therefore, this embodiment provides a configurable function for users to configure the original FMU file according to actual needs.

[0029] More specifically, the user configuration instruction can be sent to the computer device in the form of a command. For example, the user configuration instruction contains a configuration file, and the configuration file contains the user's specification or definition of the field values or other attributes (such as variable type, variable name, etc., not limited to this) of each field. Of course, the user configuration instruction can also be generated by receiving the user's configuration operation through a visual configuration interface.

[0030] The computer device parses and responds to user configuration instructions to configure the original FMU file, and then a customized FMU configuration file can be generated. The FMU configuration file is the FMU integrated configuration file.

[0031] The FMU configuration file records the configuration or specification of the field values or other attributes of each configurable field in the original FMU file by the user.

[0032] S200: Integrate the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file to obtain the target Modelica model text. Among them, the target import template can be adjusted according to the updated FMI specification or user requirements.

[0033] Specifically, the template execution engine can integrate the content in the import template and the model description file based on the FMU configuration file for translation and conversion into Modelica model text. More specifically, the template execution engine reads and, based on the FMU configuration file (integrated configuration), parses the model description file (modelDescription.xml) to filter out the target content to be written in the target import template, and integrates the FMU configuration file (integrated configuration), the parsed model description file, and the target content, or adjusts the target content based on the FMU configuration file (integrated configuration) and the parsed model description file and then writes it into the Modelica model file, thereby generating the target Modelica model text.

[0034] More specifically, the target import template contains the Modelica model text framework content written in the Modelica language. Different import templates can be set according to attributes such as the FMU version and the model integration method, and the target import template can be determined from multiple import templates according to the user configuration data. Of course, a general import template can also be set, and the present application does not limit this.

[0035] The target import template defines the framework content of the Modelica model text, but not all of the framework content in the target import template needs to be converted into Modelica model text. Instead, the matching framework content (target content) needs to be selectively written into the Modelica model file according to the FMU configuration file and the model description file. In addition, some content in the framework content of the Modelica model text (such as the matching framework content) needs to be adjusted according to the model data in the FMU configuration file and the model description file, such as filling, complementing, replacing, etc. Based on this, by integrating the Modelica model text framework content defined in the target import template, the FMU configuration file, and the model data in the model description file, the target Modelica model text is obtained.

[0036] In addition, the target import template is adjustable or modifiable. If the FMI specification version is updated, by adding or adjusting the import template without modifying the tool itself, and then regenerating the Modelica model text according to the modified or adjusted import template through the steps of this embodiment, the regenerated Modelica model text conforms to the updated FMI specification, thus achieving efficient and flexible support for the FMI specification and reducing the complexity of tool maintenance.

[0037] In addition, when debugging the integration function, only the corresponding import template needs to be modified, without modifying the software code and recompiling the software, which makes it have better debuggability.

[0038] The Modelica model text generated after the integration of this embodiment can be seamlessly integrated with other Modelica models, facilitating the construction of complex system models across multiple domains and platforms.

[0039] The FMU integration method based on the Modelica language in this embodiment is an FMU integration method that supports expandable templates of the Modelica language. Users can efficiently and flexibly integrate FMU files of different versions to build complex multi-domain cross-platform system models.

[0040] The FMU integration method based on the Modelica language in this embodiment can, when the FMI specification version is updated, only add or adjust the template without modifying the tool itself, thereby achieving efficient and flexible support for the FMI specification and reducing the complexity of tool maintenance. When there are specific requirements such as debugging the integration function, only the template file needs to be modified, without modifying the software code and recompiling the software, which has better debuggability.

[0041] This embodiment is applicable to the FMU integration system of complex system models. When the FMI specification version is updated or under specific requirements, without modifying the tool itself, only adding or adjusting the template can generate Modelica model text that conforms to the updated FMI specification or specific requirements, thereby achieving efficient and flexible support for the continuously updated FMI specification and specific requirements and reducing the maintenance difficulty and complexity of the tool. Based on the Modelica language, this embodiment can be seamlessly integrated with other Modelica models, facilitating the construction of complex system models across multiple domains and platforms.

[0042] In one embodiment, in step S200, the content of the Modelica model text framework defined in the target import template, the model description file and the FMU configuration file in the original FMU file are integrated to obtain the target Modelica model text, including:

[0043] Parse the target import template;

[0044] Write the immutable content in the recognized target import template to the Modelica model file to be written;

[0045] If the mutable content in the target import template is recognized, determine whether to write the mutable content based on the FMU configuration file and the model description file;

[0046] If it is determined that there is target content to be written in the mutable content, generate the model text to be written according to the model data and target content in the FMU configuration file and the model description file, and write the model text to be written to the Modelica model file to be written.

[0047] Specifically, the template execution engine parses the target import template byte by byte to recognize the mutable content and immutable content (fixed content) in the target import template.

[0048] The fixed part (immutable content) of the target import template includes: FMU interface function definitions, simulation auxiliary variable declarations, FMU object declarations, initialization processes, etc. data, which are the target content written in the Modelica model file to be written based on the Modelica language.

[0049] The immutable content of the target import template can be directly written to the Modelica model file to be written.

[0050] If the content parsed is the immutable content in the target import template, write the recognized immutable content in the target import template to the newly created or specified Modelica model file to be written.

[0051] The mutable part (mutable content) of the target import template includes: inputs, outputs, parameters, internal variable declarations, model single-step simulation processes, input variable value setting algorithms (codes), output variable value acquisition algorithms (codes), etc. data.

[0052] According to user requirements, when configuring the FMU file, the user can configure and select some fields in the model description file of the original FMU file, and some parameters or fields that are not needed can be unselected and not configured.

[0053] Correspondingly, the target import template contains sub-framework content corresponding to most parameters, fields, or variables in the model description file.

[0054] Therefore, it is necessary to determine which framework contents in the target import template need to be written into the Modelica model file to be written and which framework contents do not need to be written into the Modelica model file to be written according to the model parameters in the FMU configuration file and the model description file. That is, to judge whether the variable contents are written or not, and if they are to be written, which target contents in the variable contents need to be written, etc.

[0055] Based on this, generating the model text to be written according to the model data and target contents in the FMU configuration file and the model description file specifically includes: if the parsed content is the variable content in the target import template, then use the target contents determined to be written without adjustment in the variable content as the model text to be written and write it into the Modelica model file to be written.

[0056] Or, adjust the target contents that need to be adjusted (such as filling, complementing, or replacing, etc.) according to the model data in the FMU configuration file and the model description file, generate the model text to be written, and write the model text to be written into the Modelica model file to be written.

[0057] Among them, the target contents that need to be adjusted, for example, need to complement variable information such as the type and name of variables, or need to replace relevant variable contents such as the definition and reading / writing of model variables, and some may also need to assign values to variables, etc. And this variable information can be user-configured, so the corresponding variable information can be found in the model description file according to the FMU configuration file.

[0058] When parsing the import template byte by byte, a template keyword list will be established, and keyword matching will be performed in a loop during the parsing process. The corresponding model text will be processed and generated according to the matched keywords until the parsing of the import template file is completed.

[0059] Specifically, if the recognized content is used to indicate the end of parsing, stop parsing the target import template, and obtain the target Modelica model text according to the finally obtained Modelica model file.

[0060] More specifically, if the matched keyword is the end character, the parsing is completed, and the content in the finally obtained Modelica model file is the target Modelica model text.

[0061] According to the integration configuration information in the FMU configuration file and the actual model variable information (model data) in the model description file, this embodiment can quickly identify the variable and immutable content in the target import template, write the immutable content into the Modelica model file, perform a write judgment on the variable content, and generate the model text to be written based on the integration configuration information in the FMU configuration file, the actual model variable information (model data) in the model description file, and the target content when it is determined that the target content exists. It can quickly, accurately, and fully automate the integration of the FMU configuration file, the model description file, and the import template to obtain the Modelica model text.

[0062] In one embodiment, a write judgment on the variable content is performed based on the FMU configuration file and the model description file, including:

[0063] If the variable content includes conditional judgment logic, conditional judgment is performed on the conditional judgment logic based on the model data in the FMU configuration file and the model description file to obtain a conditional judgment result;

[0064] If the target branch execution logic text corresponding to the conditional judgment result is obtained from the conditional logic judgment, the target content to be written is obtained according to the target branch execution logic text.

[0065] Specifically, the variable content in the target import template may contain conditional judgment logic, and the conditional judgment logic includes conditional judgment statements (or, conditional expressions) and corresponding code blocks.

[0066] For example, the if statement is the simplest conditional judgment statement, which consists of three parts: the if keyword, the conditional expression, and the code block. The if statement selects whether to execute the corresponding code block according to the judgment result of the conditional expression.

[0067] If this embodiment determines that the conditional branch logic or conditional judgment logic is matched according to the matched keyword, it uses the model information obtained from the model description file modelDescription.xml according to the FMU configuration file to judge whether each branch condition in the conditional logic judgment is satisfied. If it is determined that a certain target branch condition is satisfied according to the obtained conditional judgment result, the target content to be written is obtained according to the code block (branch execution logic text) corresponding to the target branch condition.

[0068] For example, if conditional expression 1:

[0069] Code block 1

[0070] elif conditional expression 2:

[0071] Code block 2

[0072] else:

[0073] Code block 3

[0074] The judgments of the above conditional expressions 1 and 2 need to be made in combination with the actual model data in the FMU configuration file and the model description file. Code block 1, code block 2, and code block 3 are used as branch execution logic texts respectively.

[0075] If it is determined according to the FMU configuration file and the model description file that there are variables in the conditional expression, the conditional expression is executed for conditional judgment.

[0076] If it is determined according to the conditional judgment result that the conditional expression 1 is satisfied, the target content to be written is determined according to code block 1.

[0077] If it is determined according to the conditional judgment result that the conditional expression 2 is satisfied, the target content to be written is determined according to code block 2.

[0078] If it is determined according to the conditional judgment result that neither the conditional expression 1 nor the conditional expression 2 is satisfied, the target content to be written is determined according to code block 3.

[0079] If it is determined according to the FMU configuration file and the model description file that the conditional judgment result does not meet any condition or conditional expression in this conditional judgment logic, it is determined that there is no target content to be written in this conditional judgment logic.

[0080] If it is determined according to the FMU configuration file and the model description file that there are no variables in the conditional expression, there is no need to perform conditional judgment on this conditional judgment logic, and it is directly determined that there is no target content to be written in this conditional judgment logic.

[0081] Generate the model text to be written according to the FMU configuration file, the model description file, and the branch execution logic text.

[0082] In addition, if the branch execution logic text that meets the conditions is empty, the target content is empty.

[0083] It should be noted that the branch execution logic text or execution statement here can be a piece of code that writes the target content to a specified location. The target content may be input, output, parameters, internal variable declarations, the model single-step simulation process, etc., or it may be a piece of code or algorithm such as a conditional judgment statement or a loop statement that needs to be written into the Modelica model file. This application does not limit this. For example, the target content is an input variable value setting algorithm, an output variable value obtaining algorithm, etc.

[0084] In addition, the branch execution logic text can also be a string of code including the target content to be written into the Modelica model file and how to adjust the target content. Thus, if the branch execution logic text is executed, the target content can be adjusted according to the FMU configuration file and the model description file and then the model text to be written can be generated.

[0085] In this embodiment, by means of the FMU configuration file and the model description file, the conditional judgment logic in the import template can be accurately identified, and it is judged whether there is target content to be written in the conditional judgment logic. If there is target content, the model text to be written is generated and written according to the conditional judgment result, which is efficient and fast.

[0086] In one embodiment, judging whether to write variable content based on the FMU configuration file and the model description file includes:

[0087] If the variable content includes loop logic, and it is determined according to the FMU configuration file and the model description file that there is a target variable in the loop logic in the configured model data, then the target content to be written is determined according to the loop logic text that is repeatedly executed in the loop logic;

[0088] Generating the model text to be written according to the model data and the target content in the FMU configuration file and the model description file, and writing the model text to be written into the Modelica model file to be written, includes:

[0089] Obtaining the number of loop iterations of the loop logic according to the model data in the FMU configuration file and the model description file;

[0090] Executing the loop logic according to the number of loop iterations, and repeatedly writing the target content in the loop logic text as the model text to be written into the Modelica model file to be written until the total number of loops reaches the number of loop iterations, or adjusting the target content in the loop logic text for each round according to the model data in the FMU configuration file and the model description file and then writing it as the model text to be written into the Modelica model file to be written until the total number of loops reaches the number of loop iterations.

[0091] Specifically, the variable content in the target import template may contain loop logic, for example, for loop, while loop, etc. The loop logic, that is, the loop statement, includes the loop body and the termination condition of the loop. The loop body is a group of statements included in the loop logic that are repeatedly or cyclically executed. Whether to continue repeating depends on the termination condition of the loop.

[0092] The loop logic text of this embodiment, i.e., the loop body, contains the target content to be written, or the loop logic text contains the target content to be written and the code for how to adjust the target content (such as filling, complementing, or replacing, etc.). Thus, if the loop logic text is executed, the target content can be adjusted according to the FMU configuration file and the model description file to generate the model text to be written.

[0093] If it is determined that the loop logic is matched according to the matched keyword, and there is a target variable in the loop logic in the model data (selected parameters or variables, etc.) configured by the user according to the FMU configuration file and the model description file, it means that the loop logic can be executed. Determine the target content to be written according to the loop logic text that is repeatedly executed in the loop logic, then determine the loop iteration times according to the number of model variables obtained from the model description file, i.e., modelDescription.xml. According to the loop iteration times, repeatedly generate and write the model text to be written into the import template until the remaining iteration times are 0 or the cumulative total loop times reach the loop iteration times.

[0094] Among them, the number of model variables is identified and counted for the specified model variables in the model description file according to the model variable matching statistical rules.

[0095] Each time a loop is executed, a model text to be written is generated. The model text to be written is generated by adjusting the target content in the loop logic text according to the FMU configuration file and the model description file.

[0096] In addition, if it is determined according to the matched keyword that neither the conditional branch logic nor the loop logic is matched, and the matched keyword does not belong to the end character, the content matched is the fixed content or immutable content of the target import template, and write the immutable content into the Modelica model file to be written.

[0097] In addition, the variable information such as the type or name of the model variables corresponding to each round may be different.

[0098] In addition, if it is determined according to the FMU configuration file and the model description file that there is no target variable in the loop logic, that is, the variables in the loop logic belong to unconfigured variables, then there is no need to execute the loop logic, and it is directly determined that there is no target content to be written in the loop logic.

[0099] This embodiment can accurately identify the loop logic in the import template according to the FMU configuration file and the model description file, and determine whether there is target content to be written in the loop logic. If there is target content, the model text to be written is repeatedly generated and written according to the loop iteration times, which is efficient and fast.

[0100] Figure 2 This is a schematic diagram of the process of the second embodiment of the FMU integration method based on the Modelica language in the embodiments of the present application; refer to Figure 2 , the template file loading means loading the target import template, the modelDescription.xml file parsing means parsing the model description file according to the FMU configuration file, the template file byte-by-byte parsing means performing byte-by-byte parsing on the target import template to identify characters; the template keyword matching means performing keyword matching on the identified characters to determine whether the identified characters belong to branch logic or loop logic or are end characters or belong to fixed content.

[0101] If the identified characters are determined to be branch logic, it is determined that the identified variable content includes conditional judgment logic, and the conditional branches in the conditional judgment logic are judged according to the model data in the FMU configuration file and the model description file. According to the conditional judgment result, it is determined whether one of the conditional branches is satisfied. If one of the target conditional branches is satisfied, the model text to be written is generated according to the branch execution logic text, the FMU configuration file, and the model description file corresponding to the target conditional branch. The model text to be written is the template branch logic content text, and the template branch logic content text is written into the Modelica model file to be written.

[0102] If it is determined that the identified variable content does not include conditional judgment logic but includes loop logic, the number of loop iterations is obtained according to the model data in the FMU configuration file and the model description file. For example, the number of model variables is used as the number of loop iterations, and the loop logic is looped according to the number of loop iterations. The model text to be written is generated according to the FMU configuration file, the model description file, and the target content in the loop body of each loop. The model text to be written is the template loop logic text, and the template loop logic text is written into the Modelica model file to be written until the remaining number of loop iterations is 0.

[0103] If it is determined that the identified variable content does not include conditional judgment logic, does not include loop logic, but is an end character, the parsing is ended to obtain the final Modelica model file.

[0104] If it is determined that the identified variable content does not include conditional judgment logic, does not include loop logic, and is not an end character, it is determined to be the fixed content (immutable content) of the import template, and the template fixed content is written into the Modelica model file to be written.

[0105] By Figure 2The process template execution engine parses the template file byte by byte, identifies the fixed content and variable content in the template, and replaces the variable part in the template according to the integrated configuration information and the actual model variable information. The imported template and the template execution engine support conditional branch logic and loop logic. When parsing and replacing the definitions, readings, and writings of relevant variable contents such as model variables, they can automatically generate correct and legal Modelica model texts according to the existence of the same type of variables and the number of variables.

[0106] Of course, Figure 2 This is only an exemplary illustration. The conditional judgment logic, loop logic, end characters, the recognition and judgment order of immutable content, and how to generate the model text to be written can all be set according to actual needs, and this application does not limit this.

[0107] In one embodiment, in response to a user configuration instruction in step S100, the original FMU file is configured to generate an FMU configuration file, including:

[0108] Extract the model description file from the original FMU file, parse the model description file, and obtain FMU-related information;

[0109] Display the FMU-related information to the user through a visual configuration interface;

[0110] Receive and respond to the user's configuration operations on each configurable field in the FMU-related information through the visual configuration interface, and generate an FMU configuration file through integrated configuration.

[0111] Specifically, the original FMU file is the FMU file selected by the user. The original FMU file contains files such as the model description file and the standardized interface implementation file. The model description file is the modelDescription.xml file. The FMU-related information includes the platform for generating the FMU file, the version of the FMU, the model integration method, the implementation form, the simulation configuration, and variable information, etc.

[0112] The integrated configuration module realizes user-defined FMU integration configuration and provides content such as a visual interface and parameter configuration options.

[0113] According to the FMU detailed information or FMU-related information obtained from the FMU file, present the above FMU detailed information to the user through an integrated configuration panel or a visual configuration interface. Some fields in the model description file are editable or configurable, and some fields are not editable or configurable. Therefore, the configurable fields and the corresponding optional field values can be displayed on the visual configuration interface, or, the configurable fields and the corresponding optional field values can be displayed on the visual configuration interface, and at the same time, the non-configurable fields and the corresponding fixed field values or default field values can also be displayed.

[0114] It should be noted that the configurable fields in this embodiment include optional fields and mandatory fields. The optional fields are fields that the user can choose or not choose according to their needs.

[0115] The mandatory fields are fields that must be selected and are automatically selected by default.

[0116] Both the optional fields and the mandatory fields can have one field value option or multiple field value options. If there is only one field value option, the field value is automatically determined after the optional field is selected and cannot be modified or edited. If there are multiple field value options, the user can specify the field value by entering in the input box, or select a field value from multiple field values by selecting options in the drop-down box or by point selection or other ways not limited to this. It is specifically determined according to the presentation effect of the visual configuration interface, and this application does not limit this.

[0117] In a specific embodiment, the configurable fields include, for example, the FMU version, the model integration method, the implementation form, the integration method, and the editable variables, fields, or parameters included in the integration method specified by the user.

[0118] For example, the user selects the FMU version to be integrated (optional values are 1.0, 2.0, 3.0), the model integration method (optional values are ModelExchange, Co-Simulation), the implementation form (optional values are binary, source code), etc. to implement the configuration integration of the FMU.

[0119] Since there are many fields, parameters, or variables in the model description file, it may be necessary to configure different fields in multiple visual configuration interfaces.

[0120] Figure 3 This is a schematic diagram of a visual configuration interface in an embodiment of this application. Refer to Figure 3 , in the field of the FMU file, a local original FMU file can be specified and selected. In the field of the model name, the model name to be written into the Modelica model file or the finally generated Modelica model file can be customized. The selected FMU version in the field of the FMU version is 2.0. The field of the FMU type, that is, the model integration method field, has two field value options: Model-Exchange and Co-Simulation. The user can select any one by clicking on the circle. Figure 3Model-Exchange is selected. win32 is selected for the Platform field. The number of variables, the number of state variables, and the number of event indicators are 2000, 8, and 2 respectively. These fields can be obtained by counting the configured variables, state variables, and event indicators. MWORKS.Sysplorer is selected as the generation tool, and the generation date is 2024-08-26T11:33:31Z. The variable import mode includes variable integration methods, including 6 optional methods: black box import, partial import, full import, import of adjustable parameters, source code import, and variable name structuring. Inserted into is an optional option or field, Figure 3 There are multiple optional options through the drop-down list, Figure 3 <Top Model> is selected. The storage location of the model file can be specified by the user. Whether to use the full model name for generating the FMU resource path is an optional option, which can be selected by checking the box.

[0121] Of course, Figure 3 It is just a schematic diagram of a visual configuration interface. Other visual configuration interfaces can be used to configure other fields, parameters, or variables, and this application does not limit this.

[0122] In this embodiment, the user can conveniently and intuitively configure the FMU file according to the requirements through the visual configuration interface, which is efficient and convenient.

[0123] In one embodiment, the configurable fields include integration methods, and the integration methods include required parameter integration method, full parameter integration method, and custom integration method;

[0124] Receive and respond to the user's configuration operations on each configurable field in the FMU-related information through the visual configuration interface, including:

[0125] If it is determined according to the user's configuration operation on the integration method that the integration method specified by the user is the required parameter integration method, then display the fields corresponding to the required parameters included in the required parameter integration method to the user, and receive the user's configuration operations on the fields corresponding to the required parameters. Among them, the required parameters include the input variables, output variables, and other top-level parameters at the top level of the model;

[0126] If it is determined according to the user's configuration operation on the integration method that the integration method specified by the user is the full parameter integration method, then display the fields corresponding to all the parameters in the integrated model included in the full parameter integration method to the user, and receive the user's configuration operations on the fields corresponding to the parameters. Among them, all the parameters include the input variables, output variables, other top-level parameters, and internal variables of the model at the top level of the model;

[0127] If it is determined according to the user's configuration operation on the integration method that the integration method specified by the user is the custom parameter integration method, the fields corresponding to the required parameters and the fields corresponding to the optional parameters included in the custom parameter integration method are displayed to the user, the configuration operation of the user on the fields corresponding to the required parameters is received, and the selection and editing operation of the user on the fields corresponding to the optional parameters is received. Among them, the required parameters include the input variables, output variables, and other top-level parameters at the top layer of the model, and the optional parameters include the internal variables of the model.

[0128] Specifically, for diverse application scenarios, the integration requirements of users for model variables when using FMUs show significant differences. Specifically, when integrating FMUs for real-time simulation, there are extremely high requirements for the simulation efficiency of FMUs. However, the FMUs corresponding to large-scale complex system models often contain a large number of model variables, resulting in a long time-consuming for reading the results of model variables during the single-step simulation operation of FMUs. To improve the simulation efficiency, during the FMU integration process, strategies need to be adopted to only retain the top-level input, output, and parameter variables necessary for simulation interaction, while filtering out unnecessary internal variables. However, when integrating FMUs for model debugging, it becomes crucial to comprehensively obtain all the variable information inside the FMUs so that when problems occur, the problems can be accurately located and solved by deeply analyzing the states of the internal variables. This requires that all model variables must be integrated when integrating FMUs. Therefore, the traditional single FMU variable integration strategy is difficult to adapt to this diversified demand. How to ensure the comprehensiveness of model information while taking into account the simulation efficiency and flexibly meet the integration requirements under different application scenarios has become a major challenge faced by modeling and simulation tools when integrating FMUs.

[0129] Based on the technical problem that the above traditional variable integration strategy cannot adapt to diversified demands, for model variables, the integration configuration module in this embodiment provides multiple variable integration methods, including: required parameter integration method (black box integration method), complete parameter integration method (complete integration method), and custom integration method (partial integration method). During the configuration process, the user can select any variable integration method according to the requirements.

[0130] Among them, the black box integration method integrates the required parameters, including the input, output, and parameters at the top layer of the model, etc.; the complete integration method integrates all variables in the model, that is, it includes the required parameters and the optional parameters, specifically including all variables or parameter corresponding fields such as the input, output, and parameters at the top layer of the model and the internal variables of the model; the partial integration method, in addition to including the required parameters, that is, the required parameters such as the input and output variables at the top layer of the model are default selected, and the user can freely select the variables to be integrated for the remaining parameters.

[0131] Some parameter - corresponding fields can be automatically selected or filled with default values during initial display. If the user does not re - edit, the field will have the default value. For some fields, the user needs to input the values themselves. For some fields, the user can select the values from the selectable values, such as selecting from a drop - down box or tiled options, etc.

[0132] More specifically, for the mandatory - parameter integration method (black - box integration method), what is shown to the user in the visual configuration interface are the fields corresponding to the mandatory parameters or mandatory variables and the selectable field values or input boxes of the fields. Moreover, the fields corresponding to the mandatory parameters are in the default selected state, and the user is prohibited from deselecting them or a prompt will be given to the user when they deselect, indicating that they must be selected. If the field values of the fields corresponding to the mandatory parameters are editable, the user can input the field values, select the field values from a drop - down box, or select the field values by clicking, etc. This application does not limit this.

[0133] For the complete - parameter integration method (complete integration method), what is shown to the user in the visual configuration interface are the fields corresponding to all parameters or all variables and the selectable field values or input boxes of the fields. These fields are all in the selected state. For the fields with editable field values, the user can input the field values, select the field values from a drop - down box, or select the field values by clicking, etc. This application does not limit this. For the fields with non - editable field values, the field values of these fields are the default values.

[0134] For the custom integration method (partial integration method), what is shown to the user in the visual configuration interface are the fields corresponding to the mandatory parameters or mandatory variables and the fields corresponding to the optional parameters or optional variables. Among them, the fields corresponding to the mandatory parameters must be selected, so they are in the default selected state. If the field values of the fields corresponding to the mandatory parameters are editable, the user can also edit the field values. The fields corresponding to the optional parameters are selected or not selected by the user according to their needs. For the selected optional fields, the user can also configure or edit their field values. Of course, for the fields with default or non - editable field values, the user does not need to edit the field values.

[0135] The FMU integration configuration module designed in this application supports multiple variable integration methods. The mandatory - parameter integration method meets the requirements of efficient and concise FMU integration, improving the simulation efficiency; the complete - parameter integration method meets the full - variable FMU integration requirements in application scenarios such as model debugging; the custom integration method supports the user to freely select the variables or parameters to be integrated. By selecting different variable integration methods, it is possible to meet different diversified integration requirements and application scenarios while taking into account both integration efficiency and functionality.

[0136] In one embodiment, the FMU configuration file includes the FMU version and the model integration method;

[0137] Before integrating the Modelica model text framework content defined in the target import template, the model description file and the FMU configuration file in the original FMU file, the FMU integration method based on the Modelica language further includes:

[0138] Determine a matching target import template from the available import templates according to the FMU version and model integration method specified in the FMU configuration file.

[0139] Specifically, for example, the FMU versions include three versions: 1.0, 2.0, and 3.0, and the model integration methods include two model reuse methods or model integration methods included in the FMI standard: Model Exchange and Co-Simulation, a total of two model integration methods. FMI supports two main types of FMI units: Model Exchange and Co-Simulation, and these two modes are respectively applicable to model integration and execution in different scenarios. The full name of the FMI standard is Functional Mock-up Interface. It is a tool-independent standard that supports both model exchange (Model Exchange) and co-simulation (Co-Simulation) of dynamic models through a combination of XML files and compiled C code.

[0140] Therefore, if different FMU versions and different model integration methods each correspond to different import templates, there are a total of 6 import templates.

[0141] Of course, some FMU versions or some model integration methods can also share the same import template, which is specifically configured according to the actual application scenario, and a mapping relationship between the FMU version, the model integration method, and the import template can be established. In this way, the target import template can be matched according to the FMU version and model integration method specified in the FMU configuration file configured by the user. This application does not limit this.

[0142] Different FMU versions and different model integration methods may cause one or more of the configured parameters, variables, inputs, outputs, algorithms, etc. to differ significantly. In this embodiment, different types of import templates are set in detail according to the FMU version and the model integration method, which can ensure that the import template is more in line with the actual specific application scenario, has a smaller volume than the general import version, reduces the setting of invalid framework content in the import template, and improves the efficiency and accuracy of parsing the import template and converting it into Modelica model text.

[0143] Refer to Figure 4, this application also provides an FMU integration system based on the Modelica language. The FMU integration system based on the Modelica language includes: an FMU integration configuration module 100 and a conversion module 200;

[0144] The FMU integration configuration module 100 is used to respond to user configuration instructions, configure the original FMU file, and generate an FMU configuration file;

[0145] The conversion module 200 is used to integrate the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file to obtain the target Modelica model text, where the target import template can be adjusted according to the updated FMI specification or user requirements.

[0146] Specifically, the FMU integration configuration module 100 passes the integrated configuration selected by the user, that is, the FMU configuration file and the model description file, to the template execution engine. The conversion module 200 is specifically used to translate and convert the FMU configuration file and the model description file into Modelica model text through the template execution engine based on the import template.

[0147] In one embodiment, the conversion module 200 includes:

[0148] A template parsing module for parsing the target import template;

[0149] A first writing module for writing the immutable content in the identified target import template into the Modelica model file to be written;

[0150] A writing judgment module for, if the variable content in the target import template is identified, making a judgment on whether to write the variable content based on the FMU configuration file and the model description file;

[0151] A second writing module for, if it is determined that there is target content to be written in the variable content, generating the model text to be written according to the model data and the target content in the FMU configuration file and the model description file, and writing the model text to be written into the Modelica model file to be written.

[0152] Figure 5 is the integration schematic diagram of the FMU integration system based on the Modelica language in the embodiments of this application; refer to Figure 5, the FMU file, i.e., the original FMU file, undergoes FMU integration configuration through the integration configuration module to obtain the FMU configuration file. The template execution engine reads the FMU configuration file, parses the model description file, and based on the parsing results, determines which framework contents in the import template need to be written into the Modelica model file to be written and which do not. The Modelica model text is obtained based on the finally obtained Modelica model file.

[0153] In one embodiment, the writing judgment module includes:

[0154] The condition judgment module is used to, if the variable content includes conditional judgment logic, perform conditional judgment on the conditional judgment logic based on the model data in the FMU configuration file and the model description file to obtain the conditional judgment result;

[0155] The target content determination module is used to, if the target branch execution logic text corresponding to the conditional judgment result is obtained from the conditional logic judgment, obtain the target content to be written according to the target branch execution logic text.

[0156] In one embodiment, the writing judgment module includes:

[0157] The loop judgment module is used to, if the variable content includes loop logic and there is a target variable in the loop logic determined according to the FMU configuration file and the model description file, determine the target content to be written according to the loop logic text that is looped and executed in the loop logic;

[0158] The second writing module includes:

[0159] The loop iteration times acquisition module is used to acquire the loop iteration times of the loop logic according to the model data in the FMU configuration file and the model description file;

[0160] The loop writing module is used to execute the loop logic according to the loop iteration times, and repeatedly write the target content in the loop logic text as the model text to be written into the Modelica model file to be written until the total number of loops reaches the loop iteration times, or adjust the target content in the loop logic text for each round according to the model data in the FMU configuration file and the model description file and then write it into the Modelica model file to be written as the model text to be written until the total number of loops reaches the loop iteration times.

[0161] In one embodiment, the FMU integration configuration module 100 includes:

[0162] A file parsing module, which is used to extract a model description file from an original FMU file, parse the model description file, and obtain FMU-related information;

[0163] A display module, which is used to display FMU-related information to the user through a visual configuration interface;

[0164] A configuration module, which is used to receive and respond to the user's configuration operations on each configurable field in the FMU-related information through a visual configuration interface, and generate an FMU configuration file through integrated configuration.

[0165] In one embodiment, the configurable fields include an integration method, and the integration method includes a mandatory parameter integration method, a complete parameter integration method, and a custom integration method;

[0166] The configuration module is specifically used for:

[0167] If it is determined according to the user's configuration operation on the integration method that the specified integration method by the user is the mandatory parameter integration method, then display the fields corresponding to the mandatory parameters included in the mandatory parameter integration method to the user, and receive the user's configuration operations on the fields corresponding to the mandatory parameters. Among them, the mandatory parameters include input variables, output variables, and other top-level parameters at the model top layer;

[0168] If it is determined according to the user's configuration operation on the integration method that the specified integration method by the user is the complete parameter integration method, then display the fields corresponding to all parameters in the integrated model included in the complete parameter integration method to the user, and receive the user's configuration operations on the fields corresponding to the parameters. Among them, all parameters include input variables, output variables, other top-level parameters, and model internal variables at the model top layer;

[0169] If it is determined according to the user's configuration operation on the integration method that the specified integration method by the user is the custom parameter integration method, then display the fields corresponding to the mandatory parameters and the fields corresponding to the optional parameters included in the custom parameter integration method to the user, receive the user's configuration operations on the fields corresponding to the mandatory parameters, and receive the user's selection and editing operations on the fields corresponding to the optional parameters. Among them, the mandatory parameters include input variables, output variables, and other top-level parameters at the model top layer, and the optional parameters include model internal variables.

[0170] In one embodiment, the FMU configuration file includes the FMU version and the model integration method;

[0171] The FMU integration system based on the Modelica language further includes:

[0172] A template matching module, which is used to determine a matching target import template from available import templates according to the FMU version and the model integration method specified in the FMU configuration file.

[0173] For the specific FMU integration system based on the Modelica language in this application, please refer to the description of the above-mentioned FMU integration method based on the Modelica language, which will not be elaborated here.

[0174] Figure 6 FIG. is a schematic structural diagram of a computer device provided by an embodiment of the present application. The computer device 700 may vary greatly due to different configurations or performances, and may include one or more processors (central processing units, CPUs) 710 (for example, one or more processors) and a memory 720, and one or more storage media 730 for storing application programs 733 or data 732 (for example, one or more mass storage devices). Among them, the memory 720 and the storage media 730 may be transient storage or persistent storage. The program stored in the storage media 730 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the computer device 700. Further, the processor 710 may be configured to communicate with the storage media 730 and execute a series of instruction operations in the storage media 730 on the computer device 700.

[0175] The computer device 700 may further include one or more power supplies 740, one or more wired or wireless network interfaces 750, one or more input / output interfaces 760, and / or one or more operating systems 731, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, and so on. Those skilled in the art can understand that Figure 6 The shown computer device structure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0176] The present application also provides a computer device. The computer device includes a memory and a processor. When the computer-readable instructions stored in the memory are executed by the processor, the processor executes the steps of the FMU integration method based on the Modelica language in the above embodiments. The present application also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium, or may also be a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions run on a computer, the computer executes the steps of the FMU integration method based on the Modelica language.

[0177] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0178] 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 computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0179] As described above, the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present application.

Claims

1. An FMU integration method based on the Modelica language, characterized in that, The FMU integration method based on the Modelica language includes: Responding to a user configuration instruction, configuring the original FMU file to generate an FMU configuration file; Integrating the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file to obtain a target Modelica model text, where the target import template can be adjusted according to the updated FMI specification or user requirements; Integrating the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file to obtain a target Modelica model text, including: Parsing the target import template; Writing the immutable content identified in the target import template to the Modelica model file to be written; If mutable content is identified in the target import template, determine whether to write the mutable content based on the FMU configuration file and the model description file; If it is determined that there is target content to be written in the mutable content, generate the model text to be written according to the FMU configuration file, the model data in the model description file, and the target content, and write the model text to be written to the Modelica model file to be written; Determining whether to write the mutable content based on the FMU configuration file and the model description file includes: If the mutable content includes conditional judgment logic, perform a conditional judgment on the conditional judgment logic based on the model data in the FMU configuration file and the model description file to obtain a conditional judgment result; If the target branch execution logic text corresponding to the conditional judgment result is obtained from the conditional logic judgment, obtain the target content to be written according to the target branch execution logic text.

2. The FMU integration method based on the Modelica language according to claim 1, characterized in that Generating the model text to be written according to the FMU configuration file, the model data in the model description file, and the target content includes: Taking the target content determined to be written and not requiring adjustment in the mutable content as the model text to be written; Or, Generating the model text to be written after adjusting the target content that needs to be adjusted according to the model data in the FMU configuration file and the model description file.

3. The FMU integration method based on the Modelica language according to claim 1, wherein The parsing of the target import template includes: Parsing the target import template byte by byte, and performing keyword matching on the identified content with the template keyword list; If the identified content indicates the end of parsing, stop parsing the target import template.

4. The FMU integration method based on the Modelica language according to claim 1, wherein Determining whether to write the mutable content based on the FMU configuration file and the model description file further includes: If the mutable content includes loop logic, and it is determined according to the FMU configuration file and the model description file that there is a target variable in the configured model data in the loop logic, determine the target content to be written according to the loop logic text that is looped and executed in the loop logic; Generating the model text to be written according to the FMU configuration file, the model data in the model description file, and the target content, and writing the model text to be written to the Modelica model file to be written, includes: Obtain the number of loop iterations of the loop logic according to the model data in the FMU configuration file and the model description file; Execute the loop logic according to the number of loop iterations, and use the target content in the loop logic text as the text to be written into the Modelica model file to be written repeatedly until the total number of loops reaches the number of loop iterations. Or, according to the model data in the FMU configuration file and the model description file, adjust the target content in the loop logic text for each loop as the text to be written into the Modelica model file to be written until the total number of loops reaches the number of loop iterations.

5. The FMU integration method based on the Modelica language according to claim 1, characterized in that The response to the user configuration instruction to configure the original FMU file to generate an FMU configuration file includes: Extract the model description file from the original FMU file, and parse the model description file to obtain FMU-related information; Display the FMU-related information to the user through the visual configuration interface; Receive and respond to the user's configuration operations on each configurable field in the FMU-related information through the visual configuration interface, and generate an FMU configuration file through integrated configuration.

6. The FMU integration method based on Modelica language according to claim 5, wherein The configurable fields include integration methods, and the integration methods include mandatory parameter integration method, complete parameter integration method, and custom integration method; The receiving and responding to the user's configuration operations on each configurable field in the FMU-related information through the visual configuration interface includes: If it is determined according to the user's configuration operation on the integration method that the specified integration method by the user is the mandatory parameter integration method, display the fields corresponding to the mandatory parameters included in the mandatory parameter integration method to the user, and receive the user's configuration operations on the fields corresponding to the mandatory parameters. Among them, the mandatory parameters include input variables, output variables, and other top-level parameters at the model top layer; If it is determined according to the user's configuration operation on the integration method that the specified integration method by the user is the complete parameter integration method, display the fields corresponding to all parameters in the integrated model included in the complete parameter integration method to the user, and receive the user's configuration operations on the fields corresponding to the parameters. Among them, the all parameters include input variables, output variables, other top-level parameters, and model internal variables at the model top layer; If it is determined according to the user's configuration operation on the integration method that the specified integration method by the user is the custom parameter integration method, display the fields corresponding to the mandatory parameters and the fields corresponding to the optional parameters included in the custom parameter integration method to the user, receive the user's configuration operations on the fields corresponding to the mandatory parameters, and receive the user's selection and editing operations on the fields corresponding to the optional parameters. Among them, the mandatory parameters include input variables, output variables, and other top-level parameters at the model top layer, and the optional parameters include model internal variables.

7. The FMU integration method based on the Modelica language according to claim 1, wherein The FMU configuration file includes the FMU version and the model integration method; Before integrating the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file, the FMU integration method based on the Modelica language further includes: Determine a matching target import template from available import templates according to the FMU version and model integration method specified in the FMU configuration file.

8. An FMU integration system based on Modelica language, characterized in that, The FMU integration system based on the Modelica language includes: an FMU integration configuration module and a conversion module; The FMU integration configuration module is used to configure the original FMU file in response to a user configuration instruction to generate an FMU configuration file; The conversion module is used to integrate the Modelica model text framework content defined in the target import template, the model description file in the original FMU file, and the FMU configuration file to obtain a target Modelica model text, where the target import template can be adjusted according to the updated FMI specification or user requirements; The conversion module includes: A template parsing module for parsing the target import template; A first writing module for writing the immutable content in the identified target import template into the Modelica model file to be written; A writing judgment module for, if variable content in the target import template is identified, making a writing judgment on the variable content based on the FMU configuration file and the model description file; A second writing module for, if it is determined that there is target content to be written in the variable content, generating model text to be written according to the FMU configuration file, the model data in the model description file, and the target content, and writing the model text to be written into the Modelica model file to be written; The writing judgment module includes: A condition judgment module for, if the variable content includes conditional judgment logic, making a condition judgment on the conditional judgment logic based on the model data in the FMU configuration file and the model description file to obtain a condition judgment result; A target content determination module for, if target branch execution logic text corresponding to the condition judgment result is obtained from the conditional logic judgment, obtaining the target content to be written according to the target branch execution logic text.

9. A computer device, characterized in that, The computer device includes: a memory and at least one processor, and instructions are stored in the memory; The at least one processor calls the instructions in the memory so that the computer device executes the FMU integration method based on the Modelica language as described in any one of claims 1-7.

10. A computer-readable storage medium, on which instructions are stored, characterized in that, When the instructions are executed by the processor, the FMU integration method based on the Modelica language as described in any one of claims 1-7 is implemented.

Citation Information

Patent Citations

  • Joint simulation method and system for Modelica model and Simulink model and electronic equipment

    CN112115604A

  • Joint simulation method for converting FMU model into Modelica model

    CN114860388A

  • File analysis-based FMU file importing method and device

    CN117632114A