Continuous learning guided soft-sensing method and system for hydrogen production of hydrogen production process of electrolytic cell

By combining a dual-layer LSTM network and a multi-head self-attention mechanism with a residual network, the time lag and catastrophic forgetting problems in hydrogen production detection during electrolyzer hydrogen production are solved, achieving efficient and stable prediction of multiple variables in the electrolyzer.

CN122241159APending Publication Date: 2026-06-19QINGDAO UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
QINGDAO UNIV OF TECH
Filing Date
2026-05-20
Publication Date
2026-06-19

Smart Images

  • Figure CN122241159A_ABST
    Figure CN122241159A_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of soft sensing and discloses a method and system for soft sensing hydrogen production in an electrolyzer hydrogen production process guided by continuous learning. The method includes: acquiring historical multivariate time series data of the electrolyzer hydrogen production process and corresponding hydrogen production data, and constructing an initial training set; constructing an initial soft sensing model, including a time-series encoding layer, a multi-head self-attention layer, a residual network layer, and an output layer connected in sequence; training the initial soft sensing model using the initial training set to obtain a soft sensing model; acquiring new stage data of the electrolyzer hydrogen production process, and updating the model parameters of the soft sensing model online based on a continuous learning mechanism to obtain an updated soft sensing model, which is then used for hydrogen production prediction in the next stage. This disclosure effectively solves the problems of uniform processing of traditional LSTM time-series feature encoding and catastrophic forgetting during continuous learning, significantly improving the model's response speed to changes in operating conditions during electrolyzer hydrogen production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure pertains to the field of soft measurement, and specifically relates to a soft measurement method and system for hydrogen production in an electrolyzer hydrogen production process guided by continuous learning. Background Technology

[0002] Hydrogen production through water electrolysis is a major source of green hydrogen energy, and the real-time hydrogen production of its core equipment, the electrolyzer, is a key indicator for evaluating its efficiency. However, in actual industrial processes, hydrogen production exhibits complex characteristics such as strong nonlinearity, time dependence, and distribution drift due to the influence of multiple variables such as temperature, pressure, and flow rate. This results in significant lag in traditional detection methods, making it difficult to reflect changes in operating conditions in a timely manner.

[0003] To overcome the time-delay limitations of physical measurements, data-driven soft measurement modeling has become a research hotspot. This method achieves rapid and accurate prediction of production output by establishing a mapping model between easily measurable process variables and difficult-to-measure hydrogen production. From traditional machine learning to deep learning, time-series modeling methods have continuously evolved: Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), and Transformer neural networks have achieved significant results in industrial soft measurement due to their advantages in handling time-series dependencies. Research shows that LSTM variants incorporating attention mechanisms or bidirectional structures outperform traditional static models in the prediction accuracy of complex industrial processes such as butanizer towers, power plant denitrification, and hydrocracking, fully demonstrating the potential of time-series neural networks in dynamic industrial measurements.

[0004] The existing technology has the following drawbacks: The extraction of time-series features is coarse and the capture of key dynamic information is insufficient: Existing methods (such as standard LSTM and GRU) adopt a mechanism of uniformly processing all time steps, lacking the ability to adaptively weight key time steps, and it is difficult to focus on the key moment information that characterizes the sudden change in operating conditions; at the same time, they fail to effectively establish long-range dependencies across time steps, resulting in the model's insufficient ability to capture complex characteristics such as dynamic lag and concept drift in the operation of the electrolyzer, and it is unable to accurately perceive the nonlinear dynamic relationship between hydrogen production and variables such as temperature, pressure, and flow rate.

[0005] The continuous learning process suffers from catastrophic forgetting and poor model stability: Most existing dynamic soft measurement solutions adopt a global retraining strategy, which requires retraining all historical samples whenever new data arrives, resulting in high computational resource consumption and long iteration cycles; moreover, deep neural networks are prone to overwriting old knowledge when learning new tasks, causing catastrophic forgetting, which leads to the model losing historical working condition knowledge while adapting to new data distribution, making it difficult to achieve online rapid adaptation and long-term stability of the model in resource-constrained industrial sites.

[0006] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0007] To address or at least alleviate one or more of the above problems, a method and system for soft measurement of hydrogen production in an electrolyzer hydrogen production process guided by continuous learning is provided. This method utilizes a two-layer LSTM to extract spatiotemporal features from multivariate time-series data from the electrolyzer. Multi-head self-attention (MHSA) is employed to compute dynamically weighted key time steps and strengthen long-term temporal dependencies. A residual network is then used to mitigate gradient degradation and enhance feature reuse. When new data arrives, a parameter weighting fusion strategy driven by mean and variance differences adaptively adjusts the decay factor to fuse the parameters of the old and new models. This allows for rapid adaptation to data distribution shifts while preserving historical knowledge, using only a small batch of new data.

[0008] To achieve the above objectives, in accordance with the first aspect of this disclosure, a soft measurement method for hydrogen production in a continuously learning-guided electrolyzer hydrogen production process is provided, comprising the following steps: Acquire historical multivariate time series data of hydrogen production process in electrolyzer and corresponding hydrogen production data to construct an initial training set; An initial soft measurement model is constructed, comprising a temporal coding layer, a multi-head self-attention layer, a residual network layer, and an output layer connected in sequence. The temporal coding layer performs preliminary temporal feature extraction on the input multivariate time series to obtain a hidden state sequence. The multi-head self-attention layer maps the hidden state sequence to multiple subspaces for parallel attention computation, dynamically weighting key time steps to strengthen long-range temporal dependencies. The residual network layer further transforms the weighted features and mitigates gradient degradation. The output layer predicts the hydrogen production at the current moment based on the output of the residual network layer. The initial soft measurement model is trained using the initial training set to obtain a multi-head self-attention-residual-long short-term memory network soft measurement model; New stage data of the hydrogen production process in the electrolyzer are obtained, and the model parameters of the multi-head self-attention-residual-long short-term memory network soft measurement model are updated online based on the continuous learning mechanism to obtain the updated multi-head self-attention-residual-long short-term memory network soft measurement model, which is then used for hydrogen production prediction in the next stage. The continuous learning mechanism includes: calculating the distribution difference between the new stage data and the historical stage data; dynamically adjusting the decay factor based on the distribution difference; and weightedly fusing the old model parameters and the new model parameters based on the decay factor to obtain the updated model parameters.

[0009] To achieve the above objectives, according to a second aspect of this disclosure, a soft measurement system for hydrogen production in a continuously learning-guided electrolyzer hydrogen production process is provided, the soft measurement system comprising: The acquisition module is used to acquire historical multivariate time series data of the hydrogen production process in the electrolyzer and the corresponding hydrogen production data to build an initial training set. The model building module is used to construct an initial soft sensor model, which includes a temporal coding layer, a multi-head self-attention layer, a residual network layer, and an output layer connected in sequence. The temporal coding layer performs preliminary temporal feature extraction on the input multivariate time series to obtain a hidden state sequence. The multi-head self-attention layer maps the hidden state sequence to multiple subspaces for parallel attention computation, dynamically weighting key time steps to strengthen long-range temporal dependencies. The residual network layer further transforms the weighted features and alleviates gradient degradation. The output layer predicts the hydrogen production at the current moment based on the output of the residual network layer. The model training module is used to train the initial soft measurement model using the initial training set to obtain a multi-head self-attention-residual-long short-term memory network soft measurement model. The model update and prediction module is used to acquire new stage data of the hydrogen production process in the electrolyzer. Based on the continuous learning mechanism, the model parameters of the multi-head self-attention-residual-long short-term memory network soft measurement model are updated online to obtain the updated multi-head self-attention-residual-long short-term memory network soft measurement model, which is then used to predict the hydrogen production in the next stage. The continuous learning mechanism includes: calculating the distribution difference between the new stage data and the historical stage data; dynamically adjusting the decay factor based on the distribution difference; and weightedly fusing the old model parameters and the new model parameters based on the decay factor to obtain the updated model parameters.

[0010] To achieve the above objectives, according to a third aspect of this disclosure, a computer-readable storage medium is provided storing a computer program, which, when executed by a processor, is used to implement the continuously learning-guided soft measurement method for hydrogen production in an electrolyzer hydrogen production process as described above.

[0011] By adopting the above technical solution, this disclosure has the following beneficial effects compared with the prior art: This disclosure proposes an adaptive parameter fusion strategy driven by data distribution differences. By dynamically adjusting the decay factor through the calculation of the mean and variance differences between new and old data, weighted fusion updates of model parameters can be achieved using only a small batch of new data. This mechanism rapidly adapts to data distribution drift while preserving historical knowledge, solving the problems of high computational cost and severe catastrophic forgetting in existing global retraining schemes. It provides a low-cost, highly stable online update paradigm for real-time soft measurement in electrolyzer hydrogen production processes.

[0012] This disclosure presents a multi-head self-attention-residual-long short-term memory network model that integrates a two-layer LSTM temporal encoder, multi-head self-attention, and residual networks. The hidden state sequence extracted by LSTM is mapped to multiple subspaces for parallel attention computation. Key time steps are dynamically weighted to strengthen long-range temporal dependencies, and residual connections are used to mitigate gradient degradation and enhance feature reuse. This design solves the dynamic response lag problem caused by the uniform processing of time steps in traditional LSTM, improving the model's ability to capture nonlinear dynamic relationships among multiple variables such as electrolyzer temperature, pressure, and flow rate.

[0013] The specific embodiments of this disclosure will now be described in further detail with reference to the accompanying drawings. Attached Figure Description

[0014] The accompanying drawings, as part of this disclosure, are provided to further illustrate the present disclosure. The illustrative embodiments and descriptions of the present disclosure are used to explain the present disclosure, but do not constitute an undue limitation thereof. Clearly, the drawings described below are merely some embodiments, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.

[0015] In the attached diagram: Figure 1 This is a flowchart illustrating the soft measurement method for hydrogen production in the electrolyzer hydrogen production process guided by continuous learning in this specific embodiment. Figure 2 This is a schematic diagram of the LSTM unit in this specific embodiment; Figure 3 This is a schematic diagram of the multi-head self-attention mechanism in this specific embodiment; Figure 4 This is a schematic diagram of feature extraction using a multi-head self-attention-residual-long short-term memory network in this specific embodiment; Figure 5 The image shows the prediction results of the electrolytic cell experiment using the LSTM method in this specific embodiment, where (a) is the data for the entire stage and (b) is the test set details; Figure 6The image shows the prediction results of the electrolytic cell experiment using the multi-head self-attention + long short-term memory network method in this specific embodiment, where (a) is the data for the entire stage and (b) is the test set details; Figure 7 The image shows the prediction results of the electrolytic cell experiment using the multi-head self-attention + residual + long short-term memory network method in this specific embodiment, where (a) is the data for the entire stage and (b) is the test set details; Figure 8 The image shows the prediction results of the electrolytic cell experiment using the multi-head self-attention + long short-term memory network + continuous learning mechanism method in this specific embodiment. (a) is the data of the whole stage, and (b) is the test set details. Figure 9 The image shows the prediction results of the electrolytic cell experiment using the multi-head self-attention-residual-long short-term memory network + continuous learning mechanism method in this specific embodiment, where (a) is the data of the whole stage and (b) is the test set details; Figure 10 This is a schematic diagram of the soft measurement system for hydrogen production in the electrolyzer hydrogen production process guided by continuous learning in this specific embodiment. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions in the embodiments will be clearly and completely described below with reference to the accompanying drawings. The following embodiments are used to illustrate this disclosure, but are not intended to limit the scope of this disclosure.

[0017] Please see Figure 1 This disclosure provides a soft measurement method for hydrogen production in an electrolyzer hydrogen production process guided by continuous learning, comprising the following steps: Acquire historical multivariate time series data of hydrogen production process in electrolyzer and corresponding hydrogen production data to construct an initial training set; An initial soft sensor model is constructed, comprising a temporal coding layer, a multi-head self-attention layer, a residual network layer, and an output layer connected in sequence. The temporal coding layer extracts preliminary temporal features from the input multivariate time series to obtain the hidden state sequence. The multi-head self-attention layer maps the hidden state sequence to multiple subspaces for parallel attention computation, dynamically weighting key time steps to strengthen long-range temporal dependencies. The residual network layer further transforms the weighted features and mitigates gradient degradation. The output layer predicts the hydrogen production at the current moment based on the output of the residual network layer. The initial soft measurement model was trained using the initial training set to obtain a multi-head self-attention-residual-long short-term memory network soft measurement model. New stage data of hydrogen production process in electrolyzer are obtained, and the model parameters of multi-head self-attention-residual-long short-term memory network soft measurement model are updated online based on continuous learning mechanism to obtain updated multi-head self-attention-residual-long short-term memory network soft measurement model, which is then used for hydrogen production prediction in the next stage. The continuous learning mechanism includes: calculating the distribution difference between the new stage data and the historical stage data; dynamically adjusting the decay factor based on the distribution difference; and weightedly fusing the old model parameters and the new model parameters based on the decay factor to obtain the updated model parameters.

[0018] In one feasible implementation, the multivariate time series data includes temperature, pressure, and flow rate measured in real time from an industrial electrolyzer.

[0019] Specifically, step 1 involves collecting data on the hydrogen production process in the electrolyzer and the corresponding hydrogen production to obtain a modeling training set: To establish a soft measurement model, using This represents a multivariate time series (temperature, pressure, flow rate, etc.) measured in real time in an industrial electrolyzer, where N is the length of the time series (total number of time steps). Indicates the first D-dimensional process variables at a given time point. Take 1, 2, ..., T; use This represents the hydrogen production measurements (offline detection reference data) corresponding to the above time series, where, These represent the actual hydrogen production values ​​at times 1, 2, ..., T, respectively.

[0020] As a specific implementation method, the temporal coding layer uses a multi-layer long short-term memory network (LSTM) to perform preliminary temporal feature extraction on the input multivariate time series.

[0021] Step 2: In this embodiment, a multi-layer LSTM is used to perform preliminary temporal feature extraction on the collected multivariate sequences.

[0022] Specifically, the input sequence First, the hidden state is obtained by unidirectional stepwise encoding through multiple layers of LSTM. ,here Indicates the number of time steps (window length). It is the hidden layer dimension of LSTM. The LSTM unit uses input gate, forget gate and output gate to filter and select information during the information transmission process. When processing time series data, it captures the temporal correlation in the sequence.

[0023] LSTM cell structure as follows Figure 2 As shown, Figure 2 The direction of the middle arrow indicates the data flow direction, the current input. Compared to the previous hidden state The input is fed in parallel to three gating units (forget gate, input gate, and output gate) and a candidate state generation unit. The output from the forget gate... Cell state at the previous moment Perform element-wise multiplication, input gate output With candidate state Perform element-wise multiplication and add the two values ​​together to obtain the current cell state. . After activation by tanh, it is connected to the output gate. Element-wise multiplication yields the current hidden state. .in, and They are respectively transmitted to the next time step as cellular state and latent state. , It is also used as the output of the current layer. Forget Gate Input gate Candidate status Output gate Storage status Output status The calculation is shown in equations (1) to (6): (1); (2); (3); (4); (5); (6); in: This represents the Sigmoid activation function; , , , These are the weight matrices for the forget gate, input gate, candidate state, and output gate, respectively. , , , For the corresponding bias vector, It is the element-wise Hadamard product.

[0024] In one feasible implementation, the multi-head self-attention layer is used to map the hidden state sequence to multiple subspaces for parallel attention computation, and the dynamic weighting of key time steps includes: LSTM output hidden state Mapped to the query matrix Key matrix Sum matrix These are used to represent the query conditions for attention, the pairing relationship, and the information conveyed, respectively. The dynamic weighting of the time dimension is achieved through a multi-head self-attention mechanism: Each individual scaled dot product attention will query the matrix. AND key matrix Perform matrix dot product calculations, and input the results into a Softmax layer for normalization to obtain the attention distribution. Then, compare the attention distribution with the value matrix. Weighted summation yields the single-head attention result; Multi-Head Self-Attention (MHSA) simultaneously computes each independent attention head and... The calculation results of each attention head are concatenated and then passed through a linear layer. The concatenated result is weighted to obtain the original hidden state sequence of the LSTM coding layer. Same-dimensional total attention results .

[0025] Step 3: In this embodiment, a multi-head self-attention mechanism is used to dynamically weight key time steps.

[0026] Specifically, the hidden state of the LSTM output Mapped to query key Sum The matrices are used to represent the attention query conditions, pairing relationships, and transmitted information, as shown in formulas (7), (8), and (9): (7); (8); (9); in, for The calculation results of the LSTM layer at time 1. , They are respectively The projection matrix.

[0027] Context vectors are generated through a multi-head self-attention (MHSA) mechanism. This achieves dynamic weighting over the time dimension. The multi-head self-attention mechanism is an improvement upon the self-attention mechanism, with the following structure: Figure 3As shown, this method utilizes multiple sets of independent attention weights to simultaneously capture the dependencies of sequences at different scales, thereby enhancing the model's expressiveness and generalization ability. This embodiment employs multi-head self-attention to adaptively weight the hidden state sequences of the LSTM, mitigating the attenuation of temporal dependency information caused by long sequence propagation, thus enhancing the model's ability to perceive multi-scale information.

[0028] like Figure 3 As shown, each independent Scaled Dot-Product Attention will query the matrix. AND key matrix Perform matrix dot product calculations, and input the results into a Softmax layer for normalization to obtain the attention distribution. Then, compare the attention distribution with the value matrix. Weighted summation yields the single-head attention result. The calculation for a single head is shown in equation (10): (10); in, , representing the dimension of each attention head. This represents the total hidden layer dimension. It is the number of heads of attention. All by It is obtained through a learnable linear mapping. This represents the scaled dot product attention function.

[0029] Multi-head self-attention simultaneously computes for each independent attention head and... The calculation results of each attention head are concatenated and then passed through a linear layer. The splicing results are weighted to obtain the result. Same-dimensional total attention results The calculation is as follows: (11); (12); in, , , They represent the first A person's attention The weight matrix, Indicates the first The calculation results of each attention head, The output weight matrix for multi-head self-attention. This indicates a vector concatenation operation (concatenating the outputs of multiple attention heads along the channel dimension).

[0030] As a specific implementation, the residual network layer is used to further transform the weighted features, including: The output features of the multi-head self-attention layer, i.e., the total attention result Z, are added element-wise to the original hidden state sequence H of the LSTM coding layer to form the initial input of the residual network. To integrate attention-enhanced features with basic temporal features; Initial input The feature transformation is performed layer by layer through L residual blocks. The processing of each residual block includes: processing the input features... Layer normalization is performed to stabilize the data distribution through a feedforward subnetwork. Nonlinear feature expansion and compression are performed, combining the output of the feedforward subnetwork with the input features of the residual block. By adding elements one by one, the output features of this layer are obtained. .

[0031] Step 4: Introduce a residual network to alleviate gradient degradation and further transform features: To mitigate gradient degradation and enhance feature reuse, a residual network is introduced, with the following structure: Figure 4 As shown.

[0032] Specifically, the initial input The feature transformation is performed layer by layer through L residual blocks. The processing of each residual block includes: processing the input features... Layer normalization is performed to stabilize the data distribution through a feedforward subnetwork. Nonlinear feature expansion and compression are performed, combining the output of the feedforward subnetwork with the input of the residual block. By adding elements one by one, the output features of this layer are obtained. , is represented as: (13); (14); in, It is the number of stacked layers of residual blocks. It is a regularization layer. These are the hidden states of the residual network. It is the first A feedforward subnetwork.

[0033] As a specific real-time method, the output layer is used to predict the current hydrogen production based on the output of the residual network layer, including: From the output of the last layer of the residual network Extract the feature vector of the last time step eigenvectors It aggregates historical time-series information within the entire time window; The last time step vector output by the last layer of the residual network. Linear projection is performed using a fully connected layer to map the predicted hydrogen production value. This yields the predicted hydrogen production for the current moment.

[0034] Step 5: Establish the initial soft measurement model of the multi-head self-attention-residual-long short-term memory network: To capture long-range temporal dependencies and key time-step contributions in continuous learning scenarios, a multi-head self-attention-residual-long short-term memory network approach is proposed, the structure of which is shown below. Figure 4 .

[0035] Specifically, from the output of the last layer of the residual network Extract the feature vector of the last time step eigenvectors It aggregates historical time-series information within the entire time window; The last time step vector output by the last layer of the residual network. Linear projection is performed using a fully connected layer to map the predicted hydrogen production value. The predicted hydrogen production at the current moment is obtained and expressed as: (15); (16); in, It is the last time step vector output by the last layer of the residual network. It is the weight matrix of the output layer. It is the scalar bias of the output layer. This is a predicted value for hydrogen production.

[0036] The loss function, as the objective function for model optimization, directly quantifies the deviation between predicted and true values. During training, when the loss function shows a stable decreasing trend and the validation set performance metrics converge, it indicates that the model possesses good learning dynamics and generalization ability, and the training process can be deemed effective. Its formula is as follows: (17); Where N is the number of training samples, and i is the sample index. This is the actual hydrogen production value of the i-th sample. It is the predicted hydrogen production value for the i-th sample.

[0037] A multi-head self-attention mechanism is introduced after LSTM encoding to map the hidden state sequence to multiple subspaces and compute attention weights in parallel, thereby highlighting the historical information that contributes most to the current prediction. Furthermore, a residual network is introduced to alleviate gradient degradation and enhance feature reuse. This method retains the temporal memory advantage of LSTM while possessing the global perception capability of multi-head self-attention. The residual block performs further feature transformation on the attention output, extracting useful details and mitigating gradient degradation while preserving the original temporal features, thus improving the model's stability and prediction accuracy during continuous learning.

[0038] As a specific implementation method, the distribution difference between the new stage data and the historical stage data is calculated; based on the distribution difference, the attenuation factor is dynamically adjusted; based on the attenuation factor, the old model parameters and the new model parameters are weighted and fused to obtain the updated model parameters, including: The industrial process dataset is divided into two phases: the first phase is the initial training phase, and the second phase is the online update phase. From the second stage onwards, when new stage data arrives, the old model parameters obtained from the previous stage training are saved; Calculate the statistical distribution characteristics of the data in the new phase and the historical phase separately. The statistical distribution characteristics include the mean. and variance ; Compare the mean difference between new data and historical data and variance differences Size; If the mean difference And variance differences If the difference between the new data and historical data is small, increase the decay factor. To preserve more historical information; If the mean difference or variance difference If the new data differs significantly from historical data, the decay factor should be reduced. To adapt to new data more quickly; among them, , For the preset threshold, ; In the old model parameters Based on this, the MHA-Res-LSTM soft sensor model is trained using data from the new phase to obtain new model parameters. ; According to the attenuation factor For the parameters of the old model and new model parameters The updated model parameters are obtained by weighted fusion. ; Updated model parameters As parameters of the current soft measurement model, they will be used for hydrogen production prediction in the next stage. By traversing all data stages, we obtain the optimal multi-head self-attention-residual-long short-term memory network soft measurement model that adapts to the distribution of all data.

[0039] Step 6: Real-time update of model parameters based on continuous learning and parameter weighted fusion mechanism: Building upon multi-head self-attention-residual-long short-term memory networks, this embodiment further designs a continuous learning and parameter-weighted fusion mechanism. This enables the model to learn new knowledge while effectively suppressing catastrophic forgetting of historical knowledge. The principle is as follows: Figure 1 As shown.

[0040] Specifically, the industrial process dataset (multivariate time-series data of hydrogen production from electrolyzers, including three types of process variables: temperature, pressure, and flow rate; where temperature includes hydrogen tank temperature, alkali solution temperature, and oxygen tank temperature; pressure includes system pressure; and flow rate includes alkali solution flow rate; as well as offline detection reference data of hydrogen production corresponding to the multivariate time series) is first divided into stages. An initial multi-head self-attention-residual-long short-term memory network model is trained using the first-stage samples. From the second stage onwards, whenever new stage data arrives, the multi-head self-attention-residual-long short-term memory network model from the previous stage is first saved, and then the distribution differences between the new data and historical data are compared. The means of the new data and historical data are calculated separately. and variance See formulas (18) and (19).

[0041] (18); (19); in, It is the number of samples in the k-th stage. Indicates the first One sample; Then compare the mean difference between the new data and the historical data. and variance differences The size of is given in formulas (20) and (21): (20); (twenty one); in, It is the difference in means. It is variance difference. It is the number of features in the input data. It is an index of the feature dimension. Indicates the first in the new data The mean of the dimension, Indicates the first in the old data The mean of the dimension; It is the first in the new data The variance of the dimension, It is the first in the old data The variance of the dimension.

[0042] If the mean difference And variance differences This indicates that the new data differs little from the historical data, and the attenuation factor should be increased in this case. To preserve more historical information ); if the mean difference or variance difference If the new data differs significantly from historical data, the decay factor should be reduced. To adapt to new data more quickly; among them, , For the preset threshold, Attenuation factor Dynamic adjustment is the core of the continuous learning mechanism. By comparing the differences in mean and variance between new and old data, the decay factor is adaptively updated. This allows for dynamic control of the model's focus on both new and old data. When the difference between the new and old data is small, As the data increases, the model becomes more reliant on historical knowledge. When the difference between new and old data is significant... The model becomes more reliant on new data as the number of data points decreases. This dynamic adjustment strategy not only effectively mitigates catastrophic forgetting but also ensures the model's rapid adaptation to new data distributions (experimental results show that...). The dynamic changes at different stages have a significant impact on model performance, and specific experimental verification will be demonstrated later.

[0043] Then, the new data is trained and the multi-head self-attention-residual-long short-term memory network model is updated based on the old model. Next, the parameters of the old and new models are fused according to formula (22): (twenty two); in, These are the parameters of the fused model. These are the parameters of the old model. These are the new model parameters; Updated model parameters The parameters of the soft sensor model at the current stage are used for hydrogen production prediction in the next stage; the optimal multi-head self-attention-residual-long short-term memory network soft sensor model that adapts to the distribution of all data is obtained by traversing all data stages.

[0044] Comparative experiment: To verify the validity of this disclosure, this experiment utilized a 20 Nm³ / h alkaline electrolyzer platform, collecting 74,025 valid samples. Each sample included multivariate time-series data such as temperature, pressure, and flow rate, along with corresponding offline hydrogen production values. The dataset was divided as follows: the first 70% was used as the training set for continuous training (divided into 10 stages in chronological order), the middle 10% was used as the validation set, and the last 20% was used to test model performance. The experimental environment was configured as follows: Development was completed on a local computer running Windows 10 (64-bit), with an AMD Ryzen 5 4500U processor (integrated Radeon graphics, 2.38GHz), 16GB of RAM, and PyCharm Professional Edition development environment (version 2023.1.4). Model training and inference were both executed remotely via PyCharm to a Linux server running Ubuntu 20.04.6 LTS (IP address: 10.35.133.10). An SSH connection was established using MobaXterm (version 25.1.7) to deploy computational tasks. The key hyperparameter settings that have the greatest impact on model performance are shown in Table 2.

[0045] Table 1 illustrates the algorithm of the continuous learning and parameter weighting fusion mechanism. To evaluate the predictive performance of the continuous learning-guided multi-head self-attention-residual-long short-term memory network soft measurement method on the hydrogen production of electrolyzers, the root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²) are used. 2 The evaluation index (coefficient of determination) is calculated using the following formulas: (twenty three); (twenty four); (25); in, For the first One predicted value, For the first A true value, for The mean, This represents the number of test samples.

[0046] Table 3 shows the prediction results of the hydrogen production process data from the electrolyzer using five methods. It can be seen that the prediction accuracy of the multi-head self-attention-residual-long short-term memory network + continuous learning mechanism method is much higher than that of the traditional LSTM method alone, and the prediction errors of the training set and the test set are close. During the experiment, data was recorded at least once every 5 minutes. The training time of the method in this embodiment was 4.8363s, and the prediction time was 0.1876s, both much smaller than the 5-minute data acquisition interval. Therefore, prediction and model updates can be completed before the next data acquisition, meeting the requirements of real-time online applications. This verifies the effectiveness of the multi-head self-attention-residual-long short-term memory network + continuous learning mechanism soft measurement model in the task of predicting hydrogen production from the electrolyzer. Figure 5 , Figure 6 , Figure 7 , Figure 8 , Figure 9 The results of five methods for predicting the electrolytic cell experiment are shown in the figure. Figures 5 to 9 The blue line (test set) represents the true value, and the yellow line represents the predicted value on the test set. It can be seen that the predicted value of the multi-head self-attention-residual-long short-term memory network + continuous learning mechanism method is very close to the true value, further proving the effectiveness of the multi-head self-attention-residual-long short-term memory network + continuous learning mechanism method in this embodiment.

[0047] In summary, the multi-head self-attention-residual-long short-term memory network + continuous learning mechanism model proposed in this embodiment exhibits good real-time stability and accuracy during continuous learning. Table 3 compares the prediction results of the five methods in the electrolyzer hydrogen production experiment. As shown in Table 3, compared with the traditional LSTM model, R² increased from 0.7483 to 0.9547, indicating a significant improvement in prediction accuracy. This effectively solves the problems of prediction lag and catastrophic forgetting in dynamic industrial processes. Furthermore, the introduction of the continuous learning mechanism enables the model to quickly adjust its parameters when facing new data distributions, maintaining a gradual improvement in prediction accuracy. The dynamic adjustment of values ​​after each stage of data training reflects the model's adaptive adjustment capability to changes in data distribution. This further confirms that the prediction accuracy of the multi-head self-attention-residual-long short-term memory network + continuous learning mechanism method is significantly better than that of the traditional cumulative training method.

[0048] Table 1: Algorithm illustration of continuous learning and parameter weighted fusion mechanism .

[0049] Table 2: Explanation of Key Hyperparameters of the Model .

[0050] Table 3: Comparison of prediction results of five methods in hydrogen production experiments in electrolyzers .

[0051] Please see Figure 10 Based on the same inventive concept, this disclosure also provides a soft measurement system for hydrogen production in a continuously learning-guided electrolyzer hydrogen production process. The soft measurement system includes: The acquisition module is used to acquire historical multivariate time series data of the hydrogen production process in the electrolyzer and the corresponding hydrogen production data to build an initial training set. The model building module is used to construct the initial soft sensor model, which includes a sequentially connected temporal coding layer, a multi-head self-attention layer, a residual network layer, and an output layer. The temporal coding layer performs preliminary temporal feature extraction on the input multivariate time series to obtain the hidden state sequence. The multi-head self-attention layer maps the hidden state sequence to multiple subspaces for parallel attention computation, dynamically weighting key time steps to strengthen long-range temporal dependencies. The residual network layer further transforms the weighted features and mitigates gradient degradation. The output layer predicts the hydrogen production at the current moment based on the output of the residual network layer. The model training module is used to train the initial soft measurement model using the initial training set to obtain a multi-head self-attention-residual-long short-term memory network soft measurement model. The model update and prediction module is used to acquire new stage data of the hydrogen production process in the electrolyzer. Based on the continuous learning mechanism, the model parameters of the multi-head self-attention-residual-long short-term memory network soft sensor model are updated online to obtain the updated multi-head self-attention-residual-long short-term memory network soft sensor model, which is then used to predict the hydrogen production in the next stage. The continuous learning mechanism includes: calculating the distribution difference between the new stage data and the historical stage data; dynamically adjusting the decay factor based on the distribution difference; and weightedly fusing the old model parameters and the new model parameters based on the decay factor to obtain the updated model parameters.

[0052] Based on the same inventive concept, this disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the continuously learning-guided soft measurement method for hydrogen production in an electrolyzer hydrogen production process as described above.

[0053] The program product disclosed herein for implementing the above methods may employ a portable compact disk read-only memory and include program code, and may run on a terminal device, such as a personal computer. However, the program product disclosed herein is not limited thereto. In this disclosure, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0054] It should be noted that a computer-readable storage medium may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0055] The above are merely preferred embodiments of this disclosure and are not intended to limit this disclosure in any way. Although this disclosure has been disclosed above with reference to preferred embodiments, it is not intended to limit this disclosure. Any person skilled in the art can make some modifications or alterations to the above-mentioned technical content to create equivalent embodiments without departing from the scope of the technical solution of this disclosure. The implementation schemes in the above embodiments can also be further combined or replaced. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of this disclosure without departing from the content of the technical solution of this disclosure shall still fall within the scope of this disclosure.

Claims

1. A soft measurement method for hydrogen production in an electrolyzer hydrogen production process guided by continuous learning, characterized in that, Includes the following steps: Acquire historical multivariate time series data of hydrogen production process in electrolyzer and corresponding hydrogen production data to construct an initial training set; An initial soft measurement model is constructed, comprising a temporal coding layer, a multi-head self-attention layer, a residual network layer, and an output layer connected in sequence. The temporal coding layer performs preliminary temporal feature extraction on the input multivariate time series to obtain a hidden state sequence. The multi-head self-attention layer maps the hidden state sequence to multiple subspaces for parallel attention computation, dynamically weighting key time steps to strengthen long-range temporal dependencies. The residual network layer further transforms the weighted features and mitigates gradient degradation. The output layer predicts the hydrogen production at the current moment based on the output of the residual network layer. The initial soft measurement model is trained using the initial training set to obtain a multi-head self-attention-residual-long short-term memory network soft measurement model; New stage data of the hydrogen production process in the electrolyzer are obtained, and the model parameters of the multi-head self-attention-residual-long short-term memory network soft measurement model are updated online based on the continuous learning mechanism to obtain the updated multi-head self-attention-residual-long short-term memory network soft measurement model, which is then used for hydrogen production prediction in the next stage. The continuous learning mechanism includes: calculating the distribution difference between the new stage data and the historical stage data; dynamically adjusting the decay factor based on the distribution difference; and weightedly fusing the old model parameters and the new model parameters based on the decay factor to obtain the updated model parameters.

2. The method according to claim 1, characterized in that, The multivariate time series data includes temperature, pressure, and flow rate measured in real time in industrial electrolyzers.

3. The method according to claim 1, characterized in that, The temporal coding layer employs a multi-layer long short-term memory (LSTM) network to perform preliminary temporal feature extraction on the input multivariate time series.

4. The method according to claim 3, characterized in that, The method employs a multi-layer long short-term memory (LSTM) network to perform preliminary temporal feature extraction on the input multivariate time series, obtaining a hidden state sequence, including: The input multivariate time series is defined as Where N is the length of the time series, i.e., the total number of time steps. Let D represent the process variable at time t; At any moment Current input Compared to the previous hidden state Parallel input is fed to the forget gate, input gate, output gate, and candidate state generation unit; Forgotten Gate Cell state at the previous moment Perform element-wise multiplication, input gate With candidate state Perform element-wise multiplication and add the two values ​​to obtain the current cell state. ; Current cell state After activation by tanh, it is connected to the output gate. Element-wise multiplication yields the current hidden state. ,in and They are respectively transmitted to the next time step as cellular state and latent state. , It is also used as the output of the current layer.

5. The method according to claim 4, characterized in that, The multi-head self-attention layer is used to map the hidden state sequence to multiple subspaces for parallel attention computation, and dynamically weights key time steps, including: LSTM output hidden state Mapped to the query matrix Key matrix Sum matrix These are used to represent the query conditions for attention, the pairing relationship, and the information conveyed, respectively. The dynamic weighting of the time dimension is achieved through a multi-head self-attention mechanism: Each individual scaled dot product attention will query the matrix. AND key matrix Perform matrix dot product calculations, and input the results into a Softmax layer for normalization to obtain the attention distribution. Then, compare the attention distribution with the value matrix. Weighted summation yields the single-head attention result; Multi-head self-attention mechanisms compute simultaneously for each independent attention head and... The calculation results of each attention head are concatenated and then passed through a linear layer. The concatenated result is weighted to obtain the original hidden state sequence of the LSTM coding layer. Same-dimensional total attention results .

6. The method according to claim 5, characterized in that, The residual network layer is used to further transform the weighted features, including: The output features of the multi-head self-attention layer, i.e., the total attention result Z, are added element-wise to the original hidden state sequence H of the LSTM coding layer to form the initial input of the residual network. To integrate attention-enhanced features with basic temporal features; The initial input The feature transformation is performed layer by layer through L residual blocks. The processing of each residual block includes: processing the input features... Layer normalization is performed to stabilize the data distribution through a feedforward subnetwork. Nonlinear feature expansion and compression are performed, combining the output of the feedforward subnetwork with the input features of the residual block. By adding elements one by one, the output features of this layer are obtained. .

7. The method according to claim 5, characterized in that, The output layer is used to predict the current hydrogen production based on the output of the residual network layer, including: From the output of the last layer of the residual network Extract the feature vector of the last time step eigenvectors It aggregates historical time-series information within the entire time window; The last time step vector output by the last layer of the residual network. Linear projection is performed using a fully connected layer to map the predicted hydrogen production value. This yields the predicted hydrogen production for the current moment.

8. The method according to claim 1, characterized in that, The calculation involves identifying the distribution difference between the new stage data and the historical stage data; dynamically adjusting the attenuation factor based on the distribution difference; and weighting and fusing the old and new model parameters based on the attenuation factor to obtain the updated model parameters, including: The industrial process dataset is divided into two phases: the first phase is the initial training phase, and the second phase is the online update phase. From the second stage onwards, when new stage data arrives, the old model parameters obtained from the previous stage training are saved; Calculate the statistical distribution characteristics of the data in the new phase and the historical phase, respectively. The statistical distribution characteristics include the mean. and variance ; Compare the mean difference between new data and historical data and variance differences Size; If the mean difference And variance differences If the difference between the new data and historical data is small, increase the decay factor. To preserve more historical information; If the mean difference or variance difference If the new data differs significantly from historical data, the decay factor should be reduced. To adapt to new data more quickly; in, , For the preset threshold, ; In the old model parameters Based on this, new model parameters are obtained by training a multi-head self-attention-residual-long short-term memory network soft measurement model using data from the new stage. ; According to the attenuation factor For the parameters of the old model and new model parameters The updated model parameters are obtained by weighted fusion. ; Updated model parameters As parameters of the current soft measurement model, they will be used for hydrogen production prediction in the next stage. By traversing all data stages, we obtain the optimal multi-head self-attention-residual-long short-term memory network soft measurement model that adapts to the distribution of all data.

9. A soft measurement system for hydrogen production in a continuously learning-guided electrolyzer hydrogen production process, characterized in that, The soft measurement system includes: The acquisition module is used to acquire historical multivariate time series data of the hydrogen production process in the electrolyzer and the corresponding hydrogen production data to build an initial training set. The model building module is used to construct an initial soft sensor model, which includes a temporal coding layer, a multi-head self-attention layer, a residual network layer, and an output layer connected in sequence. The temporal coding layer performs preliminary temporal feature extraction on the input multivariate time series to obtain a hidden state sequence. The multi-head self-attention layer maps the hidden state sequence to multiple subspaces for parallel attention computation, dynamically weighting key time steps to strengthen long-range temporal dependencies. The residual network layer further transforms the weighted features and alleviates gradient degradation. The output layer predicts the hydrogen production at the current moment based on the output of the residual network layer. The model training module is used to train the initial soft measurement model using the initial training set to obtain a multi-head self-attention-residual-long short-term memory network soft measurement model. The model update and prediction module is used to acquire new stage data of the hydrogen production process in the electrolyzer. Based on the continuous learning mechanism, the model parameters of the multi-head self-attention-residual-long short-term memory network soft measurement model are updated online to obtain the updated multi-head self-attention-residual-long short-term memory network soft measurement model, which is then used to predict the hydrogen production in the next stage. The continuous learning mechanism includes: calculating the distribution difference between the new stage data and the historical stage data; dynamically adjusting the decay factor based on the distribution difference; and weightedly fusing the old model parameters and the new model parameters based on the decay factor to obtain the updated model parameters.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it is used to implement the continuous learning-guided soft measurement method for hydrogen production in an electrolyzer hydrogen production process as described in any one of claims 1-8.