Initial Steady-State Compilation Method and System for Modelica Models

Compiling the Modelica model through the compiler and generating initialization functions solves the huge workload and redundancy of initial constraints in the initial state value setting of complex Modelica models, and realizes efficient initial steady-state value calculation and model multiplexing.

CN119396408BActive Publication Date: 2025-04-04武汉鼎元同立科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510015990.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-04-04
Estimated Expiration
2045-01-06

AI Technical Summary

Technical Problem

The complex Modelica model has huge workload when setting the initial state value, and the initial constraints of the underlying model cannot be changed in the model multiplexing scenario, resulting in compilation failure or initial conditions redundancy.

Method used

Compile the Modelica model through the compiler, determine the state variables and model state equations, place the initial equation/algorithm initial constraints and fixed initial constraints on the initial equation system set. When the user enables the initial steady-state mode, remove the redundant initial constraints according to the initial steady-state option and supplement the initial steady-state constraints. Finally, an initialization function is generated by encapsulating the initial equation system set and calculate the initial steady-state value.

Benefits of technology

Automatically supplement the initial steady-state constraints, reduce the workload of manual addition, improve the modeling efficiency of complex system models, solve the initial steady-state requirements in model multiplexing scenarios, and avoid the problem of users without model modification permissions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396408B_ABST
    Figure CN119396408B_ABST
Patent Text Reader

Abstract

The present invention discloses an initial steady-state compilation method and system for Modelica models, the method comprising: placing initial equation / algorithm initial constraints and fixed initial value constraints in the Modelica model in an initial value equation system set; when the user enables the initial steady-state mode, removing corresponding redundant initial constraints from the initial value equation system set according to the initial steady-state option, and supplementing the initial steady-state constraints; placing the initial steady-state constraints and the compiled model state equations in the initial value equation system set; encapsulating the initial value equation system set as an initialization function, and implementing the initial steady-state solution of the Modelica model by calling the initialization function. The present invention improves the modeling efficiency of complex system models by removing redundant initial constraints, automatically adding initial steady-state constraints, and constructing the initial state of the model as a steady-state value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of language compilation, and in particular relates to an initial steady-state compilation method and system for a Modelica model. Background Art

[0002] Modelica is a high-level declarative physical modeling language that is widely used for multi-domain system modeling and simulation. Unlike traditional programming languages, Modelica uses equations rather than procedural programming. Modelers only need to describe the physical behavior of the system and the interactions between components without specifying the order in which specific variables are solved. The compiler automatically generates an efficient computational model based on the dependencies of these declarative equations. Specifically, the compiler converts the original differential algebraic equations into ordinary differential equations (ODE) initial value problems, which are then numerically solved by the solver. The ODE initial value problem refers to finding the state solution of an ordinary differential equation and its state value at a certain initial moment, given an ordinary differential equation. The initial state value of the model can be explicitly specified or indirectly calculated through the initial equation / algorithm in the Modelica semantics. In many simulation applications, it is difficult for modelers to directly give appropriate initial state values, so the steady-state value of the system is usually used as the initial state value.

[0003] When the system model is too complex, such as when the number of state variables reaches hundreds or thousands, manually adding steady-state constraints will bring a huge workload, and the maintainability of the modified model will deteriorate. On the other hand, thanks to the object-oriented modeling features of Modelica, Modelica modeling applications are often based on existing standard libraries, open source libraries, or commercial libraries, without reinventing the wheel. This results in the inability to change the initial constraints of the underlying model when reusing existing models to build upper-level applications. For example, if the underlying model comes from a commercial library, its model code is not open to users. Obviously, in this case, the modeler cannot add the initial steady-state constraints, or adding them will cause the initial conditions of the system model to be redundant and fail to compile. Therefore, how to solve the problem of setting the initial state value of a complex Modelica model has become an urgent problem to be solved.

[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present invention is to provide an initial steady-state compilation method and system for Modelica models, aiming to solve the technical problem of how to solve the problem of setting the initial state value of a complex Modelica model.

[0006] To achieve the above object, the present invention provides an initial steady-state compilation method for a Modelica model, the initial steady-state compilation method for a Modelica model comprising:

[0007] Compile the Modelica model of the research object by using a compiler to determine the state variables and model state equations of the research object;

[0008] Placing the initial equation / algorithm initial constraints and fixed initial value constraints in the Modelica model into the initial value equation system set;

[0009] When the user enables the initial steady-state mode, determining an initial steady-state option based on the initial steady-state mode;

[0010] According to the initial steady-state option, corresponding redundant initial constraints are removed from the set of initial value equation systems, and initial steady-state constraints corresponding to the state variables are supplemented;

[0011] placing the initial steady-state constraint conditions and the compiled model state equations into the initial value equation system set;

[0012] The initial value equation system set is encapsulated to obtain an initialization function corresponding to the research object, and the calculation of the initial steady-state value of the Modelica model is realized by calling the initialization function.

[0013] Optionally, the model state equation is:

[0014]

[0015] In the formula, is the state of the model, is the input signal, For the current moment.

[0016] Optionally, after the step of placing the initial equation / algorithm initial constraints and fixed initial value constraints in the Modelica model into the initial value equation system set, the method further comprises:

[0017] When the user does not set the initial steady-state option in the initial steady-state mode, the initial steady-state constraint conditions are supplemented, and the initial steady-state constraint conditions and the compiled model state equations are placed in the initial value equation system set.

[0018] Optionally, the step of removing corresponding redundant initial constraints from the set of initial value equation systems according to the initial steady-state options comprises:

[0019] When the initial steady state option is to ignore the initial equation / algorithm option, the initial equation / algorithm initial constraint conditions in the initial value equation system set are removed by the compiler.

[0020] Optionally, the step of removing corresponding redundant initial constraints from the set of initial value equation systems according to the initial steady-state options further includes:

[0021] When the initial steady-state option is to ignore the fixed option, the fixed initial value constraint condition in the initial value equation system set is removed by the compiler.

[0022] Optionally, the step of encapsulating the set of initial value equation systems includes:

[0023] Determining whether the set of initial value equation systems satisfies equation compatibility;

[0024] If the initial value equation system set satisfies equation compatibility, the initial value equation system set is encapsulated.

[0025] Optionally, after the step of determining whether the set of initial value equation systems satisfies equation compatibility, the following steps are included:

[0026] When the initial value equation system set does not satisfy equation compatibility, an error message is given to the user.

[0027] In addition, to achieve the above-mentioned purpose, the present invention further proposes an initial steady-state compilation system for Modelica models, wherein the initial steady-state compilation system for Modelica models comprises:

[0028] A determination module, used for compiling a Modelica model of a research object through a compiler to determine state variables and model state equations of the research object;

[0029] A storage module, used for placing the initial equation / algorithm initial constraint conditions and fixed initial value constraint conditions in the Modelica model into the initial value equation system set;

[0030] A setting module, configured to determine an initial steady-state option based on the initial steady-state mode when the user enables the initial steady-state mode;

[0031] A processing module, used for removing corresponding redundant initial constraints from the set of initial value equation systems according to the initial steady-state options, and supplementing initial steady-state constraints corresponding to the state variables;

[0032] The storage module is further used to place the initial steady-state constraint conditions and the compiled model state equations into the initial value equation system set;

[0033] The encapsulation module is used to encapsulate the initial value equation system set, obtain the initialization function corresponding to the research object, and realize the calculation of the initial steady-state value of the Modelica model by calling the initialization function.

[0034] In addition, to achieve the above-mentioned purpose, the present invention also proposes an initial steady-state compilation device for Modelica models, the device comprising: a memory, a processor, and an initial steady-state compiler program for Modelica models stored in the memory and executable on the processor, the initial steady-state compiler program for Modelica models being configured to implement the steps of the initial steady-state compilation method for Modelica models as described above.

[0035] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which an initial steady-state compiler for a Modelica model is stored. When the initial steady-state compiler for a Modelica model is executed by a processor, the steps of the initial steady-state compilation method for a Modelica model as described above are implemented.

[0036] The present invention firstly compiles the Modelica model of the research object through a compiler, determines the state variables and model state equations of the research object, and then places the initial equation / algorithm initial constraint conditions and fixed initial value constraint conditions in the Modelica model into an initial value equation system set. When the user enables the initial steady-state mode, the initial steady-state option is determined based on the initial steady-state mode, and the corresponding redundant initial constraint conditions are removed from the initial value equation system set according to the initial steady-state option, and the initial steady-state constraint conditions corresponding to the state variables are supplemented. Then, the initial steady-state constraint conditions and the compiled model state equations are placed in the initial value equation system set. Finally, the initial value equation system set is encapsulated to obtain the initialization function corresponding to the research object, and the calculation of the initial steady-state value of the Modelica model is realized by calling the initialization function. The present invention can supplement the initial steady-state constraints by itself through the compiler, and the modeler does not need to consider adding them manually during the modeling stage, thereby improving the modeling efficiency of complex system models. For the initial steady-state requirements in the model reuse scenario, the problem of users not having model modification authority is effectively avoided. At the same time, the compilation method also provides two initial steady-state options, which can be used to ignore the initial constraints already in the model. The user does not need to manually delete the initial constraints already in the original model code to avoid redundant constraint problems, thereby improving the modeling efficiency while maintaining the maintainability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a structural schematic diagram of an initial steady-state compilation device for a Modelica model in a hardware operating environment involved in an embodiment of the present invention;

[0038] Figure 2 It is a flow chart of the first embodiment of the initial steady-state compilation method for Modelica model of the present invention;

[0039] Figure 3 A schematic diagram of a Modelica model of a first embodiment of an initial steady-state compilation method for a Modelica model according to the present invention;

[0040] Figure 4 It is a structural block diagram of the first embodiment of the initial steady-state compilation system for Modelica model of the present invention.

[0041] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0042] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0043] Reference Figure 1 , Figure 1 The schematic diagram of the structure of the initial steady-state compilation device for the Modelica model in the hardware operating environment involved in the embodiment of the present invention.

[0044] like Figure 1 As shown, the initial steady-state compilation device for the Modelica model may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage system independent of the aforementioned processor 1001.

[0045] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the initial steady-state compilation device for the Modelica model, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0046] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and an initial steady-state compiler for the Modelica model.

[0047] exist Figure 1 In the initial steady-state compilation device for Modelica model shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the initial steady-state compilation device for Modelica model of the present invention can be set in the initial steady-state compilation device for Modelica model, and the initial steady-state compilation device for Modelica model calls the initial steady-state compilation program for Modelica model stored in the memory 1005 through the processor 1001, and executes the initial steady-state compilation method for Modelica model provided by the embodiment of the present invention.

[0048] The embodiment of the present invention provides an initial steady-state compilation method for a Modelica model, referring to Figure 2 , Figure 2 It is a flow chart of the first embodiment of the initial steady-state compilation method for Modelica model of the present invention.

[0049] In this embodiment, the initial steady-state compilation method for the Modelica model includes the following steps:

[0050] Step S10: compile the Modelica model of the research object through a compiler to determine the state variables and model state equations of the research object.

[0051] It is easy to understand that the execution subject of this embodiment can be an initial steady-state compilation system for Modelica models with functions such as data processing, network communication and program running, or other computer devices with similar functions, etc., and this embodiment is not limited.

[0052] It should also be noted that the compiler can compile the Modelica model of the research object, such as the Modelica model of the mechanical object, etc., which is not limited in this embodiment.

[0053] In the specific implementation, taking the research object (i.e., car) as an example, a Modelica model is constructed:

[0054] model VehicleTest1

[0055] parameter Real m = 2000; / / Car mass

[0056] parameter Real n = 1e-5; / / Additional drag coefficient

[0057] parameter Real p = 0.2; / / Drag coefficient

[0058] Real s; / / displacement

[0059] Real v; / / speed

[0060] Real a; / / acceleration

[0061] Real F; / / Driving force

[0062] equation

[0063] der(s) = v; / / The derivative of displacement is velocity

[0064] der(v) = a; / / The derivative of velocity is acceleration

[0065] ; / / Acceleration equals driving force minus driving resistance

[0066] F = if time>0 then 1e5 else 0;

[0067] end VehicleTest1;

[0068] According to the above Modelica model, reference Figure 3 , Figure 3 This is a schematic diagram of the form of a Modelica model of the first embodiment of the initial steady-state compilation method for a Modelica model of the present invention. The displacement s and the velocity v are state variables, and initial values ​​need to be provided in the modeling stage.

[0069] Furthermore, the model state equation is:

[0070]

[0071] In the formula, the vector is a symbolic representation of the model state. In this example, the vector Specifically, displacement s and velocity v, is the input signal. In this example, Specifically, the driving force F, For the current moment.

[0072] It should also be noted that u and t are known quantities, and the initial state needs to be known when solving the above state equation , such as directly giving the initial state value, or giving the initial conditions and then indirectly solving for the initial state.

[0073] Step S20: placing the initial equation / algorithm initial constraints and fixed initial value constraints in the Modelica model into the initial value equation system set.

[0074] In the specific implementation, it is necessary to construct an initial value equation system set, place the initial constraints in the original model's initial equation / algorithm and other code blocks into the initial value equation system set, and also place the fixed initial value constraints in the original model into this set.

[0075] Initial state in Modelica semantics There are two ways to give the state directly or indirectly. The first way is to add initial constraints on the state in the model initial equation / algorithm code block, such as directly giving the state , or indirectly calculated from other variables ; Method 2: Define the fixed initial value constraints of the variables, such as directly defining the state variables Fixed initial value constraints , or define fixed initial value constraints for other variables to indirectly determine the initial value of the state, as described in method 1 to define variables The fixed initial value constraint determines the state variable The initial value of .

[0076] It should also be noted that manually adding initial constraints or specifying initial values ​​has many disadvantages, such as 1) there are too many states and the workload of adding them manually is too large; 2) users do not know what the reasonable initial state is, so they cannot set it; 3) the current model may be built based on some commercial library models, and the existing code of the model cannot be modified.

[0077] Therefore, based on the compilation method of the present invention, the user does not need to specify the initial value of the state variable, and the compiler automatically sets the initial state value of the original model as the initial steady-state value.

[0078] Step S30: when the user activates the initial steady-state mode, determining an initial steady-state option based on the initial steady-state mode.

[0079] It should be understood that if some initial constraints are added in the above two ways during the modeling process, this may lead to initial equation redundancy and compilation failure after the initial steady-state constraints are added later. If the current modeling application is based on an existing model library, this is very likely to happen. The user may not have the right to modify the model library, and deleting the original initial constraints in order to construct the initial steady state will cause model damage, which is not conducive to the maintainability of the model library. Therefore, the compiler should remove the existing initial constraints in the model as needed.

[0080] If the user does not enable the initial steady-state mode, the default strategy is used to construct the complete initial value equation system. The default strategy is used to determine the initial state :Compile the state equation It is also placed in the initial value equation system set to check whether the initial value equation system is well determined. If there are state variables with missing constraints, use their start initial values, that is, If the user enables the initial steady-state mode, the initial value equation system is constructed according to the steady-state options that the user further sets.

[0081] In this embodiment, an initial steady-state compilation mode (i.e., initial steady-state mode) is provided, in which two initial steady-state options are further provided, including "ignore initial equation / algorithm option (i.e., ignore initial constraints in initialequation / algorithm)" and "ignore fixed option (i.e., ignore fixed initial value constraints)".

[0082] Step S40: removing corresponding redundant initial constraints from the set of initial value equation systems according to the initial steady-state options, and supplementing initial steady-state constraints corresponding to the state variables.

[0083] In the specific implementation, in the initial steady-state mode, the user can further set the option to ignore the initial equation / algorithm, and remove the initial constraints of the initial equation / algorithm in the initial value equation system set through the compiler to avoid incompatibility with the initial steady-state conditions.

[0084] In the initial steady-state mode, the user can further set the Ignore Fixed option. After this option is set, the compiler ignores the fixed initial value constraints in the original model to avoid incompatibility with the initial steady-state conditions.

[0085] Furthermore, when the user does not set the initial steady-state option in the initial steady-state mode, the initial steady-state constraints are supplemented, and the initial steady-state constraints and the compiled model state equations are placed in the initial value equation system set.

[0086] Step S50: placing the initial steady-state constraint conditions and the compiled model state equations into the initial value equation system set.

[0087] In the specific implementation, the compiler automatically supplements the initial steady-state conditions of all states To the initial value equation system set, this step can avoid the huge workload and lack of modification permissions faced by manual addition. At the same time, the compiled state equation It is also placed in the equation set to perform an equation compatibility check. If the check fails, an error is reported to remind the user to set the initial steady-state option.

[0088] It should also be noted that the initial steady-state constraints are automatically added during the compilation process. In this example, after being processed by the compiler, they are equivalent to the following model form:

[0089] model VehicleTest2

[0090] parameter Real m = 2000; / / Car mass

[0091] parameter Real n = 1e-5; / / Additional drag coefficient

[0092] parameter Real p = 0.2; / / Drag coefficient

[0093] Real s; / / displacement

[0094] Real v; / / speed

[0095] Real a; / / acceleration

[0096] Real F; / / Driving force

[0097] initial equation / / Provide initial state values ​​by adding constraints to the initial equation

[0098] der(s) = 0;

[0099] der(v) = 0;

[0100] equation

[0101] der(s) = v; / / The derivative of displacement is velocity

[0102] der(v) = a; / / The derivative of velocity is acceleration

[0103] ; / / Acceleration equals driving force minus driving resistance

[0104] F = if time>0 then 1e5 else 100;

[0105] end VehicleTest2;

[0106] In this embodiment, the initial value equation system set may be:

[0107] der(s) = 0;

[0108] der(v) = 0;

[0109] der(s) = v;

[0110] der(v) = a;

[0111] ;

[0112] F = if time>0 then 1e5 else 100;

[0113] From the above, we can see that the 6 equations and 6 unknowns in the above example can be solved together to find that the initial value of the state variable s is 0, and the initial value of the state variable v is 0.

[0114] Step S60: Encapsulating the initial value equation system set to obtain the initialization function corresponding to the research object, and calculating the initial steady-state value of the Modelica model by calling the initialization function.

[0115] Furthermore, the complete initial value equation system is encapsulated as an initialization function , call this function to calculate the initial steady state for subsequent state equation solution.

[0116] In this embodiment, the Modelica model of the research object is first compiled by a compiler to determine the state variables and model state equations of the research object, and then the initial equation / algorithm initial constraints and fixed initial value constraints in the Modelica model are placed in an initial value equation system set. When the user enables the initial steady-state mode, the initial steady-state option is determined based on the initial steady-state mode, and the corresponding redundant initial constraints are removed from the initial value equation system set according to the initial steady-state option, and the initial steady-state constraints corresponding to the state variables are supplemented. Then, the initial steady-state constraints and the compiled model state equations are placed in the initial value equation system set. Finally, the initial value equation system set is encapsulated to obtain the initialization function corresponding to the research object, and the calculation of the initial steady-state value of the Modelica model is implemented by calling the initialization function. In this embodiment, the compiler can automatically supplement the initial steady-state constraints, and the modeler does not need to consider adding them manually during the modeling stage, which improves the modeling efficiency of complex system models. For the initial steady-state requirements in the model reuse scenario, the problem of users not having model modification permissions is effectively avoided. At the same time, the compilation method also provides two initial steady-state options, which can be used to ignore the initial constraints already in the model. The user does not need to manually delete the initial constraints already in the original model code to avoid redundant constraint problems, thereby improving the modeling efficiency while maintaining the maintainability of the model.

[0117] Reference Figure 4 , Figure 4 It is a structural block diagram of the first embodiment of the initial steady-state compilation system for Modelica model of the present invention.

[0118] like Figure 4 As shown, the initial steady-state compilation system for Modelica model proposed in the embodiment of the present invention includes:

[0119] A determination module 4001 is used to compile a Modelica model of a research object through a compiler to determine state variables and model state equations of the research object;

[0120] The storage module 4002 is used to place the initial equation / algorithm initial constraint conditions and the fixed initial value constraint conditions in the Modelica model into the initial value equation system set;

[0121] A setting module 4003, configured to determine an initial steady-state option based on the initial steady-state mode when the user enables the initial steady-state mode;

[0122] A processing module 4004 is used to remove corresponding redundant initial constraints from the set of initial value equation systems according to the initial steady-state options, and to supplement initial steady-state constraints corresponding to the state variables;

[0123] The storage module 4002 is further used to place the initial steady-state constraint conditions and the compiled model state equations into the initial value equation system set;

[0124] The encapsulation module 4005 is used to encapsulate the initial value equation system set, obtain the initialization function corresponding to the research object, and calculate the initial steady-state value of the Modelica model by calling the initialization function.

[0125] Other embodiments or specific implementations of the initial steady-state compilation system for Modelica models of the present invention may refer to the above-mentioned method embodiments, which will not be described in detail here.

[0126] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0127] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0129] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. An initial steady-state compilation method for Modelica models, characterized in that: The initial steady-state compilation method for the Modelica model comprises the following steps: Compile the Modelica model of the research object by using a compiler to determine the state variables and model state equations of the research object; Placing the initial equation and initial algorithm initial constraints and fixed initial value constraints in the Modelica model into an initial value equation system set; When the user enables the initial steady-state mode, determining an initial steady-state option based on the initial steady-state mode; According to the initial steady-state option, corresponding redundant initial constraints are removed from the set of initial value equation systems, and initial steady-state constraints corresponding to the state variables are supplemented; placing the initial steady-state constraint conditions and the compiled model state equations into the initial value equation system set; Encapsulating the initial value equation system set to obtain an initialization function corresponding to the research object, and calculating the initial steady-state value of the Modelica model by calling the initialization function; The step of removing corresponding redundant initial constraints from the set of initial value equation systems according to the initial steady-state options comprises: When the initial steady state option is to ignore the initial equation and initial algorithm options, removing the initial equation and initial algorithm initial constraints in the initial value equation system set through a compiler; When the initial steady-state option is to ignore the fixed option, the fixed initial value constraint condition in the initial value equation system set is removed by the compiler.

2. The method according to claim 1, characterized in that The model state equation is: In the formula, is the state of the model, is the input signal, For the current moment.

3. The method according to claim 1, characterized in that After the step of placing the initial constraints and fixed initial value constraints of the initial equation and initial algorithm in the Modelica model into the initial value equation system set, the method further includes: When the user does not set the initial steady-state option in the initial steady-state mode, the initial steady-state constraint conditions are supplemented, and the initial steady-state constraint conditions and the compiled model state equations are placed in the initial value equation system set.

4. The method according to claim 1, characterized in that The step of encapsulating the initial value equation system set comprises: Determining whether the set of initial value equation systems satisfies equation compatibility; If the initial value equation system set satisfies equation compatibility, the initial value equation system set is encapsulated.

5. The method according to claim 4, characterized in that After the step of determining whether the set of initial value equation systems satisfies equation compatibility, the method further comprises: When the initial value equation system set does not satisfy equation compatibility, an error message is given to the user.

6. An initial steady-state compilation system for Modelica models, characterized in that: The initial steady-state compilation system for the Modelica model includes: A determination module, used for compiling a Modelica model of a research object through a compiler to determine state variables and model state equations of the research object; A storage module, used for placing the initial equation and initial algorithm initial constraints and fixed initial value constraints in the Modelica model into an initial value equation system set; A setting module, configured to determine an initial steady-state option based on the initial steady-state mode when the user enables the initial steady-state mode; A processing module, used for removing corresponding redundant initial constraints from the set of initial value equation systems according to the initial steady-state options, and supplementing initial steady-state constraints corresponding to the state variables; The storage module is further used to place the initial steady-state constraint conditions and the compiled model state equations into an initial value equation system set; A packaging module is used to package the initial value equation system set, obtain the initialization function corresponding to the research object, and realize the calculation of the initial steady-state value of the Modelica model by calling the initialization function; The processing module is also used to remove the initial equation and initial algorithm initial constraints in the initial value equation system set through the compiler when the initial steady-state option is to ignore the initial equation and initial algorithm options; and to remove the fixed initial value constraints in the initial value equation system set through the compiler when the initial steady-state option is to ignore the fixed option.

Citation Information

Patent Citations

  • Joint simulation method for converting FMU model into Modelica model

    CN114860388A

  • Object oriented method and apparatus for class variable initialization

    US6832369B1