A modelica-based two-fluid six-equation and differential-algebraic equation combined simulation method
By converting the two-fluid six equations into a functional model TpfFun within the Modelica framework, and combining data dependency graphs and solution sequence programming, the coupled solution problem of the two-fluid six equations and differential-algebraic equations was solved, achieving stable and efficient solution of the nuclear power system model.
Patent Information
- Application Number
- CN202411933328.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2026-06-26
AI Technical Summary
Under the unified modeling framework based on Modelica, the coupled solution method of the two-fluid six equations and differential-algebraic equations is not yet mature, which makes it difficult to solve the multi-disciplinary coupled model of the whole nuclear power system and makes it difficult to guarantee stability and efficiency.
The two-fluid six-equation system is transformed into a function model TpfFun containing input, output, and parameter variables using the FMU model framework. A solution sequence planning is established through overall compilation and data dependency graph, and dedicated solution algorithms for the two-fluid six-equation system and differential-algebraic equations are called respectively to achieve stable solution of the heterogeneous system.
Stable coupled solution of two-fluid six equations and differential-algebraic equations was achieved, ensuring the stability and solution efficiency of the multi-disciplinary coupled model of the entire nuclear power system, and improving the scalability and applicability of the Modelica compilation and solution framework.
Smart Images

Figure CN122287412A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of thermal-hydraulic simulation technology, specifically involving a joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations. Background Technology
[0002] The Modelica-based multi-disciplinary coupled model of a nuclear power system is a heterogeneous system formed by coupling the two-fluid six-equation equations corresponding to the thermal-hydraulic discipline with the differential-algebraic equations corresponding to the instrumentation, electrical, mechanical, and pneumatic disciplines. The two-fluid six-equation equations are typical field equations with strong spatial coupling characteristics, and the variable coefficients must be completed using complex source term closure functions to ensure the closure of the equations. In contrast, the differential-algebraic equations do not possess spatial coupling characteristics, requiring the establishment of numerous variable transit equations to express the variable constraints between adjacent spatial nodes. Furthermore, the variable coefficients of the differential-algebraic equations are generally known or obtained through simple function calculations. Therefore, the equation configurations and variable constraints of the two-fluid six-equation equations and the differential-algebraic equations differ significantly, and the coupling solution method for these two types of equations significantly impacts the success or failure of solving the multi-disciplinary coupled model of the nuclear power system. Summary of the Invention
[0003] The purpose of this invention is to provide a joint simulation method based on Modelica for two-fluid six-equation and differential-algebraic equations. This method solves the problem of coupled solution of two-fluid six-equation and differential-algebraic equations under the unified modeling framework based on Modelica, and ensures the stable solution of multi-disciplinary coupled models of the entire nuclear power system. It enables both the two-fluid six-equation and differential-algebraic equations to call mature dedicated solution algorithms, ensuring the convergence and efficiency of equation solution.
[0004] The technical solution of this invention is as follows: A joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations, comprising the following steps:
[0005] Step 1: The two-fluid six-equation system is transformed into a functional model TpfFun containing input, output, and parameter variables using the FMU model framework. This functional model TpfFun has an algebraic equation model with input and output.
[0006] Step 2: Compile the function model TpfFun and the differential algebraic equation system as a whole under the compilation rules based on Modelica to obtain the sequence plan for the unified solution of the two-fluid six-equation and differential algebraic equation heterogeneous system. This solution sequence plan describes the solution order of the two-fluid six-equation FMU encapsulation function TpfFun as an independent subset of equations and other subsets of differential algebraic equations, as well as the input-output relationship between each subset of equations.
[0007] Step 3: According to the solution sequence plan, solve each subset of equations of the heterogeneous system of two-fluid six-equation and differential-algebraic equation in turn. The subset of equations corresponding to the FMU encapsulation function TpfFun of two-fluid six-equation calls the dedicated solution algorithm of two-fluid six-equation, and the subset of differential-algebraic equation calls the dedicated solution algorithm of differential-algebraic equation. Data transfer between the two types of equation subsets adopts the FMU data communication mechanism.
[0008] Step 1 includes the following:
[0009] Step 11: Establish the FMU model framework;
[0010] Step 12: Generate the function model TpfFun.
[0011] In step 11, the FMU model is a model derived from the FMI standard for co-simulation. Within the FMU model framework, the Modelica specification with extended syntax and semantics is used for thermal-hydraulic modeling based on the two-fluid six-equation model. Outside the FMU model, the native Modelica specification is used for control, electrical, and mechanical modeling based on differential-algebraic equations. The extended syntax and semantics of the Modelica specification places the conservation control equations and the data information required for equation closure of the two-fluid six-equation model in the compilation layer and the model layer, respectively. In the compilation layer, matrix equations are assembled according to the mature semi-implicit format of the two-fluid six-equation model. In the model layer, the model identification annotations, parameter variables, source term closure calculation functions, and interface data information required for matrix equation assembly are provided. The model identification annotations refer to specific keywords in the Modelica model code annotation section. These specific keywords are used to identify whether the Modelica model is included in the FMU model framework. The interfaces include fluid flow interfaces, control interfaces, electrical interfaces, and mechanical interfaces, and a mapping relationship is established between the matrix equations in the compilation layer and the data information in the model layer, thereby forming a closed two-fluid six-equation matrix system.
[0012] In step 11, under the Modelica specification after syntactic and semantic expansion, the fluid flow interface is a fluid interface that only expresses the topological connection relationship of the thermal-hydraulic model components, and no content is defined in the fluid interface; the control interface, electrical interface, and mechanical interface are data interaction interfaces between the thermal-hydraulic model and the control model, electrical model, and mechanical model based on differential-algebraic equations, and use value retrieval or assignment functions with specific identifiers, such as data transfer inside and outside the FMU model framework.
[0013] In step 11, the thermal-hydraulic modeling based on the two-fluid six-equation framework within the FMU model framework is a hierarchical modeling based on unit nodes. The unit nodes are staggered grid discrete nodes of the thermal-hydraulic system, including control volumes and nozzles. The control volume corresponds to the main control volume of the staggered grid and is used for modeling the mass and energy equations of the vapor and liquid phases. The nozzles correspond to the secondary control volumes of the staggered grid and are used for modeling the momentum equations of the vapor and liquid phases. The unit node model is the smallest granularity thermal-hydraulic model. The thermal-hydraulic equipment model and system model are formed by connecting the unit node model fluid interfaces. The staggered grid used for spatial discretization of the two-fluid six-equation framework and the parameter variable calling relationship between the basic control equations and the source term closed function are matched.
[0014] Step 12 includes the following:
[0015] Step 121: Traverse the thermal-hydraulic component models within the FMU model framework, identify the value-taking or assignment functions corresponding to the specific identifiers of the control interface, electrical interface, or mechanical interface of the thermal-hydraulic component model, confirm the data name, data type, thermal-hydraulic component model name, and unit node number to which the data belongs, and create an interface data structure container to store the interface information. One transmitted variable corresponds to one interface data container. The interface information includes the interface type, data type, full data name, and unit node number to which the data belongs.
[0016] Step 122: Create a function model TpfFun on NUMAP. TpfFun is an empty function model containing inputs and outputs encapsulated using the FMU model framework. Traverse the interface data container, obtain the interface data, and determine the type of the interface data. If it is a variable, set the interface data as the input or output variable of TpfFun according to the interface type. Combined with the unit node number to which the variable belongs, store the interface variables uniformly in the input and output data containers corresponding to the function model TpfFun using the data correspondence of <variable name, interface type, unit node number>. If it is a parameter, store the interface data in the node data container corresponding to the unit node according to the unit node number to which the parameter belongs.
[0017] Step 123: Traverse the input and output data containers of the function model TpfFun. Based on the data correspondence of <variable name, interface type, unit node number>, establish the mapping between the variables of the thermal-hydraulic unit nodes and the input and output variables of the function model TpfFun. During the initialization and time stepping of the function model TpfFun, the solver reads the correspondence between the input and output variables of the function model TpfFun and the variables of the thermal-hydraulic unit nodes. It directly maps the input variables of the function model TpfFun to the corresponding variables of the corresponding unit nodes, or assigns the corresponding variables of the corresponding unit nodes to the output variables of the function model TpfFun. This realizes the interaction between the variables of the two-fluid six-equation system based on unit nodes within the FMU framework and the variables of the differential-algebraic equation system outside the FMU framework.
[0018] The function model TpfFun described in step 2 is a functional equation model with explicit inputs and outputs. When compiling the function model TpfFun and the differential algebraic equations as a whole, TpfFun, as an independent function, is natively compiled and analyzed together with the differential algebraic equation system of electrical, control, mechanical and other disciplines. First, the hierarchical and dynamic multi-disciplinary models of electrical, control, mechanical and other disciplines are transformed into a flat and realizable differential algebraic equation solution plan. Second, a data dependency graph is established between the function model TpfFun and the subset of differential algebraic equations. Through the data dependency graph, a solution sequence plan is established between the function model TpfFun as an independent subset of equations and other subsets of differential algebraic equations, satisfying the input-output relationship between each subset of equations.
[0019] In step 2, the overall compilation of the function model TpfFun and the differential-algebraic equation system is divided into two stages: compilation and analysis. In the compilation stage, the object-oriented hierarchical and dynamic Modelica model is converted into a flattened differential-algebraic equation system by performing syntax and semantic checks, unit checks and operations, flattening and instantiation on the model code. In the analysis stage, the flattened equation system is converted into an optimized solvable equation sequence by performing compatibility analysis and reduction divide-and-conquer.
[0020] Step 2 includes:
[0021] Step 21: Compilation phase;
[0022] Step 22: Analysis phase.
[0023] Step 21 includes:
[0024] Step 211: Modelica syntax and semantics check, check whether the combination of keywords, identifiers, operators, strings, numbers and comments in the model code conforms to the syntax of Modelica; perform type and variable lookup, type compatibility check and check for restricted classes, objects, inheritance, variants and redeclarations according to the Modelica semantic specification.
[0025] Step 212: Unit checking and calculation, including variable unit validity checking and unit matching checking of expressions on both sides of the equation, supporting the derivation of the unit of the expression through the calculation of the units of each physical quantity;
[0026] Step 213: Flattening and instantiation processing. Through inheritance expansion, aggregation expansion, connection expansion, algorithm expansion and discrete expansion, as well as function processing and event processing, the declarative, object-oriented, hierarchical Modelica model is mapped into a flattened continuous-discrete hybrid differential-algebraic equation system.
[0027] Step 22 includes:
[0028] Step 221: Compatibility analysis. Using the bipartite graph analysis method, we analyze whether the differential algebraic equation system obtained by flattening is structurally compatible, that is, whether the equation system is a well-constrained system.
[0029] Step 222: Reduction and Divide & Conquer. Using bipartite graph analysis, strongly connected component analysis is performed on the flattened differential-algebraic equation system to obtain a subset of strongly coupled equations that need to be solved simultaneously. These are merged into an independent subset of equations. In addition, the function equation TpfFun is treated as an independent subset of equations. By analyzing the introduced and computed variables of the subset of equations, a data dependency graph of the subset of equations is generated. The direction of the data dependency graph corresponds to the solution sequence planning of the subset of equations. For multi-disciplinary coupled models, reduction and divide & conquer can obtain the data dependency graph formed by the subset of function TpfFun equations and other subsets of differential-algebraic equations. This data dependency graph is a typical nonlinear algebraic ring. Usually, the introduced variables of function equation TpfFun are used as tear points of the algebraic ring. During the compilation process, the algebraic ring is broken according to the tear points to generate the solution sequence planning.
[0030] The solution sequence planning described in step 3 expresses the solution order of the two-fluid six-equation FMU encapsulation function TpfFun as an independent subset of equations and other subsets of differential-algebraic equations under a unified solution framework, as well as the input-output relationship between each subset of equations. According to the solution order in the solution sequence planning, mature dedicated solution algorithms are called sequentially to solve each subset of equations in the heterogeneous system of two-fluid six-equation and differential-algebraic equations. The subset of equations corresponding to the two-fluid six-equation FMU encapsulation function TpfFun calls the dedicated solution algorithm for two-fluid six-equation.
[0031] Step 3 includes the following:
[0032] Step 31: Data communication time interval mechanism;
[0033] Step 32: Data interface mechanism.
[0034] In step 31, the data communication time interval mechanism between the two fluid six equations and the differential algebraic equations adopts a fixed-point communication mode and an active communication mode.
[0035] In step 32, the data interface mechanism between the two-fluid six equations and the differential algebraic equations determines the basic unit type corresponding to the data, whether the data is an input or an output, whether it is an integer or a real number. The data interface types are divided into eight categories, all of which contain formal parameters.
[0036] Step 32 includes the following:
[0037] Step 321: First type of formal parameter comLenth
[0038] The length of this data communication, i.e. the number of communication variables, is an integer and represents the input value;
[0039] Step 322: Second type of formal parameter infoList
[0040] The node unit number corresponding to the communication variable and the position number of the variable in the source term function variable enumeration table are integers, which are input values. The source term function variable enumeration table is formed by uniformly organizing the input and output data types and names of all source term functions of the two fluid six equations, and storing all source term function input and output data in the underlying data structure corresponding to the node unit in the data format of the variable enumeration table.
[0041] Step 323: Third type of formal parameter valList
[0042] Based on the variable description of the second type of formal parameter, the corresponding numerical value of the variable is given. The real type Real is the input value when used as an input interface and the output value when used as an output interface.
[0043] The beneficial effects of this invention are as follows: This invention solves the problem of coupled solution of the two-fluid six-equation and differential-algebraic equations under the unified modeling framework based on Modelica, ensuring the stable solution of the multi-disciplinary coupled model of the entire nuclear power system. It achieves both the independent use of mature dedicated solution algorithms for the two-fluid six-equation and differential-algebraic equations, guaranteeing the convergence and efficiency of the equation solution; and ensures that the solution order and input-output relationship between the two-fluid six-equation and differential-algebraic equations satisfy the physical coupling relationship between the thermal-hydraulic model and the electrical, mechanical, and control professional models. This invention can encapsulate the two-fluid six-equation into functional equations with inputs and outputs through the FMU model framework. These functional equations can be regarded as algebraic equations with inputs and outputs, and can be incorporated into the compilation and solution process of the differential-algebraic equation system based on native Modelica as an independent, minimized subset of equations. That is, it supports the solution of heterogeneous equations such as the two-fluid six-equation without changing the overall compilation and solution framework based on native Modelica, improving the scalability and applicability of the overall compilation and solution framework based on native Modelica. Attached Figure Description
[0044] Figure 1 Generate a logic diagram for the two-fluid six-equation functional model TpfFun;
[0045] Figure 2 The system of equations consists of a bipartite graph, strongly connected components, and a data dependency graph.
[0046] Figure 3 A schematic diagram illustrating algebraic ring tearing and solving sequence programming;
[0047] Figure 4 This is a schematic diagram of the time interval mode for data communication (fixed-point communication) between the two-fluid six equations and the differential algebraic equations;
[0048] Figure 5 This is a schematic diagram of the data communication (active communication) time interval mode between the two-fluid six equations and the differential algebraic equations. Detailed Implementation
[0049] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0050] A joint simulation method based on Modelica using two-fluid six-equation and differential-algebraic equations includes the following steps:
[0051] Step 1: The two-fluid six-equation system is transformed into a functional model TpfFun containing input, output, and parameter variables using the FMU model framework. This functional model TpfFun has an algebraic equation model with input and output.
[0052] The specific process is as follows:
[0053] Step 11: Establish the FMU model framework
[0054] The FMU model is a model derived from the FMI standard for co-simulation. Within the FMU model framework, the Modelica specification with extended syntax and semantics is used for thermal-hydraulic modeling based on the two-fluid six-equation model. Outside the FMU model, the native Modelica specification is used for multi-domain modeling based on differential-algebraic equations, including control, electrical, and mechanical aspects. The extended syntax and semantics of the Modelica specification places the conservation control equations and the data information required for equation closure in the compiler and model layers, respectively. At the compiler layer, matrix equations are assembled according to the mature semi-implicit format of the two-fluid six-equation model. At the model layer, model identifiers, annotations, parameter variables, source term closure calculation functions, interfaces, and other data information required for matrix equation assembly are provided. The model identifiers refer to specific keywords (such as tpfBaseComp or tpfPhysicComp) in the Modelica model code annotation section, which are used to identify whether the Modelica model is included in the FMU model framework. The interfaces include fluid flow interfaces, control interfaces, electrical interfaces, and mechanical interfaces, establishing a mapping relationship between the matrix equations in the compiler layer and the data information in the model layer, thus forming a closed two-fluid six-equation matrix system.
[0055] Furthermore, under the Modelica specification after the syntactic and semantic extension, the fluid flow interface is a fluid interface that only expresses the topological connection relationship of the thermal-hydraulic model components, and no content is defined in the fluid interface; the control interface, electrical interface, and mechanical interface are data interaction interfaces between the thermal-hydraulic model and the control model, electrical model, and mechanical model based on differential-algebraic equations, and data is transferred inside and outside the FMU model framework using specific identified value retrieval or assignment functions (such as the value retrieval function NumapSet or the assignment function NumapGet).
[0056] Furthermore, within the FMU model framework, the two-fluid six-equation-based thermal-hydraulic modeling is a hierarchical modeling based on unit nodes. The unit nodes are staggered grid discrete nodes of the thermal-hydraulic system, including control volumes and nozzles. The control volume corresponds to the main control volume of the staggered grid, used for modeling the mass and energy equations of the vapor and liquid phases. The nozzles correspond to the secondary control volumes of the staggered grid, used for modeling the momentum equations of the vapor and liquid phases. Using the unit node model as the smallest granularity thermal-hydraulic model, the thermal-hydraulic equipment model and system model are formed through fluid interface connections between the unit node models. This effectively matches the staggered grid used for spatial discretization of the two-fluid six-equation system and the parameter variable call relationship between the basic control equations and the source term closed functions.
[0057] Step 12: Generating the function model TpfFun
[0058] Step 121: Traverse the thermal-hydraulic component models within the FMU model framework, identify the specific identifiers of the control interface, electrical interface, or mechanical interface of the thermal-hydraulic component model, and determine the value retrieval or assignment functions (e.g., value retrieval function NumapSet or assignment function NumapGet). Confirm the data name, data type, thermal-hydraulic component model name, and unit node number to which the data belongs by the value retrieval or assignment functions. Create an interface data structure container to store the interface information. One transmitted variable corresponds to one interface data container. The interface information includes the interface type (i.e., whether the data is input or output data), data type (i.e., whether the data is a parameter or a variable), full data name, and unit node number to which the data belongs.
[0059] Step 122: Create a function model TpfFun on NUMAP. TpfFun is an empty function model containing inputs and outputs encapsulated using the FMU model framework. Traverse the interface data container, obtain the interface data, and determine the type of the interface data. If it is a variable, set the interface data as an input or output variable of TpfFun according to the interface type. Combined with the unit node number to which the variable belongs, store the interface variable in the input / output data container corresponding to the function model TpfFun using the data correspondence of <variable name, interface type, unit node number>. If it is a parameter, store the interface data in the node data container corresponding to the unit node according to the unit node number to which the parameter belongs.
[0060] Step 123: Traverse the input and output data containers of the function model TpfFun. Based on the data correspondence of <variable name, interface type, unit node number>, establish the mapping between the variables of the thermal-hydraulic unit nodes and the input and output variables of the function model TpfFun. During the initialization and time stepping of the function model TpfFun, the solver reads the correspondence between the input and output variables of the function model TpfFun and the variables of the thermal-hydraulic unit nodes. It directly maps the input variables of the function model TpfFun to the corresponding variables of the corresponding unit nodes, or assigns the corresponding variables of the corresponding unit nodes to the output variables of the function model TpfFun. This realizes the interaction between the variables of the two-fluid six-equation system based on unit nodes within the FMU framework and the variables of the differential-algebraic equation system outside the FMU framework.
[0061] Step 2: Compile the function model TpfFun and the differential algebraic equation system as a whole under the compilation rules based on Modelica to obtain the sequence plan for the unified solution of the two-fluid six-equation and differential algebraic equation heterogeneous system. This solution sequence plan describes the solution order of the two-fluid six-equation FMU encapsulation function TpfFun as an independent subset of equations and other subsets of differential algebraic equations, as well as the input-output relationship between each subset of equations.
[0062] The function model TpfFun is a functional equation model with explicit inputs and outputs. When compiling the function model TpfFun and differential algebraic equations as a whole, TpfFun, as an independent function, undergoes native compilation and analysis together with the differential algebraic equation systems of electrical, control, and mechanical disciplines. Firstly, it transforms the object-oriented, hierarchical, and dynamic multi-disciplinary models of electrical, control, and mechanical engineering into a flattened and implementable differential algebraic equation solution plan. Secondly, it establishes a data dependency graph between the function model TpfFun and subsets of differential algebraic equations. Through this data dependency graph, it establishes a solution sequence plan for the function model TpfFun as an independent subset of equations and other subsets of differential algebraic equations, satisfying the input-output relationships between each subset of equations.
[0063] The overall compilation of the function model TpfFun and the differential-algebraic equation system is divided into two stages: compilation and analysis. In the compilation stage, the object-oriented hierarchical and dynamic Modelica model is transformed into a flattened differential-algebraic equation system by performing syntax and semantic checks, unit checks and operations, flattening and instantiation on the model code. In the analysis stage, the flattened equation system is transformed into an optimized solvable equation sequence by performing compatibility analysis and reduction divide-and-conquer.
[0064] Step 21: The compilation phase includes the following steps:
[0065] Step 211: Modelica syntax and semantics check, check whether the combination of keywords, identifiers, operators, strings, numbers, comments, etc. in the model code conforms to the syntax of Modelica; perform type and variable lookup, type compatibility check, and check for complex semantics such as restricted classes, objects, inheritance, variants, and redeclaration according to the Modelica semantic specification.
[0066] Step 212: Unit checking and calculation, including variable unit validity checking and unit matching checking of expressions on both sides of the equation, supporting the derivation of the unit of the expression through the calculation of the units of each physical quantity.
[0067] Step 213: Flattening and Instantiation Processing. Through inheritance expansion, aggregation expansion, join expansion, algorithmic expansion, and discrete expansion, as well as function processing and event processing, the declarative, object-oriented, hierarchical Modelica model is mapped into a flattened continuous-discrete hybrid differential-algebraic equation system. Since the functional equation TpfFun generated by the two-fluid six-equation system is an algorithmically equivalent equation, it is flattened as an independent minimization equation along with other differential-algebraic equation systems.
[0068] Step 22: The analysis phase includes the following steps:
[0069] Step 221: Compatibility Analysis. Using bipartite graph analysis, this step analyzes whether the differential-algebraic equation system obtained after flattening is structurally compatible, i.e., whether the equation system is a perfectly constrained system. A perfectly constrained system is a closed system of equations consisting of n distinct equations and n distinct variables. Its necessary and sufficient condition is that the bipartite graph of the equation system has a perfect matching, which means a matching that covers all vertices of the bipartite graph. If the equation system contains redundant constraint equations, it is called an over-constrained system; if it contains unconstrained variables, it is called an under-constrained system. Compatibility analysis can also identify redundant equations and constraint variables in over-constrained systems or unconstrained variables in under-constrained systems.
[0070] Step 222: Reduction and Divide & Conquer. Using bipartite graph analysis, strongly connected component analysis is performed on the flattened differential-algebraic equation system to obtain a subset of strongly coupled equations that need to be solved simultaneously. These subsets are then merged into an independent subset. Additionally, the functional equation TpfFun can be directly treated as an independent subset. A data dependency graph of the subset is generated by analyzing the introduced and computed variables. The direction of the data dependency graph corresponds to the solution sequence planning for the subset.
[0071] For multi-disciplinary coupled models, a data dependency graph can be obtained by reducing and dividing and conquering the subset of the function TpfFun equation and other subsets of differential algebraic equations. This data dependency graph is a typical nonlinear algebraic ring. Usually, the variables introduced by the function equation TpfFun are taken as the tear points of the algebraic ring. During the compilation process, the algebraic ring is broken according to the tear points to generate a solution sequence programming.
[0072] Step 3: According to the solution sequence plan, solve each subset of equations of the heterogeneous system of two-fluid six-equation and differential-algebraic equation in turn. The subset of equations corresponding to the FMU encapsulation function TpfFun of two-fluid six-equation calls the dedicated solution algorithm of two-fluid six-equation, and the subset of differential-algebraic equation calls the dedicated solution algorithm of differential-algebraic equation. Data transfer between the two types of equation subsets adopts the FMU data communication mechanism.
[0073] The solution sequence planning described herein expresses the solution order of the two-fluid six-equation FMU encapsulation function TpfFun as an independent subset of equations and other subsets of differential-algebraic equations under a unified solution framework, as well as the input-output relationships between these subsets. According to the solution order in the solution sequence planning, mature dedicated solution algorithms are sequentially invoked to solve each subset of equations in the heterogeneous system of two-fluid six-equation and differential-algebraic equations. The subset of equations corresponding to the two-fluid six-equation FMU encapsulation function TpfFun invokes dedicated two-fluid six-equation solution algorithms, such as the SIMPLE algorithm for pressure-velocity coupling; the subset of differential-algebraic equations invokes dedicated differential-algebraic equation solution algorithms, such as the DASSL algorithm. The input-output data interaction between the two types of equation subsets adopts a data communication mechanism based on the FMU framework, including a data communication time interval mechanism and a data interface mechanism.
[0074] Step 31: Data Communication Time Interval Mechanism
[0075] The function TpfFun is a highly customized FMU unit. Compared to a subset of differential-algebraic equations, it features a smaller solution time step, larger input / output data volume, and convergence criterion based on quality error rather than iteration error. The data communication time interval mechanism between the two-fluid six-equation system and the differential-algebraic equations employs both fixed-point communication and active communication modes. The former exchanges data at user-defined time intervals, suitable for situations with lower computational accuracy requirements; the latter exchanges data after each time step that meets the quality error requirements, suitable for situations with higher computational accuracy requirements.
[0076] Step 32: Data Interface Mechanism
[0077] The data interface mechanism between the two-fluid six equations and the differential-algebraic equations should specify the basic unit type corresponding to the data, whether the data is an input or an output, and whether it is an integer or a real number. Therefore, the data interface type can be divided into eight categories, but regardless of the type of interface, the data form includes the following formal parameters:
[0078] Step 321: First type of formal parameter comLenth: The length of this data communication, i.e. the number of communication variables, an integer, which is the input value;
[0079] Step 322: Second type of formal parameter infoList: The node unit number corresponding to the communication variable and the position number of the variable in the source term function variable enumeration table, Integer, is the input value. The source term function variable enumeration table is formed by uniformly organizing the input and output data types and names of all source term functions of the two fluid six equations, and storing all source term function input and output data in the underlying data structure corresponding to the node unit in the data format of the variable enumeration table;
[0080] Step 323: Third type of formal parameter valList: Based on the variable description of the second type of formal parameter, give the corresponding numerical value of the variable. The real type is Real. When used as an input interface, it is the input value. When used as an output interface, it is the output value.
Claims
1. A joint simulation method based on Modelica using two-fluid six-equation and differential-algebraic equations, characterized in that, Includes the following steps: Step 1: The two-fluid six-equation system is transformed into a functional model TpfFun containing input, output, and parameter variables using the FMU model framework. This functional model TpfFun has an algebraic equation model with input and output. Step 2: Compile the function model TpfFun and the differential algebraic equation system as a whole under the compilation rules based on Modelica to obtain the sequence plan for the unified solution of the two-fluid six-equation and differential algebraic equation heterogeneous system. This solution sequence plan describes the solution order of the two-fluid six-equation FMU encapsulation function TpfFun as an independent subset of equations and other subsets of differential algebraic equations, as well as the input-output relationship between each subset of equations. Step 3: According to the solution sequence plan, solve each subset of equations of the heterogeneous system of two-fluid six-equation and differential-algebraic equation in turn. The subset of equations corresponding to the FMU encapsulation function TpfFun of two-fluid six-equation calls the dedicated solution algorithm of two-fluid six-equation, and the subset of differential-algebraic equation calls the dedicated solution algorithm of differential-algebraic equation. Data transfer between the two types of equation subsets adopts the FMU data communication mechanism.
2. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 1, characterized in that, Step 1 includes the following: Step 11: Establish the FMU model framework; Step 12: Generate the function model TpfFun.
3. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 2, characterized in that: In step 11, the FMU model is a model derived from the FMI standard for co-simulation. Within the FMU model framework, the Modelica specification with extended syntax and semantics is used for thermal-hydraulic modeling based on the two-fluid six-equation model. Outside the FMU model, the native Modelica specification is used for control, electrical, and mechanical modeling based on differential-algebraic equations. The extended syntax and semantics of the Modelica specification places the conservation control equations and the data information required for equation closure of the two-fluid six-equation model in the compilation layer and the model layer, respectively. In the compilation layer, matrix equations are assembled according to the mature semi-implicit format of the two-fluid six-equation model. In the model layer, the model identification annotations, parameter variables, source term closure calculation functions, and interface data information required for matrix equation assembly are provided. The model identification annotations refer to specific keywords in the Modelica model code annotation section. These specific keywords are used to identify whether the Modelica model is included in the FMU model framework. The interfaces include fluid flow interfaces, control interfaces, electrical interfaces, and mechanical interfaces, and a mapping relationship is established between the matrix equations in the compilation layer and the data information in the model layer, thereby forming a closed two-fluid six-equation matrix system.
4. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 3, characterized in that: In step 11, under the Modelica specification after syntactic and semantic expansion, the fluid flow interface is a fluid interface that only expresses the topological connection relationship of the thermal-hydraulic model components, and no content is defined in the fluid interface; the control interface, electrical interface, and mechanical interface are data interaction interfaces between the thermal-hydraulic model and the control model, electrical model, and mechanical model based on differential-algebraic equations, and use value retrieval or assignment functions with specific identifiers, such as data transfer inside and outside the FMU model framework.
5. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 3, characterized in that: In step 11, the thermal-hydraulic modeling based on the two-fluid six-equation framework within the FMU model framework is a hierarchical modeling based on unit nodes. The unit nodes are staggered grid discrete nodes of the thermal-hydraulic system, including control volumes and nozzles. The control volume corresponds to the main control volume of the staggered grid and is used for modeling the mass and energy equations of the vapor and liquid phases. The nozzles correspond to the secondary control volumes of the staggered grid and are used for modeling the momentum equations of the vapor and liquid phases. The unit node model is the smallest granularity thermal-hydraulic model. The thermal-hydraulic equipment model and system model are formed by connecting the unit node model fluid interfaces. The staggered grid used for spatial discretization of the two-fluid six-equation framework and the parameter variable calling relationship between the basic control equations and the source term closed function are matched.
6. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 2, characterized in that, Step 12 includes the following: Step 121: Traverse the thermal-hydraulic component models within the FMU model framework, identify the value-taking or assignment functions corresponding to the specific identifiers of the control interface, electrical interface, or mechanical interface of the thermal-hydraulic component model, confirm the data name, data type, thermal-hydraulic component model name, and unit node number to which the data belongs, and create an interface data structure container to store the interface information. One transmitted variable corresponds to one interface data container. The interface information includes the interface type, data type, full data name, and unit node number to which the data belongs. Step 122: Create a function model TpfFun on NUMAP. TpfFun is an empty function model containing inputs and outputs encapsulated using the FMU model framework. Traverse the interface data container, obtain the interface data, and determine the type of the interface data. If it is a variable, set the interface data as the input or output variable of TpfFun according to the interface type. Combined with the unit node number to which the variable belongs, store the interface variables uniformly in the input and output data containers corresponding to the function model TpfFun using the data correspondence of <variable name, interface type, unit node number>. If it is a parameter, store the interface data in the node data container corresponding to the unit node according to the unit node number to which the parameter belongs. Step 123: Traverse the input and output data containers of the function model TpfFun. Based on the data correspondence of <variable name, interface type, unit node number>, establish the mapping between the variables of the thermal-hydraulic unit nodes and the input and output variables of the function model TpfFun. During the initialization and time stepping of the function model TpfFun, the solver reads the correspondence between the input and output variables of the function model TpfFun and the variables of the thermal-hydraulic unit nodes. It directly maps the input variables of the function model TpfFun to the corresponding variables of the corresponding unit nodes, or assigns the corresponding variables of the corresponding unit nodes to the output variables of the function model TpfFun. This realizes the interaction between the variables of the two-fluid six-equation system based on unit nodes within the FMU framework and the variables of the differential-algebraic equation system outside the FMU framework.
7. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 2, characterized in that: The function model TpfFun described in step 2 is a functional equation model with explicit inputs and outputs. When compiling the function model TpfFun and the differential algebraic equations as a whole, TpfFun, as an independent function, is natively compiled and analyzed together with the differential algebraic equation system of electrical, control, mechanical and other disciplines. First, the hierarchical and dynamic multi-disciplinary models of electrical, control, mechanical and other disciplines are transformed into a flat and realizable differential algebraic equation solution plan. Second, a data dependency graph is established between the function model TpfFun and the subset of differential algebraic equations. Through the data dependency graph, a solution sequence plan is established between the function model TpfFun as an independent subset of equations and other subsets of differential algebraic equations, satisfying the input-output relationship between each subset of equations.
8. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 7, characterized in that: In step 2, the overall compilation of the function model TpfFun and the differential-algebraic equation system is divided into two stages: compilation and analysis. In the compilation stage, the object-oriented hierarchical and dynamic Modelica model is converted into a flattened differential-algebraic equation system by performing syntax and semantic checks, unit checks and operations, flattening and instantiation on the model code. In the analysis stage, the flattened equation system is converted into an optimized solvable equation sequence by performing compatibility analysis and reduction divide-and-conquer.
9. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 8, characterized in that, Step 2 includes: Step 21: Compilation phase; Step 22: Analysis phase.
10. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 9, characterized in that, Step 21 includes: Step 211: Modelica syntax and semantics check, check whether the combination of keywords, identifiers, operators, strings, numbers and comments in the model code conforms to the syntax of Modelica; perform type and variable lookup, type compatibility check and check for restricted classes, objects, inheritance, variants and redeclarations according to the Modelica semantic specification. Step 212: Unit checking and calculation, including variable unit validity checking and unit matching checking of expressions on both sides of the equation, supporting the derivation of the unit of the expression through the calculation of the units of each physical quantity; Step 213: Flattening and instantiation processing. Through inheritance expansion, aggregation expansion, connection expansion, algorithm expansion and discrete expansion, as well as function processing and event processing, the declarative, object-oriented, hierarchical Modelica model is mapped into a flattened continuous-discrete hybrid differential-algebraic equation system.
11. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 9, characterized in that, Step 22 includes: Step 221: Compatibility analysis. Using the bipartite graph analysis method, we analyze whether the differential algebraic equation system obtained by flattening is structurally compatible, that is, whether the equation system is a well-constrained system. Step 222: Reduction and Divide & Conquer. Using bipartite graph analysis, strongly connected component analysis is performed on the flattened differential-algebraic equation system to obtain a subset of strongly coupled equations that need to be solved simultaneously. These are merged into an independent subset of equations. In addition, the function equation TpfFun is treated as an independent subset of equations. By analyzing the introduced and computed variables of the subset of equations, a data dependency graph of the subset of equations is generated. The direction of the data dependency graph corresponds to the solution sequence planning of the subset of equations. For multi-disciplinary coupled models, reduction and divide & conquer can obtain the data dependency graph formed by the subset of function TpfFun equations and other subsets of differential-algebraic equations. This data dependency graph is a typical nonlinear algebraic ring. Usually, the introduced variables of function equation TpfFun are used as tear points of the algebraic ring. During the compilation process, the algebraic ring is broken according to the tear points to generate the solution sequence planning.
12. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 1, characterized in that: The solution sequence planning described in step 3 expresses the solution order of the two-fluid six-equation FMU encapsulation function TpfFun as an independent subset of equations and other subsets of differential-algebraic equations under a unified solution framework, as well as the input-output relationship between each subset of equations. According to the solution order in the solution sequence planning, mature dedicated solution algorithms are called sequentially to solve each subset of equations in the heterogeneous system of two-fluid six-equation and differential-algebraic equations. The subset of equations corresponding to the two-fluid six-equation FMU encapsulation function TpfFun calls the dedicated solution algorithm for two-fluid six-equation.
13. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 12, characterized in that, Step 3 includes the following: Step 31: Data communication time interval mechanism; Step 32: Data interface mechanism.
14. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 13, characterized in that: In step 31, the data communication time interval mechanism between the two fluid six equations and the differential algebraic equations adopts a fixed-point communication mode and an active communication mode.
15. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 13, characterized in that: In step 32, the data interface mechanism between the two-fluid six equations and the differential algebraic equations determines the basic unit type corresponding to the data, whether the data is an input or an output, whether it is an integer or a real number. The data interface types are divided into eight categories, all of which contain formal parameters.
16. The joint simulation method based on Modelica's two-fluid six-equation and differential-algebraic equations as described in claim 15, characterized in that, Step 32 includes the following: Step 321: First type of formal parameter comLenth The length of this data communication, i.e. the number of communication variables, is an integer and represents the input value; Step 322: Second type of formal parameter infoList The node unit number corresponding to the communication variable and the position number of the variable in the source term function variable enumeration table are integers, which are input values. The source term function variable enumeration table is formed by uniformly organizing the input and output data types and names of all source term functions of the two fluid six equations, and storing all source term function input and output data in the underlying data structure corresponding to the node unit in the data format of the variable enumeration table. Step 323: Third type of formal parameter valList Based on the variable description of the second type of formal parameter, the corresponding numerical value of the variable is given. The real type Real is the input value when used as an input interface and the output value when used as an output interface.
