A fuel cell temperature control method based on nonlinear model predictive control
By constructing a nonlinear autoregressive moving average model based on BP neural network and rolling optimization of particle swarm algorithm, the accuracy problem of fuel cell temperature control when it deviates from the preset point is solved, and high-precision and stable control of fuel cell temperature is achieved.
Patent Information
- Application Number
- CN202310277504.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2043-03-21
AI Technical Summary
Existing fuel cell temperature control methods have insufficient prediction accuracy when deviating from the preset point, which affects the control accuracy and effect, making it difficult to effectively manage the stack temperature.
A BP neural network is used to construct a nonlinear autoregressive moving average model, which is combined with a particle swarm algorithm for rolling optimization. An MPC controller is constructed, and a circulating water pump and a cooling fan are used as actuators to achieve precise control of the stack temperature.
The stability and accuracy of fuel cell temperature control are improved, and the temperature of the fuel cell stack can be kept stable when it deviates from the preset point, with a control error of less than 0.5K.
Smart Images

Figure CN116387564B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a model predictive control method in the field of battery heat management, in particular to a proton exchange membrane fuel cell (PEMFC) heat management system control method based on nonlinear model predictive control (NMPC). Background Art
[0002] A fuel cell is an energy conversion device that converts energy stored in fuel directly into electricity and heat through an electrochemical process, without combustion. Unconstrained by the Carnot cycle and lacking mechanical motion, fuel cells offer advantages such as high power generation efficiency, energy conservation, environmental protection, and low noise. They are considered one of the most promising power generation technologies of the 21st century. Proton exchange membrane fuel cells, with their high energy conversion efficiency, fast cold start, and low pollution, hold broad application prospects and are already widely used in fuel cell vehicles, backup power supplies, portable power supplies, and other fields.
[0003] Among the many operating parameters of a fuel cell system, the stack temperature directly affects the stack output performance and durability of the PEMFC system. When the temperature is too low, the catalyst activity is low, and the fuel cell output efficiency is reduced. Conversely, excessively high stack temperatures can cause degradation of the electrolyte membrane, damaging the entire fuel cell system. Therefore, the internal temperature of the stack needs to be maintained stably within a reasonable range. The temperature management system of a PEMFC typically has two actuators. One is a water pump that regulates the flow of cooling water entering the stack, and the other is a radiator that releases excess heat. By properly controlling the heat dissipation device, the heat generated by the chemical reactions within the stack is discharged out of the system, ensuring that the stack temperature remains stable at the preset value.
[0004] Currently, most control strategies for stack temperature control use an approximation method at a preset point to address system nonlinearity. These strategies then discretize the linearized system equations based on sampling time to obtain the system output prediction equations used in predictive control. This approach yields relatively accurate predictions when the system operates near the preset point, but accuracy is difficult to maintain in areas deviating from the preset point, directly impacting the precision and effectiveness of MPC control. Summary of the Invention
[0005] In view of this, in order to solve the problems existing in the background technology, the purpose of the present invention is to propose a fuel cell thermal management system control method based on nonlinear model predictive control. In the face of the strongly coupled and nonlinear system of the fuel cell, the present invention adopts a BP neural network to use a large amount of data to construct its nonlinear autoregressive moving average (NonlinearAutoregressive Moving Average with Exogenous Inputs, NARMAX) model to form a neural network nonlinear predictor. The circulating water pump and cooling fan of the PEMFC temperature management system are used as actuators, and the stack output temperature is used as the control variable to construct an MPC controller, and the particle swarm algorithm (PSO) is used to solve the optimization problem.
[0006] The technical solution adopted in the present invention is as follows:
[0007] Step 1: Construct a NARMAX model based on the fuel cell thermal control system. Use the BP algorithm to solve the NARMAX model based on the fuel cell's historical operating data to obtain a temperature prediction model.
[0008] Step 2: The temperature prediction model generates a temperature prediction output based on the current historical operating data. The temperature prediction output is sampled in real time to obtain the predicted sampling value for the current sampling period. The predicted sampling value for the current sampling period is subtracted from the sampling value corresponding to the reference trajectory to obtain the prediction error value for the current sampling period.
[0009] Step 3: Based on the current historical operating data and the prediction error value of the current sampling period, the battery control variable is optimized and solved to obtain the optimal control sequence of the current sampling period. The first control variable of the optimal control sequence is applied to the fuel cell thermal control system.
[0010] Step 4: Repeat steps 2 to 3 to continuously predict and control the temperature of the fuel cell in the next sampling cycle.
[0011] In the step 1, the system history input and system history output in the NARMAX model are both used as input layer nodes of the BP neural network, and the output layer node of the BP neural network is one and serves as the system prediction output.
[0012] In step 1, the formula of the NARMAX model is as follows:
[0013] y(t+1)=F(y(t),y(t-1),…,y(tm),u(t),u(t-1),…,u(tn))
[0014] Among them, y(t) represents the output of the system at time t, u(t) represents the input of the system at time t, m and n represent the number of historical outputs and historical inputs of the system, and F() represents the nonlinear mapping relationship.
[0015] In step 3, for each sampling period, the system state at the starting sampling moment of the current sampling period is used as the starting point, and the objective function of the rolling optimization is solved using the improved particle swarm algorithm. The formula of the objective function of the rolling optimization is as follows:
[0016] min J(ΔU,Y p (ΔU)
[0017] J(ΔU,Y p (ΔU))=|Y p -Y r |TQ|Y p -Y r |+ΔU T RΔU
[0018] U min ≤U+ΔU≤U max
[0019] Among them, min means taking the minimum value, J(ΔU, Y p (ΔU)) represents the objective function value of rolling optimization, U min Indicates the lower limit of the control quantity, U represents the control quantity matrix, U max Indicates the upper limit of the control value, Y p (ΔU) represents the predicted output matrix Y for the next p periods p and the functional relationship between the control quantity increment matrix ΔU in the next p periods, Y r represents the reference output matrix, Q and R are the first and second weight coefficient matrices, respectively, | | T Represents a matrix transpose operation.
[0020] The improved particle swarm algorithm introduces the genetic variation mechanism into the particle swarm algorithm. The genetic variation mechanism is specifically:
[0021] If the first random number rand1 is greater than the mutation rate C m , the particle position suddenly changes, then a second random number is generated, and the particle position at the next moment is calculated based on the second random number rand2. The calculation formula is as follows:
[0022] ΔU′=rand2*ΔU
[0023] Among them, ΔU′ represents the particle position at the next moment, and ΔU represents the particle position at the current moment.
[0024] The beneficial effects of the present invention are:
[0025] 1) The present invention combines the NMPC and PSO algorithms, overcoming the defects of traditional battery temperature control methods limited by the strong coupling and strong nonlinearity of the system, and improving the stability of the fuel cell operating temperature.
[0026] 2) The present invention uses a BP neural network to predict the stack temperature, collects a large amount of data in advance, determines the network parameters through experiments, and constructs a NARMAX prediction model to greatly improve the prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is a structural diagram of the NMPC algorithm involved in the present invention.
[0028] Figure 2 This is a structural diagram of the BP neural network prediction model involved in the present invention.
[0029] Figure 3 This is a flow chart of the PSO algorithm involved in the present invention.
[0030] Figure 4 This is a result verification diagram of the BP prediction model involved in the present invention.
[0031] Figure 5 This is a diagram verifying the effect of the NMPC algorithm involved in the present invention. DETAILED DESCRIPTION
[0032] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but the protection scope of the present invention is not limited thereto.
[0033] 1. A fuel cell temperature control method based on nonlinear model predictive control, characterized in that: Figure 1 As shown, the present invention includes the following steps:
[0034] The model of the PEMFC temperature management system is nonlinear and coupled, so the NARMAX model is used for output prediction. The NARMAX model is an effective method for identifying unknown nonlinear systems, and the BP neural network is used to fit its equations. The BP network (Back Propagation Network) is a feedforward, multi-layer, perceptron network. It consists of an input layer, a hidden layer, and an output layer. Its outstanding advantages are its strong nonlinear mapping capabilities and flexible network structure. The BP network is used to establish the relationship between the PEMFC temperature management system and the NARMAX model. Through training with sample data, the network weights and thresholds are continuously corrected to make the error function descend along the negative gradient direction, approaching the expected output.
[0035] Step 1: Build a NARMAX model based on the fuel cell thermal control system. Based on the historical operating data of the fuel cell, specifically the data of the actual fuel cell system or simulation system operation is collected, and the BP algorithm is used to solve the NARMAX model to obtain the temperature prediction model.
[0036] The formula for the NARMAX model is as follows:
[0037] y(t+1)=F(y(t),y(t-1),...,y(tm),u(t),u(t-1),...,u(tn))
[0038] Where y(t) represents the system output at time t, u(t) represents the system input at time t, m and n represent the number of historical system outputs and inputs, and F() represents the nonlinear mapping relationship. The constants m and n were determined by comparing prediction accuracy across multiple experiments.
[0039] like Figure 2 As shown, in step 1, the system historical input (control quantity cooling fan PWM wave and refrigerant flow) and system historical output (stack temperature) in the NARMAX model are used as input layer nodes of the BP neural network, and the output layer node of the BP neural network is one and serves as the system prediction output.
[0040] Specifically:
[0041] The input vector to determine the network input and output is:
[0042]
[0043] x(t) is the input vector, the output is y(t+1)=f[x(t)], and the training data is determined to be (y(t+1), x(t)). Assuming that the number of training set samples is p, the input n of the i-th node in the hidden layer is i for:
[0044]
[0045] Among them, I j is the sample input of the jth node, w ij is the weight value, b i is the threshold, and m is the number of input nodes.
[0046] After the Tansig activation function, the output of the i-th node in the hidden layer is:
[0047] o i =f(n i )
[0048]
[0049] Among them, i is the output of the i-th node in the hidden layer, f(n i ) is the Tansig activation function value of the i-th node in the hidden layer.
[0050] Similarly, the hidden layer nodes enter the output layer after weighting and threshold adjustment, and are activated by the activation function again to complete the output.
[0051] During the backpropagation process, the gradient descent algorithm is used to correct the weight coefficients of each node, and an inertia factor α between 0 and 1 is introduced to increase the training speed and avoid deviation from the fastest descent gradient during training. The correction rules are as follows:
[0052] w(k+1)=w(k)+η[(1-α)D(k)+αD(k-1)]
[0053] Among them, w(k) and w(k+1) are the weights before and after correction, η is the learning rate, α represents the inertia factor between 0 and 1, and D(k) is the negative gradient at that moment.
[0054] In the specific implementation, the input matrix consisting of the historical operating data of the fuel cell is divided into a training set and a test set, and the model parameters are adjusted through the test set: the division ratio is 80% training set and 20% test set. The model parameters are adjusted by increasing the number of training times, and the model with the smallest error between the predicted value and the true value is saved.
[0055] Step 2: The temperature prediction model predicts the temperature based on the current historical operating data, samples the temperature prediction output in real time, obtains the predicted sampling value of the current sampling period, and subtracts the predicted sampling value of the current sampling period from the sampling value corresponding to the reference trajectory to obtain the prediction error value of the current sampling period. The reference trajectory is usually set according to the actual working conditions or production requirements, and can adopt step changes or other output change curves.
[0056] Step 3: Based on the current historical operating data and the prediction error value of the current sampling period, the battery control variable is optimized and solved to obtain the optimal control sequence for the current sampling period. The optimal control sequence is the predicted output of multiple future periods. The first control variable of the optimal control sequence is applied to the fuel cell thermal control system.
[0057] In step 3, for each sampling period, the system state at the starting sampling moment of the current sampling period is used as the starting point, and the improved particle swarm algorithm is used to solve the objective function of the rolling optimization. In order to obtain the minimum error and the minimum consumption of control actions, and considering the constraints of the actual industrial site, the formula of the objective function of the rolling optimization is as follows:
[0058] min J(ΔU,Y p (ΔU)
[0059] J(ΔU,Y p (ΔU))=|Y p -Y r | T Q|Y p -Y r |+ΔU T RΔU
[0060] U min ≤U+ΔU≤U max
[0061] Among them, min means taking the minimum value, J(ΔU, Y p (ΔU)) represents the objective function value of rolling optimization, U min Indicates the lower limit of the control quantity, U represents the control quantity matrix, U max Indicates the upper limit of the control value, Y p (ΔU) represents the predicted output matrix Y for the next p periods p and the functional relationship between the control quantity increment matrix ΔU in the next p periods, Y r represents the reference output matrix, Q and R are the first and second weight coefficient matrices, respectively, | | T Represents a matrix transpose operation.
[0062] like Figure 3 As shown, the PSO algorithm structure diagram involved in the present invention is as follows:
[0063] In PSO, the potential solutions to the optimization problem can be imagined as the positions of particles in a D-dimensional space. A group of m particles flies at a certain speed in the D-dimensional search space, looking for the position with the lowest fitness value as the optimal solution. The historical optimal point experienced by a particle is recorded as pbest, and the optimal position passed by all particles in the group is recorded as gbest. Through continuous information sharing and interaction between particle populations, the positions of all particles are continuously updated, and finally the global optimal gbest is obtained. The present invention solves the incremental matrix ΔU of the control quantity for the next p periods through the PSO algorithm, that is, ΔU represents the particle position. By randomizing the particle group to represent the incremental matrix ΔU of the control quantity for the next p periods and simulating the process of particles moving to the optimal point of the population, the optimal control quantity under constraints is obtained.
[0064] First, initialize the particle position ΔU and particle velocity v:
[0065] ΔU=ΔU min +rand()*(ΔU max -ΔU min )
[0066] v=v min+rand()*(v max -v min )
[0067] Here, rand() represents a random function with a value between 0 and 1. The subscripts min and max represent the minimum and maximum values of the variable. Then, based on the objective function J, the fitness of each particle is calculated, and the positions with the minimum fitness for each particle and the minimum global fitness are found, denoted as pbest and gbest, respectively. Next, a loop is entered to update the particle's velocity and position. The update formula is as follows:
[0068] v(k+1)=w*v(k)+c1*r1*(pbest-ΔU)+c2*r2*(gbest-ΔU)
[0069] ΔU(k+1)=ΔU(k)+v(k)
[0070] Where r1 and r2 are the first and second inertia coefficients, which are random numbers between 0 and 1, and w, c1, and c2 are the first to third weight coefficients in the velocity update process, respectively.
[0071] In the particle iteration process, the genetic variation mechanism in the natural evolution mechanism is simulated. If the first random number is greater than the mutation rate C m , the particle position suddenly changes, then a second random number is generated, and the particle position at the next moment is calculated based on the second random number rand2. The calculation formula is as follows:
[0072] ΔU′=rand2*ΔU
[0073] Among them, ΔU′ represents the particle position at the next moment, and ΔU represents the particle position at the current moment.
[0074] This prevents the PSO algorithm from finding a local optimal solution. After a sudden change or not, due to actual operating conditions, ΔU needs to be limited. Any deviations from the maximum or minimum range are limited to the boundary line. After each iteration, the loop is checked to see if it meets the termination criteria: if the number of iterations exceeds the set maximum number of iterations or the performance indicator meets the required range, the PSO algorithm outputs the optimal control variable sequence for this sampling period. If the criteria are not met, the loop returns to repeat the iteration process.
[0075] Step 4: Repeat steps 2 to 3 to continuously predict and control the temperature of the fuel cell in the next sampling cycle.
[0076] like Figure 4 As shown, the BP prediction model of the present invention has the following effects:
[0077] For the PEMFC temperature control system, the input is a white noise signal within the constraint range. The predicted output of the neural network and the actual output of the model are compared and observed. The results are as follows: Figure 4 In the continuous simulation, the nonlinear prediction model based on BP can better track the actual output of the system, and the maximum absolute error is controlled within 0.5K, and the mean absolute error is controlled within 0.1K. At this time, the MSE and MAE of the test set are 1.4*10 -5 and 0.0017, so the accuracy of the prediction model is well verified.
[0078] like Figure 5 As shown, the NMPC algorithm of the present invention has the following effects:
[0079] The initial temperature of the fuel cell is set to 65°C (338.15K). For different temperature demand changes, it can be seen that the NMPC algorithm designed in the present invention can control the output temperature to reach the reference temperature at a relatively fast speed and maintain a stable state. The absolute error is less than 0.5K, which proves that the NMPC algorithm designed in the present invention has good control performance.
[0080] The above embodiments are used to illustrate the present invention rather than to limit the present invention. Any modifications and changes made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.
Claims
1. A fuel cell temperature control method based on nonlinear model predictive control, characterized in that: The following steps are involved: Step 1: Construct a NARMAX model based on the fuel cell thermal control system. The input of the NARMAX model is the control variable cooling fan PWM wave and refrigerant flow, and the output is the stack temperature. Based on the historical operating data of the fuel cell, the BP algorithm is used to solve the NARMAX model to obtain a temperature prediction model. Step 2: The temperature prediction model generates a temperature prediction output based on the current historical operating data. The temperature prediction output is sampled in real time to obtain the predicted sampling value for the current sampling period. The predicted sampling value for the current sampling period is subtracted from the sampling value corresponding to the reference trajectory to obtain the prediction error value for the current sampling period. Step 3: Based on the current historical operating data and the prediction error value of the current sampling period, the battery control variable is optimized and solved to obtain the optimal control sequence of the current sampling period. The first control variable of the optimal control sequence is applied to the fuel cell thermal control system. Step 4: Repeat steps 2 to 3 to continuously predict and control the temperature of the fuel cell in the next sampling period.
2. A fuel cell temperature control method based on nonlinear model predictive control according to claim 1, characterized in that: In the step 1, the system history input and system history output in the NARMAX model are both used as input layer nodes of the BP neural network, and the output layer node of the BP neural network is one and serves as the system prediction output.
3. The fuel cell temperature control method based on nonlinear model predictive control according to claim 1, characterized in that: In step 1, the formula of the NARMAX model is as follows: y(t+1)=F(y(t),y(t-1),…,y(tm),u(t),u(t-1),…,u(tn)) Among them, y(t) represents the output of the system at time t, u(t) represents the input of the system at time t, m and n represent the number of historical outputs and historical inputs of the system, and F() represents the nonlinear mapping relationship.
4. The fuel cell temperature control method based on nonlinear model predictive control according to claim 1, characterized in that: In step 3, for each sampling period, the system state at the starting sampling moment of the current sampling period is used as the starting point, and the objective function of the rolling optimization is solved using the improved particle swarm algorithm. The formula of the objective function of the rolling optimization is as follows: minJ(ΔU,Y p (ΔU)) J(ΔU,Y p (ΔU))=|Y p -Y r | T Q|Y p -Y r |+ΔU T RΔU IN min ≤U+ΔU≤U max Among them, min means taking the minimum value, J(ΔU,Y p (ΔU)) represents the objective function value of rolling optimization, U min Indicates the lower limit of the control quantity, U represents the control quantity matrix, U max Indicates the upper limit of the control value, Y p (ΔU) represents the predicted output matrix Y for the next p periods p and the functional relationship between the control quantity increment matrix ΔU in the future p periods, Y r represents the reference output matrix, Q and R are the first and second weight coefficient matrices, respectively, || T Represents a matrix transpose operation.
5. The fuel cell temperature control method based on nonlinear model predictive control according to claim 4, characterized in that: The improved particle swarm algorithm introduces the genetic variation mechanism into the particle swarm algorithm. The genetic variation mechanism is specifically: If the first random number rand1 is greater than the mutation rate C m , the particle position suddenly changes, then a second random number is generated, and the particle position at the next moment is calculated based on the second random number rand2. The calculation formula is as follows: ΔU′=rand2*ΔU Among them, ΔU′ represents the particle position at the next moment, and ΔU represents the particle position at the current moment.
Citation Information
Patent Citations
Modeling system of proton exchange membrane fuel cell (PEMFC) and intelligent predictive control method thereof
CN102968056A
Multi-fuel cell module power generation system and control method thereof
CN113555590A