Multi-core implementation method for nonlinear MPC controller of fuel cell hydrogen system
By combining the computing characteristics of CPU and NPU in the fuel cell hydrogen system, the resource utilization and data transmission of multi-core processors are optimized, and the problems of low control efficiency and low resource utilization in existing systems are solved, achieving more efficient computing and more stable system performance.
Patent Information
- Application Number
- CN202510360458.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-26
AI Technical Summary
The existing fuel cell hydrogen systems have low control efficiency on multi-core processors, resulting in excessive computing load, low resource utilization efficiency, and difficulty in optimizing multi-core collaboration and task communication.
By combining the computing characteristics of CPU and NPU, scalar calculations and large-scale parallel matrix calculations in model predictive control (MPC) optimization are respectively processed, data transmission is optimized, and the utilization efficiency of multi-core resources and the overall coordination of the system are improved.
It significantly shortens the total computing time, improves the utilization efficiency of multi-core resources, enhances the overall coordination and stability of the system, adapts to dynamically changing computing needs, and improves the performance and flexibility of handling complex logic tasks.
Smart Images

Figure CN119882573A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of fuel cell hydrogen systems, and in particular to a multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system. Background Art
[0002] Although the existing technology has achieved a certain degree of resource optimization and task parallelism in the application of multi-core processors, there are still significant deficiencies in technical implementation. For example, most of the existing methods and computing platforms are multi-core isomorphic, and multiple CPUs are similar in internal structure. Therefore, the algorithm is limited by the multi-core isomorphic structure during the controller deployment process; furthermore, for the traffic scheduling method of multi-core processors, it mainly focuses on the static segmentation of flow information and task distribution, but the efficiency of task allocation and data interaction between the control plane and the data plane is not high. Task allocation is mainly concentrated on the main core, which may lead to excessive processing load on the control plane, thereby limiting the further improvement of the overall system performance. In addition, the optimization processing of multi-dimensional data characteristics is not in-depth enough, which is easy to cause scheduling bottlenecks and data conflict problems. Although the multi-core clock control method improves resource utilization efficiency by dynamically adjusting the clock frequency, it relies too much on the independent module configuration of a single core, increases hardware overhead and system complexity, and does not fully optimize the collaboration and task communication between multi-cores, resulting in limited overall performance improvement. These shortcomings are particularly obvious when facing high-complexity calculations and dynamic task requirements. Summary of the invention
[0003] The present invention currently provides a multi-core implementation method for a nonlinear MPC controller of a fuel cell hydrogen system, and proposes a solution with higher flexibility and resource utilization efficiency. By combining the computing characteristics of the CPU and NPU cores, the scalar calculations and large-scale parallel matrix calculations in the MPC optimization problem are processed separately, which significantly shortens the total calculation time and optimizes the occupancy of multi-core resources. In addition, the present invention optimizes the data transmission during the calculation process by dividing the cores, thereby minimizing the data interaction load between the CPU and the NPU, and improving the overall coordination and stability of the system. This method not only adapts to dynamically changing computing needs, but also shows higher performance and flexibility when processing complex logical tasks, breaking through the limitations of the prior art.
[0004] To achieve the above object, the present invention provides the following technical solutions: Glossary: MPC: Model predictive control (MPC) is an optimization control method based on a mathematical model. It generates optimal control inputs by predicting future system states and solving optimization problems. It is widely used in chemical, energy, autonomous driving and other fields, and is suitable for dealing with multivariable coupling and constraint problems.
[0005] Vector computing core: A hardware unit specifically used for parallel processing of vector data that can perform single instruction multiple data (SIMD) operations. It can significantly improve the computing efficiency of tasks such as matrix operations, graphics rendering, and neural network reasoning, and is an important component of high-performance computing.
[0006] IPC synchronous communication: a technology for sharing data or coordinating work between processes, including shared memory, message queues, semaphores, pipes, etc., which can be used to improve the system's concurrency capabilities and is widely used in distributed systems and multi-threaded programming.
[0007] Crossbar bus: A high-performance interconnection architecture that enables parallel communication of multiple input and output devices through matrix cross-connection, providing high bandwidth, low latency and dynamic path allocation capabilities. It is widely used in multi-processor systems and chip internal interconnection and is suitable for scenarios with high performance requirements.
[0008] A multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system, the method comprising: S1: Perform Taylor expansion on the fuel cell hydrogen system and linearize each system state equation at the set equilibrium point.
[0009] S2: After linearization, all state equations are combined into continuous time-state space equations, which are then discretized using the forward Euler method; S3: After obtaining the discrete state equation, define the prediction step size and control step length , by default, both are equal to p, and the model is recursively derived based on the step length; S4: The recursion of the discrete state equations is integrated into a matrix form by defining the state and control sequence of the system; S5: Determine the reference sequence to achieve systematic tracking; S6: transform the defined objective function into its quadratic objective function; S7: Since the quadratic objective function contains two unknowns, the solution is more complicated, so the recursive discrete state equation is replaced: S8: After converting the objective function into the standard form of quadratic programming, the gradient descent method is used to solve it. After the optimal control sequence is obtained by the gradient descent method, the first control variable in the control sequence is applied to the system to obtain the system state at the next moment. , and then through continuous rolling optimization, until the system achieves tracking of the reference value, the purpose of effectively controlling the hydrogen system is achieved.
[0010] As a further technical solution of the present invention, the method further includes: the control principle of the model predictive control is to use the state and constraints of the system at the current moment to predict the state and input variables in the future period, and solve the optimal control sequence, and finally select the first control amount in the control sequence to apply to the system; Note that at time k, the system state predicted within the next p control cycles is for: ; In addition, when predicting the future state of a dynamic system, it is also necessary to know the control quantity within the prediction time domain. : .
[0011] As a further technical solution of the present invention, in S8, according to the solution process of the gradient descent method, the operations of each solution step are respectively assigned to the NPU and the CPU for processing, including: Step 1: Calculation of the Hessian matrix: The Hessian matrix is obtained by taking the second derivative of the objective function; ; Among them, the Q matrix is the state weight matrix, which is defined according to the objective function and is used to measure the impact of the deviation between the system state and the reference value on the optimization target; the W matrix is the control weight matrix, which is defined according to the objective function and is used to constrain and optimize the size of the control input to prevent instability or excessive power consumption caused by excessive control input; Solving the Hessian matrix mainly involves matrix multiplication operations. Assign it to the NPU for processing and send the calculation results of the NPU to the Through IPC high-speed communication, the CPU and 2W perform addition integration to obtain the H matrix; Step 2: Gradient calculation: By taking the first-order derivative of the objective function, we get: ; in, , , , , and The matrix is the coefficient matrix obtained by discretizing the state equation by the forward Euler method; The calculation of the objective function gradient mainly involves matrix multiplication operations, including the f matrix and The above calculations are mainly implemented by NPU, and after the solution is completed, it is handed over to CPU through IPC high-speed communication. and The addition and integration calculation finally obtains the gradient of the objective function; Step 3: Solve the linear equation to control the change :For the objective function In the current control sequence Taylor expansion nearby: ; Step 4: Convergence judgment: Find the descending direction Then, define the appropriate descending step size , ensuring that the objective function decreases monotonically towards the optimal value, the iterative update formula is: ; Step 5: State prediction: After the convergence is judged, the state quantity and state equation are updated: ; ; in, and The matrix is the coefficient matrix obtained by discretizing the state equation by the forward Euler method; , ; Step 5.1: For the update of state quantities and state equations, the NPU is responsible for matrix-vector multiplication operations After the calculation, the result is sent to the CPU through IPC high-speed communication for addition and integration calculation. After the update is completed, the reference sequence And the f matrix After all the solution processes and state equation updates are completed, the solution calculation for the next moment is started, and the rolling optimization is continuously performed until the output of the system tracks the reference value.
[0012] As a further technical solution of the present invention, both NPU and CPU use shared memory to store data. For task interaction, the computing data of the two cores will be transmitted through a high-bandwidth, low-latency Crossbar bus, and the IPC communication mechanism adopts a synchronous mode to ensure the real-time transmission between data and computing tasks, avoiding data inconsistency or computing delays during the transmission process.
[0013] As a further technical solution of the present invention, step 3 comprises: Step 3.1: To minimize the objective function, we want the first-order term (gradient term) of the Taylor expansion to be zero and the second-order term (curvature term) to be negative, so as to find a suitable descent direction. To find this direction, calculate the objective function about The first-order derivative of and set it to zero, that is: ; Then the optimal descent direction is obtained: ; Step 3.2: When solving the equation, considering that the order of the H matrix is relatively large and the computational complexity is high, we choose to use Cholesky decomposition to change the solution of the ordinary linear equation to two simple triangular matrix equations to reduce the computational complexity. Specifically: Step 3.2.1: Perform Cholesky decomposition on the H matrix: , the original equation is simplified to: ; Step 3.2.2: Parameter substitution solution: Let , solve ; Step 3.2.3: Direction solution: After solving for y, calculate , and finally get ; For the allocation of solution tasks, since the calculation of Cholesky decomposition requires that the matrix is positive definite, the CPU first checks whether the H matrix satisfies the positive definiteness. If it does, the CPU communicates with the NPU through IPC high-speed communication to perform Cholesky decomposition and matrix inversion on the H matrix. , matrix multiplication And other operations.
[0014] As a further technical solution of the present invention, step 4 comprises: Step 4.1: Define the convergence criteria , after each iteration update Substitute the gradient of the objective function into And calculate the two norms, if it satisfies It is considered that the optimal control sequence is obtained at the current moment, otherwise it is continuously updated , until the conditions are met; Step 4.2: For the task allocation of convergence judgment, NPU is mainly responsible for controlling the sequence Update of and the two-norm After the calculation, the result of the two-norm calculation is sent to the CPU through the IPC high-speed communication method to determine whether it is less than If it does not meet the requirements, the communication NPU continues to perform iterative calculations.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The present invention combines the respective computing advantages of the CPU and NPU, assigns the scalar computing tasks in the MPC optimization problem to the CPU for processing, while the NPU is responsible for the large-scale parallel vector and matrix calculations, thereby significantly shortening the total computing time and improving the utilization efficiency of multi-core resources. At the same time, by optimizing the data transmission between the NPU and the CPU, the data interaction load between the two cores is effectively reduced, further improving the overall collaborative efficiency and stability of the system, and is an effective method for solving the problem of MPC solving requiring more time and resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a main flow chart of solving the problem using model predictive control (MPC) in an embodiment of the present invention.
[0017] Figure 2 This is a diagram of the processing of the operation cores involved in the solution process of MPC using the gradient descent method in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0019] The background of the present invention is to address the existing problems of fuel cell hydrogen systems and propose to use model predictive control (MPC) to solve them, mainly to achieve accurate tracking of the ideal inlet hydrogen mass flow and internal pressure of the fuel cell stack to avoid power drop problems caused by purging and the risk of proton membrane rupture due to excessive pressure difference. In view of the complexity of the MPC solution process and the shortcomings of existing methods, the present invention proposes a multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system. The main idea is: according to the objective function, in the process of solving the optimal control variable, the scalar operations and matrix operations involved in the gradient descent method are respectively assigned to the CPU and NPU for processing. The main calculation process includes: calculation of the Hessian matrix (H matrix), calculation of the objective function gradient ( ), solving linear equations (controlling the amount of change in the sequence ), convergence judgment and system status update. In the above calculations, the CPU is mainly involved in the integration of output results and conditional judgment, while the NPU mainly handles large-scale matrix operations and decomposition tasks. When the calculation tasks of the two cores are completed, the calculation results will be transmitted through the high-speed communication bus between the cores (hereinafter referred to as the Crossbar bus) for data transmission, and IPC synchronous communication will be used to ensure the real-time data transmission and avoid delays, ultimately achieving the goal of minimizing the total computing time and resource usage.
[0020] The specific steps for determining the system state, control quantity, and output quantity of the fuel cell hydrogen system are as follows: Since the proportional valve and circulating pump have a great influence on the mass flow rate and internal pressure of the fuel cell stack inlet, the opening of the proportional valve is selected ( ) and the control voltage of the circulation pump ( ) as the control quantity; The state quantity of the system is selected as the hydrogen supply manifold pressure ( )、Return manifold pressure( ) and the angular velocity of the circulating pump ( ); Since we are mainly interested in the hydrogen mass flow rate and stack pressure at the inlet, the output is set to and .
[0021] In summary, the control model of the system is:
[0022] in: The x in the equation is the state quantity of the system; u is the control quantity of the system; the state quantity x mainly includes: (pressure of hydrogen supply manifold), (pressure in the return manifold) and (angular velocity of the circulating pump); the control quantity u mainly includes: (opening degree of proportional valve) and (control voltage of circulating pump); the output y of the system mainly includes: (mass flow rate of hydrogen at the anode inlet) and (Anode pressure).
[0023] Step 2: The objective function mainly considers tracking the ideal value and minimizing the control change to ensure the stability of the system. Therefore, the formula of the objective function is: ; Where: p is the length of the prediction time domain; m is the length of the control time domain; is the weight coefficient of the output error, which is used to adjust the contribution of the output error in the objective function; is the future predicted at time k Step system output; is the reference trajectory, i.e., the target value that the system expects to achieve; is the weight coefficient of the control increment, which is used to adjust the contribution of the control input change in the objective function; is the control increment, which indicates the change in the control input.
[0024] Step 3: The system constraints mainly consider the opening of the proportional valve, the control voltage and angular velocity of the circulating pump, the pressure constraints of the manifold, and the pressure difference between the anode and cathode:
[0025] in: is the maximum value of the proportional valve opening; is the maximum value of the circulating pump control voltage; is the maximum angular velocity of the circulating pump; Represent the minimum and maximum pressure respectively; Indicates the pressure difference between the cathode and cathode.
[0026] The above are the control model, objective function and constraints of the fuel cell hydrogen system. The main process of solving the problem using model predictive control (MPC) is as follows: Figure 1 As shown: An embodiment of the present invention provides a multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system, the method comprising: S1: Since the fuel cell hydrogen system is a nonlinear system, its solution is more computationally complex and time-consuming than a linear system. In order to save computing time and resources and reduce computational complexity, the fuel cell hydrogen system is usually Taylor expanded. The specific operation is to linearize each system state equation at the set equilibrium point. The following is the calculation formula for Taylor expansion:
[0027] S2: After linearization, all state equations are combined into continuous time state space equations, which are then discretized by the forward Euler method. The discretized state equations are:
[0028] in: The matrix is the coefficient matrix obtained by discretizing the state equation by the forward Euler method; S3: After obtaining the discrete state equation, define the prediction step size and control step length , by default, both are equal to p, and the model is recursively derived based on the step length:
[0029] S4: The control principle of model predictive control (MPC) is to use the current system state and constraints to predict the state and input variables in the future, and solve the optimal control sequence, and finally select the first control variable in the control sequence to apply to the system; therefore, compared with other control methods such as PID, the uniqueness of MPC is that it needs to predict the future system state; S4.1: Record the system state predicted within the next p control cycles at time k for:
[0030] S4.2: In addition, when predicting the future state of a dynamic system, it is also necessary to know the control quantity within the prediction time domain :
[0031] S5: By defining the state and control sequence of the system, the recursion of the discrete state equation is integrated into a matrix form:
[0032] in: ; S6: Determine the reference sequence , realize system tracking;
[0033] The process of determining the reference sequence needs to be determined according to the system status and will not be described in detail here; S7: Convert the defined objective function into its quadratic objective function form:
[0034] Among them, the Q matrix is the state weight matrix, which is defined according to the objective function and is used to measure the impact of the deviation between the system state and the reference value on the optimization target; the W matrix is the control weight matrix, which is defined according to the objective function and is used to constrain and optimize the size of the control input to prevent instability or excessive power consumption caused by excessive control input; S8: Since the quadratic objective function contains two unknowns, the solution is relatively complicated, so the recursive discrete state equation is replaced and converted into:
[0035] in: ; S8.1: Simplify the above objective function to: ; in: .
[0036] S9: After converting the objective function into the standard form of quadratic programming, the gradient descent method is used to solve it. The core splitting operation involved in the solution process will be described in detail below. After the optimal control sequence is obtained by the gradient descent method, the first control quantity in the control sequence is applied to the system to obtain the system state at the next moment. , and then through continuous rolling optimization, until the system achieves tracking of the reference value, the purpose of effectively controlling the hydrogen system is achieved.
[0037] The calculation involved in the solution process of MPC is divided into cores for processing by the gradient descent method. The detailed process is as follows Figure 2 As shown: According to the solution process of the gradient descent method, the operations of each solution step are respectively assigned to the NPU and the CPU for processing, including: Step 1: Calculation of the Hessian matrix: The Hessian matrix is obtained by taking the second derivative of the objective function;
[0038] Among them, the Q matrix is the state weight matrix, which is defined according to the objective function and is used to measure the impact of the deviation between the system state and the reference value on the optimization target; the W matrix is the control weight matrix, which is defined according to the objective function and is used to constrain and optimize the size of the control input to prevent instability or excessive power consumption caused by excessive control input;
[0039] Solving the Hessian matrix mainly involves matrix multiplication operations. Assign it to the NPU for processing and send the calculation results of the NPU to the Through IPC high-speed communication, the CPU and 2W perform addition integration to obtain the H matrix; Step 2: Gradient calculation: By taking the first-order derivative of the objective function, we get:
[0040] in, , , , , and The matrix is the coefficient matrix obtained by discretizing the state equation by the forward Euler method;
[0041] The calculation of the objective function gradient mainly involves matrix multiplication operations, including the f matrix ( ) and The above calculations are mainly implemented by NPU, and after the solution is completed, it is handed over to CPU through IPC high-speed communication. and The addition and integration calculation finally obtains the gradient of the objective function; Step 3: Solve the linear equation to control the change :For the objective function In the current control sequence Taylor expansion nearby:
[0042] Step 3.1: To minimize the objective function, we want the first-order term (gradient term) of the Taylor expansion to be zero and the second-order term (curvature term) to be negative, so as to find a suitable descent direction. To find this direction, calculate the objective function about The first-order derivative of and set it to zero, that is:
[0043] Then the optimal descent direction is obtained:
[0044] Step 3.2: When solving the equation, considering that the order of the H matrix is relatively large and the computational complexity is high, we choose to use Cholesky decomposition to change the solution of the ordinary linear equation to two simple triangular matrix equations to reduce the computational complexity. Specifically: Step 3.2.1: Perform Cholesky decomposition on the H matrix: , the original equation is simplified to:
[0045] Step 3.2.2: Parameter substitution solution: Let , solve ; Step 3.2.3: Direction solution: After solving for y, calculate , and finally get ; For the allocation of solution tasks, since the calculation of Cholesky decomposition requires that the matrix is positive definite, the CPU first checks whether the H matrix satisfies the positive definiteness. If so, the CPU communicates with the NPU through IPC high-speed communication to perform Cholesky decomposition and matrix inversion on the H matrix ( ), matrix multiplication[ ] and other operations.
[0046] Step 4: Convergence judgment: Find the descending direction Then, define the appropriate descending step size , ensuring that the objective function can monotonically decrease towards the optimal value, the iterative update formula is:
[0047] Step 4.1: Define the convergence criteria , after each iteration update Substitute the gradient of the objective function into And calculate the two norms, if it satisfies It is considered that the optimal control sequence is obtained at the current moment, otherwise it is continuously updated , until the conditions are met; Step 4.2: For the task allocation of convergence judgment, NPU is mainly responsible for controlling the sequence Update of and the two-norm After the calculation, the result of the two-norm calculation is sent to the CPU through the IPC high-speed communication method to determine whether it is less than If it does not meet the requirements, the communication NPU continues to perform iterative calculations.
[0048] Step 5: State prediction: After the convergence is judged, the state quantity and state equation are updated:
[0049] in, and The matrix is the coefficient matrix obtained by discretizing the state equation by the forward Euler method; , ;
[0050] Step 5.1: For the update of state quantities and state equations, the NPU is responsible for the matrix-vector multiplication operation ( ) and after calculation, the result is sent to the CPU for addition and integration calculation via IPC high-speed communication. In addition, the system status After the update is completed, the reference sequence And the f matrix ( ) is updated. When all the solution processes and state equation updates are completed, the solution calculation for the next moment is entered, and the rolling optimization is continuously carried out until the output of the system tracks the reference value.
[0051] Both NPU and CPU use shared memory to store data. For task interaction, the computing data of the two cores are transmitted through the high-bandwidth, low-latency Crossbar bus, while the IPC communication mechanism adopts a synchronous mode to ensure the real-time transmission between data and computing tasks, avoiding data inconsistency or computing delays during the transmission process.
[0052] It should be noted that, in this article, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0053] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system, characterized in that: The method comprises: S1: Perform Taylor expansion on the fuel cell hydrogen system to linearize the state equations of each system at the set equilibrium point; S2: After linearization, the state equations are combined into continuous time-state space equations and discretized using the forward Euler method; S3: Define the prediction step size and control step length , by default, both are equal to p, and the model is recursively deduced according to the length of the step; S4: The recursion of the discrete state equations is integrated into a matrix form by defining the state and control sequence of the system; S5: Determine the reference sequence to achieve systematic tracking; S6: transform the defined objective function into a quadratic objective function; S7: Since the quadratic objective function contains two unknowns, the solution is relatively complicated, so the recursive discrete state equation is replaced; S8: After converting the objective function into the standard form of quadratic programming, the gradient descent method is used to solve it. After the optimal control sequence is obtained by the gradient descent method, the first control variable in the control sequence is applied to the system to obtain the system state at the next moment. , and then through continuous rolling optimization, until the system achieves tracking of the reference value, the purpose of effectively controlling the hydrogen system is achieved.
2. The multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system according to claim 1, characterized in that: The method also includes: the control principle of the model predictive control is to use the state and constraints of the system at the current moment to predict the state and input variables in the future period, and solve the optimal control sequence, and finally select the first control quantity in the control sequence to apply to the system; Note that at time k, the system state predicted within the next p control cycles is for: ; In addition, when predicting the future state of a dynamic system, it is also necessary to know the control quantity within the prediction time domain. : 。 3. The multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system according to claim 1, characterized in that: In S8, according to the solution process of the gradient descent method, the operations of each solution step are respectively assigned to the NPU and the CPU for processing, including: Step 1: Calculation of the Hessian matrix: The Hessian matrix is obtained by taking the second derivative of the objective function; ; Among them, the Q matrix is the state weight matrix, which is defined according to the objective function and is used to measure the impact of the deviation between the system state and the reference value on the optimization target; the W matrix is the control weight matrix, which is defined according to the objective function and is used to constrain and optimize the size of the control input to prevent instability or excessive power consumption caused by excessive control input; Solving the Hessian matrix mainly involves matrix multiplication. Assign it to the NPU for processing and send the calculation results of the NPU to the Through IPC high-speed communication, the CPU and 2W perform addition integration to obtain the H matrix; Step 2: Gradient calculation: By taking the first-order derivative of the objective function, we get: ; in, , , , , and The matrix is the coefficient matrix obtained by discretizing the state equation by the forward Euler method; The calculation of the objective function gradient mainly involves matrix multiplication, including the f matrix and The calculation is realized by NPU, and after the solution is completed, it is handed over to CPU through IPC high-speed communication. and The addition and integration calculation finally obtains the gradient of the objective function; Step 3: Solve the linear equation to control the change :For the objective function In the current control sequence Taylor expansion nearby: ; Step 4: Convergence judgment: Find the descending direction Then, define the appropriate descending step size , ensuring that the objective function decreases monotonically towards the optimal value, the iterative update formula is: ; Step 5: State prediction: After the convergence is judged, the state quantity and state equation are updated: ; ; in, and The matrix is the coefficient matrix obtained by discretizing the state equation by the forward Euler method; , ; Step 5.1: For the update of state quantity and state equation, NPU is responsible for matrix-vector multiplication and sends the result to CPU for addition and integration calculation through IPC high-speed communication. After the update is completed, the reference sequence And the f matrix is updated. When all the solution processes and state equation updates are completed, the solution calculation at the next moment is entered, and the rolling optimization is continuously carried out until the output of the system tracks the reference value.
4. The multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system according to claim 3, characterized in that: Both NPU and CPU use shared memory to store data. For task interaction, the computing data of the two cores are transmitted through the high-bandwidth, low-latency Crossbar bus, while the IPC communication mechanism uses a synchronous mode.
5. The multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system according to claim 3, characterized in that: Step 3 includes: Step 3.1: Calculate the objective function with respect to The first-order derivative of and set it to zero, that is: ; Then the optimal descent direction is obtained: ; Step 3.2: When solving the equation, considering that the order of the H matrix is relatively large and the computational complexity is high, we choose to use Cholesky decomposition to change the solution of the ordinary linear equation to two simple triangular matrix equations to reduce the computational complexity: Step 3.2.1: Perform Cholesky decomposition on the H matrix: , the original equation is simplified to: ; Step 3.2.2: Parameter substitution solution: Let , solve ; Step 3.2.3: Direction solution: After solving for y, calculate , and finally get ; Regarding the allocation of solution tasks, since the calculation of Cholesky decomposition requires that the matrix is a positive definite matrix, the CPU is first asked to check whether the H matrix satisfies the positive definiteness. If so, the CPU communicates with the NPU through IPC high-speed communication to perform Cholesky decomposition, matrix inversion, and matrix multiplication on the H matrix.
6. The multi-core implementation method of a nonlinear MPC controller for a fuel cell hydrogen system according to claim 3, characterized in that: Step 4 includes: Step 4.1: Define the convergence criteria , after each iteration update Substitute the gradient of the objective function into And calculate the two norms, if it satisfies It is considered that the optimal control sequence is obtained at the current moment, otherwise it is continuously updated , until the conditions are met; Step 4.2: For the task allocation of convergence judgment, NPU is mainly responsible for controlling the sequence Update of the two-norm After the calculation, the result of the two-norm calculation is sent to the CPU through the IPC high-speed communication method to determine whether it is less than If it does not meet the requirements, the communication NPU continues to perform iterative calculations.
Citation Information
Patent Citations
Cement decomposing furnace control method and system based on combined model predicting control technology
CN104765350A
Method for real time optimization and parallel computing of model prediction control based on computing chart
US20220327388A1
Stochastic nonlinear predictive controller and method based on uncertainty propagation by gaussian-assumed density filters
WO2023276268A1
Cited By
Sublimation AscendCL-based nonlinear optimization processing method, system and device, and storage medium
CN122044891A
Processing method, system and device of nonlinear optimization based on ascend cl and storage medium
CN122044891B