Two-fluid six-equation-based thermotechnical fluid assembly error reporting method and system

Through the calculation method of data container and generalized source term function, the problem that the Modelica compilation and solution framework cannot report wrong model components in a two-fluid hexa equation system is solved, and accurate positioning and feedback error information is achieved, improving model debugging efficiency.

CN120508494APending Publication Date: 2025-08-19NUCLEAR POWER INSTITUTE OF CHINA +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510507662.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

The existing Modelica-based compilation solution framework is difficult to report wrong model component names in two-fluid hexa equation systems, resulting in debugging difficulties.

Method used

The basic node unit data information storage method and generalized source item function calculation method based on the data container are used to store the model component information of the basic node unit belonging to the basic node unit, establish the data information mapping relationship between the basic node unit and the model component, and support feedback error information to the model components that can be operated directly by the user.

Benefits of technology

It effectively avoids data read and write conflicts, can accurately locate the error model components, and improves the debugging efficiency of the two-fluid hexa equation thermal fluid model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508494A_ABST
    Figure CN120508494A_ABST
Patent Text Reader

Abstract

The invention provides a thermal fluid assembly error reporting method and system based on two fluids and six equations. The method comprises the steps that a corresponding data container used for basic node unit variable parameter storage and read-write is arranged for each basic node unit model in a thermal hydraulic system topological structure chart formed by orderly connecting basic node unit models; obtaining the serial number of the thermal hydraulic basic node unit and a corresponding data container; generalized source item function calculation based on the basic node units is carried out, data containers corresponding to the basic node units and the upstream and downstream basic node units of the basic node units are read through input data of generalized source item function calculation, and output data are stored in the data containers corresponding to the basic node units. According to the method, a basic node unit data information storage mode and a generalized source item function calculation mode based on a data container are adopted, so that the problem that a current Modelica-based calculation error reporting mechanism is difficult to report an error model component is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of nuclear power simulation technology, and specifically relates to a thermal fluid component error reporting method and system based on two-fluid six equations. Background Art

[0002] In the current Modelica-based compilation and solving framework, the logging system automatically reports Modelica model code statements that contain errors, including syntax errors, division by zero, and data out-of-limit errors. However, it does not report the Modelica model component name where the error code statement resides. This is because the current Modelica-based compilation and solving framework uses a flattening operation to completely eliminate the hierarchical relationships formed by integration and inclusion between models, forming a flattened continuous-discrete mixed differential algebraic equation system. This facilitates subsequent model analysis and the generation of a solution sequence plan for the differential algebraic equation system. However, for a two-fluid six-equation system, since thermal-hydraulic systems contain a large number of homogeneous basic node units, all of which contain the same type of source term function, model code statements for the same source term function will be inherited and referenced by these homogeneous basic node units. Therefore, an error reporting mechanism based solely on code statements cannot meet the debugging requirements of thermal-hydraulic models based on two-fluid six-equation systems. Summary of the Invention

[0003] In view of this, the present application is committed to providing a thermal fluid component error reporting method and system based on two-fluid six equations, by adopting a basic node unit data information storage method based on a data container and a generalized source term function calculation method to solve the problem that the current Modelica-based calculation error reporting mechanism is difficult to report model components with errors.

[0004] A first aspect of the present application provides a method for reporting errors of thermal fluid components based on two-fluid six equations. The method for reporting errors of thermal fluid components based on two-fluid six equations includes the following steps 1 to 8.

[0005] Step 1: Use a flattening method to restore the user-built thermal-hydraulic system model to a thermal-hydraulic system topology diagram consisting entirely of ordered connections of basic node unit models. For each basic node unit model, a corresponding data container is set for storing and reading basic node unit variable parameters. The data container is used to store all the information required to solve the two-fluid six equations.

[0006] Step 2: traverse the basic node units of the thermal hydraulic system topology diagram to obtain the thermal hydraulic basic node unit number and its corresponding data container.

[0007] Step 3: Carry out the calculation of the generalized source term function based on the basic node unit. The input data of the generalized source term function calculation reads the data container corresponding to the basic node unit and the upstream and downstream basic node units of the basic node unit, and the output data is stored in the data container corresponding to the basic node unit.

[0008] Step 4: Determine whether an error occurs in the calculation process of the generalized source term function of the basic node unit. If no error occurs in the calculation process of the generalized source term function, jump to step 7; if an error occurs in the calculation process of the generalized source term function, feedback the generalized source term function name and basic node unit number, and jump to step 5.

[0009] Step 5: According to the basic node unit number, obtain the model component information of the basic node unit model stored in the data container corresponding to the basic node unit.

[0010] Step 6: Feedback the user with information about the model component that caused the error, stop the calculation thread of the generalized source function, and jump to step 8.

[0011] Step 7: Determine whether the traversal of the basic node units of the thermal hydraulic system topology diagram is complete. If the traversal is complete, jump to step 8; if the traversal is not complete, jump to step 2.

[0012] Step 8: End the calculation of the generalized source function.

[0013] In a specific embodiment of the present application, step 1 includes the following steps 1-1 to 1-6.

[0014] Step 1-1: Identify the Modelica-based thermal-hydraulic system model through model annotation keywords, wherein the model annotation keywords are divided into basic node unit model identification keywords and thermal-hydraulic component model identification keywords.

[0015] Step 1-2: traverse the thermal-hydraulic component model of the thermal-hydraulic system model, flatten the thermal-hydraulic component model, and convert the thermal-hydraulic component model into a component model with staggered directed connections between control bodies and takeovers according to the number of discrete nodes and hierarchical encapsulation information.

[0016] Step 1-3: According to the connection relationship between the thermal-hydraulic system models, the flattened thermal-hydraulic component models and the basic node unit models are connected to form a flattened model connection diagram.

[0017] Steps 1-4: traverse the basic node units of the flattened model connection graph, number the basic node units, and define a data container for each basic node unit.

[0018] Step 1-5: remove the hierarchical component encapsulation information of the flattened model connection graph to form a flattened topology structure graph, which is a topology graph completely composed of directed connections of basic node units.

[0019] Steps 1-6: traverse the graph vertices and directed connections of the flattened topology graph, obtain the upstream and downstream node information of the basic node unit, and store it in the corresponding data container.

[0020] In a specific embodiment of the present application, step 3 includes the following steps 3-1 to 3-4.

[0021] Step 3-1, define the data reading function and data writing function of the basic node unit data container, the data reading function and data writing function read and write the data information at the corresponding position of the data container data structure according to the basic node unit number id and the variable name VarType.

[0022] Step 3-2: Use data reading function and data writing function to convert each source item function into a source item function model with the basic node unit number id as the only input variable. The source item function model reads the data stored in the basic node unit data container corresponding to the basic node unit number id as the input variable of the source item function through the data reading function, calculates the function output result using the mathematical principle formula of the source item function, and then uses the data writing function to write the function output result into the memory space corresponding to the source item function output variable in the basic node unit data container corresponding to the basic node unit number id.

[0023] Step 3-3. Define the source term function enumeration table. The source term function enumeration table encompasses all generalized source term function types for the calculation of the two-fluid six-equation system. The position number in the enumeration table represents the execution order of the source term function and expresses the mathematical logic of the source term function calculation of the two-fluid six-equation system.

[0024] Step 3-4: According to the execution order of the generalized source function defined in the source function enumeration table, traverse the basic node units of the thermal-hydraulic system, and use single-node serial calculation or multi-basic node unit parallel calculation to carry out the source function model calculation of each basic node unit.

[0025] In a specific embodiment of the present application, step 3-1 includes step 3-1-1 and step 3-1-2.

[0026] Step 3-1-1: In the data container corresponding to the basic node unit, a variable enumeration table is used to define the storage data structure of the basic node's parameters, variables, and source term functions in the data container. The variable enumeration table is an array that stores the input and output variables and parameters of all generalized source term functions of the basic node unit according to a certain data structure. The variable enumeration table contains all the input and output data required for the calculation of the generalized source term function of the basic node unit.

[0027] Step 3-1-2. After defining the variable enumeration table, define the data reading function and the data writing function. The data reading function is used to read the variable VarType stored in the basic node unit data container corresponding to the basic node unit number id. The data writing function is used to write the externally obtained parameter inputVal to the memory location corresponding to the basic node unit data container variable VarType corresponding to the basic node unit number id.

[0028] In a specific embodiment of the present application, step 3-2 includes steps 3-2-1 to 3-2-4.

[0029] Step 3-2-1. Define the input variables, output variables and process variables of the source function according to the source function name;

[0030] Step 3-2-2, use the data reading function to read the data required for the input variable from the basic node unit data container corresponding to the basic node unit number id;

[0031] Step 3-2-3, according to the mathematical principle formula of the source function, obtain the process variable data and output variable data of the function calculation through the input variable data;

[0032] Step 3-2-4: Use the data writing function to write the obtained output variable data into the memory location corresponding to the output variable of the source item function in the basic node unit data container corresponding to the basic node unit number id.

[0033] In a specific embodiment of the present application, step 4 includes step 4-1 and step 4-6.

[0034] Step 4-1: define an execution plug and an error plug for controlling error reporting and thread termination of the generalized source function calculation. The execution plug and the error plug are shared Boolean variables, and their initial states are both false.

[0035] Step 4-2: Carry out parallel calculation of multiple basic node units of the generalized source function based on the data container, and each parallel branch thread obtains the calculation task from the calculation assembly point.

[0036] Step 4-3: Perform error checking on each thread of the parallel computation of the source function. If a source function computation error occurs in any branch thread, stop the computation task of that branch thread, provide the source function name and basic node unit number, and atomically set the execution plug and error plug to true. Jump to step 4-4. If no source function computation error occurs in any branch thread, jump to step 4-5.

[0037] Step 4-4: Based on the status of other branch threads at the time of error reporting, the execution process of the branch thread is divided into the following two cases:

[0038] Case 1: The branch thread is executing the source function's computation task and detects that the error block is true. Error checking and error reporting are not performed. Then, after the task completes, the execution block is detected as true. The branch thread cannot obtain the computation task from the computation assembly point, terminates the computation, and jumps to steps 4-6.

[0039] Case 2: After the branch thread completes its task execution, it detects that the execution block symbol is true. The branch thread cannot obtain the computing task from the computing assembly point, so the branch thread terminates the calculation and jumps to steps 4-6.

[0040] Step 4-5: Determine whether the source function calculation task is completed. If the calculation task is completed, jump to step 4-6; if the calculation task is not completed, each branch thread continues to obtain calculation tasks from the calculation assembly point and jump to step 4-3.

[0041] Steps 4-6: Jump to the calculation node, and the parallel calculation of the source function ends.

[0042] In one specific embodiment of the present application, the basic node unit model includes, but is not limited to, a control volume v, a takeover j, a time-dependent control volume tdv, and a time-dependent takeover tdj. All information required to solve the two-fluid six equations includes, but is not limited to, model component information to which the basic node unit model belongs, basic node unit type, basic node unit number, upstream and downstream node information, parameters, variables, and generalized source term function. The model component information includes, but is not limited to, the model component name, type, and the name of the model component's upper-level component.

[0043] A second aspect of the present application provides a computer system comprising a processor and a memory. The processor is configured to execute the thermal fluid component error reporting method based on two fluids and six equations according to the first aspect of the present application. The memory is configured to store executable instructions for the processor.

[0044] A third aspect of the present application provides a computer-readable storage medium storing computer executable instructions, which, when executed by a processor, implement the thermal fluid component error reporting method based on two fluids and six equations according to the first aspect of the present application.

[0045] The fourth aspect of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the thermal fluid component error reporting method based on two fluids and six equations according to the first aspect of the present application.

[0046] The beneficial effects of the technical solution of the present application are: adopting a basic node unit data information storage method based on a data container and a generalized source term function calculation method, which can not only avoid the complete erasure of the hierarchical encapsulation information of the model component during the model flattening process by the current Modelica-based compilation and solution framework, but also store the model component information of the basic node unit through the data container, establish a data information mapping relationship between the basic node unit and the model component, and support the feedback of the error information or abnormal state of the basic node unit to the model component that the user can directly operate; and can limit the reading and writing of data related to the calculation of the basic node unit source term function to the data container of the basic node unit and its upstream and downstream basic node units, effectively avoiding data reading and writing conflicts or anomalies in the calculation of the basic node unit source term function, especially in the parallel calculation of multiple basic node unit source term functions. In addition, the embodiment of the present application can feedback the name of the source term function in which the error occurs and the basic node unit number according to the error information of a certain source term function calculation of a certain basic node unit, and then obtain the model component information of the basic node unit model stored in the data container corresponding to the basic node unit according to the basic node unit number, and report the model component in which the error occurs (especially the model component directly operated by the user). Therefore, the embodiments of the present application solve the problem that the current Modelica-based calculation error reporting mechanism is difficult to report the model components where errors occur, and greatly improve the debugging efficiency of the thermal fluid model based on two fluids and six equations. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 The figure shows a flow chart of a thermal fluid component error reporting method based on two fluids and six equations provided by an embodiment of the present application.

[0048] Figure 2 Shown is an example diagram of the logic for generating a topological structure diagram of a thermal hydraulic system model provided in one embodiment of the present application.

[0049] Figure 3 The figure shows an example diagram of an error reporting process for parallel computing of a source function provided by an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0051] At least one embodiment of the present application provides a method for reporting errors in a thermal fluid component based on two fluids and six equations. The method for reporting errors in a thermal fluid component based on two fluids and six equations can be applied to the Modelica language. Figure 1 The thermal fluid component error reporting method based on two-fluid six equations includes the following steps 1 to 8.

[0052] Step 1: Use a flattening method to restore the user-built thermal-hydraulic system model to a thermal-hydraulic system topology diagram consisting entirely of ordered connections of basic node unit models. For each basic node unit model, a corresponding data container is set for storing and reading basic node unit variable parameters. The data container is used to store all the information required to solve the two-fluid six equations.

[0053] It should be noted that in the hierarchical thermal-hydraulic modeling approach based on basic node units, there are basic node unit models such as control volume v, nozzle j, time-dependent control volume tdv, and time-dependent nozzle tdj. There are also equipment models such as pipes, vessels, and heat exchangers that are encapsulated by combinations of basic node unit models, as well as models with higher levels of encapsulation, such as steam generators and reactor pressure vessels. Because the generalized source term function of the two-fluid six-equation system is calculated based on basic node units such as control volumes and nozzles, it lacks the characteristic of hierarchical encapsulation. User-constructed thermal-hydraulic system models are formed by connecting thermal-hydraulic system model components with different levels of encapsulation. Therefore, flattening is required to restore the user-constructed thermal-hydraulic system model to a topological structure composed entirely of sequentially connected basic node unit models. Each vertex in the topological structure corresponds to a basic node unit, enabling the calculation of the generalized source term function based on the basic node units. Each basic node unit corresponds to a data container.

[0054] In at least one embodiment of the present application, the basic node unit model includes, but is not limited to, a control volume v, a takeover pipe j, a time-dependent control volume tdv, and a time-dependent takeover pipe tdj. All information required for solving the two-fluid six equations includes, but is not limited to, model component information of the basic node unit model, basic node unit type, basic node unit number, upstream and downstream node information, parameters, variables, and generalized source term function.

[0055] Step 2: traverse the basic node units of the thermal hydraulic system topology diagram to obtain the thermal hydraulic basic node unit number and its corresponding data container.

[0056] Step 3: Carry out the calculation of the generalized source term function based on the basic node unit. The input data of the generalized source term function calculation reads the data container corresponding to the basic node unit and the upstream and downstream basic node units of the basic node unit, and the output data is stored in the data container corresponding to the basic node unit.

[0057] It should be noted that the generalized source term function refers to physical source terms such as wall heat transfer calculation, phase heat transfer calculation, phase friction calculation, wall friction calculation, local resistance calculation, and the variable coefficients and constant terms of the discrete equations of conservation of mass, energy, and momentum, as well as the calculation preparation parts required to calculate these source terms, solve variable coefficients, constant terms, etc. The generalized source term function includes physical property calculation, takeover variable calculation based on control body variables, control body variable calculation based on takeover variables, etc.

[0058] Step 4: Determine whether an error occurs in the calculation process of the generalized source term function of the basic node unit. If no error occurs in the calculation process of the generalized source term function, jump to step 7; if an error occurs in the calculation process of the generalized source term function, feedback the generalized source term function name and basic node unit number, and jump to step 5.

[0059] Step 5: According to the basic node unit number, obtain the model component information of the basic node unit model stored in the data container corresponding to the basic node unit.

[0060] In at least one embodiment of the present application, the model component information includes but is not limited to the model component name, type, and the name of the upper-level component of the model component (especially the component directly operated by the user).

[0061] Step 6: Feedback the user with information about the model component that caused the error, stop the calculation thread of the generalized source function, and jump to step 8.

[0062] Step 7: Determine whether the traversal of the basic node units of the thermal hydraulic system topology diagram is complete. If the traversal is complete, jump to step 8; if the traversal is not complete, jump to step 2.

[0063] Step 8: End the calculation of the generalized source function.

[0064] According to the technical solution provided by the embodiment of the present application, a basic node unit data information storage method based on a data container and a generalized source term function calculation method are adopted, which can avoid the complete erasure of the hierarchical encapsulation information of the model component in the model flattening process by the current Modelica-based compilation and solution framework, and the model component information to which the basic node unit belongs is stored by the data container, and the data information mapping relationship between the basic node unit and the model component is established, which supports the feedback of the error information or abnormal state of the basic node unit to the model component to which the user can directly operate; and the reading and writing of data related to the calculation of the basic node unit source term function can be restricted to the data container of the basic node unit and its upstream and downstream basic node units, effectively avoiding the data reading and writing conflicts or anomalies in the calculation of the basic node unit source term function, especially the parallel calculation of multiple basic node unit source term functions. In addition, the embodiment of the present application can feedback the name of the source term function in which the error occurs and the basic node unit number according to the error information of the calculation of a certain source term function of a certain basic node unit, and then obtain the model component information of the basic node unit model stored in the data container corresponding to the basic node unit according to the basic node unit number, and report the model component in which the error occurs (especially the model component directly operated by the user). Therefore, the embodiments of the present application solve the problem that the current Modelica-based calculation error reporting mechanism is difficult to report the model components where errors occur, and greatly improve the debugging efficiency of the thermal fluid model based on two fluids and six equations.

[0065] In at least one embodiment of the present application, reference Figure 2 , the above step 1 includes the following steps 1-1 to 1-6.

[0066] exist Figure 2 In the , the flow boundary model, pressure boundary model, inlet pipe model, parallel pipe model, branch model, tee model, and outlet control body model are all model components that can be directly operated by users. Among them, the flow boundary model and pressure boundary model define the inlet flow boundary and outlet pressure boundary of the thermal-hydraulic system model respectively; the inlet pipe model, parallel pipe model, and branch model are all instantiated pipe model components, named according to the location of the pipe, which can simulate the thermal-hydraulic characteristics of the fluid in the pipe, and the parallel channel model is obtained by hierarchical encapsulation of two branch models; the tee model is used to simulate the thermal-hydraulic characteristics of pipe accessories such as tees that are common in thermal-hydraulic systems; the outlet control body model is an instantiated control body model, which is used to simulate the thermal-hydraulic characteristics upstream of the pressure boundary of the outlet.

[0067] Step 1-1: Identify the Modelica-based thermal-hydraulic system model through model annotation keywords, where the model annotation keywords are divided into basic node unit model identification keywords (such as tpfBaseComp) and thermal-hydraulic component model identification keywords (such as tpfPhysicComp).

[0068] It should be noted that the model annotation keywords belong to the expanded Modelia syntax and semantics, which supports hierarchical thermal-hydraulic modeling based on basic node units by introducing the FMU (Functional Mock-up Unit) model framework. These thermal-hydraulic component models refer to thermal-hydraulic models of pipes, vessels, and other systems with internally defined discrete nodes, as well as higher-level thermal-hydraulic models formed by connecting and encapsulating thermal-hydraulic component models.

[0069] Step 1-2: traverse the thermal-hydraulic component model of the thermal-hydraulic system model, flatten the thermal-hydraulic component model, and convert the thermal-hydraulic component model into a component model with staggered directed connections between control bodies and takeovers according to the number of discrete nodes and hierarchical encapsulation information.

[0070] Step 1-3: According to the connection relationship between the thermal-hydraulic system models, the flattened thermal-hydraulic component models and the basic node unit models are connected to form a flattened model connection diagram.

[0071] Steps 1-4: traverse the basic node units of the flattened model connection graph, number the basic node units, and define a data container for each basic node unit.

[0072] Step 1-5: remove the hierarchical component encapsulation information of the flattened model connection graph to form a flattened topology structure graph, which is a topology graph completely composed of directed connections of basic node units.

[0073] Steps 1-6: traverse the graph vertices and directed connections of the flattened topology graph, obtain the upstream and downstream node information of the basic node unit, and store it in the corresponding data container.

[0074] In at least one embodiment of the present application, step 3 includes the following steps 3-1 to 3-4.

[0075] Step 3-1, define the data reading function and data writing function of the basic node unit data container, the data reading function and data writing function read and write the data information at the corresponding position of the data container data structure according to the basic node unit number id and the variable name VarType.

[0076] It should be noted that the data reading function is the Get(id, VarType) function, which can be referred to as the Get function. The data writing function is the Set(id, VarType, inputVal) function, which can be referred to as the Set function.

[0077] Step 3-2: Use the data reading function and the data writing function to convert each source item function into a source item function model with the basic node unit number id as the only input variable. The source item function model reads the data stored in the basic node unit data container numbered id as the input variable of the source item function through the data reading function, calculates the function output result using the mathematical principle formula of the source item function, and then uses the data writing function to write the function output result into the memory space corresponding to the source item function output variable in the basic node unit data container numbered id.

[0078] Step 3-3. Define the source term function enumeration table. The source term function enumeration table encompasses all generalized source term function types for the calculation of the two-fluid six-equation system. The position number in the enumeration table represents the execution order of the source term function and expresses the mathematical logic of the source term function calculation of the two-fluid six-equation system.

[0079] Step 3-4: According to the execution order of the generalized source function defined in the source function enumeration table, traverse the basic node units of the thermal-hydraulic system, and use single-node serial calculation or multi-basic node unit parallel calculation to carry out the source function model calculation of each basic node unit.

[0080] The embodiment of the present application can adapt to the parallel calculation method of the generalized source term function based on multiple basic node units, can convert the generalized source term function of the basic node unit into a source term function model with the basic node unit number id as the only input variable, and realize the orderly parallel calculation of the source term function of multiple basic node units according to the execution order of the generalized source term function defined by the source term function enumeration table; can terminate the source term function calculation of each calculation branch in an orderly and rapid manner and jump to the calculation assembly point when an error occurs in any calculation branch, and avoid confusion and conflict in the operational processes of task execution, task termination, error checking, error handling, etc. caused by simultaneous error printing of multiple branches.

[0081] In at least one embodiment of the present application, step 3-1 includes step 3-1-1 and step 3-1-2.

[0082] Step 3-1-1: In the data container corresponding to the basic node unit, a variable enumeration table is used to define the storage data structure of the basic node's parameters, variables, and source term functions in the data container. The variable enumeration table refers to an array in which the input and output variables and parameters of all generalized source term functions of the basic node unit are stored according to a certain data structure. The variable enumeration table contains all the input and output data required for the calculation of the generalized source term function of the basic node unit. In this way, by defining a standardized data structure in the data container, data read and write conflicts or anomalies can be further avoided during the calculation of the basic node unit source term function, especially during the parallel calculation of multiple basic node unit source term functions.

[0083] Taking the control body as an example, the variable enumeration is as follows:

[0084]

[0085] Note: _Vol represents the control body variable parameter.

[0086] Step 3-1-2. After defining the variable enumeration table, define the read Get(id,VarType) function and the write Set(id,VarType,inputVal) function. The former reads the variable VarType stored in the basic node unit data container numbered id, and the latter writes the externally obtained parameter inputVal to the memory location corresponding to the basic node unit data container variable VarType numbered id.

[0087] It should be noted that the variable VarType is defined in the variable enumeration table.

[0088] In the above embodiment, the Get(id, VarType) function and the Set(id, VarType, inputVal) function are used to directly operate the memory space corresponding to the parameter variable, thereby avoiding a large number of equal value or value transfer functions.

[0089] In at least one embodiment of the present application, step 3-2 includes steps 3-2-1 to 3-2-4.

[0090] Step 3-2-1. Define the input variables, output variables and process variables of the source function according to the source function name;

[0091] Step 3-2-2, use the data reading function to read the data required by the input variable from the basic node unit data container numbered id;

[0092] Step 3-2-3, according to the mathematical principle formula of the source function, obtain the process variable data and output variable data of the function calculation through the input variable data;

[0093] Step 3-2-4: Use the data writing function to write the obtained output variable data into the memory location corresponding to the output variable of the source item function in the basic node unit data container numbered id.

[0094] Example of source function code with basic node unit ID as the only input:

[0095]

[0096] Source function enumeration table

[0097] Define a source term function enumeration table. The source term function enumeration table is an array that stores all generalized source term function types of the two-fluid six-equation system according to a certain data structure. The position number in the enumeration table represents the execution order of the source term function. The source term function enumeration table example is as follows:

[0098]

[0099] Note: _Vol represents the control volume source function, and _Jun represents the takeover source function.

[0100] During the parallel computation of a generalized source term function across multiple basic node units, the computational process and time consumption for the same source term function vary due to the varying thermal and hydraulic states of different basic node units. Furthermore, random fluctuations in the execution rate of the computational threads occur, and as a result, the tasks of each parallel branch are not completed simultaneously in actual parallel computations. To maximize parallel computation efficiency, when a thread completes its computation, it immediately adds new tasks, rather than waiting for the completion of the same batch of tasks computed by other threads before adding tasks. In this case, if errors occur in multiple parallel branches, then multiple error messages are printed simultaneously, potentially leading to confusion and conflicts in the processes of task execution, task termination, error checking, and error handling. Therefore, it is important to ensure that only one parallel branch's error message is printed during the parallel computation process, and that the computation is stopped after the error message occurs.

[0101] In at least one embodiment of the present application, step 4 includes step 4-1 and step 4-6.

[0102] Step 4-1: define an execution plug and an error plug for controlling error reporting and thread termination of the generalized source function calculation. The execution plug and the error plug are shared Boolean variables, and their initial states are both false.

[0103] Step 4-2: Carry out parallel calculation of multiple basic node units of the generalized source function based on the data container, and each parallel branch thread obtains the calculation task from the calculation assembly point.

[0104] Step 4-3: Perform error checking on each thread of the parallel computation of the source function. If a source function computation error occurs in any branch thread, stop the computation task of that branch thread, provide the source function name and basic node unit number, and atomically set the execution plug and error plug to true. Jump to step 4-4. If no source function computation error occurs in any branch thread, jump to step 4-5.

[0105] Step 4-4: Based on the status of other branch threads at the time of error reporting, the execution process of the branch thread is divided into the following two cases:

[0106] Case 1: The branch thread is executing the source function's computation task and detects that the error block is true. Error checking and error reporting are not performed. Then, after the task completes, the execution block is detected as true. The branch thread cannot obtain the computation task from the computation assembly point, terminates the computation, and jumps to steps 4-6.

[0107] Case 2: After the branch thread completes its task execution, it detects that the execution block symbol is true. The branch thread cannot obtain the computing task from the computing assembly point, so the branch thread terminates the calculation and jumps to steps 4-6.

[0108] Step 4-5: Determine whether the source function calculation task is completed. If the calculation task is completed, jump to step 4-6; if the calculation task is not completed, each branch thread continues to obtain calculation tasks from the calculation assembly point and jump to step 4-3.

[0109] Steps 4-6: Jump to the calculation node, and the parallel calculation of the source function ends.

[0110] Taking 3 parallel branches as an example, the parallel calculation error and calculation thread termination of the generalized source function are as follows: Figure 3 As shown, each moment along the time axis is t 11 , t 21 , t 31 , t 12 , t 22 , t 32 , t 13 , t 23 , t 33 , t 14 to t 15 The time flow from task reception, task execution, calculation error reporting to task termination is as follows:

[0111] (1) At t 11 to t 31 During this time, the execution plug and the error plug are both 0, and each computing branch obtains the computing task from the computing assembly point for execution.

[0112] (2) At t12 At this moment, the calculation branch based on sub-thread 1 completes the calculation task of the source term function of basic node unit 1. Since the error plug is 0 at this time, the calculation branch performs an error check on the calculation result of the source term function of basic node unit 1, and the status is correct.

[0113] (3) At t 22 At this moment, the calculation branch based on the main thread completes the calculation task of the source item function of the basic node unit 2. Since the error plug is 0 at this time, the calculation branch performs an error check on the calculation result of the source item function of the basic node unit 2, and the status is wrong.

[0114] (4) At t 32 At this moment, the calculation branch based on sub-thread 2 completes the calculation task of the source term function of the basic node unit 3. Since the error plug is 0 at this time, the calculation branch performs an error check on the calculation result of the source term function of the basic node unit 3, and the status is correct.

[0115] (5) At t 13 At this moment, the execution plug is 0, and the calculation branch based on sub-thread 1 obtains the basic node unit 4 source item function calculation task from the calculation assembly point.

[0116] (6) At t 23 At this moment, the calculation branch based on the main thread performs atomic operations on the plug symbol, sets the execution plug symbol and the error plug symbol to 1, and feeds back the source item function name and basic node unit number where the error occurred. The calculation branch terminates the source item function calculation and jumps to the calculation assembly point.

[0117] (7) At t 33 At this moment, the execution plug is 1, and the calculation branch based on sub-thread 2 stops obtaining the calculation task from the calculation assembly point. The calculation branch terminates the calculation and jumps to the calculation assembly point.

[0118] (8) At t 14 At this moment, the calculation branch based on sub-thread 1 completes the calculation task of the source item function of basic node unit 4. At this time, the error plug is 1 and no error check is performed.

[0119] (9) At t 15 At this moment, the execution plug is 1, and the calculation branch based on sub-thread 1 stops obtaining the calculation task from the calculation assembly point. The calculation branch terminates the calculation and jumps to the calculation assembly point.

[0120] (10) The parallel calculation of the source function is completed.

[0121] At least one embodiment of the present application further provides a computer system comprising a processor and a memory. The processor is configured to execute a method for reporting errors in a thermal fluid component based on two-fluid six equations, as provided in any of the above embodiments of the present application. The memory is configured to store executable instructions for the processor, such as an application. The number of processors may be one or more. The application stored in the memory may include one or more modules, each corresponding to a set of instructions. In addition, the processor is configured to execute instructions to execute the above-mentioned method for reporting errors in a thermal fluid component based on two-fluid six equations.

[0122] The computer system may also include a power supply component configured to manage power of the computer system, a wired or wireless network interface configured to connect the computer system to a network, and an input / output (I / O) interface. The computer system may operate based on an operating system stored in the memory, such as Windows Server 2003. TM , Mac OSX TM , Unix TM , Linux TM , FreeBSD TM or similar.

[0123] At least one embodiment of the present application further provides a computer-readable storage medium having computer executable instructions stored thereon. When executed by a processor, the executable instructions implement a thermal fluid component error reporting method based on two fluids and six equations provided in any of the above embodiments of the present application.

[0124] A non-transitory computer-readable storage medium, when executed by a processor of the computer system, enables the computer system to execute the above-mentioned method for reporting errors in thermal fluid components based on two-fluid six-equations. The method for reporting errors in thermal fluid components based on two-fluid six-equations is executed by an agent program.

[0125] Those skilled in the art will appreciate that the algorithmic steps of each example described in conjunction with the embodiments disclosed in this application can be implemented using electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0126] At least one embodiment of the present application further provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements a thermal fluid component error reporting method based on two fluids and six equations provided in any of the above embodiments of the present application.

[0127] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a computer program product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the thermal fluid component error reporting method based on two fluids and six equations in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, and other media that can store program check codes.

[0128] It should be noted that the combination of the various technical features in the embodiments of the present application is not limited to the combination described in the embodiments of the present application or the combination described in the specific embodiments. All technical features described in the present application can be freely combined or combined in any way unless there is a contradiction between them.

[0129] As used in this application and the claims, unless the context clearly indicates otherwise, the words "a," "an," and / or "the" are not intended to refer to the singular but may include the plural. Generally speaking, the term "comprising" only indicates the inclusion of the steps and elements specifically identified, and these steps and elements do not constitute an exclusive list. A method or apparatus may also include other steps or elements.

[0130] The terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the quantity of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of the features.

[0131] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A thermal fluid component error reporting method based on two-fluid six equations, characterized in that: include: Step 1: Use a flattening method to restore the user-built thermal-hydraulic system model to a thermal-hydraulic system topology diagram consisting entirely of ordered connections of basic node unit models. For each basic node unit model, a corresponding data container for storing and reading basic node unit variable parameters is set. The data container is used to store all the information required to solve the two-fluid six equations. Step 2: traverse the basic node units of the thermal hydraulic system topology diagram to obtain the thermal hydraulic basic node unit number and its corresponding data container; Step 3: Carry out the calculation of the generalized source term function based on the basic node unit. The input data of the generalized source term function calculation reads the data container corresponding to the basic node unit and the upstream and downstream basic node units of the basic node unit, and the output data is stored in the data container corresponding to the basic node unit. Step 4: Determine whether an error occurs in the calculation process of the generalized source term function of the basic node unit. If no error occurs in the calculation process of the generalized source term function, jump to step 7; if an error occurs in the calculation process of the generalized source term function, feedback the generalized source term function name and basic node unit number, and jump to step 5; Step 5: According to the basic node unit number, obtain the model component information of the basic node unit model stored in the data container corresponding to the basic node unit; Step 6: Feedback the user with information about the model component that caused the error, stop the calculation thread of the generalized source function, and jump to step 8; Step 7: Determine whether the traversal of the basic node units of the thermal hydraulic system topology diagram is complete. If the traversal is complete, jump to step 8; if the traversal is not complete, jump to step 2; Step 8: End the calculation of the generalized source function.

2. A thermal fluid component error reporting method based on two-fluid six equations according to claim 1, characterized in that: Step 1 includes: Step 1-1, identifying a thermal-hydraulic system model based on Modelica through model annotation keywords, wherein the model annotation keywords are divided into basic node unit model identification keywords and thermal-hydraulic component model identification keywords; Step 1-2: traverse the thermal-hydraulic component model of the thermal-hydraulic system model, flatten the thermal-hydraulic component model, and convert the thermal-hydraulic component model into a component model with staggered directed connections between control bodies and takeovers according to the number of discrete nodes and hierarchical encapsulation information; Step 1-3: Connect the flattened thermal-hydraulic component models and the basic node unit models according to the connection relationship between the thermal-hydraulic system models to form a flattened model connection diagram; Steps 1-4: traverse the basic node units of the flattened model connection graph, number the basic node units, and define a data container for each basic node unit; Step 1-5: removing the hierarchical component encapsulation information of the flattened model connection graph to form a flattened topology structure graph, wherein the flattened topology structure graph is a topology graph consisting entirely of directed connections of basic node units; Steps 1-6: traverse the graph vertices and directed connections of the flattened topology graph, obtain the upstream and downstream node information of the basic node unit, and store it in the corresponding data container.

3. The thermal fluid component error reporting method based on two-fluid six equations according to claim 1 is characterized in that: Step 3 includes: Step 3-1, defining a data reading function and a data writing function of a basic node unit data container, wherein the data reading function and the data writing function read and write data information at corresponding positions of the data container data structure according to the basic node unit number and the variable name; Step 3-2, using a data reading function and a data writing function to convert each source item function into a source item function model with the basic node unit number as the only input variable, the source item function model reads the data stored in the basic node unit data container corresponding to the basic node unit number as the input variable of the source item function through the data reading function, calculates the function output result using the mathematical principle formula of the source item function, and then uses the data writing function to write the function output result into the memory space corresponding to the source item function output variable in the basic node unit data container corresponding to the basic node unit number; Step 3-3: Define the source term function enumeration table. The source term function enumeration table encompasses all generalized source term function types for the two-fluid six-equation system. The position numbers in the enumeration table represent the execution order of the source term functions and express the mathematical logic of the source term function calculation for the two-fluid six-equation system. Step 3-4: According to the execution order of the generalized source function defined in the source function enumeration table, traverse the basic node units of the thermal-hydraulic system, and use single-node serial calculation or multi-basic node unit parallel calculation to carry out the source function model calculation of each basic node unit.

4. A thermal fluid component error reporting method based on two-fluid six equations according to claim 3, characterized in that: Step 3-1 includes: Step 3-1-1. In the data container corresponding to the basic node unit, a variable enumeration table is used to define the storage data structure of the basic node parameters, variables, and source term functions in the data container. The variable enumeration table refers to an array in which the input and output variables and parameters of all generalized source term functions of the basic node unit are stored according to a certain data structure. The variable enumeration table contains all the input and output data required for the calculation of the generalized source term function of the basic node unit; Step 3-1-2. After defining the variable enumeration table, define the data reading function and the data writing function. The data reading function is used to read the variables stored in the basic node unit data container corresponding to the basic node unit number. The data writing function is used to write the parameters obtained externally to the memory location corresponding to the basic node unit data container variable corresponding to the basic node unit number.

5. The method for reporting errors of thermal fluid components based on two-fluid six-equation method according to claim 3, characterized in that: Step 3-2 includes: Step 3-2-1. Define the input variables, output variables and process variables of the source function according to the source function name; Step 3-2-2, using the data reading function to read the data required for the input variable from the basic node unit data container corresponding to the basic node unit number; Step 3-2-3, according to the mathematical principle formula of the source function, obtain the process variable data and output variable data of the function calculation through the input variable data; Step 3-2-4: Use the data writing function to write the obtained output variable data into the memory location corresponding to the output variable of the source item function in the basic node unit data container corresponding to the basic node unit number.

6. The method for reporting errors of thermal fluid components based on two-fluid six equations according to claim 1, characterized in that: Step 4 includes: Step 4-1, define an execution plug and an error plug for controlling error reporting and thread termination of the generalized source function calculation. The execution plug and the error plug are shared Boolean variables, and their initial states are both false. Step 4-2: Carry out parallel computing of multiple basic node units of the generalized source term function based on the data container, and each parallel branch thread obtains computing tasks from the computing assembly point; Step 4-3: Perform error checking on each thread of the parallel calculation of the source function. If a source function calculation error occurs in any branch thread, stop the calculation task of the branch thread, feedback the source function name and basic node unit number where the error occurs, and perform atomic operations on the execution plug and the error plug, set them to true, and jump to step 4-4; if no source function calculation error occurs in any branch thread, jump to step 4-5; Step 4-4: Based on the status of other branch threads at the time of error reporting, the execution process of the branch thread is divided into the following two cases: Case 1: The branch thread is executing the source function calculation task and detects that the error block is true. No error checking or error reporting is performed. Then, after the task execution is completed, the execution block is detected to be true. The branch thread cannot obtain the calculation task from the calculation assembly point, so the branch thread terminates the calculation and jumps to steps 4-6. Case 2: After the branch thread has completed its task execution, it detects that the execution block symbol is true. The branch thread cannot obtain the computing task from the computing assembly point, so the branch thread terminates the calculation and jumps to steps 4-6. Step 4-5: Determine whether the source function calculation task is completed. If the calculation task is completed, jump to step 4-6; if the calculation task is not completed, each branch thread continues to obtain calculation tasks from the calculation assembly point and jump to step 4-3; Steps 4-6: Jump to the calculation node, and the parallel calculation of the source function ends.

7. A thermal fluid component error reporting method based on two-fluid six equations according to any one of claims 1 to 6, characterized in that: The basic node unit model includes a control body, a takeover, a time-related control body, and a time-related takeover; and / or, All information required for solving the two-fluid six equations includes model component information of the basic node unit model, basic node unit type, basic node unit number, upstream and downstream node information, parameters, variables, and generalized source term function; and / or, The model component information includes but is not limited to the model component name, type, and the name of the upper-level component of the model component.

8. A computer device, characterized in that: include: A processor, configured to execute a thermal fluid component error reporting method based on two-fluid six equations according to any one of claims 1 to 7; as well as A memory is used to store executable instructions of the processor.

9. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that: When the executable instructions are executed by the processor, a thermal fluid component error reporting method based on two fluids and six equations according to any one of claims 1 to 7 is implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, a thermal fluid component error reporting method based on two fluids and six equations according to any one of claims 1 to 7 is implemented.