Simulation solver for industrial system control, electronic device, and storage medium

CN122655321APending Publication Date: 2026-08-28ZHEJIANG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610715290.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-22
Publication Date
2026-08-28

AI Technical Summary

Technical Problem

差商近似法在每个时间步对每个状态变量进行数值扰动,计算量与状态变量个数成正比,引入截断误差,导致处理器无法在预设时间步长内完成计算,引起硬件在环仿真超时;统一自动微分法将整个DAE系统作为整体处理,未利用预处理阶段的分块结构特征,造成内存中计算图膨胀、处理器执行大量冗余指令,占用过多CPU时间

Benefits of technology

由上述实施例可知,本申请采用基于图论的方程变量分析方法,将系统复杂组成分解为分层分块的图结构,克服了现有仿真求解器无法区分系统内部多种结构的缺陷,为每种结构分别采取不同的自动微分策略提供了可能性,提升了数值求解的鲁棒性与仿真效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122655321A_ABST
    Figure CN122655321A_ABST
Patent Text Reader

Abstract

The application discloses a simulation solver for industrial system control, an electronic device and a storage medium, to solve the problems of high memory occupation and multiple redundant iterations in calculating the Jacobian matrix of the existing simulation solver, comprising: obtaining the differential algebraic equation system compiled from the physical model of the controlled object, generating a hierarchical block directed acyclic graph through strong connected component decomposition, and outputting a topological solving sequence; constructing a partial differential expression node, assigning a number to each node, and generating an ordered array; traversing the directed acyclic graph, executing corresponding automatic differentiation strategies according to the type of the equation block (explicit block, implicit block, algebraic loop), and storing the intermediate results in the topological solving sequence; calculating the partial derivative value through assignment or solving a linear equation set, and filling in the Jacobian matrix. The application eliminates irrelevant equations, distinguishes different types of equations and adopts differentiated differentiation strategies, effectively reduces the memory occupation, and improves the real-time performance and automation level of the industrial system simulation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer-aided engineering (CAE) and industrial simulation technology, and in particular to a simulation solver, electronic device and storage medium for industrial system control. Background Technology

[0002] In the simulation verification of safety-critical systems such as automotive electronic controller hardware-in-the-loop simulation, aircraft servo control system real-time simulation, and industrial robot joint motion control, the physical model of the controlled object is usually compiled into a system of differential algebraic equations (DAE system). The simulation solver needs to calculate the Jacobian matrix of the DAE system in each simulation time step in order to complete the Newton iteration update of the system state.

[0003] Unlike simple ordinary differential equations, DAE systems describe the dynamic characteristics of the system through differential equations (the main physical quantities described by these differential equations are called state variables), and introduce physical constraints or conservation laws through algebraic equations.

[0004] From a mathematical perspective, a DAE system can typically be represented as: Based on whether the equation contains differential terms and the dependencies between variables, it can be classified into different types: Explicit equations: of the form of The equation has variables on the left side that can be directly calculated from the function on the right side without iterative solution.

[0005] Implicit equations: of the form of The equations in which the variable y cannot be directly expressed as an explicit function of x usually require numerical solutions using iterative methods such as the Newton-Raphson method.

[0006] In Modelica-based physical system simulations, simulation solvers (such as DASSL and CVODE) typically employ implicit integration methods, such as the BDF method and the implicit Runge-Kutta method, to solve the equations. Within each integration step, the Jacobian matrix needs to be calculated to iteratively solve a system of nonlinear algebraic equations. The accuracy and efficiency of the Jacobian matrix calculation are crucial for ensuring the convergence speed and overall simulation performance of Newton-like iterative methods. Existing simulation solvers typically obtain the Jacobian matrix in two ways: Difference quotient approximation (numerical differentiation): This method approximates the derivative value by perturbing the independent variable. It is simple to implement, but suffers from truncation error, which affects the convergence speed of nonlinear iterations. Furthermore, its computational cost is proportional to the number of system variables, resulting in high computational redundancy and low efficiency for large-scale DAE systems.

[0007] Unified Automatic Differentiation: Automatic differentiation utilizes the chain rule to accurately calculate derivatives, avoiding truncation errors. However, existing automatic differentiation methods typically treat the entire DAE system as a single unit. This approach fails to fully utilize the structural features revealed during the preprocessing phase of the DAE system (such as equation partitioning and strongly connected component decomposition), leading to unnecessary differentiation calculations, resulting in computational graph bloat, high memory consumption, and computational redundancy. The lack of reuse management for partial differential expression nodes leads to repeated storage and computation of partial derivative expressions with the same structure. The absence of inter-block dependency sequential storage of differentiation results necessitates frequent lookups by the processor at runtime, reducing instruction pipeline efficiency.

[0008] Existing simulation solvers have technical limitations when calculating the Jacobian matrix at each time step: The difference quotient approximation method perturbs the values ​​of each state variable at each time step. The computational cost is proportional to the number of state variables, introducing truncation error. This causes the processor to be unable to complete the calculation within the preset time step, resulting in hardware-in-the-loop simulation timeout. The unified automatic differentiation method treats the entire DAE system as a whole, failing to utilize the block structure characteristics of the preprocessing stage. This causes the computation graph in memory to expand, the processor to execute a large number of redundant instructions, and consumes too much CPU time. Summary of the Invention

[0009] To address the aforementioned technical problems, the purpose of this application is to provide a simulation solver, electronic device, and storage medium for industrial system control.

[0010] According to a first aspect of the embodiments of this application, a simulation solver for industrial system control is provided, comprising: The automated block module is configured to receive the differential-algebraic equation system obtained by compiling the physical model of the controlled object of the industrial control system coupled with multiple physical domains, construct a directed graph reflecting the dependency relationship between the equations and variables, generate a hierarchical block directed acyclic graph through strongly connected component decomposition, and output the topology solution order. The node management module is configured to receive each pair of expression nodes corresponding to the variables in the differential algebraic equation system of the controlled object of the multi-physical domain coupled industrial control system, construct partial differential expression nodes and calculate their content-based hash values, assign a globally unique number to each partial differential expression node through a hash mapping table, reuse the same number for nodes with the same hash value, and generate an ordered array storing all partial differential node numbers. The Jacobian matrix organization module is configured to receive the set of state variables of the differential algebraic equation system, create partial differential nodes corresponding to each element of the Jacobian matrix in memory and assign numbers, wherein each partial differential node corresponds to a partial differential relationship between a derivative variable and a state variable, and the derivative variable represents the first derivative of the state variable with respect to time. The classification automatic differentiation module is configured to traverse the hierarchical block directed acyclic graph, select the corresponding differentiation strategy according to the type of the equation block currently traversed, generate data objects that store the intermediate representation of the storage symbols, and store all data objects in a unified sequential container according to the topological solution order. The Jacobian matrix evaluation module is configured to process the intermediate representation of each symbol sequentially according to the order of the unified order container, calculate the partial derivative value by assigning values ​​or solving the linear equation system, arrange the partial derivative values ​​in the order of the ordered array, extract the partial derivative value corresponding to the number assigned by the Jacobian matrix organization module, and fill it into the Jacobian matrix function of the integrator.

[0011] According to a second aspect of the embodiments of this application, an electronic device is provided, comprising: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the simulation solver as described in the first aspect.

[0012] According to a third aspect of the embodiments of this application, a computer-readable storage medium is provided, on which computer instructions are stored, which, when executed by a processor, implement the simulation solver as described in the first aspect.

[0013] The technical solutions provided by the embodiments of this application may include the following beneficial effects: As can be seen from the above embodiments, this application adopts a graph theory-based equation variable analysis method to decompose the complex components of the system into a hierarchical and block-based graph structure, which overcomes the defect of existing simulation solvers that cannot distinguish between multiple structures inside the system, and provides the possibility of adopting different automatic differentiation strategies for each structure, thereby improving the robustness of numerical solution and simulation efficiency.

[0014] This application overcomes the problem of redundant calculation of irrelevant algebraic parts by integrators through hierarchical decoupling and algebraic ring identification of strongly connected components based on differential relations, and significantly reduces the consumption of simulation computing resources by performing hierarchical decoupling and algebraic ring identification on the iteration of each block.

[0015] This application employs a content-based hash comparison and global number reuse mechanism when constructing partial derivative nodes, and uses these nodes as a type of sub-expression symbol. This overcomes the defects of storing the same partial derivative expression multiple times in memory, repeatedly evaluating it at runtime, and the defect of expression bloat in the differentiation result, thus achieving the effect of minimizing memory usage and avoiding redundant symbol calculations.

[0016] This application overcomes the memory fragmentation and addressing overhead caused by dynamically searching or recreating Jacobian matrix elements at runtime by pre-creating nodes of Jacobian matrix elements in memory and fixing their positions in an ordered array storing all partial differential node numbers. This achieves the effects of fast positioning and zero-copy transfer of integrator interfaces when filling the Jacobian matrix.

[0017] This application constructs a selective automatic differentiation tool, which introduces the set of dependent variables into implicit partial derivative nodes for chain-like correction. This overcomes the shortcomings of traditional forward-mode automatic differentiation, which cannot flexibly adjust inter-block dependencies and leads to repeated differentiation. It achieves the effect of limiting the amount of partial derivative computation to the local dependency range of the current equation block while maintaining mathematical accuracy, thus avoiding the expansion of the global computation graph.

[0018] This application employs an optimal differentiation strategy that balances the amount of generated code and computational speed for different types of equations. This overcomes the problem of excessive redundant iterations in algebraic rings and difference quotient approximations caused by the unified automatic differentiation method, thus reducing memory usage. Specifically: for explicit blocks, it constructs assignment-based differential equations, overcoming the problem of large code generation when using a computation graph, thereby reducing memory usage and the number of computational instructions. For implicit blocks, it constructs linear equation systems, and for algebraic rings, it uses matrix transformations to eliminate iterative operations of explicit variables, overcoming the difficulties of symbolic expansion of implicit equations or the low accuracy of difference quotient approximations, thus improving both simulation accuracy and real-time performance.

[0019] This application stores all generated explicit and implicit data objects in the same sequential container according to the topological order defined by the hierarchical block directed acyclic graph. This overcomes the performance bottleneck of not being able to obtain all node values ​​at once during runtime and requiring multiple rounds of assignment calculations. It enables the processor to read sequentially and evaluate directly, achieving a significant improvement in cache hit rate and instruction pipeline efficiency.

[0020] This application minimizes iterative operations by meticulously screening, organizing, and classifying equations and nodes before simulation, and fixes the pipeline instructions during simulation. This overcomes the problems of long execution time and high failure rate caused by the need for continuous differentiation calculations during simulation in traditional automatic differentiation, thus improving the real-time performance and automation efficiency of simulation in industrial system control.

[0021] This application employs sign-based exact automatic differentiation in all differentiation strategies, rather than difference quotient approximation, overcoming the problem that traditional methods require iterative calculation at each time step. While maintaining the same accuracy, it achieves the effect of improving the robustness and stability of solving nonlinear equation systems.

[0022] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0023] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0024] Figure 1 This is a schematic diagram illustrating the structure of a simulation solver for industrial system control according to an exemplary embodiment.

[0025] Figure 2 This is a block diagram illustrating an automated segmentation module according to an exemplary embodiment.

[0026] Figure 3 This is a block diagram illustrating an automatic classification differentiation module according to an exemplary embodiment. Detailed Implementation

[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.

[0028] Taking a permanent magnet DC motor starting system (corresponding to the Modelica.Electrical.Machines.Examples.DCMachines.DCPM_Start model in the Modelica standard library) as an example, this invention is demonstrated in the application of the present invention in a real industrial simulation preprocessing scenario. It should be noted that the controlled object is not limited to this; it can be any multi-physics domain system containing algebraic-differential equation coupling relationships constructed using equation-based modeling languages ​​(such as Modelica, Simulink, VHDL-AMS, etc.) in industrial fields such as robotics, automobiles, aerospace, and energy systems. The simulation solver provided in this application for industrial system control can be uniformly applied to multiple industrial fields such as robot system simulation, aerospace vehicle simulation, new energy vehicle system simulation, and power electronics and energy system simulation. For any differential-algebraic equation system in any field compiled from the physical model of the multi-physics domain coupled controlled object, the simulation solver sequentially performs a complete set of steps, including automated block partitioning, node hash reuse, automatic differential classification, Jacobian matrix organization, and sequential evaluation. For example: In the field of robot system simulation, this method can be applied to the dynamics model of multi-axis robotic arms (including DAE systems composed of motor drive equations and rigid-flexible coupling dynamic equations of links). The simulation solver described in this application first generates a hierarchical and block-based directed acyclic graph through strongly connected component decomposition, decoupling irrelevant algebraic constraint loops such as contact forces from the core integral part; secondly, it assigns globally unique hash-based numbers to the nodes of partial differential expressions to avoid duplicate storage of the same partial derivative term in multiple joint equations; then, it pre-assigns fixed numbers in memory to the Jacobian matrix elements of each joint of the robotic arm (such as the partial derivatives of joint driving torque with respect to joint position and velocity), eliminating the need for dynamic lookups during control simulation; for algebraic loops containing implicit constraints such as joint flexibility and friction, it obtains the coupled partial derivatives of joint acceleration and torque by solving a small system of linear equations, replacing Newton's iteration. This process significantly reduces the Jacobian computational load in real-time robotic arm simulation, meeting the real-time requirements of hardware-in-the-loop simulation.

[0029] In the field of aerospace vehicle simulation, this approach can be applied to aerodynamic / structural coupling models of flight control systems and controlled objects. The automated block segmentation module identifies and marks the algebraic loops between the flight control law equations and the servo actuator equations, generating a block-based directed acyclic graph and a topological solution order. The node management module hashes and reuses frequently occurring partial derivative subgraphs in expressions such as aerodynamic derivatives and structural modes, reducing memory usage. The Jacobian matrix organization module pre-fixes the memory numbers of Jacobian elements according to state variables (such as angle of attack, pitch rate, etc.). The classification-based automatic differentiation module selects a differentiation strategy based on the block type, solves the linear equations for the implicit algebraic loop formed between the servo actuator and the elastic structural modes to obtain the partial derivative of the control surface deflection rate of change, avoiding complex implicit function differentiation and expansion. The intermediate differential representations are stored in a sequential container according to the simulation timeline of the aerodynamic / structural / control law, matching the causal order of the aerodynamic-flight control-actuator link in the flight control system. This process improves the real-time performance and stability of semi-physical simulation or hardware-in-the-loop simulation of the flight control system.

[0030] In the field of new energy vehicle system simulation, it can be applied to the whole vehicle energy management model (including multi-physical domain coupled equations such as battery model, motor drive model, and thermal management model). The automated block module separates the battery SOC differential equation from the electrical steady-state algebraic constraints (such as circuit network equations) and independently marks the algebraic loop in the thermal model; the node management module numbers and reuses frequently occurring partial derivative expressions (such as the derivative of battery internal resistance with respect to temperature) to reduce redundant storage; it pre-allocates fixed positions in memory for elements such as the sensitivity of battery terminal voltage to SOC, the derivative of motor torque with respect to current, and the partial derivative of thermal model temperature with respect to various state variables, so as to facilitate real-time acquisition by the whole vehicle controller simulation; the classification automatic differentiation module generates assignment form differential equations for the decoupled explicit blocks, and solves the linear equation system to obtain the partial derivative of battery internal temperature with respect to current for the implicit algebraic loop formed by the coupling of battery electrochemical model and thermal model, replacing the iterative solution of electrochemical-thermal coupling; the intermediate differential representation is stored in the order of dependence of electrical-mechanical-thermodynamic physical domains, and the processor executes them sequentially to avoid data waiting when performing cross-domain coupling calculations. This process improves the efficiency of system-level simulation.

[0031] In the field of power electronics and energy system simulation, this method can be applied to the electromagnetic transient simulation of large-scale power grid or microgrid models containing numerous switching devices and controllers. The simulation solver described in this application automatically divides the algebraic constraint equations (node ​​voltage equations) and differential equations (generator transient equations, energy storage SOC equations) into blocks, generating a hierarchical solution order suitable for parallel computing; it pre-organizes the Jacobian element memory layout according to state variables (such as bus voltage phase angle, frequency, etc.); it hashes and reuses recurring nodes such as the derivatives of switching functions and the partial derivatives of controller transfer functions to avoid exponential expansion of the computation graph; for algebraic loops containing numerous switching states, it obtains the current partial derivatives at the moment of switch on / off by solving linear equations, avoiding numerical oscillations in electromagnetic transient simulation; and it stores intermediate differential representations according to the electrical distance or hierarchical partitioning order of the power grid topology, allowing the processor to solve the voltages of each node sequentially, conforming to the natural order of power flow calculation. This process supports accelerated simulation and digital twin applications of electromagnetic transient simulation in power systems.

[0032] Figure 1 This is a schematic diagram illustrating the structure of a simulation solver for industrial system control according to an exemplary embodiment, such as... Figure 1 As shown, the simulation solver may include: The automated block module 100 is configured to receive the differential-algebraic equation system obtained from the compilation of the physical model of the controlled object in a multi-physical-domain coupled industrial control system, construct a directed graph reflecting the dependencies between equations and variables, generate a hierarchical block directed acyclic graph through strongly connected component decomposition, and output the topology solution order; (Reference) Figure 2 The automated block division module includes the following sub-modules: The graph construction submodule 110 is configured to obtain a system of differential algebraic equations obtained by compiling the physical model of the controlled object of the industrial control system coupled with multiple physical domains. All equations and all variables in the system of differential algebraic equations are respectively used as two types of vertices to construct an undirected bipartite graph. If an equation depends on a variable, an undirected edge is established between the vertex of the equation and the vertex of the variable. Specifically, the controlled object in this embodiment is a permanent magnet DC motor starting system, the physical components of which include: DC voltage source: provides a time-varying armature voltage ramp. Permanent magnet DC motor (DCPM): includes electrical components such as armature winding, permanent magnet magnetic field, and commutator, as well as mechanical components such as rotor inertia and mechanical bearings; Load torque model: Apply a step load torque at a specified time (tStep) to simulate a sudden load increase scenario in actual working conditions; Inertial component: simulates the rotational inertia of the motor rotor and load.

[0033] This model couples equations from multiple physical domains, including electrical, mechanical, and thermodynamic, forming a typical differential-algebraic equation (DAE) system, which includes: Differential variables: state variables that change with time, such as armature current, rotor angular velocity, and rotor angle; Algebraic variables: variables that satisfy instantaneous algebraic constraints, such as armature voltage, back electromotive force, electromagnetic torque, and load torque; Differential equations: Kirchhoff's voltage law equations describing the dynamic changes of current and rotational speed, and equations of mechanical motion; Algebraic equations: constitutive equations describing the relationship between back electromotive force and rotational speed, the relationship between electromagnetic torque and current, and load torque characteristics.

[0034] After flattening and symbol transformation, the mathematical model of this system can be characterized as a system of differential-algebraic equations as follows. The superscript “·” in the formula refers to the first derivative of the variable with respect to time. The physical meaning and unit description of each parameter in the model are shown in Table 1.

[0035] Table 1: The physical meaning and units of each variable are shown in Table 2.

[0036] Table 2: The permanent magnet DC motor in this embodiment, after flattening and symbol transformation, contains 22 equations and 22 variables. Similarly, all equations and all variables are treated as two types of vertices, and each equation is used to determine which variables appear in it, establishing corresponding undirected edges. The final constructed bipartite graph contains 44 vertices and several undirected edges, with each edge representing only the dependency that "the variable is referenced in the expression or equation of the equation." Mathematically, the DAE system consists of a set of equations and a set of variables, along with the reference relationships between them, corresponding to the structural characteristics of a bipartite graph in graph theory. By abstracting the system into a bipartite graph, the coupling relationships between equations, originally existing in the form of symbolic expressions, are transformed into topological relationships within the graph structure.

[0037] This transformation forms the basis for subsequent automated structural analysis. Furthermore, bipartite graphs are a classic data structure that computers can directly store and manipulate. Computers perform topological traversal and searches on graph structures, greatly reducing the complexity of automating the processing of physical equations.

[0038] The matching and direction determination submodule 120 is configured to determine the maximum matching or perfect matching from the set of equations to the set of variables in the undirected bipartite graph, and to transform the undirected bipartite graph into a directed graph based on the matching relationship, wherein the direction of the matching edge is defined as from the equation vertex to its matching variable vertex, and the direction of the non-matching edge is defined as from the variable vertex to its associated equation vertex. Specifically, in this example, the bipartite graph with 22 equations and 22 variables is solved using the Hungarian algorithm for maximum matching. Since the number of system equations and variables is equal and the structure is good, the algorithm will produce a perfect match, where each equation matches exactly one unique variable, and each variable is solved by exactly one equation. Then, following the above rules, directions are uniformly assigned to each edge, completing the directed graph transformation. For example, in this system, the armature voltage drop equation (9) matches the armature resistance voltage. The direction of the matching edge is from the corresponding equation to the variable it is solving; while other unmatched variables referenced in the equation (such as armature current) If an edge is not matched, it points from the vertex of the variable to the vertex of the equation that references it. After matching, a directed graph transformation is performed: for all matched edges, their direction is uniformly set to point from the vertex of the equation to the vertex of the variable it matches, indicating that "the equation is used to solve for this variable"; for all unmatched edges (i.e., variables referenced by the equation but not matched to themselves), their direction is uniformly set to point from the vertex of the variable to the vertex of the equation that references it, indicating that "the value of this variable is provided by other equations as input to these equations". Through this transformation, the originally undirected bipartite graph becomes a directed graph.

[0039] The maximum matching algorithm automatically establishes the attribution relationship between variables and equations in the system, and automatically determines this attribution. The computer can complete causal assignment without any additional input, and the matching result maximizes the coverage of the variables solved by the equations. The maximum matching problem is a well-established and fundamental problem in graph theory. Various efficient algorithms, such as the Hungarian algorithm and the Hopcroft-Karp algorithm, can be directly implemented using standard libraries without customizing analytical logic for the specific physical background of the equation system. This means that the implementation of this step can be completely decoupled from the specific meaning of the equations, relying only on the graph structure data, thus ensuring the universality and maintainability of the entire block-based process. Orienting the undirected graph to a directed graph enables automatic derivation of causal directions. By traversing the directed edges, the computer can directly track which equation produces the value of any variable and which equations reference it as input. This defines the reachability and strong connectivity between vertices, allowing the computer to automatically detect cyclic dependencies between equations, i.e., the location of algebraic cycles.

[0040] The component decomposition submodule 130 is configured to perform strongly connected component decomposition on the directed graph to obtain at least one strongly connected component. Specifically, in this example, the directed graph formed by the 22 equations after orientation by module 120 is also decomposed using the Tarjan algorithm for strongly connected components. Regarding the coupling relationship between the armature circuit-related equations (equations (8), (9), (11), (12), (15), etc.) and the torque balance relationship-related equations of the rotational inertia system (equations (4) and (20)), since both reference each other's solved variables (angular acceleration)... and shaft torque In a directed graph, reachable loops are formed, and Tarjan's algorithm groups them into the same strongly connected component, indicating that these equations must be solved simultaneously. However, equations like the load torque characteristic equation, which only reference known variables and do not introduce inverse dependencies, are decomposed into independent, strongly connected single-point components, indicating that they can be directly substituted into the calculation after the other equations have been solved.

[0041] In a system of differential-algebraic equations, if a set of equations forms a closed dependency loop through variable references (i.e., variables solved by equation A are referenced by equation B, and variables solved by equation B are referenced by equation A), this set of equations constitutes an algebraic ring, which must be solved iteratively using simultaneous equations. Such loops correspond precisely to the strongly connected components of a directed graph. Therefore, the process of a computer executing Tarjan's algorithm to traverse a directed graph is essentially about automatically locating all algebraic rings in the system, without needing to analyze the specific algebraic form of the equations.

[0042] Simultaneously, strongly connected component decomposition compresses the entire directed graph into a directed acyclic graph—each strongly connected component serves as a hypervertices, and the directed edges between components retain their original dependencies. Because this hypergraph contains no cycles, the computer can directly perform topological sorting on it, automatically generating a valid solution order between the components.

[0043] Tarjan's algorithm has a time complexity of O(V+E), where V is the number of vertices and E is the number of edges, meaning it can decompose the entire directed graph in linear time. For industrial-grade differential-algebraic equation systems with hundreds or even thousands of equations, this linear complexity ensures that the preprocessing step itself will not become a performance bottleneck in the simulation process, enabling it to handle automated structural analysis tasks for ultra-large-scale equation systems.

[0044] The block type marking submodule 140 is configured to determine whether each strongly connected component contains a differential relation. If it does, the strongly connected component is marked as an integral block; otherwise, it is marked as a non-integral block. Specifically, in this embodiment, the permanent magnet DC motor, among the strongly connected components decomposed by module 130, includes components related to the armature circuit equations and the torque balance equations, because it contains explicit derivative variables (the derivative of the armature current). The derivative of angular velocity The integral block and its corresponding differential equation are labeled as an integral block. Other algebraic equations are labeled as non-integral blocks.

[0045] Algebraic equations and differential equations require completely different algorithms for numerical solutions: algebraic equations are suitable for solving using Newton's method at a single time point, while differential equations require a numerical integrator to advance the solution step by step. If both are fed into the same solver without distinction, the integrator may repeatedly iterate over algebraic constraints without convergence, or it may drag algebraic loops that could be solved quickly into time-consuming integration steps.

[0046] By traversing the variable types and equation operators within the components, the computer can automatically divide the system into two main categories: those requiring integration and those not requiring integration. Furthermore, by separating the integration blocks from the non-integration blocks, numerical integrators can be assigned to the integration blocks and algebraic solvers to the non-integration blocks during subsequent simulations, thus addressing the problem of uneven distribution of computational resources through a divide-and-conquer approach.

[0047] The iterative decoupling submodule 150 is configured to iteratively execute the graph construction module to the block type marking module for each marked integral block and non-integral block, further decompose its internal structure, identify and mark the algebraic ring structure therein, until no new strongly connected components or algebraic rings can be decomposed out, thereby generating a hierarchical block-based directed acyclic graph. Specifically, the integral block marked by module 140 of the permanent magnet DC motor in this embodiment contains 9 equations. By re-executing modules 110 to 130 as a subsystem and analyzing the algebraic cyclic dependencies of the new strongly connected components, it can be found that equations (4) and (20) form a small algebraic loop, while the core differential coupling loop formed by the remaining 7 equations retains the differential relations. Therefore, the integral block is further decomposed into: an inner algebraic block (equations (4) and (20)) and an inner integral sub-block (the remaining 7 equations). The final specific block division results of the entire system are as follows: 1) One integration block: contains 9 equations, with differential coupling relationships and an algebraic ring inside; 2) 11 independent scalar algebra blocks: each containing one equation with no coupling dependencies; 3) Two condition assignment blocks: each containing one equation in piecewise function form.

[0048] The specific arrangement, based on the order of block-based solution and equation solving, is as follows: a) Conditional assignment algebraic block The equations included are: (22) and (21); b) Integral blocks The equations included are: (9), (8), (17), (15), (11), (12), (16), (4), (20); Where (4) and (20) are coupled algebraic rings; c) Independent scalar algebra blocks The equations are: (1), (2), (3), (5), (6), (7), (10), (13), (14), (18), (19).

[0049] Algebraic equations and differential equations require completely different algorithms for numerical solutions: algebraic equations are suitable for solving using Newton's method at a single time point, while differential equations require a numerical integrator to advance the solution step by step. If both are fed into the same solver without distinction, the integrator may repeatedly iterate over algebraic constraints without convergence, or it may drag algebraic loops that could be solved quickly into time-consuming integration steps.

[0050] By traversing the variable types and equation operators within the components, the computer can automatically divide the system into two main categories: those requiring integration and those not requiring integration. Furthermore, by separating the integration blocks from the non-integration blocks, numerical integrators can be assigned to the integration blocks and algebraic solvers to the non-integration blocks during subsequent simulation. In traditional simulators (such as Dymola), the Newton iteration in the numerical integration process requires solving all 22 equations simultaneously, resulting in high computational overhead. However, after preprocessing using the device of this invention, Newton iteration only needs to be performed on the 9 equations within the integration block, while the remaining 13 algebraic blocks can be solved independently outside the integration step. In terms of the number of equations involved in the iteration, computational resource consumption is reduced by approximately 59.1%, significantly improving simulation efficiency.

[0051] The node management module 200 is configured to receive each pair of expression nodes (as dependent and independent variables respectively) corresponding to the variables in the differential algebraic equation system of the controlled object of the multi-physical domain coupled industrial control system, construct partial differential expression nodes and calculate their content-based hash values, assign a globally unique number to each partial differential expression node through a hash mapping table, reuse the same number for nodes with the same hash value, and generate an ordered array storing all partial differential node numbers. Specifically, each pair of expression nodes serves as the dependent and independent variables, respectively.

[0052] This involves constructing partial differential expression nodes and calculating their hash values ​​based on their data structures. A globally unique ID is assigned to each partial differential expression node using a hash mapping table in memory, including: Define a content-based hash function for each partial differential expression node, which is generated by combining the hash values ​​of the node's left and right child nodes; Maintain a hash map in memory, using the hash value of the node as the key and the assigned globally unique number as the value; When creating a new node, the hash mapping table is queried first. If a node with the same hash value exists, the existing globally unique number is returned and the memory of the new node is released; otherwise, a new globally unique number is allocated and stored in the mapping table.

[0053] Specifically, in the permanent magnet DC motor model of this embodiment, the same dependent variable appears in multiple equations. If all differential calculations are performed, multiple expansions will be required. Before processing by the node management module 200, the model globally constructs 57 nodes, which is reduced to 27 after processing. That is, the globally unique numbering design of the node management module 200 avoids 30 redundant differential calculations and symbolic expansions, saving the memory space occupied by 30 expression trees.

[0054] This module searches the hash map each time a new node is constructed. If a matching node already exists, the new node is connected to the old node. When obtaining values ​​in the Jacobian matrix evaluation module, all connected nodes of the same type can be substituted to achieve a simultaneous equation system, ensuring the correctness of the result. Furthermore, partial differential equation nodes are used to replace their corresponding expressions, effectively saving memory usage.

[0055] The Jacobian matrix organization module 300 is configured to receive the set of state variables of the differential algebraic equation system, create partial differential nodes corresponding to each element of the Jacobian matrix in memory and assign numbers, wherein each partial differential node corresponds to a partial differential relationship between a derivative variable and a state variable, and the derivative variable represents the first derivative of the state variable with respect to time. Specifically, the permanent magnet DC motor model in this embodiment has three state variables, namely rotor angular displacement. Armature current Angular velocity of load These will serve as independent variables, i.e., the right child nodes of the partial differential nodes; the derivative variables corresponding to the state variables in the model. This will be used as the dependent variable, i.e., the left child node of the partial differential node. This embodiment uses a SUNDIALS series CVode integrator for time stepping, and its interface requires the following Jacobian matrix for this model: Jacobi matrix organization module 300 constructs each element node in column-major order and assigns globally unique numbers 0-8 in sequence.

[0056] The Jacobian matrix organization module 300 enables the differential node array to be accurately connected to the Jacobian matrix evaluation module, facilitating the rapid location of the required elements after Jacobian matrix evaluation, preventing confusion with other intermediate partial derivatives, and ensuring the correctness of simulation results.

[0057] The automatic differentiation module 400 is configured to traverse the hierarchical block-based directed acyclic graph, select the corresponding differentiation strategy based on the type of the currently traversed equation block, generate data objects with symbolic intermediate representations, and store all data objects in a unified sequential container according to the topological solution order; (See reference) Figure 3 This module includes the following sub-modules: The differential strategy selection submodule 410 is configured to traverse the hierarchical block directed acyclic graph and select the corresponding differential strategy according to the type of the equation block currently traversed. Specifically, the differential strategy selection submodule 410 is used to receive the block-level directed acyclic graph generated after the permanent magnet DC motor model in this embodiment is automatically divided into blocks by the automatic block division module 100, as input to the classification automatic differential module 400, as follows: Among them, rotor angular displacement Armature current Angular velocity of load These are the state variables of the permanent magnet DC motor model. Auxiliary variables include: This is the voltage at the negative terminal of the armature inductor. The armature resistance voltage is This is the potential at the negative terminal of the armature resistor. The armature inductance voltage, For electromagnetic torque, Shaft torque, external load torque , This represents the motor terminal voltage. Model parameters include the torque constant. armature resistance Rotor moment of inertia Load rotational inertia armature inductance Equations (7-8) form an algebraic ring 1, which needs to be solved simultaneously. and In the coupling, equation (7) is chosen as the explicit equation, (8) is the implicit equation, and all other equations are explicit equations.

[0058] The differential strategy selection submodule 410 takes a hierarchical, block-based directed acyclic graph (DAG) of the physical model of the controlled object, generated through compilation and segmentation, as input. This primarily provides a unified classification criterion for the differential step. Furthermore, the topological solution order it indicates transforms the coefficient matrix of the integral equation system into a lower triangular matrix. For each equation being solved, all other variables are already calculated, allowing for a single round of calculation without repeated computation. This order also applies to the differential result, achieving the effect of avoiding redundant calculations and reducing processor instruction count. When industrial models contain implicit equations, automatic differentiation is difficult to apply, easily leading to regression to difference quotient approximation. The differential strategy selection submodule 410 avoids this technical problem of using difference quotient approximation for explicit equation differentiation in such cases, reducing local computational complexity and improving simulation real-time performance.

[0059] The explicit equation molecular module 420 is configured to execute the first differential strategy and generate an explicit data object if the current block type is an explicit block. Specifically, the first differential strategy includes: rewriting the explicit equation into an assignment form equation, where the left-hand side of the assignment form equation is the dependent variable of the explicit block, and the independent variable of the equation is a vector of state variables; for each state variable, constructing a partial differential node with the dependent variable as the dependent variable; calling the selective automatic differentiation tool to calculate the partial differential expression of the right-hand side of the assignment form equation, combining it with the partial differential node to generate the differential equation of the assignment form equation, and storing it in the explicit intermediate representation data object; and adding the dependent variable of the explicit block to the dependent variable array D of the selective automatic differentiation tool.

[0060] When executing the first, second, and third differentiation strategies, a selective automatic differentiation tool is invoked to perform differentiation calculations; the selective automatic differentiation tool is configured as follows: The input includes the differential expression E, the independent variable x, and the set of dependent variables. The Boolean flag `include_direct` is taken as input, and the partial differential expression `R` is output; wherein, the set of dependent variables... The elements in the set are the set of dependent variables contained in the equation block that has completed the differential calculation before the current block, and do not contain state variables.

[0061] The selective automatic differentiation tool calculates the partial derivative expression R in the following way: if the Boolean flag include_direct is true, the result is initialized. ,in, This means ignoring other variables in E that are related to x, only taking the partial derivative of x with respect to terms that explicitly contain x, otherwise initializing the result. When the Boolean flag include_direct is false, the result has no physical meaning and serves only as an intermediate mathematical supplement; traversing the set of dependent variables For each dependent variable d in the equation, calculate... And construct implicit partial derivative nodes. ;Will and Multiplication and accumulation added to Returns the accumulated result. The expression for the partial differential result is essentially a modification of the formal partial derivative into the actual mathematical partial derivative.

[0062] Each time an explicit or implicit block completes a differential calculation and generates a corresponding data object, the dependent variables corresponding to that equation block are added to the dependent variable set. For blocks of algebraic ring type, their implicit and explicit parts are treated as an implicit block and an explicit block, respectively. After the implicit data object corresponding to the implicit part is generated, the dependent variables of the implicit part are added to the dependent variable set. Then, the explicit differential calculation is performed.

[0063] The specific construction method of the data objects includes: defining a base class to store common information of all types of equation blocks, including explicit / implicit enumeration types and the corresponding number of state variables n; defining a derived data class for the differential results of the explicit parts of explicit equations or algebraic rings, storing the number r of equations in the original equation block and r*n equations in assignment form, where the left side of the equation is the partial differential node as an unknown and the right side is the symbolic differential result expression; defining a derived data class for the differential results of the implicit parts of implicit equations or algebraic rings, storing the coefficient matrix array A, the right-hand matrix array B, and the unknown partial derivative node number vector X; and creating a unified sequential container to store all created data objects.

[0064] Specifically, in the permanent magnet DC motor model of this embodiment, after processing by the automated block segmentation module 100, in the integration block received by module 410, equations 1-6 and equation 9 are explicit equation blocks. For each explicit block, executing the first differential strategy will generate three assignment-form differential equations. Taking equation 3 as an example: The three equations above are stored sequentially in a vector container, which serves as a member of an explicit data object. Other member variables include: type - EXPLICIT, number of original equations - 1, and number of state variables - 3. Following the topological solution order, this object is the third element of the unified order container.

[0065] In this module, the selective automatic differentiation tool modifies the forward-mode automatic differentiation implementation into a selective automatic differentiation method. This solves the technical problem that the forward-mode automatic differentiation, which does not record the computation graph, cannot identify implicit dependent variables, providing a general method for subsequent calculations of expressions with different purposes. The data object unifies intermediate representations into standardized object pointers and arranges intermediate representations according to the solution order, solving the technical problem that the runtime evaluation module requires a strict order due to the dependency order between equations. The explicit equation differentiation module transforms the evaluation of the explicit equation differentiation into assignment equations, solving the technical problem that traditional automatic differentiation has high computational complexity for a large number of explicit equations during simulation, thus improving the speed of local simulation.

[0066] The implicit equation molecular module 430 is configured to execute the second differential strategy and generate an implicit data object if the current block is of type implicit block. Specifically, the second differential strategy includes: rearranging the implicit equation to obtain a residual expression, where the dependent variable of the expression is the dependent variable of the implicit block, and the independent variable is a vector of state variables; for each state variable, constructing a partial differential node and storing its globally unique number in a vector; calculating the coefficient matrix A and the right-hand side matrix B according to the residual expression; constructing a system of linear equations based on the coefficient matrix, the right-hand side matrix, and the vector, and storing the coefficient matrix, the right-hand side matrix, and the vector... Store the implicit intermediate representation data object; add the dependent variables of this implicit block to the dependent variable array D of the selective automatic differentiation tool.

[0067] In this embodiment of the permanent magnet DC motor model, there is no separate implicit block, but the main processing logic is a simplified version of the implicit part of the algebraic loop. The relevant description can be found in the specific implementation of module 440.

[0068] A single implicit equation, independent of other variables, can theoretically be solved directly. However, its complex form prevents the transformation procedure from being rewritten into an assignment form, making it unsuitable for processing like explicit equations. Therefore, the difference quotient approximation method is employed to find the numerical differential. This step constructs a system of linear equations as an intermediate form for a single implicit equation, resolving the technical problem of repeated calculations due to the inability of the difference quotient approximation to identify explicit partial differential nodes.

[0069] The algebraic ring micro-molecule module 440 is configured to execute a third differential strategy if the current block type is an algebraic ring, generating an implicit data object and an explicit data object. The third differential strategy includes: classifying the equations in the algebraic ring into a set of explicit equations and a set of implicit equations, and recording the set of dependent variables ys for the explicit equations and the set of dependent variables yu for the implicit equations; calculating the formal partial derivative matrix of the explicit equations with respect to the iteration variables. The formal partial derivative matrix of implicit equations with respect to explicit variables The formal partial derivative matrix of the implicit equation with respect to the iteration variables For each state variable, calculate the partial derivative matrix of the explicit equation. The partial derivative matrix of the implicit equation Based on the set of dependent variables and state variables of the implicit equation, create partial derivative nodes and store their globally unique numbers in an ordered vector X; construct an implicit intermediate representation data object based on the partial derivative matrix, the partial derivative matrix, and the ordered vector, where the coefficient matrix A = Q3 + Q2 Q1, the right-hand matrix B = -Q5 - Q2 Q4, and the unknown partial derivative node numbering vector is the ordered vector X; add the elements of the implicit equation's dependent variable set yu to the dependent variable array of the selective automatic differentiation tool. In the explicit equation set, for each explicit equation, a partial differential node is constructed for each state variable. The selective automatic differentiation tool is called with the current state variable as the independent variable. The dependent variable array is set to yu, and the Boolean flag include_direct is set to false to obtain the supplementary expression R1. For each R1, the Q4 elements that are the same in the equation and state variable combination are found and added together. This sum is divided by the coefficients of the dependent variables in the original equation. The resulting expression is combined with the partial differential node to form a differential equation, generating the corresponding explicit intermediate representation data object. The dependent variables of the explicit part are... Add the dependent variable array to the selective automatic differentiation tool middle.

[0070] In the permanent magnet DC motor model generated in this embodiment, the integration block received by module 410 performs the third differential strategy on algebraic ring 1. , , , , , Calculate the intermediate partial derivative matrix: Using the selective automatic differentiation tool, with the second state variable... Using the independent variable as an example, calculate the elements of the intermediate selective partial derivative matrix: The members of the implicit data object can be obtained: the coefficient matrix. The right-hand matrix ,in , , All are 1x3 matrices, with the second element (out of a total of 3 elements) of array X storing the node. Number 25, iteration variable The information can be considered known, and deposit In the middle, the other two state variables also execute as follows: The general operation results in the following implicit data object: type - IMPLICIT, number of state variables - 3, contents of array A, contents of array B, X = [24, 25, 26]. This implicit data object is the 7th element in the Uniform Sequential Container.

[0071] If for a single implicit equation rather than the implicit part in an algebraic ring, the second differential strategy only requires , Other matrices are not calculated.

[0072] Using the selective automatic differentiation tool, we can further process explicit equation 7 to obtain: After storing the three differential equations into an explicit data object (this explicit data object is the 8th element in a uniformly ordered container), It is also stored as a variable of known information. middle.

[0073] After module 440 processes the algebraic loop, for each state variable in each time step, the Newton iteration solution of the 2×2 matrix equation system in the difference quotient approximation method is changed to the solution of the 1×1 linear equation system. Another equation that should have been solved iteratively is transformed into a single assignment, reducing redundant calculations.

[0074] The storage submodule 450 is configured to store all generated explicit and implicit data objects in a unified order container according to the topology solution order.

[0075] Specifically, in the integral block of the permanent magnet DC motor model, which is divided by module 100 and received by module 410, the data objects stored in the unified sequence container of module 450 according to the topological solution order are as follows: explicit data objects corresponding to integral block equations 1-6, an implicit data object and an explicit data object corresponding to algebraic rings 7-8, and finally, the explicit data object corresponding to equation 9. In this example, the unified sequence container uses a vector data structure.

[0076] This step sorts the differential results, ensuring consistency with the input topological solution order. This allows the solver to synchronously calculate the values ​​of all partial differential nodes after sequentially calculating the values ​​of all variables at the current time step. This overcomes the problem that the order of explicit and implicit primitive equations in the algebraic ring is reversed with the order of partial differential node calculations, thus reducing redundant calculations.

[0077] The Jacobian matrix evaluation module 500 is configured to process the intermediate representation of each symbol in the order of the unified order container, calculate the partial derivative value by assigning a value or solving a system of linear equations, arrange the partial derivative values ​​in the order of the ordered array, extract the partial derivative value corresponding to the number assigned by the Jacobian matrix organization module, and fill it into the Jacobian matrix function of the integrator. Specifically, for explicit blocks, partial derivative values ​​are obtained by assignment calculation; for implicit blocks or algebraic rings, the partial derivative values ​​are obtained by solving the linear equation system using the linear algebra library; the solution results are directly written to the corresponding storage location in the globally unique ordered array of partial derivative nodes in memory.

[0078] After processing by modules 100-400, the permanent magnet DC motor model in this embodiment only requires module 500 to assign values ​​to 27 equations at each time step. By numerically solving 3 linear equations using the LAPACK library, the complete Jacobian matrix can be obtained. The obtained numerical Jacobian matrices for the first 4 time steps are as follows: Upon comparison, for all time steps, the present invention is consistent with the difference quotient approximation Jacobian matrix, and the preprocessing of the present invention does not cause errors in the simulation materials.

[0079] This module converts the intermediate representation of the symbols into a numerical matrix usable by the integrator, and solves it in one step according to the topological solution order, so that it can be passed in and used in a format that meets the requirements of the integrator.

[0080] In summary, this application, as a simulation solver for industrial system control, is integrated into the multi-domain unified modeling software NGM and connected to the CVode integrator. For permanent magnet DC motors selected from automotive, robotics, aerospace and other systems, the simulation results of their physical models show an error within 1e-10 compared with the simulation results of the commercial software Dymola. The number of equations processed is reduced by 59.1%, the space for avoiding redundant expression expansion is reduced by about 52.6%, and the number of linear equations solved per time step is reduced to 50% of the original.

[0081] This application can be integrated into the multi-domain unified modeling software NGM for simulating physical models of permanent magnet DC motors selected from systems such as automobiles, robots, and aerospace. Compared to the difference quotient approximation method, the single-step simulation time is reduced by 2%. This is mainly because this model has mostly explicit structures and extremely small algebraic rings, which can be quickly handled by the difference quotient approximation method, thus preventing this application from fully leveraging its advantages. However, in tests on other models with larger differential scales and more algebraic rings, the real-time performance improvement of this application is more significant.

[0082] The number of computational instructions for difference quotient approximation and unified differential is positively correlated with the square of the number of state variables. However, the number of instructions in this application is related to the cube of the number of equations in the implicit structure, namely the number of implicit blocks and the number of implicit partial equations in the algebraic ring. In the physical model of the controlled object in a typical industrial control system, both are much smaller than the number of state variables. This application can more effectively improve the simulation real-time performance.

[0083] Accordingly, this application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; and when the one or more programs are executed by the one or more processors, causing the one or more processors to implement the simulation solver as described above.

[0084] Accordingly, this application also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the simulation solver as described above.

[0085] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only.

[0086] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.

Claims

1. A simulation solver for industrial system control, characterized in that, include: The automated block module is configured to receive the differential-algebraic equation system obtained by compiling the physical model of the controlled object of the industrial control system coupled with multiple physical domains, construct a directed graph reflecting the dependency relationship between the equations and variables, generate a hierarchical block directed acyclic graph through strongly connected component decomposition, and output the topology solution order. The node management module is configured to receive each pair of expression nodes corresponding to the variables in the differential algebraic equation system of the controlled object of the multi-physical domain coupled industrial control system, construct partial differential expression nodes and calculate their content-based hash values, assign a globally unique number to each partial differential expression node through a hash mapping table, reuse the same number for nodes with the same hash value, and generate an ordered array storing all partial differential node numbers. The Jacobian matrix organization module is configured to receive the set of state variables of the differential algebraic equation system, create partial differential nodes corresponding to each element of the Jacobian matrix in memory and assign numbers, wherein each partial differential node corresponds to a partial differential relationship between a derivative variable and a state variable, and the derivative variable represents the first derivative of the state variable with respect to time. The classification automatic differentiation module is configured to traverse the hierarchical block directed acyclic graph, select the corresponding differentiation strategy according to the type of the equation block currently traversed, generate data objects that store the intermediate representation of the storage symbols, and store all data objects in a unified sequential container according to the topological solution order. The Jacobian matrix evaluation module is configured to process the intermediate representation of each symbol sequentially according to the order of the unified order container, calculate the partial derivative value by assigning values ​​or solving the linear equation system, arrange the partial derivative values ​​in the order of the ordered array, extract the partial derivative value corresponding to the number assigned by the Jacobian matrix organization module, and fill it into the Jacobian matrix function of the integrator.

2. The simulation solver according to claim 1, characterized in that, The automated block segmentation module includes: The graph construction submodule is configured to obtain the differential algebraic equation system obtained after compiling the physical model of the controlled object of the industrial control system coupled by multiple physical domains. All equations and all variables in the differential algebraic equation system are respectively used as two types of vertices to construct an undirected bipartite graph. If an equation depends on a variable, an undirected edge is established between the vertex of the equation and the vertex of the variable. The matching and direction determination submodule is configured to determine the maximum or perfect matching of the equation set to the variable set in the undirected bipartite graph, and to transform the undirected bipartite graph into a directed graph based on the matching relationship. The direction of the matching edge is defined as pointing from the equation vertex to its matching variable vertex, and the direction of the non-matching edge is defined as pointing from the variable vertex to its associated equation vertex. The component decomposition submodule is configured to perform strongly connected component decomposition on the directed graph to obtain at least one strongly connected component. The block type marking submodule is configured to determine whether each strongly connected component contains a differential relation. If it does, the strongly connected component is marked as an integral block; otherwise, it is marked as a non-integral block. The iterative decoupling submodule is configured to iteratively execute the graph construction module up to the block type marking module for each marked integral and non-integral block, further decompose its internal structure, identify and mark the algebraic ring structure within it, until no new strongly connected components or algebraic rings can be decomposed out, thereby generating a hierarchical and block-based directed acyclic graph.

3. The simulation solver according to claim 1, characterized in that, Construct partial differential expression nodes and calculate their hash values ​​based on their data structures. Use an in-memory hash map to assign a globally unique number to each partial differential expression node, including: Define a content-based hash function for each partial differential expression node, which is generated by combining the hash values ​​of the node's left and right child nodes; Maintain a hash map in memory, using the hash value of the node as the key and the assigned globally unique number as the value; When creating a new node, the hash mapping table is queried first. If a node with the same hash value exists, the existing globally unique number is returned and the memory of the new node is released; otherwise, a new globally unique number is allocated and stored in the mapping table.

4. The simulation solver according to claim 1, characterized in that, The automatic classification differentiation module includes: The differential strategy selection submodule is configured to traverse the hierarchical block directed acyclic graph and select the corresponding differential strategy based on the type of the equation block currently being traversed. The explicit equation molecular module is configured to execute the first differential strategy and generate an explicit data object if the current block is of type explicit block. The implicit equation molecular module is configured to execute the second differentiation strategy and generate an implicit data object if the current block is of type implicit block. The algebraic ring micro-molecule module is configured to execute the third differential strategy if the current block type is algebraic ring, generating an implicit data object and an explicit data object. The storage submodule is configured to store all generated explicit and implicit data objects in a unified order container according to the topology solution order.

5. The simulation solver according to claim 4, characterized in that, When executing the first, second, and third differentiation strategies, a selective automatic differentiation tool is invoked to perform differentiation calculations; the selective automatic differentiation tool is configured as follows: The input includes the differential expression E, the independent variable x, and the set of dependent variables. The Boolean flag `include_direct` is taken as input, and the partial differential expression `R` is output; wherein, the set of dependent variables... The elements in the set are the set of dependent variables contained in the equation block that has completed the differential calculation before the current block, and do not contain state variables.

6. The simulation solver according to claim 5, characterized in that, The selective automatic differentiation tool calculates the partial derivative expression R in the following way: If the boolean flag include_direct is true, then the initialization result is... ,in, This means ignoring other variables in E that are related to x, only taking the partial derivative of x with respect to terms that explicitly contain x, otherwise initializing the result. When the Boolean flag include_direct is false, the result has no physical meaning and is only used as an intermediate mathematical supplement. Traverse the set of dependent variables For each dependent variable d in the equation, calculate... And construct implicit partial derivative nodes. ; Will and Multiplication and accumulation added to ; Return the accumulated result: The expression for the partial differential result is essentially a modification of the formal partial derivative into the actual mathematical partial derivative.

7. The simulation solver according to claim 4, characterized in that, Each time an explicit or implicit block completes a differential calculation and generates a corresponding data object, the dependent variables corresponding to that equation block are added to the dependent variable set. For blocks of algebraic ring type, their implicit and explicit parts are treated as an implicit block and an explicit block, respectively. After the implicit data object corresponding to the implicit part is generated, the dependent variables of the implicit part are added to the dependent variable set. Then, the explicit differential calculation is performed.

8. The simulation solver according to claim 4, characterized in that, The specific construction methods of the data object include: Define a base class to store common information about all types of equation blocks, including explicit / implicit enumeration types and the corresponding number of state variables n; Define a derived data class for the differential results of the explicit part of an explicit equation or an algebraic ring. Store the number of equations r in the original equation block and r*n equations in assignment form. The left side of the equation is the partial differential node as an unknown, and the right side is the symbolic expression of the differential result. Define a derived data class for the differential results of the implicit part in an implicit equation or algebraic ring, storing the coefficient matrix array A, the right-hand matrix array B, and the vector X that stores the globally unique numbers of the unknown partial derivative nodes; Create a uniformly ordered container to store all created data objects.

9. The simulation solver according to claim 4, characterized in that, The first differential strategy includes: The explicit equation is rewritten as an assignment equation, where the left-hand side of the assignment equation is the dependent variable of this equation, and the independent variable of the equation is a vector of state variables. For each state variable, construct partial differential nodes by treating the dependent variable as the dependent variable; The selective automatic differentiation tool is invoked to calculate the partial differential expression of the right-hand side of the assigned form equation, and then combined with the partial differential node to generate the differential equation of the assigned form equation, which is stored in the explicit intermediate representation data object. Add the dependent variables of the explicit block to the dependent variable array D of the selective automatic differentiation tool.

10. The simulation solver according to claim 4, characterized in that, The second differential strategy includes: The implicit equation is rearranged to obtain the residual expression, where the dependent variable is the variable that this equation depends on, and the independent variable is the vector of state variables. For each state variable, construct partial differential nodes and store their numbers in a vector; Calculate the coefficient matrix A and the right-hand matrix B based on the residual expression; Based on the coefficient matrix, right-hand side matrix, and vector, construct a system of linear equations, and store the coefficient matrix, right-hand side matrix, and vector storing globally unique numbers of partial differential nodes. Store the implicit intermediate representation data object; Add the dependency variables of the implicit block to the dependent variable array D of the selective automatic differentiation tool.

11. The simulation solver according to claim 4, characterized in that, The third differential strategy includes: The equations in the algebraic ring are divided into a set of explicit equations and a set of implicit equations, and the set of dependent variables ys for explicit equations and the set of dependent variables yu for implicit equations are recorded. Calculate the formal partial derivative matrix Q1 of the explicit equation with respect to the iteration variables, the formal partial derivative matrix Q2 of the implicit equation with respect to the explicit variables, and the formal partial derivative matrix Q3 of the implicit equation with respect to the iteration variables; For each state variable, calculate the partial derivative matrix Q4 of the explicit equation and the partial derivative matrix Q5 of the implicit equation; Based on the set of dependent variables and state variables of the implicit equation, create partial derivative nodes and store their numbers in an ordered vector X; Based on the partial derivative matrix, partial derivative matrix and ordered vector shown, construct an implicit intermediate representation data object, where the coefficient matrix A = Q3 + Q2 Q1, the right-hand matrix B = -Q5 - Q2 Q4, and the unknown partial derivative node numbering vector is the ordered vector X. Add the elements from the set of dependent variables yu of the implicit equation to the dependent variable array of the selective automatic differentiation tool. middle; For each explicit equation in the set of explicit equations, for each state variable, construct a partial differential node, and call the selective automatic differentiation tool with the current state variable as the independent variable, set the dependent variable array to yu, set the Boolean flag include_direct to false, and obtain the supplementary expression R1. For each R1, find the Q4 elements that are the same in the combination of equation and state variables and add them together. Divide by the coefficients of the dependent variables in the original equation. The resulting expression is combined with the partial differential nodes to form a differential equation and generate the corresponding explicit intermediate representation data object. Dependencies in the explicit part Add the dependent variable array to the selective automatic differentiation tool middle.

12. The simulation solver according to claim 1, characterized in that, The Jacobian matrix evaluation module performs the following steps: For explicit blocks, partial derivative values ​​are obtained by assignment calculation; for implicit blocks or algebraic rings, the partial derivative values ​​are obtained by solving the linear equation system using the linear algebra library; the solution results are directly written to the storage location corresponding to the partial derivative node number in memory, and the node value corresponding to the number assigned by the Jacobian matrix organization module is extracted from the ordered array storing all partial derivative node numbers and passed to the integrator Jacobian function interface.

13. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the simulation solver as described in any one of claims 1-12.

14. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by the processor, this instruction implements the simulation solver as described in any one of claims 1-12.