A unit model analysis system based on EO variables
By adopting the unit model analysis system based on EO variables in the process simulation software, the problems of poor sequential calculation flexibility and low scalability are solved, the scalability and practicality of the process simulation software are improved, and unit model development and Code reuse.
Patent Information
- Application Number
- CN202111574845.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-12-21
AI Technical Summary
In the existing technology, process simulation software based on sequential calculation has problems such as poor flexibility and unsuitability for optimal control of loop processes and operating variables. Moreover, the traditional EO-oriented unit model construction has poor scalability and low code reusability, making it difficult to manage EO variables and equation.
It adopts a unit model analysis system based on EO variables, adopts a client-server distributed architecture, performs flow chart information conversion and distributed iterative calculation through the intermediate data processing layer and calculation engine, and uses the dynamic link library to realize the management and management of EO variables and equations. Solve and improve code reuse rate and development efficiency.
It improves the scalability and practicality of process simulation software, simplifies unit model development, reduces the amount of code and development cycle, and realizes group management of EO variables and distributed iterative calculation of equations.
Smart Images

Figure CN114428606B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a unit model analysis system based on EO variables. Background Art
[0002] In chemical process design, engineers usually use tools similar to flow charts (process simulation software such as Aspen) to abstract the production process in the factory, and abstract the process flow into complex flow charts. The components in these flow charts usually include equipment, measuring instruments, pipelines, etc. in the factory. People in the industry call these elements unit models. When the element parameters in the flow chart are correctly configured, the flow chart calculation can be performed to simulate the production process. There are usually two types of calculation processes: sequential and EO; sequential is to calculate according to the order of arrows (topology) in the flow chart, and the previous model outputs the calculation results to the next connected model; EO describes the calculation data in the flow model (i.e., flow chart) as variables, and the calculation in the model as equations. These equations describe the association between variables, and the input-output relationship between models is given by the connection equations between variables.
[0003] The vast majority of process simulation software in China is based on sequential computing, but sequential computing has many disadvantages, such as lack of flexibility in calculation, difficulty in convergence when there are many loops in the process, and unsuitability for optimization control of operating variables.
[0004] The construction of traditional EO-oriented unit models is usually coded with MATLAB due to the lack of a development framework to achieve the calculation and optimization of simple processes. The main disadvantages are: 1) poor scalability of unit model development; 2) poor code reusability; 3) large amount of repetitive coding work; 4) generally only used for test calculations of small-scale processes; 5) lack of organization for EO variables and equations, making it difficult to locate and manage. Summary of the invention
[0005] 1. Technical issues to be resolved
[0006] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a unit model analysis system based on EO variables.
[0007] (II) Technical solution
[0008] In order to achieve the above object, the main technical solutions adopted by the present invention include:
[0009] In a first aspect, an embodiment of the present invention provides a unit model analysis system based on EO variables.
[0010] The unit model parsing system is a client-server distributed architecture, and the server includes:
[0011] The intermediate data processing layer is used to receive the flowchart information of the client and the processing instructions corresponding to the flowchart transmitted by the server, convert the flowchart information into structured data for use in computing services, select the processing strategy corresponding to the processing instruction according to the processing instruction to interact with the computing engine, and obtain the processing result corresponding to the processing instruction;
[0012] Convert the processing result into information recognizable by the client, and transmit the information to the client through the server for display;
[0013] A computing engine, for creating an information structure table corresponding to the structured data according to the structured data converted by the intermediate data layer; and / or interactively calling the intermediate data layer and various dynamic link libraries based on the processing instructions, structured data and information structure table, so as to perform distributed iteration and solve the EO variables or results in the information structure table, the residual or Jacobian matrix of the equation;
[0014] A dynamic link library, which includes at least: a unit model library, a solver library, a thermodynamic library and a numerical calculation library. The dynamic link library is connected to the computing engine through respective abstract interfaces, so that the computing engine calls the dynamic link library according to the requirements of processing instructions and structured data to implement distributed iteration and obtain the results of the transmission computing engine.
[0015] Optionally, the processing instruction is an instruction to be executed by the server triggered by the user on the client based on the flowchart information selected on the display interface, and the processing instruction includes: compiling, estimating initial values, importing initial values or running;
[0016] The information structure table created by the calculation engine includes one or more of the following: unit model object list, connection information table, unit model library information, solver library information, EO variable and equation summary table, global configuration information, component thermodynamic information, calculation process information, EO variable and equation positioning information.
[0017] Optionally, when the processing instruction is a compile instruction, the intermediate data processing layer is specifically used to:
[0018] Receive the complete information of the flowchart transmitted by the server, and convert the received complete information of the flowchart into structured data; call the initialization process of the computing engine, create a unit model object corresponding to each node in the flowchart according to the structured data and the compilation instruction, generate EO variables and equations corresponding to the unit model object based on the created unit model object, and make the computing engine store the EO variables and equations belonging to the unit model object in the information structure table; and the computing engine updates / creates the location information of the EO variables and equations in the information structure table for subsequent calling or access;
[0019] The intermediate data layer converts the information in the information structure table into data that can be recognized and viewed by the client and sends it to the client for display through the server;
[0020] And / or, the complete flowchart information includes one or more of the following: configuration information, component grouping information, total component information, connection information, component configuration information, component grouping configuration information, and global configuration information corresponding to each node (i.e., unit model) in the flowchart.
[0021] Optionally, when the processing instruction is an initial value estimation instruction, the intermediate data processing layer is specifically used to:
[0022] The first associated information of the flowchart transmitted by the server is converted into structured data, and sequential operations are performed in the intermediate data processing layer. Based on the identifiers of all unit model objects in the flowchart, EO variables and equations are retrieved from the information structure table of the calculation engine and initially processed. According to predefined input and output rules, the connection of EO variables and input and output stream information are determined, so as to realize the transmission of EO variables of all unit model objects and obtain the estimated initial value of each EO variable.
[0023] Convert the estimated initial value and the transmission information of the EO variable into data that can be recognized and viewed by the client and send it to the client through the server for display;
[0024] The first associated information of the flowchart includes: complete flowchart information, EO variables and equations.
[0025] Optionally, the input and output rules of the intermediate data processing layer include:
[0026] All EO variables belonging to a specified stream of a unit model object need to be continuous.
[0027] When creating a single unit model object, you need to specify the arrangement between the EO variable groups;
[0028] The connectome of EO variables specific to the unit model object needs to be continuous.
[0029] Optionally, when the processing instruction is an initial value import instruction, the intermediate data processing layer is specifically used to: receive the initial value information of the EO variables transmitted by the server and configure the EO variables of each unit model object belonging to the flowchart, convert the configured information into data that the client can recognize and view, and send it to the client through the server for display.
[0030] Optionally, when the processing instruction is a run instruction, the intermediate data processing layer is specifically used to:
[0031] Convert the second associated information of the flowchart transmitted by the server into structured data, and transmit the converted structured data and the operation instruction to the computing engine;
[0032] The computing engine constructs a mathematical model corresponding to the structured data that can be recognized and processed by the solver according to the solver and solver parameter information in the structured data, distributes the mathematical model to the corresponding solver by means of an abstract interface connecting each solver, and realizes asynchronous solving of each solver in cooperation with a dynamic link library. The solver calls the information of the information structure table of the computing engine through the corresponding abstract interface for processing in distributed solving;
[0033] The computing engine receives the process information and result information of each solver in each processing process, stores and combines the information, and obtains the final result information through a set number of iterations;
[0034] The intermediate data layer converts the stored process information, the result information of each iteration and the final result information into data that can be recognized and viewed by the client and sends it to the client for display through the server;
[0035] The second associated information of the flowchart includes: complete flowchart information, EO variables and equations, solver, and parameter information of the solver.
[0036] Optionally, the unit model library stores the location information / position information of the EO variable to which the unit model object belongs in the information structure table of the calculation engine;
[0037] The processing functions of the computing engine include: generation of EO variables and equations, initial value estimation of EO variables, calculation of equation residuals and calculation of Jacobian matrix.
[0038] Optionally, the intermediate data layer converts the received complete information of the flowchart into structured data; calls the initialization process of the calculation engine to generate EO variables and equations, and is also used to follow the generation rules of EO variables and equations for processing;
[0039] The generation rules of EO variables and equations include:
[0040] All EO variables and equations need to be stored continuously;
[0041] EO variables and equations need to be stored in groups, and the variables and equations within a group occupy continuous storage space;
[0042] For the same configuration information, the generation object / routine needs to generate the same EO variable and equation information.
[0043] (III) Beneficial effects
[0044] The method of the present invention can make the full-process simulation software of the prior art more scalable and practical, overcome the traditional flow chart based on MATLAB to directly perform numerical calculations, extract the same features (such as thermodynamic configuration, EO variable generation) in various unit models and put them into a common base class, use the connection stream aggregation class to group and manage the EO variables, thereby greatly reducing the difficulty and code amount of unit model development and improving the code reuse rate.
[0045] The system of the present invention utilizes this construction scheme to realize a flow chart calculation engine in a short period of time. The unit model construction only needs to focus on the flow type, its own variables, and equation calculation, which greatly shortens the development cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1A and Figure 1B A partial schematic diagram of a server architecture in a unit model parsing system based on EO variables provided in one embodiment of the present invention;
[0047] Figure 2 A schematic diagram of the architecture of the information structure table of the computing engine in FIG1 ;
[0048] Figure 3 is a schematic diagram of the interaction between the unit model and the computing engine in FIG1 ;
[0049] Figure 4 A schematic diagram of the process of constructing a flash tank class based on FIG1 ;
[0050] Figure 5 It is a schematic diagram of each function of the unit model;
[0051] Figure 6 This is a partial schematic diagram of the server processing flow in the unit model parsing system based on EO variables. DETAILED DESCRIPTION
[0052] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0053] To overcome the defects of sequentiality, an embodiment of the present invention provides a full-process simulation software, namely a unit model analysis system based on EO variables, which adopts the calculation strategy of EO variables, groups and manages EO variables, improves code reuse rate, and realizes equation-oriented distributed iteration.
[0054] For better understanding, some terms in the embodiments of the present invention are defined or explained.
[0055] Components: Common chemical substances constitute the components in the calculation process, such as methane, oxygen, water, nitrogen, air, benzene, etc. Total components: The collection of all components used in the current process calculation. Component group: A non-empty subset of the total components. Physical properties: The property parameters of the component, such as the average molecular weight. Unit model: The abstraction of various types of equipment in the actual factory in the flow chart. The equipment in the factory in the flow chart is abstracted as model information, input streams, output streams, and configuration information; the unit model in the calculation will be further abstracted into EO variables and EO equations (describing the relationship between its own EO variables) according to the information in the flow chart. The unit model types mainly include source streams, flash tanks, mixing, separators, heaters, etc.
[0056] Model information: Contains information related to the unit model, such as model type (source stream, flash tank, etc.), model ID, etc. Stream: Streams are usually similar to pipes, which are used to transport mixtures of a certain concentration. Streams in the flow chart usually need to store the temperature, pressure, flow rate, total enthalpy of the mixture, and molar concentration of each component in the mixture as their attributes. Stream data is generally embedded in the unit model input and described in the output.
[0057] Connecting streams: Connecting streams can describe the connection relationship between two unit models. They belong to the data of the flow chart configuration and can be described by <source unit model, target unit model, connecting stream ID, source unit model stream ID, target unit model ID>, which indicates that the stream of the source unit model is connected to the specified stream of the target unit model through the connecting stream. In the calculation, the connecting stream directly associates (through equations) the stream-related attributes of the source unit model (such as temperature and pressure, which are abstracted as EO variables) to the corresponding attributes in the stream of the target unit model. In addition, the connecting stream can also be the information in the unit model. The connecting stream in the unit model is used to indicate the corresponding relationship between the pins in the unit model and the external streams. It belongs to the configuration of the unit model, that is, it is used for the calculation of the object itself. In practical applications, the connecting stream in the unit model can be directly called a stream.
[0058] Model configuration information: Contains interface configurable information related to the unit model, such as model name, component group, thermodynamics, number of input streams / ID, number of output streams / ID, etc. Different types of unit models have different configuration information. For example, reactors have reaction configurations and compressors have characteristic curve configurations. The configuration information will determine the abstraction of the model at the computational level (EO variables and equations).
[0059] Global configuration information: Contains some configuration information shared by all unit models, such as the current time, unit model calculation options, etc.
[0060] Solver configuration information: Contains some configuration information of the solver, such as solver selection and solver-related configuration information.
[0061] Calculation mode: It is mainly divided into simulation calculation and optimization calculation. Simulation calculation mainly requires solving equations with a degree of freedom of 0, while optimization problem mainly requires solving optimization problems with a degree of freedom greater than 0, mainly to minimize the cost or maximize the economic benefit.
[0062] EO variables: The underlying abstraction of numerical attributes related to streams and unit models, such as stream mixture flow, molar concentration of various components, gas phase fraction of flash tank, separation coefficient of separator, isentropic efficiency of compressor, heat transfer coefficient of heat exchanger, etc. Different unit models may abstract different EO variables under different model configurations. There are two main types of EO variables in the flow chart, fixed variables and calculated variables. Fixed variables are constants during the calculation process, and calculated variables are usually solved by mathematical methods from fixed variables and EO equations. Fixed variables can be selected as optimization variables in the optimization calculation mode.
[0063] EO equation: used to describe the mathematical relationship between EO variables.
[0064] Single variable connection: used to describe the connection relationship between different EO variables (generally using equation relationship). A connection relationship will add an equation in the calculation. It can be configured by the client or fixed by the system (generated by the system itself or unit model requirements).
[0065] Variable connection group: A group consisting of multiple single variable connections for the convenience of variable connection management. It can be configured by the client or fixed by the system. For example, the connected stream is actually a variable connection group (fixed by the system) at the bottom layer, which establishes the relationship (equation relationship) between the EO variables (temperature, pressure, flow rate, mixture concentration) of the specified stream in the source / target unit model. According to actual needs, a specific connection group can be specified for connection when designing each unit model. For example, when designing a flash tank, the EO variable representing heat can be exposed to the upper layer for connection.
[0066] Degree of freedom: It is expressed as the number of calculation variables minus the number of equations. 0 means that the number of equations is equal to the number of variables. In this case, the equation is square and can be solved directly by numerical methods. If the degree of freedom is greater than 0, there are optimization variables and the corresponding optimization problem is solved. Usually, the simulation mode requires the degree of freedom to be 0, and the optimization mode requires the degree of freedom to be greater than or equal to 0.
[0067] Sub-process: A special type of unit model. The flow chart itself can also be abstracted as a unit model, because it can be connected to the unit model in the outer flow chart through connecting streams, and also has EO variables and equations.
[0068] Solver: used to solve mathematical models, such as solving the equation F(x)=0 or the optimization problem min f(x)stg(x)=0,l<=x<=u.
[0069] Unit model library: a collection of various unit models. The library on the computing side is a collection of dynamic link libraries that implement the common interface of unit models.
[0070] Solver library: A collection of solver dynamic link libraries.
[0071] Thermodynamics library: a collection of various thermodynamic calculation dynamic link libraries.
[0072] Model solution sequence: describes the model sequence involved in solving the flowchart. When solving, not all unit models in the flowchart are necessarily involved in the calculation. Some sub-processes may be selected to be virtually connected and solved by configuring variable connection groups. Therefore, a solution sequence is needed to describe the unit models involved in the solution.
[0073] Computing service: mainly used for computing resource management and remote interaction with clients, such as the allocation of computing tasks and parallel / distributed computing thread management.
[0074] Intermediate data layer: mainly used to process the client's data into an efficient structure required for calculation, and to organize the result information returned by the process calculation engine into the structure required by the client.
[0075] Process calculation engine: performs relevant modeling calculations based on the data provided by the intermediate data layer, and returns the calculation results to the intermediate data layer for processing.
[0076] Embodiment 1
[0077] like Figure 1A and Figure 1B As shown, this embodiment provides a unit model parsing system based on EO variables, the unit model parsing system is a client-server distributed architecture, and the server of the distributed architecture includes: an intermediate data processing layer, a computing engine and a dynamic link library;
[0078] The intermediate data processing layer is used to receive the flowchart information of the client and the processing instructions corresponding to the flowchart transmitted by the server, convert the flowchart information into structured data for use in computing services, select the processing strategy corresponding to the processing instruction according to the processing instruction to interact with the computing engine, and obtain the processing result corresponding to the processing instruction;
[0079] Convert the processing result into information recognizable by the client, and transmit the information to the client through the server for display;
[0080] The computing engine is used to create an information structure table corresponding to the structured data according to the structured data converted by the intermediate data layer; and / or interactively call the intermediate data layer and each dynamic link library based on the processing instructions, structured data and information structure table to distribute and iterate and solve the initial values or results of the EO variables and equations in the information structure table,
[0081] A dynamic link library, which includes at least: a unit model library, a solver library, a thermodynamic library and a numerical calculation library. The dynamic link library is connected to the computing engine through respective abstract interfaces, so that the computing engine calls the dynamic link library to implement distributed iteration according to the needs of processing instructions and structured data, and obtains the initial value or result, such as Figure 1B shown.
[0082] It is understandable that the unit model library stores the location information / position information of the EO variable to which the unit model object belongs in the information structure table of the calculation engine;
[0083] The processing functions of the calculation engine include: generation of EO variables and equations, initial value estimation of EO variables, calculation of residual equations and calculation of Jacobian.
[0084] In actual applications, the server can receive the relevant data transmitted by the client through the receiving module, and then create threads through the computing service, etc., and then the computing service transmits it to the intermediate data processing layer. This embodiment does not limit the process of the receiving module and the computing service, which are all content that can be implemented by the existing method. The improvement of this embodiment lies in the call and interaction between the intermediate data processing layer and the computing engine and dynamic link library. Through the above-mentioned call and interaction, it realizes distributed iterative computing, improves the code reuse rate, and greatly shortens the development cycle.
[0085] In addition, in this embodiment, the processing instructions are instructions to be executed by the server triggered by the user on the client based on the flowchart information selected on the display interface, and the processing instructions include: compiling, initial value estimation, initial value importing or running; Figure 6 shown.
[0086] The information structure table created by the calculation engine includes one or more of the following: unit model object list, connection information table, unit model library information, solver library information, EO variable and equation summary table, global configuration information, component thermodynamic information, calculation process information, EO variable and equation location information, such as Figure 2 shown.
[0087] In a specific implementation process, when the processing instruction is a compile instruction, the intermediate data processing layer is specifically used to:
[0088] Receive the complete information of the flowchart transmitted by the server, and convert the received complete information of the flowchart into structured data; call the initialization process of the computing engine, create a unit model object corresponding to each node in the flowchart according to the structured data and the compilation instruction, generate EO variables and equations corresponding to the unit model object based on the created unit model object, and make the computing engine store the EO variables and equations belonging to the unit model object in the information structure table; and the computing engine updates / creates the location information of the EO variables and equations in the information structure table for subsequent calling or access;
[0089] The intermediate data layer converts the information in the information structure table into data that can be recognized and viewed by the client and sends it to the client for display through the server;
[0090] The above-mentioned flowchart complete information includes one or more of the following: configuration information corresponding to each node, group information, total component information, connection information, component configuration information, group configuration information, and global configuration information. The above-mentioned flowchart complete information can be configured by the user on the client, corresponding to Figure 6 In the configuration process, you can select the total components, set several component groups, configure thermodynamics, group flow charts (such as a source stream OS1, a flash tank B1, connected by a connecting stream S1), configure unit model objects (such as configuring the source stream temperature, pressure, composition parameters (mainly used for initial value estimation), configuring the flash tank effective phase state, mist entrainment (affecting EO variables and equations), flash type, temperature, pressure and other properties (for initial value estimation)), etc. During the configuration process, component groups and thermodynamic data, unit model data corresponding to the flow chart data and connecting stream data, etc. can be generated.
[0091] It is understandable that the operations that can be triggered by the compilation process include: checking the configuration. If the configuration is correct, the client sends the configuration data to the intermediate data layer through the server's computing service and tells it to compile. The intermediate data layer parses the configuration data and converts the units of the configuration parameters. Finally, a structured solution structure and solution sequence are formed, and the processed data is passed to the computing engine for compilation; the computing engine creates unit models and connection objects in the flow chart based on the data of the intermediate data layer, and calls the EO variable and equation generation interface of each unit model according to the solution sequence to generate EO variables and equations, and returns the EO variables / equations to the intermediate data layer; the intermediate data layer processes the returned EO variables and equations and finally passes them to the client for display.
[0092] In addition, the intermediate data layer converts the received complete information of the flowchart into structured data; calls the initialization process of the computing engine to generate EO variables and equations, and is also used to follow the generation rules of EO variables and equations for processing; that is, the arrangement of EO variables is not random. In order to improve the efficiency and scalability of the system, this embodiment defines the following rules.
[0093] The rules for generating EO variables and equations include: Rule 1): All EO variables and equations need to be stored continuously; because the variables in the stream are usually a variable connection group, if they are continuous, it will be convenient for subsequent connection operations. Rule 2) EO variables and equations need to be stored in groups, and the variables and equations in the group occupy continuous storage space, which is convenient for subsequent connection operations as a whole; Rule 3) For the same configuration information, the generated object / routine needs to generate the same EO variable and equation information.
[0094] The above rules realize the arrangement among the specified variable groups in a single unit model. For example, the flash tank is generally arranged in sequence of inlet stream, flash tank own variables, gas phase outlet, and liquid phase outlet to ensure the sparsity of the Jacobian decomposition process of the equation and improve the solution efficiency.
[0095] In a second achievable manner, when the processing instruction is an initial value estimation instruction, the intermediate data processing layer is specifically used to: convert the first associated information of the flowchart transmitted by the server into structured data, and perform sequential operations in the intermediate data processing layer, retrieve EO variables and equations from the information structure table of the calculation engine based on the identifiers of all unit model objects in the flowchart and perform initial processing, determine the connection of EO variables and input and output flow information according to predefined input and output rules, realize the transmission of EO variables of all unit model objects and obtain the estimated initial value of each EO variable; convert the estimated initial value and the transmission information of the EO variable into data that the client can recognize and view, and send it to the client through the server for display;
[0096] It is understandable that after compiling and generating EO variables, users can directly import previously calculated EO variable values from other places. If no value is available, initial value estimation is required. The initial value estimation will trigger the following operations: the intermediate data layer performs data conversion and calculates the topological sequence of the flow chart, and calls the unit model initial value estimation interface of the calculation engine according to the topological sequence. After calculating the current unit model, the variables (variable connection group) related to the flow stream are connected to the flow stream variables specified by the next unit model according to the connection flow stream information, and the calculation is continued until all unit models that need to be estimated are calculated. The intermediate data layer finally returns the value of the EO variable to the client for display.
[0097] The first associated information of the above-mentioned flowchart includes: complete flowchart information, EO variables and equations. Specifically, the input and output rules of the above-mentioned intermediate data processing layer include: a) all EO variables belonging to the specified flow stream of the unit model object need to be continuous, b) when creating a single unit model object, it is necessary to specify the arrangement between the EO variable groups; c) the EO variable connection group unique to the unit model object needs to be continuous.
[0098] Of course, when the above-mentioned processing instruction is an initial value import instruction, the intermediate data processing layer is specifically used to: receive the initial value information of the EO variables transmitted by the server and configure the EO variables of each unit model object belonging to the flowchart, and convert the configured information into data that the client can recognize and view and send it to the client through the server for display.
[0099] In a third possible implementation, when the processing instruction is an execution instruction, the intermediate data processing layer is specifically used to: convert the second associated information of the flowchart transmitted by the server into structured data, and transmit the converted structured data and the execution instruction to the computing engine;
[0100] The computing engine constructs a mathematical model corresponding to the structured data that can be recognized and processed by the solver according to the solver and solver parameter information in the structured data, distributes the mathematical model to the corresponding solver by means of an abstract interface connecting each solver, and realizes asynchronous solving of each solver in cooperation with a dynamic link library. The solver calls the information of the information structure table of the computing engine through the corresponding abstract interface for processing in distributed solving;
[0101] The computing engine receives the process information and result information of each solver in each processing process, stores and combines the information, and obtains the final result information through a set number of iterations;
[0102] The intermediate data layer converts the stored process information, the result information of each iteration and the final result information into data that can be recognized and viewed by the client and sends it to the client for display through the server;
[0103] The second associated information of the flowchart includes: complete flowchart information, EO variables and equations, solver, and parameter information of the solver.
[0104] It can be connected that after having the initial value of the EO variable, you can perform EO-related configurations, such as changing variable properties (exchanging fixed variables and calculated variables), changing the upper and lower limits of variables, changing the value of fixed variables for special calculations, selecting calculation mode, configuring solvers, and other operations.
[0105] After completing the EO-related configuration, you can start the calculation. The process calculation process (the run button in the video, taking the simulation mode as an example) will trigger the following operations:
[0106] The server transmits the client's degree of freedom configuration information, configuration information, global configuration information and other data to the intermediate data layer for simulation scenario calculation. The intermediate data layer structures the client's configuration information data and global configuration information, generates the structure required by the solution engine (unit model structure data (including ID, component group / thermodynamic data, inlet and outlet flow description, configuration information...), connection flow table), and generates solution sequence, variable connection group information, solution configuration information (solver ID, solver properties), and transmits these data to the calculation engine for simulation mode solution; the calculation engine constructs a mathematical model of the flow chart based on the data of the intermediate layer, and transmits the mathematical model to the underlying solver selected in the solution configuration for calculation;
[0107] The solver continuously updates the value of the current EO variable and calls the residual of the unit model. The Jacobian calculation interface obtains the residual value and Jacobian matrix under the current EO variable value for iterative calculation, and asynchronously notifies the intermediate data layer of the solution results of each round, and finally completes the solution of the mathematical model.
[0108] The calculation engine processes the results returned by the solver to obtain the solution results of the flowchart, and returns the results to the intermediate data layer; the intermediate data layer organizes and processes the results and finally returns them to the client for display. After obtaining the final solution results, users usually reconfigure or perform EO configuration according to the results, and then recalculate until a satisfactory result is obtained.
[0109] The client in the unit model analysis system of this embodiment can be any client for creating a process flow chart, and the client is mainly used to display the operation results and receive the user's operation instructions. For example, the above system may include: a display interface for displaying and receiving user-triggered operations on the client, wherein the display interface displays a component grouping area, a total component area, a unit model configuration area, a thermodynamic configuration area, and an editing area, etc.;
[0110] The above-mentioned component grouping area mainly displays the components in the calculation flow chart that constitute multiple chemical substances; the above-mentioned total component area mainly displays the information of common components used in multiple calculation flow charts; the above-mentioned unit model configuration area mainly displays the EO variables and / or EO equations abstracted by the unit models in multiple flow charts; the above-mentioned thermodynamic configuration area is mainly used to configure the thermodynamic property information in the thermal diagram; the above-mentioned editing area is mainly used to display the elements in the component grouping area, total component area, unit model configuration area, and thermodynamic configuration area triggered by the user, and combine and / or display the results of server feedback according to the operation instructions selected by the user.
[0111] For example, in the client, you can select the total components, such as C6H6, C7H8, H2O, etc., you can also set up several groups, configure thermodynamics, specify the calculation subroutine for each thermodynamic property, and group flow charts. For example, you can group a source stream OS1 and a flash tank B1, which are connected by connecting stream S1; you can also configure unit models, such as configuring the source stream temperature, pressure, composition parameters (mainly used for initial value estimation), configuring the flash tank effective phase state, mist entrainment (affecting EO variables and equations), flash type, temperature, pressure and other properties (used for initial value estimation), etc.
[0112] The calculation engine in this embodiment records the location information of the EO variables of each unit model object in the general table, and distributes the calculation to each unit model based on the location information, so that the calculation of each unit model only processes the relationship of its own EO variables, and the relationship between different unit models is realized through the connection equation association.
[0113] In the prior art, when compiling EO variables and equations, the EO variables and equations are designed to be stored in the memory of the unit model object, which causes the EO variable equations to be relatively scattered in the memory, and access requires traversing the unit models in the process to obtain all EO variables. In the embodiment of the present invention, the calculation engine allocates the master table during compilation and allows each unit model object to fill in the EO variables and equations, and the calculation engine records the location information of each unit model object EO variable in the master table.
[0114] EO variable grouping management simplifies the work of the intermediate data layer. It mainly allows variables within the group to be directly connected without considering the specific EO variables when processing variable connection groups.
[0115] In the design of the unit model, the connection streams are abstracted into separate classes and aggregated into the unit model, which has the following main advantages: reducing the coupling with the unit model code; building a model stream library as needed, increasing the code reuse rate; simplifying the design of the unit model; aggregation with the unit model allows the equation calculation routine to quickly access the specified entry and exit stream EO variables by directly performing pointer conversion without table lookup; it can facilitate the common base class to generate variable location information, and only needs to generate the stream EO variables in sequence and record the variable offset information; special connection stream classes can be used to implement virtual grouping of unit model EO variables, so that some complex functions in the process can be simplified (such as connection equations between variable groups).
[0116] At the same time, the common base class of the unit model realizes the interaction between all common functions of the model (such as thermodynamic configuration, property configuration) and the engine. Model development only needs to focus on variables and equations, which greatly simplifies the unit model design and coding. Figure 3 shown.
[0117] In addition, the computing engine disperses the calculation to each individual unit model, and adapts it through some information organization and solver interface. Therefore, the unit model calculation process only needs to focus on the relationship between its own EO variables, and the relationship between different unit models is only described by the connection equation.
[0118] Embodiment 2
[0119] In order to better illustrate the content of the above-mentioned embodiment 1, the technical solution of the present application is described from another perspective below.
[0120] Description of the overall computing architecture
[0121] The server of the unit model analysis system based on EO variables may include a calculation engine, a unit model library, and a solver library; Figure 1A shown.
[0122] The computation engine integrates various unit models (such as flash tanks, separators, etc.) and solvers through abstract interfaces. Various unit models connect and interact with the engine through abstract interfaces; the solver library also interacts with the computation engine through dedicated solver abstract interfaces.
[0123] like Figure 2 The specific structure of the calculation engine shown is mainly responsible for the management of the unit model library and the solver library, the establishment of flow charts, the management of EO variables and equations, and the calculation modes of various scenarios.
[0124] The flowchart information is represented in the computing engine as a list of unit model information and a list of connection streams. The connection is mainly represented as a tuple of source unit model, target unit model, source connection stream, and target connection stream.
[0125] In order to facilitate the management of EO variables in the calculation engine, the EO variables of all unit models need to be stored continuously in the calculation engine. The unit model only needs to store the position of its own variables in the entire master table for quick access.
[0126] In terms of calculation, the solver side often requires a large number of iterative calculations. In each round of iterative calculation, the engine organizes the current iteration information of the solver and updates it in a distributed manner to each individual unit model for calculation. After all unit models are calculated, the calculation results are organized together and passed to the solver for further iteration. This architecture can distribute the solving tasks to each individual unit model. Each unit model only needs to provide its own calculation method, which not only improves the parallelism of the system, but also facilitates the subsequent expansion of the analysis system.
[0127] In this embodiment, from the perspective of calculation function, the unit model can be mainly divided into the generation of EO variables / equations, the initial value estimation of EO variables, the calculation of equation residuals and the calculation of Jacobian matrix. The EO variables / equations of the unit model are generated according to the current configuration information of the unit model, and the generation of EO variables / equations needs to meet the following rules:
[0128] 1) All EO variables / equations need to be stored contiguously
[0129] 2) EO variables / equations need to be stored in groups, and the variables / equations within the group occupy continuous storage space
[0130] 3) For the same configuration information, the generation routine needs to generate the same EO variable / equation information,
[0131] Rule 1) is mainly used to improve access performance (can be accessed through array indexes) and facilitate subsequent unified management. Rule 2) is mainly used to expand configuration calculation functions and facilitate variable group management (group variables / equations can be represented by index intervals). For example, when it is necessary to establish an association relationship between certain special EO variables / equations between unit models during calculation, these special variables / equations can be placed in a separate group and the index interval can be directly returned to the engine calculation. Rule 3) is a mandatory constraint condition for configuration calculation.
[0132] During the compilation phase, the EO variable / equation generation routine will generate a variable / equation table that complies with the generation rules based on the current configuration in the flowchart transmitted from the client. During the initial value estimation phase, the EO variable initial value estimation needs to calculate the value and related properties of the generated EO variable based on the current configuration in the flowchart transmitted from the client. During the running phase, the equation residual calculation needs to calculate the residual values of each equation based on the initial value of the EO variable of the current model and the current unit model configuration. The Jacobian calculation needs to calculate the first-order derivative of each equation with respect to its EO variable based on the initial value of the EO variable of the current unit model and the current unit model configuration. The EO variable initial value estimation, equation residual calculation, and Jacobian matrix calculation require access to unit model configuration-related information, the EO variables of the unit model, and the equations of the unit model.
[0133] The configuration information of the unit model mainly includes the connection stream information between unit models, the connection stream information within the unit model, the group information, the thermodynamic information, and the model-related configuration properties. These configuration information can determine the EO variables / equations of the model. The connection stream information between unit models mainly describes the connection-related information of the unit model, mainly including the unit model pin number, connection number, connection stream number, stream group and thermodynamics. The connection stream can be divided into outlet stream, inlet stream, outlet gas stream, outlet liquid stream, etc. according to the purpose. Different streams contain different types and numbers of EO variables. EO variables belonging to the same stream need to form a group. The group-related information is mainly used for EO variable / equation generation, and thermodynamics is mainly used for initial value estimation, residual and Jacobian calculation. The configuration properties related to the unit model mainly affect the generation of EO variables / equations, initial value estimation, equation residual and Jacobian matrix calculation, and the properties are generally represented by <key, value> pairs. In other words, the connection stream information between unit models is used to generate EO variable connection groups or to achieve overall calculation. The sequential operations of the intermediate data layer will use the connection streams between unit models. At runtime, the calculation engine will add the EO variable connection group of the connection streams between unit model objects when merging the calculation results of each unit model object. That is, the connection streams between unit models are mainly used when the unit model objects are compiled to generate EO variables and equations, and when calculating equation residuals and Jacobian matrices.
[0134] In addition, the connection flow stream is the information in the unit model. The connection flow stream in the unit model is used to indicate the correspondence between the pins in the unit model and the external flow stream. It belongs to the configuration of the unit model, that is, it is used for the calculation of the object itself. In practical applications, the connection flow stream in the unit model can be directly called a flow stream.
[0135] In order to meet the above unit model requirements, the server of this embodiment provides a reasonable unit model construction solution. Since the only functional difference between unit models is EO variable / equation generation, initial value estimation, equation residual / Jacobian matrix calculation, all other functions (such as attribute acquisition, group acquisition, connection stream acquisition) can be placed in the base class, and the corresponding interface can be exported for subsequent derived classes to access. Figure 3As shown, all configuration-related information such as grouping, thermodynamics, model properties, etc. can be placed in the base class (directly obtained and created by engine interaction), and no subsequent derived class creation and modification is required. In this way, the derived class only needs to care about EO variables / equations and related calculation routines. Since the unit model EO variables can be divided into stream-related EO variable groups, model EO variable groups, and special EO variable groups, a special stream connection class can be defined to store connection-related information structures for the generation of stream EO variable groups and special EO variable groups (virtual streams). This class provides the generation rules for the EO variables of this group, and the model variable generation function is responsible for generating the EO variables of the model itself. In this way, only the unit model derivation needs to provide the EO variable generation rule table for each group, and the base class can generate the overall EO variable table in the specified order according to the table, while maintaining the location information of the group EO variables. In order to improve access performance, the rule list can be integrated into the unit model base class in an aggregated manner to avoid the time loss caused by subsequent table lookup. In order to hide the interaction between the unit model and the engine, all interaction interfaces can be implemented in the base class. These interaction interface implementations can access the functional interfaces in the derived class through polymorphism (CRTP can be considered for implementation in C++). The base class is also responsible for providing the default implementation of equation generation, initial value estimation, and residual Jacobian calculation, mainly using polymorphic methods to call the implementation of the derived class. The interface functions provided by the base class, such as Figure 5 shown.
[0136] Given that Figure 3 The unit model shown can easily be combined into a simple flash tank model with the help of the client display interface. The flash tank model mainly includes an inlet (variable number, at least one), a gas phase outlet, and a liquid phase outlet. Three variable generation rules can be defined to generate an EO variable group according to the configuration information of the current stream class. The flash tank can be derived from the base class and the three rules can be passed to the base class. Next, you only need to implement EO variable / equation generation, initial value estimation, and residual / Jacobi interface. Each method can be easily implemented using the methods provided by the above base class. The flash tank EO variables and equations constructed in this way not only meet the calculation-related constraints, but can also be directly controlled by the engine. The derived class only has implementations related to variable generation and equation calculation. The corresponding construction relationship is as follows: Figure 4 shown.
[0137] It should be noted that in the claims, any reference numerals placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In the claims enumerating several means, several of these means may be embodied by the same hardware. The use of the words first, second, third, etc., is for convenience of expression only and does not indicate any order. These words may be understood as part of the component name.
[0138] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0139] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments after knowing the basic creative concept. Therefore, the claims should be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0140] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention should also include these modifications and variations.
Claims
1. A unit model analysis system based on EO variables, characterized in that: The unit model parsing system is a client-server distributed architecture, and the server includes: The intermediate data processing layer is used to receive the flowchart information of the client and the processing instructions corresponding to the flowchart transmitted by the server, convert the flowchart information into structured data for use in computing services, select the processing strategy corresponding to the processing instruction according to the processing instruction to interact with the computing engine, and obtain the processing result corresponding to the processing instruction; When the processing instruction is a compile instruction, the intermediate data processing layer is specifically used for: Receive the complete information of the flowchart transmitted by the server, and convert the received complete information of the flowchart into structured data; call the initialization process of the computing engine, create the unit model object corresponding to each node in the flowchart according to the structured data and the compilation instruction, generate the EO variables and equations corresponding to the unit model object based on the created unit model object, and make the computing engine store the EO variables and equations belonging to the unit model object in the information structure table; and the computing engine updates / creates the location information of the EO variables and equations in the information structure table for subsequent calls or accesses; and convert the information in the information structure table into data that the client can recognize and view, and send it to the client through the server for display; the complete information of the flowchart includes one or more of the following: configuration information, component grouping information, total component information, connection information, component configuration information, component grouping configuration information, and global configuration information corresponding to each node in the flowchart; The processing result is converted into information that can be recognized by the client, and transmitted to the client through the server for display; the computing engine is used to create an information structure table corresponding to the structured data according to the structured data converted by the intermediate data processing layer; and / or based on the processing instructions, structured data and information structure table, the intermediate data processing layer and each dynamic link library are interactively called to distribute iterate and solve the EO variables or results in the information structure table, the residual or Jacobian matrix of the equation; A dynamic link library, which includes at least: a unit model library, a solver library, a thermodynamic library and a numerical calculation library, and the dynamic link library is connected to the computing engine through respective abstract interfaces, so that the computing engine calls the dynamic link library to implement distributed iteration according to the needs of processing instructions and structured data, and obtains the results transmitted to the computing engine; The information structure table created by the calculation engine includes one or more of the following: unit model object list, connection information table, unit model library information, solver library information, EO variable and equation summary table, global configuration information, component thermodynamic information, calculation process information, EO variable and equation positioning information.
2. The unit model analysis system according to claim 1, characterized in that: The processing instructions are instructions to be executed by the server that are triggered by the user on the client based on the flowchart information selected on the display interface. The processing instructions include: compiling, initial value estimation, initial value importing or running.
3. The unit model analysis system according to claim 2, characterized in that: When the processing instruction is an initial value estimation instruction, the intermediate data processing layer is specifically used to: The first associated information of the flowchart transmitted by the server is converted into structured data, and sequential operations are performed in the intermediate data processing layer. Based on the identifiers of all unit model objects in the flowchart, EO variables and equations are retrieved from the information structure table of the calculation engine and initially processed. According to predefined input and output rules, the connection of EO variables and input and output stream information are determined, so as to realize the transmission of EO variables of all unit model objects and obtain the estimated initial value of each EO variable. Convert the estimated initial value and the transmission information of the EO variable into data that can be recognized and viewed by the client and send it to the client through the server for display; The first associated information of the flowchart includes: complete flowchart information, EO variables and equations.
4. The unit model analysis system according to claim 3, characterized in that: The input and output rules of the intermediate data processing layer include: All EO variables belonging to a specified stream of a unit model object need to be continuous. When creating a single unit model object, you need to specify the arrangement between the EO variable groups; The connectome of EO variables specific to the unit model object needs to be continuous.
5. The unit model analysis system according to claim 3, characterized in that: When the processing instruction is an initial value import instruction, the intermediate data processing layer is specifically used to: receive the initial value information of the EO variables transmitted by the server and configure the EO variables of each unit model object belonging to the flowchart, convert the configured information into data that the client can recognize and view, and send it to the client through the server for display.
6. The unit model analysis system according to claim 3, characterized in that: When the processing instruction is a run instruction, the intermediate data processing layer is specifically used to: Convert the second associated information of the flowchart transmitted by the server into structured data, and transmit the converted structured data and the operation instruction to the computing engine; The computing engine constructs a mathematical model corresponding to the structured data that can be recognized and processed by the solver according to the solver and solver parameter information in the structured data, distributes the mathematical model to the corresponding solver by means of an abstract interface connecting each solver, and realizes asynchronous solving of each solver in cooperation with a dynamic link library. The solver calls the information of the information structure table of the computing engine through the corresponding abstract interface for processing in distributed solving; The computing engine receives the process information and result information of each solver in each processing process, stores and combines the information, and obtains the final result information through a set number of iterations; The intermediate data processing layer converts the stored process information, the result information of each iteration and the final result information into data that can be recognized and viewed by the client and sends it to the client for display through the server; The second associated information of the flowchart includes: complete flowchart information, EO variables and equations, solver, and parameter information of the solver.
7. The unit model analysis system according to claim 3, characterized in that: The unit model library stores the location information / position information of the EO variable to which the unit model object belongs in the information structure table of the calculation engine; The processing functions of the computing engine include: generation of EO variables and equations, initial value estimation of EO variables, calculation of equation residuals and calculation of Jacobian matrix.
8. The unit model analysis system according to claim 1, characterized in that: The intermediate data processing layer converts the received complete information of the flowchart into structured data; calls the initialization process of the calculation engine to generate EO variables and equations, and is also used to perform processing according to the generation rules of EO variables and equations; The generation rules of EO variables and equations include: All EO variables and equations need to be stored continuously; EO variables and equations need to be stored in groups, and the variables and equations within a group occupy continuous storage space; For the same configuration information, the generation object / routine needs to generate the same EO variable and equation information.
