Method for optimizing power density and operating parameters of a proton exchange membrane fuel cell
By constructing a proton exchange membrane fuel cell surrogate model using the random forest algorithm and an improved spectral algorithm, the problem that existing power density optimization methods cannot meet the load variation needs is solved, achieving more efficient power density optimization and shorter optimization time.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN INSTITUTE OF SCIENCE AND TECHNOLOGY
- Filing Date
- 2024-09-11
- Publication Date
- 2026-05-29
AI Technical Summary
Existing power density optimization methods for proton exchange membrane fuel cells mainly target the maximum power density, which cannot meet the changing load requirements and take a long time to optimize.
A proton exchange membrane fuel cell surrogate model based on the random forest algorithm is constructed and optimized by combining it with an improved spectral algorithm to predict the maximum power density and corresponding operating parameters, adapt to changes in load demand, and shorten the optimization time.
It improves the accuracy and efficiency of power density optimization for proton exchange membrane fuel cells, enabling rapid response to changes in load demand and reducing the computational burden of optimization.
Smart Images

Figure CN119170150B_ABST
Abstract
Description
Technical fields:
[0001] This invention relates to the field of proton exchange membrane fuel cells, and more specifically to a method for optimizing the power density and operating parameters of a proton exchange membrane fuel cell. Background technology:
[0002] Proton exchange membrane fuel cells (PEMFCs) are a new type of clean and efficient energy device with advantages such as low operating temperature, high power density, and environmental friendliness. They have been widely used in transportation, residential, stationary, and portable power systems. Power density is a key parameter for evaluating fuel cell efficiency and is closely related to various operating parameters, including operating temperature, pressure, humidity, and current density. Higher power density helps improve the output power and overall performance of PEMFCs; therefore, power density optimization is crucial. The data used in power density optimization is usually obtained from models or experiments, and the iterative algorithm requires a large amount of data to ensure the accuracy and precision of the optimization. This data is difficult to obtain experimentally, and PEMFC models involve complex electrochemical reactions and require long running times.
[0003] In practical applications, output power varies according to load demand. Current power density optimization methods for PEMFCs primarily target maximum power density and cannot accommodate changes in load requirements. Meanwhile, machine learning-based surrogate models can reduce optimization time, but these models must maintain high accuracy and reliability. Summary of the Invention:
[0004] Therefore, it is necessary to propose a method for optimizing the power density and operating parameters of proton exchange membrane fuel cells (PEMFCs) to address the aforementioned problems. First, a surrogate model of the PEMFC based on the Random Forest (RF) algorithm is constructed, using the stack's operating temperature, anode pressure, cathode / anode relative humidity, and current density as inputs and power density as output. Then, an improved spectral algorithm (ILSO) is used to optimize the inputs and outputs of the surrogate model, enabling the prediction of the maximum power density and corresponding operating parameters. When load demand changes, the fitness function of the improved spectral algorithm can be modified to calculate the power density corresponding to the load demand and predict its corresponding operating parameters. Simultaneously, this method shortens the optimization time and improves optimization efficiency.
[0005] This invention discloses a method for optimizing the power density and operating parameters of a proton exchange membrane fuel cell. It includes the following steps:
[0006] Step 1: Establish a mathematical model of the electrochemical reaction of a proton exchange membrane fuel cell stack.
[0007] Step 2: Using the power density of the fuel cell stack as the target quantity, and operating temperature, anode pressure, cathode / anode relative humidity, and current density as decision variables, obtain the dataset using MATLAB / Simulink software.
[0008] Step 3: Use the Random Forest algorithm to train and predict on the dataset to obtain the surrogate model. Simultaneously, compare the mean absolute error (MAE), mean squared error (MSE), and coefficient of determination (R²) of the Random Forest algorithm with those of three machine learning surrogate models: Support Vector Machine (SVM) and Radial Basis Function (RBF). 2 The training time was compared with the training time.
[0009] Step 4: Optimize the prediction results using an improved spectral algorithm, and compare its optimization performance with that of traditional spectral algorithms, particle swarm optimization, and differential evolution algorithms. Predict the maximum power density and its corresponding set of operating parameters, and compare the optimization time of the original model and the surrogate model.
[0010] The beneficial effects of this invention are as follows:
[0011] This invention discloses an optimization method for the power density and operating parameters of a proton exchange membrane fuel cell (PEMFC) based on random forest and an improved spectral algorithm. In the training and optimization of the PEMFC surrogate model, the random forest algorithm of this invention has a faster training speed, smaller mean absolute error, mean square error, and coefficient of determination than support vector machines and radial basis function neural networks, thus improving the accuracy and predictive ability of the surrogate model. The improved spectral algorithm has stronger global search capabilities and faster convergence speed than traditional spectral algorithms, differential evolution algorithms, and particle swarm optimization algorithms. Furthermore, the optimization method based on this invention can effectively predict the maximum power density of the PEMFC and its corresponding operating parameters according to different power requirements. Compared with optimization methods based on the original mathematical model, it has a shorter optimization time, reduces the computational burden of the optimization process, and improves optimization efficiency. Attached Figure Description
[0012] Figure 1 This is a flowchart of the technology of the present invention;
[0013] Figure 2 This is a diagram illustrating the working principle of the Random Forest algorithm.
[0014] Figure 3 The predictive performance of surrogate models based on three methods: random forest, support vector machine, and radial basis neural network is analyzed.
[0015] Figure 4 A basic schematic diagram for improving the spectral algorithm;
[0016] Figure 5To improve the performance of the spectral algorithm compared with traditional spectral algorithms, differential evolution algorithms, and particle swarm optimization algorithms;
[0017] Figure 6 To compare the optimization time of the surrogate model based on random forest with that of the original model;
[0018] Figure 7 The power density curves of the surrogate model based on random forest and the original model are shown. Detailed Implementation
[0019] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Preferred embodiments of the invention are shown in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a thorough and complete understanding of the disclosure of the invention.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0021] The method for optimizing the power density and operating parameters of a proton exchange membrane fuel cell based on random forest and improved spectral algorithm described in this invention has the following overall technical flow: Figure 1 As shown, the specific steps include:
[0022] Step 1: Establish a mathematical model of the electrochemical reaction of a proton exchange membrane fuel cell stack.
[0023] In the electrochemical reaction process of a proton exchange membrane fuel cell, the following unavoidable losses exist: activation loss, ohmic loss, and concentration loss. The actual output voltage V of the proton exchange membrane fuel cell... cell It can be represented as:
[0024] V cell =E Nernst -V act -V ohm -V con (1)
[0025] Where E Nernst It is the open-circuit voltage; V act V ohm and V con These represent activation loss, ohmic loss, and concentration loss, respectively.
[0026] ENernst Calculated using the Nernst equation:
[0027]
[0028] Where T st The operating temperature of the fuel cell stack; This represents the effective partial pressure of hydrogen gas at the anode. This is the effective partial pressure of oxygen at the cathode.
[0029]
[0030] RH an and RH ca The relative humidity of the anode and cathode are respectively; P an and P ca These are the inlet pressures for the anode and cathode, respectively. It is the saturated vapor pressure of water, which can be described by the following formula:
[0031]
[0032] The expression for activation loss is:
[0033]
[0034] Where ξ1, ξ2, ξ3, and ξ4 are empirical parameters; Ix t This is the operating current of the fuel cell stack; The oxygen dissolved concentration can be calculated using Henry's theorem, that is:
[0035]
[0036] Ohmic loss can be expressed as:
[0037] V ohm =I st ·R m (8)
[0038]
[0039] Where R m ρ is the membrane impedance of a single cell; A is the activation area of a single cell within the stack; l is the membrane thickness (cm); ρ m λ is the resistivity of the proton exchange membrane. m This represents the water content of the proton exchange membrane; its specific functional expression is as follows:
[0040]
[0041] Where a an and a caThese are the water activities at the anode and cathode, respectively; a m This represents the average water activity.
[0042] The expression for concentration loss is:
[0043]
[0044] Where b is a parameter determined by the system; i and i max These are the actual current density and the maximum current density, respectively; the output voltage and power of the fuel cell stack can be described as follows:
[0045] V st =V cell ·N cell (14)
[0046] P st =V st ·I st (15)
[0047] Where V cell It is the voltage of a single cell; N cell It represents the number of individual cells in the fuel cell stack.
[0048] Step 2: Using the power density of the fuel cell stack as the target quantity, and operating temperature, anode pressure, cathode / anode relative humidity, and current density as decision variables, obtain the dataset using MATLAB / Simulink software.
[0049] Furthermore, code was written in the MATLAB editor to control the temperature (50–80℃), anode pressure (1–3 bar), cathode / anode relative humidity (50%–100%), and current density (0–1.9 A / cm²). 2 Generate several uniform random arrays within a specified range, then substitute these decision variables into the Simulink model to obtain the corresponding power density values, and save these decision variables and target quantities as a dataset in the MATLAB workspace.
[0050] Step 3: Use the random forest algorithm to train and predict the dataset to obtain the surrogate model. At the same time, compare the mean absolute error, mean square error and coefficient of determination of the random forest algorithm with those of three machine learning surrogate models: support vector machine and radial basis function neural network.
[0051] Furthermore, the Random Forest algorithm, by constructing and ensembling multiple decision trees for prediction and regression analysis, exhibits good robustness because it reduces the risk of overfitting from individual decision trees by merging multiple trees. It also boasts high interpretability, can handle large-scale datasets, and can be efficiently trained and predicted.
[0052] Figure 2 The diagram illustrates the working principle of the PEMFC surrogate model based on random forest. First, using the TreeBagger function in MATLAB, the dataset obtained in Step 2 is randomly divided into training and test sets in an 8:2 ratio. A regression method is used, with 100 decision trees and a minimum of 1 sample per leaf node. Five features are randomly selected for training on each tree. Then, the test set is input into the training set to calculate the mean absolute error, mean squared error, and coefficient of determination of the surrogate model.
[0053] The basic steps of the random forest algorithm can be represented as follows:
[0054] (1) Randomly select a portion of samples from the original dataset (sampling with replacement) to form a smaller training set.
[0055] (2) Construct decision trees using selected samples and feature subsets. The decision tree construction process is based on feature splitting, which aims to divide the samples into subsets with similar target variables. At the same time, for the construction of each decision tree, a subset of features is randomly selected from all features as candidate features.
[0056] (3) Repeat steps 1 and 2 to construct multiple decision trees to form a forest, with each decision tree learning and predicting independently. In regression problems, the most commonly used ensemble strategy is to take the average of the predictions from the decision trees as the final regression prediction.
[0057] Figure 3 The predictive performance of surrogate models based on three methods—random forest, support vector machine, and radial basis function neural network—was analyzed. The training time for random forest was 0.3 seconds, while the training times for support vector machine and radial basis function neural network were 2.2 seconds and 169.2 seconds, respectively. The maximum error between the surrogate model based on random forest and the original model was 0.0966, which was 53% and 36% lower than that of support vector machine and radial basis function neural network, respectively. The mean absolute error, mean squared error, and coefficient of determination of the random forest algorithm were also lower than those of the other two.
[0058] Step 4: Optimize the prediction results using an improved spectral algorithm, and compare its optimization performance with that of traditional spectral algorithms, particle swarm optimization, and differential evolution algorithms. Predict the maximum power density and its corresponding set of operating parameters, and compare the optimization time of the original model and the surrogate model.
[0059] The improved spectral algorithm optimizes the input variables (temperature, anode pressure, cathode / anode relative humidity, and current density) of the surrogate model and substitutes them into the surrogate model. The output value (power density) of the surrogate model is compared, and the input corresponding to the optimal output value is the current optimal solution. The current optimal solution is then fed back into the algorithm for optimization until the final iteration count stops.
[0060] Furthermore, the principle of improving the spectral algorithm can be expressed as follows:
[0061] Initialization: The search process of the improved spectral algorithm begins with random initialization of white light, mathematically expressed as:
[0062]
[0063] in It is the initial white light; X rand d is an array of random numbers uniformly distributed between [0, 1]; d is X rand The dimension of the search space; lb and ub are the lower and upper bounds of the search space, respectively;
[0064] In optimizing the power density and operating parameters of a proton exchange membrane fuel cell, lb and ub represent the upper and lower limits of the set operating temperature, anode pressure, cathode / anode relative humidity, and current density, respectively. The above initialization steps constitute several initial operating parameters (depending on the amount of initial white light set). The matrix is constructed, and the fitness function value of each initial running parameter is calculated; the current optimal solution is selected, and then the algorithm iteration proceeds through the following steps;
[0065] Rainbow ray vector calculation; internal refraction after initialization. Internal reflection External refraction The normal vector is calculated as follows:
[0066]
[0067] in It is a solution randomly selected from the current population when the number of iterations is g; It is the current solution when the number of iterations is g; It is the global optimal solution; norm() represents the normalized value of the vector and is calculated according to the following formula:
[0068]
[0069] Where d represents the dimension of the optimization problem; It is the input vector of the norm function; used to standardize it; m j It is the input vector The j-th dimension in the equation; for the incident ray, the calculation is as follows:
[0070]
[0071] in M is the incident ray; M is the average value of the current solution population. N is the total size;
[0072] Then, the vector calculations for the internal and external refracted and reflected rays are as follows:
[0073]
[0074] in and These are internal refraction, internal reflection, and external refraction of light, respectively; k r Representing refractive index:
[0075] k r =X rand (k red -k violet (26)
[0076] Where k red k is the refractive index of red light. violet is the refractive index of violet light;
[0077] The generation of new colored rays; generating new seven-colored rays by designing scaling factors and adaptive control factors:
[0078]
[0079] GI = P-1(a, 1) (29)
[0080] GI1 = 0.2·GI·a (30)
[0081] GI2 = 10·GI·a (31)
[0082] GI3 = GI4 = 50·GI·a (32)
[0083] GI5 = 5·GI·a (33)
[0084]
[0085] in These are newly generated candidate solutions; It is the current candidate solution when the number of iterations is g; and Four solutions are randomly selected from the current population; p, q, and X. rand是 A random number between 0 and 1; g is the current iteration number; G is the maximum iteration number; a and GI are adaptive control factors;
[0086] Scattering of colored light; the mathematical formula for the first scattering stage is as follows:
[0087]
[0088] in These are newly generated candidate solutions; It is the best solution to date; and These are two solutions randomly selected from the current population; the predetermined probability β helps to shift the current solution toward the direction of the best solution so far.
[0089] The mathematical formula for the second scattering stage is as follows:
[0090]
[0091] in These are newly generated candidate solutions; π is the mathematical constant pi; the exchange between the first and second scattering stages is based on a predefined probability P. e The result is shown in the following formula:
[0092]
[0093] in These are newly generated candidate solutions;
[0094] The third scattering stage generates a new solution based on a solution randomly selected from the population and the current solution. The formula is as follows:
[0095]
[0096] in These are newly generated candidate solutions; and These are three solutions randomly selected from the current population; It is a vector containing random values 0 and 1;
[0097]
[0098] Where F is the difference between the fitness value of each solution and the fitness value of the best solution to date; f, f best and f worst These represent the fitness values of the current solution, the best solution so far, and the worst solution, respectively.
[0099]
[0100] in It is a newly generated candidate solution; P s It is a predefined probability.
[0101] The improved spectral optimization algorithm is based on the refraction phenomenon that occurs when light propagates through materials with different refractive indices. Sunlight is refracted and dispersed into various shapes as it travels from one material to another. Figure 4 The rainbow spectrum shown.
[0102] Figure 5 The diagram shows a performance comparison between the improved spectral algorithm and other algorithms. The convergence curve of the improved spectral algorithm is superior to that of the traditional spectral algorithm. This is because the different data ranges of the five feature variables lead to poor population diversity in the traditional spectral algorithm. The improved method of this invention can improve the diversity between populations and find the optimal solution more quickly. The improved spectral algorithm converges in the 57th iteration, which is 50.4% and 33.8% faster than the differential evolution algorithm and particle swarm optimization algorithm, respectively, and its optimal fitness value is also higher than both.
[0103] Figure 6 Table 1 shows a comparison of the optimization time between the surrogate model based on random forest and the original model. The combinations of iteration count and number of rays are shown in Table 1. Figure 6 As shown, the optimization time increases with the number of iterations and the number of rays. The average optimization time of the surrogate model is 1716.3s, which is 44.8% less than that of the original model (3110.3s).
[0104] Table 1. Combinations of iteration count and number of rays.
[0105]
[0106] Figure 7 The figure shows the power density curves of the surrogate model and the original model based on random forest. The relative error between the surrogate model and the original model remains within 2.5%, and the current density at the optimal power density point is 1.77 A / cm². 2 .
[0107] The present invention uses five different target power values of 5, 10, 15, 20 and 25 kW as objective functions and predicts their corresponding operating parameters as shown in Table 2.
[0108] To address this changing target power optimization problem, the fitness function of the improved spectral algorithm is as follows:
[0109]
[0110] Where Pr is the predicted value, TP is the target power value, and A active The activation area of the PEMFC is shown. The relative errors between the five predicted values and the target power density value remain below 0.16%, ensuring the accuracy of this invention.
[0111] Table 2 Prediction parameters under different target powers
[0112]
[0113] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0114] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A method for optimizing the power density and operating parameters of a proton exchange membrane fuel cell, characterized in that, Includes the following steps: Step 1: Establish a mathematical model of the electrochemical reaction of a proton exchange membrane fuel cell stack; Step 2: Using the power density of the fuel cell stack as the target quantity, and the operating temperature, anode pressure, cathode / anode relative humidity, and current density as decision variables, obtain the dataset using MATLAB / Simulink software; Step 3: Use the random forest algorithm to train and predict the dataset to obtain the surrogate model. At the same time, compare the mean absolute error, mean square error and coefficient of determination of the random forest with those of three machine learning surrogate models: support vector machine and radial basis neural network. Step 4: Optimize the prediction results by combining the improved spectral algorithm, and compare the optimization performance of the improved spectral algorithm with that of the traditional spectral algorithm, particle swarm optimization algorithm and differential evolution algorithm; predict the maximum power density and the corresponding set of operating parameters, and compare the optimization time of the original model and the surrogate model. In Step 1, establishing the mathematical model of the electrochemical reaction of the proton exchange membrane fuel cell stack includes the following: The following unavoidable losses occur during the electrochemical reaction process of a proton exchange membrane fuel cell: activation loss, ohmic loss, and concentration loss; the actual output voltage of the proton exchange membrane fuel cell... It can be represented as: ; in It is the open-circuit voltage; , and These represent activation loss, ohmic loss, and concentration loss, respectively. Calculated using the Nernst equation: ; in The operating temperature of the fuel cell stack; This represents the effective partial pressure of hydrogen gas at the anode. This is the effective partial pressure of oxygen at the cathode; ; ; in and These are the relative humidity levels at the anode and cathode, respectively. and These are the inlet pressures for the anode and cathode, respectively. It is the saturated vapor pressure of water, which can be described by the following formula: ; The expression for activation loss is: ; in , , , These are empirical parameters; This is the operating current of the fuel cell stack; The oxygen dissolved concentration can be calculated using Henry's theorem, that is: ; Ohmic loss can be expressed as: ; ; ; in The membrane impedance of a single cell; The activation area of a single cell within the fuel cell stack; The thickness of the membrane (cm); The resistivity of the proton exchange membrane; The specific functional expression for representing the water content of a proton exchange membrane is as follows: ; ; in and These are the water activities at the anode and cathode, respectively. Mean water activity; The expression for concentration loss is: ; in These are parameters determined by the system; and These are the actual current density and the maximum current density, respectively; the output voltage and power of the fuel cell stack can be described as follows: ; ; in It is the voltage of a single cell; It represents the number of individual cells in the fuel cell stack.
2. The method according to claim 1, characterized in that, In Step 3, The random forest algorithm performs prediction and regression analysis by constructing and ensembling multiple decision trees.
3. The method according to claim 1, characterized in that, The inputs are the operating temperature, pressure, relative humidity of the cathode / anode, and current density of the proton exchange membrane fuel cell stack, and the output is the power density.