A method for predicting the lifetime migration of a fuel cell
Patent Information
- Application Number
- CN202610802189.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-04
- Publication Date
- 2026-08-28
AI Technical Summary
但燃料电池数据具有强非线性、时间尺度大、分布随场景变化的特点,传统单尺度、固定结构的模型难以同时捕捉短期退化征兆与长期趋势
本发明首先在源域(FC1/FC2)上利用大量燃料电池退化数据训练得到底层特征和中层特征,并提取多时间尺度的退化规律,所以使得源域燃料电池寿命预测模型能够充分学习燃料电池通用的退化模式;并且本发明的目标域燃料电池寿命预测模型不同于传统微调方法,由于本发明采用层冻结策略保留源域底层特征不变,同时仅对中层特征进行少量轮次的微调,所以极大地降低了对燃料电池寿命预测原始数据的依赖,避免了因数据不足而导致的过拟合或预测失效,确保在仅有少量观测数据时仍能准确预测剩余寿命。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of fuel cell lifetime prediction technology, and in particular to a method for predicting fuel cell lifetime migration. Background Technology
[0002] With increasingly severe environmental pollution and energy shortages, hydrogen-oxygen fuel cell vehicles have become an important development direction in the new energy vehicle field due to their advantages such as zero emissions and high efficiency. Fuel cells are a crucial power source for new energy vehicles, but the in-stack membrane electrode assembly, bipolar plates, and catalyst layer all gradually degrade over time and under varying operating conditions, manifesting as voltage decay, increased internal resistance, and slower dynamic response. Lifespan-related degradation is influenced by multiple factors: load fluctuations, start-stop frequency, temperature and humidity management, air and hydrogen supply, pollution and flooding, driving style, and environmental climate. Significant differences exist between different regions and applications, leading to substantial variations in the lifespan distribution of the same fuel cell model.
[0003] Current life assessment methods largely rely on bench durability tests or offline modeling after long-term vehicle data collection. Bench data is controllable but deviates significantly from real-world road data; real-world vehicle data is accurate but suffers from scarce annotations, long collection cycles, and unstable data quality (missing data, noise, sensor drift). When migrating models trained in one region to a new region, predictive distortion often occurs, making it difficult to guide maintenance and upkeep plans.
[0004] With the development of vehicle connectivity and cloud-edge collaboration, health status and remaining life prediction based on multi-source time-series data has become a trend. However, fuel cell data is characterized by strong nonlinearity, large time scale, and distribution that varies with the scenario. Traditional single-scale, fixed-structure models are difficult to capture both short-term degradation signs and long-term trends simultaneously.
[0005] Therefore, how to accurately predict the lifespan of fuel cells when the amount of raw data is limited is one of the important problems that urgently need to be solved in this field. Summary of the Invention
[0006] The purpose of this disclosure is to provide a method for predicting the life migration of fuel cells to overcome the shortcomings of the prior art. It can significantly improve the accuracy, generalization ability and calculation speed of fuel cell life prediction, thereby improving the service life and economic value of fuel cells.
[0007] This disclosure provides a method for predicting fuel cell lifetime migration, which includes the following steps: S1, Construct a source-domain fuel cell lifetime prediction model; S2, Use fuel cell degradation data to train the source domain fuel cell lifetime prediction model to obtain the trained source domain fuel cell lifetime prediction model. S3, extract the low-level and mid-level feature data of the source domain fuel cell lifetime prediction model after training; S4. Construct a target domain fuel cell lifetime prediction model based on the bottom-level feature data and the middle-level feature data; S5. Based on the original training data for fuel cell life prediction, train the target domain fuel cell life prediction model; during the training process, keep the bottom-level feature data unchanged and fine-tune the middle-level feature data; to obtain the trained target domain fuel cell life prediction model. S6. Input the raw data for fuel cell life prediction into the trained target domain fuel cell life prediction model to obtain the prediction results.
[0008] In the fuel cell lifetime migration prediction method described above, optionally, the bottom-level feature data includes voltage change rate, local slope, and second-order difference; the middle-level feature data includes overall downward trend, degradation rate, and inflection point location.
[0009] In the fuel cell lifetime migration prediction method described above, step S2 optionally includes the following steps: S21, acquire fuel cell degradation data and perform data preprocessing; S22. Based on the preprocessed data of the fuel cell, features are created and training and testing datasets are constructed according to the relevant working conditions and health indicators of the fuel cell life. The data is then standardized and a sliding window is constructed to obtain fuel cell sequence data. S23, perform multi-time-window slicing (short / medium / long) on fuel cell time series data to form fuel cell time-scale series; S24, extract features from the time-scale sequence of the fuel cell and splice them together to obtain the multi-scale time series of the fuel cell. S25, input the multi-scale time series of fuel cell into the variable attention module in the source domain fuel cell lifetime prediction model, and calculate the offset of fuel cell lifetime degradation data. S26, In the variable attention module, bilinear interpolation is used on the fuel cell lifetime degradation data to obtain the sampling features of the fuel cell lifetime degradation data; S27, the sampling features of the attention-weighted fuel cell lifetime degradation data are sent to the multi-head attention module for multi-subspace parallel modeling; S28. After the sampling features of the fuel cell life degradation data enter the multi-head attention module, the features are spliced to obtain the fused fuel cell life prediction time series. S29, the fuel cell lifetime prediction time series is fed into the pooling layer for aggregation at the last time step, and the fuel cell lifetime standardized prediction voltage is output. S210 denormalizes the fuel cell lifetime standardized prediction voltage and outputs the fuel cell lifetime prediction voltage result and the fuel cell lifetime prediction source domain training model data.
[0010] In the fuel cell lifetime migration prediction method described above, step S21 optionally includes the following specific steps: S211, Obtain the voltage time series of a sample fuel cell identical to the target fuel cell, and collect the corresponding operating condition data; S212, perform data cleaning on the raw voltage time series obtained in step S211 to remove outliers and invalid records; S213, a linear interpolation method is used to fill in missing values in the cleaned data. For the missing position t, adjacent known points Va and Vb are used according to the formula... Fill in the gaps to obtain the complete voltage time series; S214, use exponentially weighted moving average to filter and denoise the filled voltage time series, according to the formula. Calculation, where High-frequency noise components are removed, while the main trend of voltage degradation is retained, to obtain the pre-processed raw data for fuel cell lifetime prediction. S215, input the preprocessed data into the source domain fuel cell lifetime prediction model.
[0011] In the fuel cell lifetime migration prediction method described above, step S22 optionally includes the following steps: S221, Based on the preprocessed data from the fuel cell, create features in the Transformer embedding layer, including the original voltage Vt and the rate of voltage change. and voltage smoothing sequence ; S222, based on fuel cell life-related operating conditions and health indicators, divides the complete dataset into training sets according to a certain proportion. and test set The training set is used for model training, and the test set is used for model evaluation and selection of the optimal model. S223, Calculate the mean of each feature column in the training set. and standard deviation The training and test sets are standardized separately. The standardization formula is as follows: ,in Prevent division by zero and ensure the model runs under a uniform data distribution; S224, construct a sliding window for predicting fuel cell lifetime voltage, set the input sequence length L and the sliding step size stride, and convert the standardized data into input-output pairs in a supervised learning format: for the j-th sample, the input is... Output ,in, h is the prediction step size, and the fuel cell life prediction dataset is constructed.
[0012] In the fuel cell lifetime migration prediction method described above, step S23 optionally includes the following steps: S231, The fuel cell time series data constructed in step S22 is used as input and passed into the multi-scale attention module; S232, in the multi-scale attention module, sets up three convolutional kernels with different kernel sizes. The convolutional layers correspond to short, medium, and long time windows, respectively, to capture degradation features at different time scales; S233, input data The inputs are fed into three convolutional layers in parallel. Each convolutional layer first transposes the input to (B, d, L), and then processes it according to the formula. Perform convolution operations to extract feature representations at the corresponding time scales, where B is the batch size, L is the sequence length, and d is the feature dimension. S234, features extracted from short, medium, and long time windows. By splicing the data along the channel dimension, a fuel cell timescale sequence integrating information from multiple time scales is formed. .
[0013] In the fuel cell lifetime migration prediction method described above, step S24 optionally includes the following steps: S241, input the fuel cell timescale sequence C obtained in step S23 into the subsequent processing part of the multi-scale attention module; S242, Apply the ReLU activation function to the concatenated features. This enhances the nonlinear expressive power of features; S243, through a linear projection layer The activated high-dimensional features are mapped back to the original feature dimensions, where , representing a linear transformation Achieve dimensionality reduction and fusion of features; S244, Apply Dropout operation to the output of the linear projection layer. To prevent overfitting, the multi-scale time series of the fuel cell was finally obtained. This sequence contains multi-level information ranging from instantaneous fluctuations to long-term degradation trends.
[0014] In the fuel cell lifetime migration prediction method described above, step S5 optionally includes the following steps: S51, acquire the raw data for fuel cell life prediction and preprocess it to obtain fuel cell life prediction degradation data; S52, based on fuel cell life prediction degradation data and VRPLR calculated based on polarization curves, extract fuel cell performance degradation characteristics; S53, construct a sliding window for fuel cell performance degradation characteristics, and divide the fuel cell degradation time series data into a training set and a test dataset for model adaptation; S54. Input the processed fuel cell degradation time series data into the model to complete the fuel cell lifetime prediction feature engineering and input preparation. S55, call the fuel cell life prediction transfer learning module, based on the source domain pre-trained model source domain fuel cell life prediction model, keep the bottom layer features unchanged, and fine-tune the middle layer features. S56, call the adaptive memory module, which uses a forgetting mechanism in conjunction with the multi-scale module, the variability module and the multi-head attention module to ensure normal prediction through forgetting recovery voltage, and uses a recovery mechanism in conjunction with feature fusion gating to achieve the purpose of predicting the rising fluctuations of VRPLR during the degradation process; S57. Input the fuel cell degradation time series data into the multi-scale attention module to extract short sequence features, medium sequence features and long sequence features. Then, the fuel cell time scale series are spliced together to obtain the fuel cell multi-scale time series. S58, in the variable attention module, bilinear interpolation is used on the fuel cell lifetime degradation data to obtain the sampling features of the fuel cell lifetime degradation data; S59, the sampling features of the attention-weighted fuel cell life degradation data are sent to the multi-head attention module for parallel modeling of multiple subspaces, and then fed into the feature fusion gate for fusion. S510 inputs the fuel cell lifetime prediction features into the pooling layer, performs time step aggregation and feature dimensionality reduction, and denormalizes the fuel cell VRPLR prediction results to output the final VRPLR prediction results, thus completing the fuel cell lifetime prediction.
[0015] In the fuel cell lifetime migration prediction method described above, step S55 optionally includes: S551, Load the source domain fuel cell lifetime prediction model; S552, the multi-scale convolutional weights, Transformer encoder self-attention weights, and feedforward network weights of the source domain fuel cell lifetime prediction model are transferred to the corresponding layers in the target domain model, as shown in the formula. ; S553, Application Layer Freeze Strategy: Sets the parameters of the low-level feature modules of the target domain model to be untrainable. To keep the underlying features unchanged; S554, fine-tuning the mid-level feature module: using training set data, with mean squared error loss. Add L2 regularization terms Perform a limited number of training rounds, update the mid-layer parameters, and complete the source domain pre-trained model + layer freezing + fine-tuning target domain adaptation.
[0016] In the fuel cell lifetime migration prediction method described above, step S56 optionally includes the following steps: S561 invokes the adaptive memory module to generate a forgetting signal based on the shutdown and restart times. and recovery signal For each downtime ,exist Set within range For each restart moment ,exist Set within range ; S562, Forgetting Mechanism: In the variable attention module, the forgetting signal ft is used to suppress the influence of historical degradation information on the current prediction, ensuring that normal prediction is not disturbed by abnormal fluctuations; S563, Recovery Mechanism: In the multi-head attention module, feature fusion gating and the recovery signal rt enhance the model's ability to capture voltage regeneration phenomena (VRPLR rising fluctuations). The formula is as follows: , in This indicates element-wise multiplication.
[0017] S564 integrates a multi-scale module, a variability module, and a multi-head attention module, enabling the model to adaptively remember or forget degradation patterns at different stages, thus completing the integration of an adaptive memory module.
[0018] Compared with the prior art, this disclosure has the following beneficial effects: This invention first trains the low-level and mid-level features in the source domain (FC1 / FC2) using a large amount of fuel cell degradation data, and extracts degradation patterns at multiple time scales. This allows the source domain fuel cell lifetime prediction model to fully learn the common degradation patterns of fuel cells. Furthermore, the target domain fuel cell lifetime prediction model of this invention differs from traditional fine-tuning methods. Because this invention uses a layer freezing strategy to preserve the low-level features of the source domain unchanged, while only fine-tuning the mid-level features in a few rounds, it greatly reduces the dependence on the original data for fuel cell lifetime prediction, avoids overfitting or prediction failure due to insufficient data, and ensures accurate prediction of remaining lifetime even with only a small amount of observation data.
[0019] The variable attention module of this invention differs from the attention mechanism with a fixed receptive field. Because this invention dynamically calculates the sampling point position through an offset prediction network and uses bilinear interpolation to obtain sampling features, it can adaptively focus on key inflection points and local fluctuations during the voltage drop process, significantly improving the ability to capture complex phenomena such as voltage regeneration and shutdown restart. Furthermore, the multi-scale attention module of this invention works in collaboration with the multi-head attention module. Since the multi-scale module models short, medium, and long time windows in parallel, and the multi-head module calculates dependencies in parallel in multiple subspaces, it can simultaneously capture the instantaneous fluctuations, periodic oscillations, and long-term monotonic decay trends of fuel cell degradation.
[0020] The adaptive memory module of this invention adjusts the feature fusion gating by jointly adjusting the forgetting signal and the recovery signal. Since the forgetting mechanism suppresses the interference of historical abnormal fluctuations on the current prediction, and the recovery mechanism enhances the modeling of voltage regeneration rise fluctuations, the model can accurately track the non-monotonic changes in the VRPLR sequence, avoiding the defect of traditional methods that misjudge regeneration phenomena as the end of life.
[0021] The overall prediction process of this invention is fully automated from data preprocessing to denormalized output. Due to the use of lightweight calculations such as hourly resampling, Savitzky-Golay smoothing, and exponentially weighted moving average, and the fact that model inference only requires one forward propagation to output multi-step prediction results, the speed of fuel cell lifetime prediction is greatly improved, making online monitoring and real-time remaining lifetime assessment possible. In summary, this method significantly improves the accuracy, generalization ability, and computational speed of fuel cell lifetime prediction, thereby enhancing the service life and economic value of fuel cells. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of this disclosure, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of the source domain fuel cell lifetime prediction model structure of the present invention; Figure 2 This is a schematic diagram of the target domain fuel cell lifetime prediction model of the present invention; Figure 3 This is a flowchart of the steps in this method; Figure 4 This is a flowchart showing the specific steps of step S2 in this method; Figure 5This is a flowchart showing the specific steps of step S5 in this method; Figure 6 This is a schematic diagram of the prediction results of the source domain fuel cell lifetime prediction model FC1 of the present invention; Figure 7 This is a schematic diagram of the prediction results of the source domain fuel cell lifetime prediction model FC2 of the present invention; Figure 8 This is a schematic diagram of the migration prediction results of the target domain fuel cell lifetime prediction model of the present invention on the Tongji University dataset after 100 hours. Figure 9 This is a schematic diagram of the migration prediction results of the target domain fuel cell lifetime prediction model of the present invention based on the Tongji University dataset after 200 hours. Figure 10 This is a schematic diagram of the migration prediction results of the target domain fuel cell lifetime prediction model of the present invention based on the Tongji University dataset after 300 hours. Figure 11 This is a schematic diagram of the migration prediction results of the target domain fuel cell lifetime prediction model of the present invention based on the Tongji University dataset after 400 hours. Figure 12 This is a schematic diagram of the migration prediction results of the target domain fuel cell lifetime prediction model of the present invention based on the 500-hour Tongji University dataset. Detailed Implementation
[0024] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0025] To address the problems raised in the background art, this invention provides a fuel cell lifetime migration prediction method, aiming to accurately predict fuel cell lifetime even with a small amount of original data for fuel cell lifetime prediction.
[0026] Please refer to the appendix. Figures 1 to 5 This invention provides a method for predicting fuel cell lifetime migration. This method uses two models: a source domain fuel cell lifetime prediction model and a target domain fuel cell lifetime prediction model.
[0027] For the source-domain fuel cell lifetime prediction model, please refer to... Figure 1The source domain fuel cell lifetime prediction model mainly includes a transformer embedding layer, a fuel cell lifetime prediction linear projection layer, a multi-scale attention module, a variable attention module, a multi-head attention module, and a prediction output module.
[0028] The data preprocessing module preprocesses the raw data for fuel cell life prediction by cleaning, imputing missing values, and filtering to remove noise.
[0029] The transformer embedding layer aligns the preprocessed data at the same time step and then constructs characteristic voltage change rate, current change rate, and voltage smoothing sequence based on the original voltage and current signals. Subsequently, the degraded data is divided into training and prediction sets in an 8:2 ratio. The training and test sets are standardized to ensure that the model runs under a uniform data distribution. Finally, a voltage prediction sliding window for fuel cell lifetime prediction is constructed, specifying the number of prediction steps and the sliding window size.
[0030] The multi-scale attention module first distributes features to neural networks at different time scales through a linear projection layer for fuel cell lifetime prediction. The neural networks at different time scales extract and fuse the features to capture the dynamic changes in fuel cell lifetime during instantaneous, periodic, and integrated lifetimes during fuel cell degradation.
[0031] The variable attention module introduces a variable attention mechanism, enabling the model to dynamically adjust its attention receptive field based on input features. It focuses on the changes in key time nodes during the fuel cell degradation process. By learning the offset of the time series, it adaptively selects the time series position with the highest correlation to the current fuel cell life degradation for attention, thereby more accurately capturing local fluctuation features and trend turning points during the voltage drop process. In addition, the module uses the ReLU activation function to enhance the nonlinear expressive power of the features. It also combines input features with position encoding to preserve the positional order of fuel cell life degradation data. Finally, it aligns the fuel cell life degradation data through bilinear interpolation and outputs sampled features.
[0032] The multi-head attention module transmits the sampled features to a multi-layer neural network through a linear projection layer for prediction. After the prediction is completed, the data is combined in a splicing layer and then fed into a pooling layer for final time step aggregation to output the non-standardized prediction voltage of fuel cell lifetime.
[0033] The prediction output module normalizes the unnormalized predicted voltage for fuel cell lifetime and retains the low-level and mid-level features from the fuel cell lifetime prediction process as training model data for the fuel cell lifetime prediction source domain. The low-level features include the variation relationship between adjacent time points in the time series data, second-order differences, and local slopes. The mid-level features include the overall downward trend, degradation rates at different stages, inflection point locations, periodic patterns, and degradation stage characteristics. The low-level features are strictly implemented in the target domain fuel cell lifetime prediction model, and the mid-level features are used to fine-tune the target domain fuel cell lifetime prediction model. The low-level feature data includes voltage change rate, local slope, and second-order differences; the mid-level feature data includes the overall downward trend, degradation rate, and inflection point locations.
[0034] Please refer to Figure 2 The target domain fuel cell lifetime prediction model includes a data preprocessing module, a multi-scale attention module, a variable attention module, a multi-head attention module, a prediction output module, an adaptive memory module, and a transfer learning module.
[0035] The data preprocessing module preprocesses the raw data for fuel cell lifetime prediction through data cleaning, missing value imputation, and filtering and denoising. It also performs data resampling and interpolation. Then, it calculates the original VRPLR based on the voltage and current data and polarization curves in the data. The calculated original VRPLR is then divided into a training set and a prediction set with an 8:2 ratio. A sliding window for fuel cell lifetime prediction voltage prediction is then constructed, specifying the prediction steps and the sliding window size. This ensures that subsequent inputs into the model for VRPLR prediction can effectively capture the short-term fluctuations and long-term trend characteristics of VRPLR during fuel cell degradation.
[0036] The adaptive memory module includes a recovery signal mechanism and a forgetting mechanism. The forgetting mechanism, closely integrated with the multi-scale attention module, the variability attention module, and the multi-head attention module, forces the forgetting of non-degradation voltage recovery caused by shutdown and restart during the operation of the Tongji University fuel cell dataset, thus ensuring normal VRPLR prediction. If the target domain dataset does not contain non-degradation voltage recovery, the forgetting mechanism will not run. The recovery signal mechanism is tightly integrated with the fuel cell lifetime prediction feature fusion gating in the multi-head attention mechanism, ensuring that normal fuel cell lifetime degradation recovery voltage can be detected when predicting the final VRPLR result. This module ensures that the model is not affected by non-degradation voltage recovery during the prediction process, nor does it affect the prediction of normal degradation voltage, thereby ensuring the accuracy and stability of the final predicted VRPLR.
[0037] The transfer learning module first extracts the fuel cell lifetime prediction source domain training model data from the source domain fuel cell lifetime prediction model through the transfer learning manager. This data mainly includes low-level features and mid-level features. The low-level features are the change relationships between adjacent time points in the time series data, second-order differences, and local slopes. The mid-level features are the overall downward trend, degradation rates at different stages, inflection point positions, periodic patterns, and degradation stage characteristics. The low-level features strictly implement a layer freezing strategy in the target domain fuel cell lifetime prediction model, while the mid-level features perform model fine-tuning in the target domain fuel cell lifetime prediction model, providing the necessary foundation for subsequent model prediction of VRPLR.
[0038] The multi-scale attention module first distributes features to neural networks at different time scales through a linear projection layer for fuel cell lifetime prediction. The neural networks at different time scales extract and fuse the features to capture the dynamic changes in fuel cell lifetime during instantaneous, periodic, and integrated lifetimes. In addition, the forgetting mechanism in the adaptive memory module is combined to force the recovery of non-degradable voltages of fuel cells in the forgotten dataset, thereby ensuring the normal prediction of VRPLR.
[0039] The variable attention module introduces a variable attention mechanism, enabling the model to dynamically adjust its receptive field based on input features. It focuses on changes in key time points during fuel cell degradation, learning time series offsets and adaptively selecting the time series positions most correlated with the current fuel cell lifespan degradation. This allows for more accurate capture of local fluctuations and trend inflection points during voltage drop. Furthermore, the module employs the ReLU activation function to enhance the non-linear expressive power of features. It also combines input features with positional encoding to preserve the positional order of fuel cell lifespan degradation data. Bilinear interpolation is then used to align the data and output sampled features. Additionally, the forgetting mechanism in the adaptive memory module forces the recovery of non-degraded fuel cell voltages in the forgotten dataset, ensuring normal VRPLR prediction. This allows the model to effectively address changes in feature distribution across different degradation stages.
[0040] The multi-head attention module transmits the sampled features to a multi-layer neural network through a linear projection layer for prediction. After prediction, the data is combined with the fuel cell lifetime prediction features fused by the recovery signal mechanism in the joint adaptive memory module to ensure that the fuel cell lifetime degradation recovery voltage can be predicted normally. In addition, the forgetting mechanism in the joint adaptive memory module forces the forgetting of the non-degradation voltage recovery of the fuel cell in the dataset, thereby ensuring the normal prediction of VRPLR. Then, the data is fed into the pooling layer for the final time step aggregation to output the non-standardized prediction of fuel cell lifetime VRPLR.
[0041] The prediction output module standardizes the non-standardized fuel cell lifetime prediction VRPLR, and then outputs the fuel cell lifetime prediction feature VRPLR to complete the final prediction.
[0042] Please refer to Figures 3 to 5 This disclosure provides a method for predicting the life migration of a fuel cell, which includes the following steps: S1, Construct a source-domain fuel cell lifetime prediction model; the model constructed in this step, such as... Figure 1 The source domain fuel cell lifetime prediction model disclosed in the paper has been described above and will not be repeated here.
[0043] S2, using fuel cell degradation data, trains the source domain fuel cell lifetime prediction model to obtain the trained source domain fuel cell lifetime prediction model. The main purpose of this step is to utilize the large amount of existing degradation data to obtain low-level and mid-level feature data, so as to apply them to the target domain fuel cell lifetime prediction model. Please refer to... Figure 4 This step includes steps S21 to S210.
[0044] S21, acquire fuel cell degradation data and perform data preprocessing; specifically, this step includes steps S211 to S215.
[0045] S211, Obtain the voltage time series {Vt} of a sample fuel cell identical to the target fuel cell, and collect the corresponding operating condition data.
[0046] S212, perform data cleaning on the raw voltage time series obtained in step S211 to remove outliers and invalid records; this step ensures the continuity and consistency of the data.
[0047] S213, a linear interpolation method is used to fill in missing values in the cleaned data. For the missing position t, adjacent known points V are used. a V b According to the formula The missing time series is filled in to obtain the complete voltage time series. Here, t refers to the time corresponding to the missing position; a is the time corresponding to the adjacent previous time; b is the time corresponding to the adjacent next time; Va is the voltage corresponding to time a; and Vb is the voltage corresponding to time b.
[0048] S214, use exponentially weighted moving average to filter and denoise the filled voltage time series, according to the formula. Calculation, where High-frequency noise components are removed while retaining the main trend of voltage degradation, resulting in preprocessed raw data for fuel cell lifetime prediction. Here, EMAt is the exponentially weighted moving average (filtered voltage value) at time t, and Vt is the original voltage value at time t. The smoothing factor is 'span', and the window length is 'span'. This recursive formula smooths and filters the voltage sequence using an exponentially weighted method, preserving long-term degradation trends and suppressing high-frequency random noise.
[0049] S215, input the preprocessed data into the source domain fuel cell lifetime prediction model.
[0050] S22: Based on the preprocessed fuel cell data, features are created, and training and testing datasets are constructed according to fuel cell life-related operating conditions and health indicators. The data is then standardized and a sliding window is constructed to obtain fuel cell sequence data. This step includes S221 to S225. Specifically, steps S221 to S225 are as follows: S221, Based on the preprocessed data from the fuel cell, create features in the Transformer embedding layer, including the original voltage Vt and the rate of voltage change. and voltage smoothing sequence .
[0051] S222, based on fuel cell life-related operating conditions and health indicators, divides the complete dataset into training sets according to a certain proportion. and test set The training set is used for model training, and the test set is used for model evaluation and selection of the optimal model.
[0052] S223, Calculate the mean of each feature column in the training set. and standard deviation The training and test sets are standardized separately. The standardization formula is as follows: ,in To prevent division by zero, the model must operate under a uniform data distribution. is the mean (average value) of feature f on the training set, reflecting the central location of the data. is the standard deviation of feature f on the training set, reflecting the dispersion (fluctuation) of the data. Let be the feature value of the i-th sample in the training set. The total number of samples in the training set. The training set is the dataset. i ∈ This indicates that the summation process is performed on all samples in the training set.
[0053] S224, construct a sliding window for predicting fuel cell lifetime voltage, set the input sequence length L and the sliding step size stride, and convert the standardized data into input-output pairs in a supervised learning format: for the j-th sample, the input is... Output ,in, h represents the prediction step size, completing the construction of the fuel cell lifetime prediction dataset. Here, h=0 indicates predictions at the same time point.
[0054] S23, perform multi-time-window slicing (short / medium / long) on the fuel cell time-series data to form a fuel cell time-scale series. In this step, S23 includes steps S231 to S234, the specific steps of which are as follows: S231, the fuel cell time series data constructed in step S22 is used as input and passed to the multi-scale attention module.
[0055] S232, in the multi-scale attention module, sets up three convolutional kernels with different kernel sizes. The convolutional layers correspond to short, medium, and long time windows, respectively, to capture degradation features at different time scales.
[0056] S233, input data The inputs are fed into three convolutional layers in parallel. Each convolutional layer first transposes the input to (B, d, L), and then processes it according to the formula. Perform convolution operations to extract feature representations at the corresponding time scales, where B is the batch size, L is the sequence length, and d is the feature dimension. S234, features extracted from short, medium, and long time windows. By splicing the data along the channel dimension, a fuel cell timescale sequence integrating information from multiple time scales is formed. .
[0057] S24, feature extraction and concatenation of the fuel cell time-scale sequence are performed to obtain the fuel cell multi-scale time series. This step includes steps S241 to S244, and the specific steps of steps S241 to S244 are as follows.
[0058] S241, input the fuel cell timescale sequence C obtained in step S23 into the subsequent processing part of the multi-scale attention module.
[0059] S242, Apply the ReLU activation function to the concatenated features. This enhances the non-linear expressive power of features. C is the input feature matrix (data before activation, which may contain positive and negative numbers); The output feature matrix after processing by the ReLU activation function; max(0, C): For each element in C, take the larger value between that element and 0 (negative numbers are set to 0, positive numbers remain unchanged).
[0060] S243, through a linear projection layer The activated high-dimensional features are mapped back to the original feature dimensions, where , representing a linear transformation Achieve feature reduction and fusion. Among these, This is the output feature matrix after linear projection and Dropout (i.e., the final multi-scale time series of the fuel cell). This is the feature matrix (C_act = max(0, C)) after processing with the ReLU activation function in the previous sub-step. T is the matrix transpose symbol, indicating that... A transpose operation is performed to transform the dimensions from (B, L, 3d) to (B, 3d, L) to accommodate the input requirements of the linear layer. Linear(·) is the linear projection operation, specifically in the form Wx + b, where: x is the input feature (i.e., the transposed value) Each sample in the dataset). W is the weight matrix (a learnable parameter) used to achieve linear transformation and dimensionality reduction of the features. b is the bias vector (a learnable parameter). Dropout(·) is a regularization operation that randomly sets the output of some neurons to zero with a certain probability during training to prevent overfitting.
[0061] S244, Apply Dropout operation to the output of the linear projection layer. To prevent overfitting, the multi-scale time series of the fuel cell was finally obtained. This sequence contains multi-level information ranging from instantaneous fluctuations to long-term degradation trends.
[0062] S25, input the multi-scale time series data of the fuel cell into the variable attention module in the source domain fuel cell lifetime prediction model, and calculate the offset of the fuel cell lifetime degradation data. This step includes steps S251 to S254.
[0063] S251, multi-scale time series of fuel cells Input variability attention module, which is located in the first layer of the Transformer encoder.
[0064] S252, in the variable attention module, a shift prediction network is set up, which consists of two one-dimensional convolutional layers: input... The offset is output after Conv1D and ReLU, and then after Conv1D again. Where H is the number of attention heads, and P is the number of sampling points per head. Δp is the offset tensor, representing the offset value corresponding to each query position, each attention head, and each sampling point. R is a real number field, indicating that the elements of the tensor are real numbers. B is the batch size, i.e., the number of independent sequence samples processed in one forward propagation. L is the sequence length, i.e., the number of time steps of the input time series.
[0065] H represents the number of attention heads, the number of parallel subspaces in a multi-head attention mechanism. P represents the number of sampling points per head, the number of points sampled from the feature map at each query location in variable attention. This is a multi-scale time series, i.e., the input features for the variable attention module. Conv1D: a one-dimensional convolution operation that convolves the features along the time dimension. ReLU is the activation function, setting negative values to 0.
[0066] S253, Apply the tanh activation function to the output of the offset prediction network. By limiting its value to the range of [-1,1], the normalized offset is obtained, and the offset calculation of fuel cell life degradation data is completed.
[0067] S254, based on the preset reference point position Using the calculated offset, determine the actual coordinate position of each sampling point. .in, This is a pre-defined set of reference point coordinates (normalized coordinate system) used to define the initial sampling reference position for each time location in the variability attention mechanism. `l` is the time step index, ranging from 0, 1, 2, ..., L−1, corresponding to the l-th position in the sequence. `L` is the length of the input sequence (total number of time steps). `p` is the actual coordinate position of each sampling point, obtained by adding the reference point coordinates and the offset: `p = ...` +Δp. Δp is the offset, which is predicted by the offset prediction network and used to dynamically adjust the sampling point position.
[0068] S26, In the variable attention module, bilinear interpolation is used to obtain the sampling characteristics of the fuel cell lifetime degradation data. This step includes steps S261 to S264.
[0069] S261, in the variability attention module, features are sampled from the key K and value V based on the sampling point coordinates p determined in step S5, where K and V are determined by the input. Obtained through linear projection.
[0070] S262 uses bilinear interpolation to perform interpolation calculations on a discrete grid of keys and values based on the continuous coordinate positions of the sampling points. For a one-dimensional sequence, the sampled values are calculated according to the formula... Obtain, among which Given integer coordinates, obtain the sampling features at the corresponding positions.
[0071] S263, for each query position l, calculate its attention weight with each sampling point, using the scaled dot product attention formula. The normalized weights are obtained. Let be the attention weights corresponding to the l-th query position, the h-th attention head, and the p-th sampling point. exp is an exponential function with the natural constant e as the base. Let h be the query vector for the l-th query position and the h-th attention head. This is the feature vector obtained by bilinear interpolation at the p-th sampling point in the l-th query position and h-th attention head. is the scaling factor, where k is usually the dimension of the key vector (d_k), used to control the size of the dot product and avoid gradient saturation. The numerator represents the scaled exponent of the dot product of the query and the sampled key. The denominator represents the sum of the numerator values of all P sampled points at the same query location and under the same attention head, achieving normalization. P is the total number of sampled points for each attention head.
[0072] S264, the attention weights are summed with the corresponding sampled values to obtain the variable attention output for the query position. This refers to the sampling characteristics of fuel cell life degradation data.
[0073] S27, the sampling features of the attention-weighted fuel cell lifetime degradation data are fed into the multi-head attention module for parallel modeling in multiple subspaces. This step includes steps S271 to S273.
[0074] S271, the attention-weighted sampling features obtained in step S26 The input multi-head attention module is located in layers two through four of the Transformer encoder.
[0075] S272, in the multi-head attention module, the input features are mapped to multiple independent subspaces through a linear projection layer, with each subspace corresponding to an attention head, as shown in the formula. .in, is the query matrix for the h-th attention head, used to match the keys to calculate attention weights. The key matrix (Key) of the h-th attention head is used to calculate the similarity score with the query. The output is obtained by summing the values of the h-th attention head according to the attention weights. The sampled feature matrix output by the variable attention module (i.e., the output of the previous module, which serves as the input to the multi-head attention module). is the query weight matrix (learnable parameter) for the h-th attention head, used to linearly map Odeform to the query space. is the key weight matrix (learnable parameter) of the h-th attention head, used to linearly map Odeform to the key space. The value weight matrix (learnable parameter) for the h-th attention head is used to linearly map the Odeform to the value space.
[0076] S273 employs a standard multi-head self-attention mechanism for parallel modeling within each subspace, capturing the dependencies between different positions within the sequence, using the formula... The attention output of each subspace is calculated to complete the parallel modeling of multiple subspaces. Among them, Attention(Q_h, K_h, V_h): the output of the attention function, that is, the feature matrix after weighted aggregation by the attention mechanism. is the query matrix for the h-th attention head, used for matching with the key. Let hh be the key matrix of the hh-th attention head, and let it be used to calculate the similarity score with the query. The output is obtained by summing the values of the h-th attention head according to the attention weights. This is the transpose of the key matrix, used for matrix multiplication with the query matrix. The dimension of each key (or query) vector is used to scale the dot product to avoid gradient saturation. dk is the scaling factor, which scales the dot product result to an appropriate range. softmax is the normalized exponential function that transforms the attention score into a probability distribution, such that the sum of the weights at all locations is 1.
[0077] S28: After the sampled features of the fuel cell lifetime degradation data enter the multi-head attention module, feature concatenation is performed to obtain the fused fuel cell lifetime prediction time series. This step includes steps S281 to S283.
[0078] S281, the output obtained from the parallel computation of each attention head in step S7. By concatenating along the feature dimension, we obtain... .in, The output matrix of the h-th attention head is obtained from the attention calculation: Concat is a concatenation operation that merges multiple tensors along a specified dimension (here, the feature dimension). H_1, H_2, …, H_H are the output matrices of all H attention heads. H is the total number of attention heads (multiple heads). This outputs a matrix concatenated along the feature dimension for all attention heads. B is the batch size, i.e., the number of samples processed in one forward propagation. L is the sequence length, i.e., the number of time steps in the input time series. (or H×) ) represents the concatenated feature dimension, where This represents the key / query vector dimension for each header. Since the output dimension of each header is dk, the total dimension after concatenation is H×. . This indicates that the shape of the tensor is a three-dimensional real tensor.
[0079] S282, the stitched features are passed through a linear projection layer. Perform a linear transformation to restore the original model dimensions. .in, This is the final output of the multi-head attention module after passing through the linear projection layer. The weight matrix (learnable parameter) of the linear projection layer is typically (H⋅dk)×dmodel, used to map the concatenated features back to the model's internal dimensions. is the bias vector (learnable parameter) of the linear projection layer, with dimension dmodel.
[0080] S283 applies residual connectivity and layer normalization to the output of the linear projection layer, as shown in the formula: The fused fuel cell lifetime prediction time series was obtained. This sequence integrates different semantic information captured from multiple subspaces.
[0081] S29, the fuel cell lifetime prediction time series is input into the pooling layer for aggregation at the last time step, and the fuel cell lifetime standardized prediction voltage is output; this step includes steps S291 to S293.
[0082] S291, the fused fuel cell lifetime prediction time series obtained in step S8 Pass it into the pooling layer.
[0083] In S292, within the pooling layer, the feature vector of the last time step of the sequence is selected as the aggregated representation of the sequence, i.e. The aggregation at the final time step is completed. Here, z_last is the feature vector obtained after aggregation by the pooling layer, representing the feature representation of the last time step of the sequence. This is the feature tensor (3D tensor) output by the multi-head attention module, typically with a shape of [B, L, D]. Here, B is the batch size, L is the sequence length, and D is the feature dimension (dmodel). [i, -1, j] represents the tensor indexing: i is the index in the batch dimension (from 0 to B−1), indicating the current sample's position within the batch; -1 is the index in the time step dimension, indicating the last time step (similar to negative indexing in Python, -1 represents the last element); and j is the index in the feature dimension (from 0 to D−1), indicating the feature value at a specific position.
[0084] S293 performs a linear transformation on the aggregated feature vector through a fully connected layer, outputting a scalar value, as shown in the formula. This refers to the standardized prediction voltage for fuel cell lifetime. The standardized predicted voltage (scalar value) output by the model is the prediction result after linear transformation. The feature vector obtained after pooling is of shape (dmodel), representing the feature representation of the last time step of the input sequence. The weight vector for the prediction head (fully connected layer) has a shape that matches zlast (dimension dmodel) and can be learned. The bias term (scalar) of the prediction head is a learnable parameter.
[0085] S210, denormalize the fuel cell lifetime standardized prediction voltage, and output the fuel cell lifetime prediction voltage result and the fuel cell lifetime prediction source domain training model data. This step includes steps S2101 to S2104.
[0086] S2101, Obtain the fuel cell lifetime standardized prediction voltage output in step S29. .
[0087] S2102, Obtain the standardized statistics of the training set from step S22, including the mean of the target voltage. and standard deviation .
[0088] S2103, according to the inverse standardization formula By restoring the standardized predicted voltage to the original voltage dimension, the fuel cell lifetime predicted voltage result is obtained.
[0089] S2104 saves the low-level and mid-level features of the model during training. The low-level features include the change relationship between adjacent time points in the time series data, second-order difference, and local slope. The mid-level features include the overall downward trend, degradation rate at different stages, inflection point position, periodic pattern, and degradation stage features. The above features are used as the source domain training model data output for fuel cell lifetime prediction, providing a basis for subsequent fine-tuning of the target domain model.
[0090] S3, extract the low-level and mid-level feature data of the source domain fuel cell lifetime prediction model after training; in specific implementation, the low-level feature data includes voltage change rate, local slope and second-order difference; the mid-level feature data includes overall downward trend, degradation rate and inflection point position.
[0091] S4. Construct a target domain fuel cell lifetime prediction model based on the bottom-level feature data and the middle-level feature data. In specific implementation, the structure of the target fuel cell lifetime prediction model has been described in detail above and will not be repeated here.
[0092] S5, based on the original training data for fuel cell life prediction, train the target domain fuel cell life prediction model; during the training process, keep the low-level feature data unchanged, and fine-tune the mid-level feature data; thus obtaining the trained target domain fuel cell life prediction model; training the target domain fuel cell life prediction model is one of the most important aspects of this method, please refer to... Figure 5 This process mainly includes steps S51 to S510.
[0093] S51: Obtain the raw training data for fuel cell life prediction and preprocess it to obtain fuel cell life prediction degradation data. Specifically, this step includes steps S511 to S518.
[0094] S511, acquire raw data for fuel cell life prediction, i.e. read multiple CSV files from a specified path, each file corresponds to a polarization curve test, the file name contains the test time (hour), and a polarization curve test is performed before shutdown every 100 hours and after restart.
[0095] S512 reads the time (seconds), current, and voltage for each CSV file, and calculates the absolute time (hours) based on the time offset: ; S513: Sort and merge the data from all files according to absolute time to form a complete fuel cell life prediction degradation time series dataset, and then enter the fuel cell life prediction target domain training process.
[0096] S514 cleans the merged original data, removing records with missing current or voltage values.
[0097] S515 performs a lightweight smoothing filter on the original voltage sequence using an SG filter (window length 11, polynomial order 2), the formula is as follows: To reduce transient noise.
[0098] S516 extracts current-voltage data within a 0.5-hour window before and after each test point based on the polarization curve test time, and constructs the polarization curve.
[0099] S517 performs interpolation and robust fitting on each polarization curve, using linear interpolation: ; The weighted fusion with RANSAC linear regression yields a continuous voltage-current function f(t,I).
[0100] S518, resample the raw data to the hourly level: take the weighted average of the median and mean of the raw VRPLR values within each hourly interval, using the following formula: VRPLRhour(h) = 0.6⋅median + 0.4⋅mean, where VRPLRhour(h) represents the hourly VRPLR value calculated at time h (hours). h is a time variable, in hours, representing the current hourly time point (e.g., hour h). 0.6 and 0.4 are weighting coefficients, assigned to the median and mean respectively. Their sum is 1, representing a weighted average. median is the median of all original VRPLR samples within a given hourly interval (usually [h−0.5, h+0.5)), reflecting the central tendency of the data and being insensitive to outliers. mean is the arithmetic mean of all original VRPLR samples within the same interval, reflecting the overall level of the data.
[0101] Then, missing values were filled in by linear interpolation to complete the standardization of the original data for fuel cell life prediction, and the original VRPLR sequence of fuel cell life prediction degradation data was obtained.
[0102] S52, Based on the fuel cell lifetime prediction degradation data and the VRPLR calculated based on the polarization curve, extract the fuel cell performance degradation characteristics. This step includes steps S521 to S524.
[0103] S521, Based on the polarization curve function f(t,I) obtained in step S2, calculate the voltage degradation reference value under the rated current I=35.6 A.
[0104] S522, VRPLR (Virtual Relative Power Loss Rate) calculation formula: , in The voltage at rated current at the start of the lifespan. Let be the estimated voltage at the rated current at time t.
[0105] 523. For any time t, estimate the current voltage using linear interpolation at two adjacent polarization curve test points ti and ti+1: . 524. The calculated original VRPLR sequence is smoothed in two stages: first, a medium-range filter (kernel size 5) is applied, then an SG filter (window 11, order 3) is applied, and finally an exponentially weighted moving average α=0.15 is applied to extract the fuel cell performance degradation feature VRPLR(t).
[0106] S53, construct a sliding window for the performance degradation characteristics of fuel cells, and divide the fuel cell degradation time series data into a training set and a test dataset for model adaptation; this step includes steps S531 to S533.
[0107] S531, Align the VRPLR sequence {yt} obtained in step S52 with the corresponding adaptive memory signals (recovery signal rt, forgetting signal ft, time signal mt).
[0108] S532, Construct a sliding window: Set the window length L (default is the historical observation length, dynamically changing with the prediction starting point), and the step size is 1. For each window, the input is... , The output is the true value y at the next time step. t+1 .
[0109] S533 divides the data into training and testing sets in chronological order: with each prediction start point Tstart as the boundary, data with t≤Tstart is used as the training set, and data with t>Tstart is used as the prediction set (for evaluation), thus completing the sliding window construction and dataset segmentation of fuel cell performance degradation characteristics.
[0110] S54, input the processed fuel cell degradation time series data into the target domain fuel cell lifetime prediction model to complete the fuel cell lifetime prediction feature engineering and input preparation. This step includes steps S541 to S543.
[0111] S541 converts the VRPLR sequence yobs from the training set into a model input tensor with shape (1,Lobs,1).
[0112] S542 synchronously extracts the recovery signal robs from the adaptive memory signal and uses it as the conditional input for the target domain fuel cell lifetime prediction model.
[0113] S543, Standardize the fuel cell lifetime prediction training sequence: Calculate the mean. and standard deviation The standardized sequence Input the model and complete the feature engineering and input preparation for fuel cell lifetime prediction.
[0114] S55, invoke the fuel cell lifetime prediction transfer learning module, and based on the source domain fuel cell lifetime prediction model, keep the low-level features unchanged while fine-tuning the mid-level features. This step includes steps S551 to S554, the specific contents of which are as follows: S551, Load the source domain pre-trained model.
[0115] S552, the multi-scale convolutional weights, Transformer encoder self-attention weights, and feedforward network weights of the source domain model are transferred to the corresponding layers in the target domain model, as shown in the formula. .
[0116] S553, Application Layer Freezing Strategy: Set the parameters of the bottom-level feature module (input embedding layer) of the target domain fuel cell lifetime prediction model to be untrainable, i.e. The underlying features remain unchanged.
[0117] S554 fine-tunes the mid-level feature modules (multi-scale attention, variability attention, multi-head attention, prediction head): using training set data, with mean squared error loss. Add L2 regularization terms A limited number of training rounds are conducted to update the mid-layer parameters, completing the source domain pre-trained model, layer freezing, and fine-tuning for target domain adaptation; among these steps... is the mean squared error loss value (scalar), which measures the average squared deviation between the model's predicted values and the actual values. N is the total number of samples (the number of samples involved in the loss calculation). i is the sample index (from 1 to N). This is the model prediction value (i.e., predicted voltage or VRPLR) for the i-th sample. This is the true value of the i-th sample (i.e., the actual voltage or VRPLR).
[0118] S56, the adaptive memory module is invoked. This module, through a forgetting mechanism combined with a multi-scale module, a variability module, and a multi-head attention module, ensures normal prediction through forgetting recovery voltage. The recovery mechanism, combined with feature fusion gating, aims to predict the rising fluctuations of VRPLR during degradation. This step includes steps S561 to S564, the specific contents of which are as follows: S561 invokes the adaptive memory module to generate a forgetting signal f based on the shutdown and restart times. t and recovery signal r t For each shutdown time t off , in [t off −2,t off Set f within the range of +2] t =1; for each restart time t on , in [t on -2, ton Set r within the range of +2] t =1.
[0119] S562, Forgetting Mechanism: In the variable attention module, the forgetting signal ft is used to suppress the influence of historical degradation information on the current prediction, ensuring that normal prediction is not disturbed by abnormal fluctuations.
[0120] S563, Recovery Mechanism: In the multi-head attention module, feature fusion gating and the recovery signal rt enhance the model's ability to capture voltage regeneration phenomena (VRPLR rising fluctuations). The formula is as follows: ,in This indicates element-wise multiplication. Let be the output feature vector after signal enhancement. x is the input feature vector (usually from the output of feature fusion gating). ReLU() is the rectified linear unit activation function, defined as ReLU(z) = max(0,z), which sets negative values to 0 and introduces nonlinearity. is the weight matrix of the first fully connected network, which maps the input feature x to the representation in the intermediate dimension. is the weight matrix of the second fully connected network, mapping intermediate features back to the same feature dimension as x. ⊙ is the Hadamard product (element-wise multiplication) operator. To recover the value of the signal at time t+1 (usually a scalar or a vector of the same shape as x, with a value range of [0,1], used to indicate the time position of voltage regeneration or restart events, and to enhance the characteristic expression of the relevant time steps).
[0121] S564 integrates a multi-scale module, a variability module, and a multi-head attention module, enabling the model to adaptively remember or forget degradation patterns at different stages, thus completing the integration of an adaptive memory module.
[0122] S57, Input the fuel cell degradation time series data into the multi-scale attention module to extract short-sequence features, medium-sequence features, and long-sequence features. Then, concatenate the fuel cell time-scale sequences to obtain the fuel cell multi-scale time series. This step includes steps S571 to S574, and the specific steps of steps S571 to S574 are as follows: S571, the standardized VRPLR sequence y is input into the multi-scale attention module, first mapped to d through the input embedding layer. model =128 dimensions: .
[0123] S572, add sine position encoding: ,in Calculated according to the standard Transformer formula.
[0124] S573 uses three multi-head attention branches of different scales in parallel, with window sizes {10, 30, 60}. Each branch first passes through a linear projection. Then perform self-attention: .
[0125] S574 concatenates the outputs of the three branches along the feature dimension: , Then, through layer normalization and Dropout, the multi-scale time series of the fuel cell is obtained.
[0126] S58, In the variable attention module, bilinear interpolation is used on the fuel cell lifetime degradation data to obtain the sampling features of the fuel cell lifetime degradation data; this step includes steps S581 to S584, wherein the specific steps of steps S581 to S584 are as follows: S581, multi-scale time series O concat The input variable attention module is first reduced to dmodel through a dimension adaptation layer: .
[0127] In S582, within the variable attention module, an offset prediction network (two layers of one-dimensional convolution) is used to compute the sampling offset Δp at each time location. t : ; Here, Δp_t represents the calculated relative offset (or normalized offset), whose value is restricted to the range [−1, 1]. tanh is the hyperbolic tangent activation function, which maps the input to the interval (−1, 1), and here it is used to constrain the offset value within [−1, 1]. Conv1D is a one-dimensional convolution operation that performs a sliding window convolution on the input features along the time dimension to extract local temporal features. ReLU is the rectified linear unit activation function, defined as ReLU(z) = max(0, z), which introduces nonlinearity and sets negative values to zero. The feature matrix input to the offset prediction network is typically a multi-scale time series (shape [B, L, dmodel]) after dimensionality adaptation. [-1, 1]: a closed interval representing the offset values with a lower bound of -1 and an upper bound of 1. After tanh activation, all output values are confined to this interval.
[0128] S583, Generate normalized reference coordinates Obtain the coordinates of the sampling points .
[0129] S584 uses bilinear interpolation to sample features from the input sequence: for the sampling coordinate p, the interpolation formula is: , Where q i The position is an integer. The sampled feature x def This refers to the sampling characteristics of fuel cell life degradation data.
[0130] S59, the sampling features of the attention-weighted fuel cell lifetime degradation data are fed into the multi-head attention module for parallel modeling of multiple subspaces, and then passed into the feature fusion gate for fusion; this step includes steps S591 to S594, the specific steps of steps S591 to S594 are as follows: S591, the sampled features xdef obtained in step S58 are sent to the multi-head attention module (3-layer Transformer encoder).
[0131] S592, in each attention head, compute the scaled dot product attention: Multi-subspace modeling is performed in parallel.
[0132] S593 concatenates the outputs of all heads and performs a linear transformation, then uses feature fusion gating: Where σ is the Sigmoid function, and... The output feature vector after feature fusion and gating is the result of element-wise multiplication of the input feature x with the gating weights. x is the input feature vector (usually from the output of the multi-head attention module or the features from the previous sub-step). ⊙ is the Hadamard product (element-wise multiplication) operator, which multiplies elements at corresponding positions. σ is the Sigmoid activation function, which maps the input to the (0,1) interval, and the output value is used as the gating weight. Linear(x) is a linear transformation of the input feature x, in the form Linear(x) = xW + b, where W is the weight matrix and b is the bias vector.
[0133] S594, enhanced by combining the recovery signal rt: The fused fuel cell lifetime prediction characteristics were obtained. This is the final output feature vector after signal enhancement and recovery, used for subsequent pooling and prediction. The output feature vector of the feature fusion gate (i.e., the result of the previous sub-step) serves as the main part of the residual connection. ReLU is the rectified linear unit activation function, defined as ReLU(z) = max(0,z), which introduces nonlinearity and suppresses negative values. W1 is the weight matrix (learnable parameters) of the first fully connected layer, mapping xgated to the intermediate feature space. W2 is the weight matrix (learnable parameters) of the second fully connected layer, mapping the intermediate features back to the same feature dimension as xgated. ⊙ is the Hadamard product (element-wise multiplication) operator. To recover the value of the signal at time t.
[0134] S510: The fuel cell lifetime prediction features are input into the pooling layer to complete time-step aggregation and feature dimensionality reduction. The fuel cell VRPLR prediction results are then de-standardized, and the final VRPLR prediction result is output, completing the fuel cell lifetime prediction. This step includes steps S5101 to S5104, the specific steps of which are as follows: S5101 will fuse the features Global average pooling along the time dimension: .
[0135] S5102, input the pooled feature z into the prediction head (two fully connected layers, intermediate layer dimension dmodel / 2, output dimension 1): .
[0136] S5103, Obtain the mean μ and standard deviation σ saved during the training (observation) phase, and perform inverse standardization on the standardized prediction results: .
[0137] S5104, outputs the final VRPLR prediction value. Complete fuel cell life prediction.
[0138] S6. Input the raw data for fuel cell life prediction into the trained target domain fuel cell life prediction model to obtain the prediction results.
[0139] Using the above methods, the Tongji University fuel cell dataset and the 2014 Data Challenge fuel cell dataset were used as degradation data for training and prediction testing. The prediction results of the source domain fuel cell life prediction model are as follows: Figure 6 and Figure 7 As shown, the migration prediction results of the target domain fuel cell lifetime prediction model at 100 hours, 200 hours, 300 hours, 400 hours, and 500 hours are respectively as follows: Figures 8 to 12 As shown.
[0140] Through the above steps, because the source domain pre-trained model of this method differs from the traditional prediction model trained from scratch, this method first trains the source domain (FC1 / FC2) with a large amount of degradation data to obtain low-level features (voltage change rate, local slope, second-order difference) and mid-level features (overall downward trend, degradation rate, inflection point location), and extracts multi-time-scale degradation patterns through Transformer embedding layers, multi-scale attention modules, and variable attention modules. Therefore, the source domain model can fully learn the general degradation patterns of fuel cells. Furthermore, the target domain transfer learning module of this method differs from traditional fine-tuning methods because this method employs a layer freezing strategy. By preserving the low-level features of the source domain and only fine-tuning the mid-level features in a few rounds, this method significantly reduces its dependence on small sample data in the target domain, avoiding overfitting or prediction failure due to insufficient data. This ensures accurate prediction of remaining lifetime even with limited observation data (e.g., 100–500 hours). Furthermore, the variable attention module differs from fixed-field attention mechanisms. Because this method dynamically calculates sampling point positions through an offset prediction network and uses bilinear interpolation to obtain sampling features, it can adaptively focus on key inflection points and local fluctuations during voltage drop, significantly improving the capture of complex phenomena such as voltage regeneration and shutdown restarts. The method has the ability to capture the transient fluctuations, periodic oscillations and long-term monotonic decay trends of fuel cell degradation simultaneously. Furthermore, the adaptive memory module of this method adjusts the feature fusion gating by jointly using forgotten and recovered signals. Since the forgotten mechanism suppresses the interference of historical abnormal fluctuations on the current prediction, and the recovered mechanism enhances the modeling of voltage regeneration rise fluctuations, the model can accurately track the non-monotonicity in the VRPLR sequence. This method avoids the pitfalls of traditional methods that misjudge regeneration phenomena as the end of life. Furthermore, the entire prediction process, from data preprocessing to denormalized output, is fully automated. By employing lightweight computations such as hourly resampling, Savitzky-Golay smoothing, and exponentially weighted moving averages, and by requiring only one forward propagation to output multi-step prediction results, the speed of fuel cell life prediction is greatly improved, enabling online monitoring and real-time remaining life assessment. In summary, this method significantly improves the accuracy, generalization ability, and computational speed of fuel cell life prediction, thereby enhancing both the lifespan and economic value of fuel cells.
[0141] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0142] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for predicting fuel cell lifetime migration, characterized in that, Includes the following steps: S1, Construct a source-domain fuel cell lifetime prediction model; S2, Use fuel cell degradation data to train the source domain fuel cell lifetime prediction model to obtain the trained source domain fuel cell lifetime prediction model. S3, extract the low-level and mid-level feature data of the source domain fuel cell lifetime prediction model after training; S4. Construct a target domain fuel cell lifetime prediction model based on the bottom-level feature data and the middle-level feature data; S5. Based on the original training data for fuel cell life prediction, train the target domain fuel cell life prediction model; during the training process, keep the bottom-level feature data unchanged and fine-tune the middle-level feature data; to obtain the trained target domain fuel cell life prediction model. S6. Input the raw data for fuel cell life prediction into the trained target domain fuel cell life prediction model to obtain the prediction results.
2. The fuel cell lifetime migration prediction method according to claim 1, characterized in that, The underlying feature data includes voltage change rate, local slope, and second-order difference; the intermediate feature data includes overall downward trend, degradation rate, and inflection point location.
3. The fuel cell lifetime migration prediction method according to claim 1, characterized in that, Step S2 includes the following steps: S21, acquire fuel cell degradation data and perform data preprocessing; S22. Based on the preprocessed data of the fuel cell, features are created and training and testing datasets are constructed according to the relevant working conditions and health indicators of the fuel cell life. The data is then standardized and a sliding window is constructed to obtain fuel cell sequence data. S23, perform multi-time-window slicing on fuel cell time series data to form a fuel cell time-scale series; S24, extract features from the time-scale sequence of the fuel cell and splice them together to obtain the multi-scale time series of the fuel cell. S25, input the multi-scale time series of fuel cell into the variable attention module in the source domain fuel cell lifetime prediction model, and calculate the offset of fuel cell lifetime degradation data. S26, In the variable attention module, bilinear interpolation is used on the fuel cell lifetime degradation data to obtain the sampling features of the fuel cell lifetime degradation data; S27, the sampling features of the attention-weighted fuel cell lifetime degradation data are sent to the multi-head attention module for multi-subspace parallel modeling; S28. After the sampling features of the fuel cell life degradation data enter the multi-head attention module, the features are spliced to obtain the fused fuel cell life prediction time series. S29, the fuel cell lifetime prediction time series is fed into the pooling layer for aggregation at the last time step, and the fuel cell lifetime standardized prediction voltage is output. S210 denormalizes the fuel cell lifetime standardized prediction voltage and outputs the fuel cell lifetime prediction voltage result and the fuel cell lifetime prediction source domain training model data.
4. The fuel cell lifetime migration prediction method according to claim 3, characterized in that, Step S21 includes the following specific steps: S211, Obtain the voltage time series of a sample fuel cell identical to the target fuel cell, and collect the corresponding operating condition data; S212, perform data cleaning on the raw voltage time series obtained in step S211 to remove outliers and invalid records; S213, a linear interpolation method is used to fill in missing values in the cleaned data. For the missing position t, adjacent known points Va and Vb are used according to the formula... Fill in the gaps to obtain the complete voltage time series; S214, use exponentially weighted moving average to filter and denoise the filled voltage time series, according to the formula. Calculation, where High-frequency noise components are removed, while the main trend of voltage degradation is retained, to obtain the pre-processed raw data for fuel cell lifetime prediction. S215, input the preprocessed data into the source domain fuel cell lifetime prediction model.
5. The fuel cell lifetime migration prediction method according to claim 3, characterized in that, Step S22 includes the following steps: S221, Based on the preprocessed data from the fuel cell, create features in the Transformer embedding layer, including the original voltage Vt and the rate of voltage change. and voltage smoothing sequence ; S222, based on fuel cell life-related operating conditions and health indicators, divides the complete dataset into training sets according to a certain proportion. and test set The training set is used for model training, and the test set is used for model evaluation and selection of the optimal model. S223, Calculate the mean of each feature column in the training set. and standard deviation The training and test sets are standardized separately. The standardization formula is as follows: ,in Prevent division by zero and ensure the model runs under a uniform data distribution; S224, construct a sliding window for predicting fuel cell lifetime voltage, set the input sequence length L and the sliding step size stride, and convert the standardized data into input-output pairs in a supervised learning format: for the j-th sample, the input is... Output ,in, h is the prediction step size, and the fuel cell life prediction dataset is constructed.
6. The fuel cell lifetime migration prediction method according to claim 3, characterized in that, Step S23 includes the following steps: S231, The fuel cell time series data constructed in step S22 is used as input and passed into the multi-scale attention module; S232, in the multi-scale attention module, sets up three convolutional kernels with different kernel sizes. The convolutional layers correspond to short, medium, and long time windows, respectively, to capture degradation features at different time scales; S233, input data The inputs are fed into three convolutional layers in parallel. Each convolutional layer first transposes the input to (B, d, L), and then processes it according to the formula. Perform convolution operations to extract feature representations at the corresponding time scales, where B is the batch size, L is the sequence length, and d is the feature dimension. S234, features extracted from short, medium, and long time windows. By splicing the data along the channel dimension, a fuel cell timescale sequence integrating information from multiple time scales is formed. .
7. The fuel cell lifetime migration prediction method according to claim 3, characterized in that, Step S24 includes the following steps: S241, input the fuel cell timescale sequence C obtained in step S23 into the subsequent processing part of the multi-scale attention module; S242, Apply the ReLU activation function to the concatenated features. This enhances the nonlinear expressive power of features; S243, through a linear projection layer The activated high-dimensional features are mapped back to the original feature dimensions, where , representing a linear transformation Achieve dimensionality reduction and fusion of features; S244, Apply Dropout operation to the output of the linear projection layer. To prevent overfitting, the multi-scale time series of the fuel cell was finally obtained. This sequence contains multi-level information ranging from instantaneous fluctuations to long-term degradation trends.
8. The fuel cell lifetime migration prediction method according to claim 1, characterized in that, Step S5 includes the following steps: S51, acquire the raw data for fuel cell life prediction and preprocess it to obtain fuel cell life prediction degradation data; S52, based on fuel cell life prediction degradation data and VRPLR calculated based on polarization curves, extract fuel cell performance degradation characteristics; S53, construct a sliding window for fuel cell performance degradation characteristics, and divide the fuel cell degradation time series data into a training set and a test dataset for model adaptation; S54. Input the processed fuel cell degradation time series data into the model to complete the fuel cell lifetime prediction feature engineering and input preparation. S55, call the fuel cell life prediction transfer learning module, based on the source domain pre-trained model source domain fuel cell life prediction model, keep the bottom layer features unchanged, and fine-tune the middle layer features. S56, call the adaptive memory module, which uses a forgetting mechanism in conjunction with the multi-scale module, the variability module and the multi-head attention module to ensure normal prediction through forgetting recovery voltage, and uses a recovery mechanism in conjunction with feature fusion gating to achieve the purpose of predicting the rising fluctuations of VRPLR during the degradation process; S57. Input the fuel cell degradation time series data into the multi-scale attention module to extract short sequence features, medium sequence features and long sequence features. Then, the fuel cell time scale series are spliced together to obtain the fuel cell multi-scale time series. S58, in the variable attention module, bilinear interpolation is used on the fuel cell lifetime degradation data to obtain the sampling features of the fuel cell lifetime degradation data; S59, the sampling features of the attention-weighted fuel cell life degradation data are sent to the multi-head attention module for parallel modeling of multiple subspaces, and then fed into the feature fusion gate for fusion. S510 inputs the fuel cell lifetime prediction features into the pooling layer, performs time step aggregation and feature dimensionality reduction, and denormalizes the fuel cell VRPLR prediction results to output the final VRPLR prediction results, thus completing the fuel cell lifetime prediction.
9. The fuel cell lifetime migration prediction method according to claim 1, characterized in that, Step S55 includes: S551, Load the source domain fuel cell lifetime prediction model; S552, the multi-scale convolutional weights, Transformer encoder self-attention weights, and feedforward network weights of the source domain fuel cell lifetime prediction model are transferred to the corresponding layers in the target domain model, as shown in the formula. ; S553, Application Layer Freeze Strategy: Sets the parameters of the low-level feature modules of the target domain model to be untrainable. To keep the underlying features unchanged; S554, fine-tuning the mid-level feature module: using training set data, with mean squared error loss. ; Add L2 regularization terms A limited number of training rounds are conducted to update the mid-level parameters and complete the adaptation of the source domain fuel cell lifetime prediction model and the target domain fuel cell lifetime prediction model.
10. The fuel cell lifetime migration prediction method according to claim 9, characterized in that, Step S56 includes the following steps: S561 invokes the adaptive memory module to generate a forgetting signal based on the shutdown and restart times. and recovery signal For each downtime ,exist Set within range For each restart moment ,exist Set within range ; S562, Forgetting Mechanism: In the variable attention module, the forgetting signal ft is used to suppress the influence of historical degradation information on the current prediction, ensuring that normal prediction is not disturbed by abnormal fluctuations; S563, Recovery Mechanism: In the multi-head attention module, the model's ability to capture voltage regeneration phenomena is enhanced through feature fusion gating and the recovery signal rt. The formula is as follows: , in This indicates element-wise multiplication. S564 integrates a multi-scale module, a variability module, and a multi-head attention module, enabling the model to adaptively remember or forget degradation patterns at different stages, thus completing the integration of an adaptive memory module.