Hydrogen production flow calculation method and system based on Kalman filtering algorithm
By applying the Kalman filter algorithm and multi-sensor data fusion in the hydrogen production system, the problems of insufficient measurement accuracy and stability of traditional flow meters are solved, realizing high-precision, low-cost, and dynamic flow measurement, and improving the operating efficiency and safety of the hydrogen production system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SINOPEC HYDROGEN ENERGY MACHINERY (WUHAN) CO LTD
- Filing Date
- 2025-11-25
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional hydrogen flow meters are susceptible to changes in operating conditions and electromagnetic interference, resulting in insufficient measurement accuracy and stability, poor dynamic response performance, and an inability to provide accurate flow data in real time.
By employing the Kalman filter algorithm and combining flow, pressure, and temperature sensors, the flow data is updated in real time through system state prediction equations and observation equations. The Kalman filter is then used for data fusion and correction to output the optimal flow estimate.
It improves the measurement accuracy and stability of hydrogen/oxygen production flow rate, reduces system hardware costs, dynamically tracks flow rate changes, provides accurate instantaneous flow rate data, and enhances the system's reliability and real-time performance.
Smart Images

Figure CN121901558A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of hydrogen production flow rate calculation. More specifically, this invention relates to a method and system for calculating hydrogen production flow rate based on the Kalman filter algorithm. Background Technology
[0002] With the development of green energy, technologies such as water electrolysis for hydrogen production are being applied more and more widely in the energy sector. Accurate measurement of hydrogen and oxygen production flow rates is crucial during the operation of hydrogen production systems and is an important foundation for their efficient and stable operation.
[0003] Currently, hydrogen production systems commonly use traditional flow meters (such as orifice plate flow meters, vortex flow meters, and thermal mass flow meters) for direct flow measurement. However, this method has several technical drawbacks in practical applications. Firstly, the measurement results are easily affected by changes in operating conditions. The purity of hydrogen and oxygen fluctuates during the hydrogen production process, directly interfering with the measurement mechanism of traditional flow meters, leading to decreased measurement accuracy and an inability to reflect the true gas flow rate. Secondly, the complex industrial environment, with its various electromagnetic interferences, makes the sensor signals of traditional flow meters susceptible to interference during transmission, causing reading fluctuations and data instability, resulting in insufficient reliability of the measurement data. Furthermore, traditional flow meters have poor dynamic response performance. When changes in the hydrogen production system's operating conditions cause rapid flow fluctuations, the flow meter cannot capture these changes in time, exhibiting a response lag and failing to output accurate instantaneous flow data. This, in turn, affects the real-time performance of system efficiency calculations, the accuracy of safety control, and the effectiveness of process optimization. Therefore, a more reasonable method for calculating hydrogen production flow rate is urgently needed to overcome these challenges. Summary of the Invention
[0004] To achieve these objectives and other advantages according to the present invention, a preferred embodiment of the present invention provides a method for calculating hydrogen production flow rate based on a Kalman filter algorithm, comprising the following steps: S1. Deploy flow sensors in the gas pipeline of the hydrogen production system to collect the gas flow value in the gas pipeline in real time and form a real-time gas flow dataset. S2. Establish system state prediction equations and observation equations with gas flow rate as the state variable, and then update the system state prediction equations in real time based on real-time gas flow rate data. S3. The real-time measurement dataset collected in step S1 is preprocessed to remove outliers. The preprocessed measurement data is then used as an observation vector and input into a Kalman filter with pre-configured parameters. The parameters of the Kalman filter include the process noise covariance Q and the observation noise covariance R, which are determined based on the statistical analysis of sensor noise. S4. The Kalman filter, combined with the state equation of step S2, performs the prediction step to obtain the prior state prediction value of the flow rate at the current time k and the flow rate estimation covariance; then, combined with the observation vector of step S3, it performs the update step, and by calculating the Kalman gain to correct the prior prediction, it obtains the optimal prediction value of the gas flow rate at the current time. S5. Execute steps S1 to S4 in a loop according to the preset sampling cycle, continuously outputting smooth and accurate instantaneous gas flow values as the final flow measurement result of the hydrogen production system.
[0005] Preferably, in step S2, the system state prediction equation is as follows; ; Where A is the state transition matrix of the state equation, and W k It's process noise. The traffic forecast data represents time k. in, ; It is a preset sampling period, and it is assumed that the flow rate changes at a constant rate.
[0006] Preferably, in step S2, the observation equation is as follows: ; Wherein, the observation vector Z k The values are measured by the flow sensor; H is the observation matrix; V k It is observation noise; This represents the traffic forecast data at time k.
[0007] Preferably, in step S4, the Kalman filter performs the prediction step using the following formula to obtain the current flow prediction value and flow prediction variance; in, The prior estimate of the covariance of the flow rate at time k-1 is given. The prior estimate covariance of the flow rate at time k; The prior prediction of the flow rate at time k-1 is given. Let be the prior state prediction of the flow rate at time k; A is the state transition matrix of the state equation; Q is the process noise covariance.
[0008] Preferably, in step S4, the Kalman filter performs the update step using the following formula, utilizing the observation vector Z. k To correct the flow rate prediction, we obtain the optimal predicted gas flow rate for the current moment. : in, in, Let the posterior estimate of the flow rate at time k be the covariance. The prior estimate covariance of the flow rate at time k; Let be the posterior state prediction of the flow at time k. Let be the predicted prior state value of the flow at time k; R is the Kalman gain; R is the observation noise covariance matrix, I is the identity matrix, and H is the observation matrix; H T It is the transpose of the observation matrix.
[0009] Preferably, the flow sensor is a flow meter with an accuracy of less than ±3% FS.
[0010] On the other hand, a preferred embodiment of the present invention provides a hydrogen production flow calculation system, comprising: Flow sensors, pressure sensors, and temperature sensors are installed in the gas pipeline of the hydrogen production system to synchronously and in real time collect initial flow, pressure, and temperature values. The data acquisition unit is used to receive real-time measurement signals output by each sensor and perform the preprocessing operation described in step S3. The processing unit is communicatively connected to the data acquisition unit. The processing unit has built-in storage of system state prediction equations and Kalman filters. The processing unit receives real-time gas flow data output by the data acquisition unit, performs prediction and update calculations according to the S4 process, and outputs the optimal flow estimate. Output unit: Electrically connected to the processing unit, used to receive the optimal flow estimate output by the processing unit, convert it into an identified signal, and transmit it.
[0011] This invention offers at least the following advantages: It utilizes a Kalman filter algorithm to optimally fuse and estimate raw data, dynamically correcting flow measurement values in real time. This method effectively suppresses noise and compensates for measurement deviations caused by changes in physical conditions, thereby significantly improving the measurement accuracy, stability, and reliability of hydrogen / oxygen production flow rates during hydrogen production without relying on high-cost, high-precision flow meters.
[0012] (1) High precision of the present invention: By fusing information from multiple sensors and using the optimal estimation algorithm, the systematic error and random error of a single sensor are effectively compensated, and the obtained flow rate value is closer to the true value than the direct reading of any single sensor.
[0013] (2) High stability and noise resistance: Kalman filtering can effectively suppress sensor noise and field interference, output a smooth and stable flow curve, and avoid drastic fluctuations in readings.
[0014] (3) Low cost: A low-cost, low-precision flow meter can be used in conjunction with common pressure and temperature sensors. Through algorithms, the measurement effect can be close to that of a high-precision flow meter, which significantly reduces the system hardware cost.
[0015] (4) Good dynamic performance: Kalman filtering is a recursive algorithm with low computational cost. It can track the rapid changes in flow rate in real time and provide accurate instantaneous flow rate.
[0016] (5) Strong robustness: Even if a sensor experiences a short-term anomaly or drift, the system can still provide a relatively reliable estimate due to the constraints of the model and other sensors, thus enhancing the reliability of the system.
[0017] Other advantages, objectives and features of the present invention will become apparent in part from the following description, and in part from those skilled in the art through study and practice of the invention. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating the hydrogen production flow rate calculation method based on the Kalman filter algorithm in this invention. Detailed Implementation
[0019] The present invention will now be described in further detail with reference to the accompanying drawings, so that those skilled in the art can implement it based on the description.
[0020] The following description is intended to disclose the present invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious modifications will occur to those skilled in the art. The basic principles of the invention defined in the following description can be applied to other embodiments, modifications, improvements, equivalents, and other technical solutions that do not depart from the spirit and scope of the invention.
[0021] Those skilled in the art should understand that, in the disclosure of this invention, the terms "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the above terms should not be construed as limiting this invention.
[0022] It is understood that the term "a" should be understood as "at least one" or "one or more", that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple, and the term "a" should not be understood as a limitation on the number.
[0023] like Figure 1 As shown, a preferred embodiment of the present invention provides a method for calculating hydrogen production flow rate based on the Kalman filter algorithm, comprising the following steps: S1. Deploy flow sensors in the gas pipeline of the hydrogen production system to collect the gas flow value in the gas pipeline in real time and form a real-time gas flow dataset. A hydrogen production system refers to a complete set of equipment that produces hydrogen through technologies such as water electrolysis and natural gas reforming. Its gas pipelines are used to transport the hydrogen or related raw material gases generated during the production process. In the gas pipelines of the hydrogen production system, a location with a uniform pipeline diameter, stable gas flow, and no obvious bends or obstacles should be selected as the sensor installation point. This location should avoid areas prone to turbulence, such as pipeline valves and joints, to ensure the stability of the sensor data.
[0024] S2. Establish the system state prediction equation and observation equation with gas flow rate as the state variable; S3. The real-time measurement dataset collected in step S1 is preprocessed to remove outliers. The preprocessed measurement data is then used as an observation vector and input into a Kalman filter with pre-configured parameters. The parameters of the Kalman filter include the process noise covariance Q and the observation noise covariance R, which are determined based on the statistical analysis of sensor noise. S4. The Kalman filter, combined with the state equation of step S2, performs the prediction step to obtain the prior state prediction value of the flow rate at the current time k and the flow rate estimation covariance; then, combined with the observation vector of step S3, it performs the update step, and by calculating the Kalman gain to correct the prior prediction, it obtains the optimal prediction value of the gas flow rate at the current time. The Kalman filter first invokes the system state prediction equation. Based on the prior flow prediction value at the previous time k-1, it calculates the prior flow prediction value at the current time k. At this point, the current real-time flow measurement data has not yet been integrated, and this is called the prior flow prediction value. Simultaneously, it calculates the flow estimation covariance at the current time by combining the process noise covariance Q. Then, the preprocessed observation vector (i.e., the current flow measurement value) is input into the Kalman filter. The Kalman filter calculates the Kalman gain based on the observation equation and the observation noise covariance R. The Kalman gain is used to correct the current prior flow prediction value, resulting in the corrected posterior flow prediction value, which is the optimal prediction value of the gas flow at the current time. The prior flow prediction value is the flow prediction result obtained based on historical states without incorporating current measurement data; the optimal prediction value is the estimate closest to the actual flow rate obtained after fusing the prediction and observation information using the Kalman filter algorithm.
[0025] S5. Execute steps S1 to S4 in a loop according to the preset sampling cycle, continuously outputting smooth and accurate instantaneous gas flow values as the final flow measurement result of the hydrogen production system.
[0026] The above technical solution enables real-time and accurate measurement of gas flow in the hydrogen production system. Preprocessing of the measurement data effectively eliminates outliers and reduces the impact of interference factors on the measurement results. The application of the Kalman filter algorithm, through recursive calculations of prediction and update, integrates historical state information with current measurement information, effectively suppressing the influence of process noise and observation noise, and providing reliable support for hydrogen production efficiency optimization and energy consumption control.
[0027] In another technical solution, in step S2, the system state prediction equation is as follows; ; Where A is the state transition matrix of the state equation, and W k It's process noise. The traffic forecast data represents time k. in, ; Δt is the preset sampling period, and it is assumed that the flow rate changes at a constant rate.
[0028] The system state prediction equation is based on the flow prediction data (including flow value and flow change rate) of the previous time step, combined with the state transition matrix A, to deduce the flow prediction data at the current time step k. This prediction data is a prior estimate without combining the sensor measurement values at the current time step, which provides the basis for the subsequent Kalman filter update step.
[0029] In another technical solution, the observation equation in step S2 is as follows: ; Wherein, the observation vector Z k The values are measured by the flow sensor; H is the observation matrix; V k It is observation noise; This represents the traffic forecast data at time k.
[0030] The observation equations link the predicted system state with the real-time actual measurements from the sensors, providing observational basis for the Kalman filter update steps.
[0031] In another technical solution, in step S4, the Kalman filter performs the prediction step using the following formula to obtain the current flow prediction value and flow prediction variance; in, The prior estimate of the covariance of the flow rate at time k-1 is given. The prior estimate covariance of the flow rate at time k; The prior prediction of the flow rate at time k-1 is given. Let be the prior state prediction of the flow rate at time k (at which the current real-time flow rate measurement data has not yet been integrated, and is referred to as the prior state prediction of the flow rate); A is the state transition matrix of the state equation; Q is the process noise covariance.
[0032] When the Kalman filter performs the prediction step, it first calls the prior flow prediction value and the prior flow estimation covariance from the previous time step (k-1). Based on the state transition matrix A in the system state prediction equation, it iteratively calculates the prior flow prediction value at time k-1 to deduce the prior flow state prediction value at the current time k, thus realizing the prediction from the historical state to the current state.
[0033] When calculating the prior estimate covariance of the flow rate at the current time k, the calculation is first performed based on the state transition matrix A and the prior estimate covariance of the flow rate at time k-1, and then the process noise covariance Q is added for supplementary correction.
[0034] In another technical solution, in step S4, the Kalman filter performs an update step using the following formula, utilizing the observation vector Z. k To correct the flow rate prediction, we obtain the optimal predicted gas flow rate for the current moment. : ; in, ; ; in, Let the posterior estimate of the flow rate at time k be the covariance. The prior estimate covariance of the flow rate at time k; Let be the posterior state prediction of the flow at time k. Let be the predicted prior state value of the flow at time k; R is the Kalman gain; R is the observation noise covariance matrix, I is the identity matrix, and H is the observation matrix; H T It is the transpose of the observation matrix.
[0035] When the Kalman filter performs the update step, it first estimates the covariance of the flow prior at time k, the observation matrix H, and the transpose of the observation matrix H. T The Kalman gain is calculated using the observed noise covariance matrix R and the identity matrix I. Then, the calculated Kalman gain is used... Combined with the observation vector Z k (Sensor measurement at current time) and the predicted flow rate prior state at time k After correction, the posterior state prediction of the flow at time k is obtained. Simultaneously, based on the Kalman gain, observation matrix H, prior estimate covariance, and identity matrix I, the flow estimation covariance is updated to obtain the posterior flow estimation covariance at time k.
[0036] In another technical solution, the flow sensor is a flow meter with an accuracy of less than ±3% FS.
[0037] On the other hand, another technical solution of the present invention provides a hydrogen production flow calculation system, comprising: Flow sensors, pressure sensors, and temperature sensors are installed in the gas pipeline of the hydrogen production system to synchronously and in real time collect initial flow, pressure, and temperature values. The data acquisition unit is used to receive real-time measurement signals output by each sensor and perform the preprocessing operation described in step S3. The processing unit is communicatively connected to the data acquisition unit. The processing unit has built-in storage of system state prediction equations and Kalman filters. The processing unit receives real-time gas flow data output by the data acquisition unit, performs prediction and update calculations according to the S4 process, and outputs the optimal flow estimate. Output unit: Electrically connected to the processing unit, used to receive the optimal flow estimate output by the processing unit, convert it into an identified signal, and transmit it.
[0038] The entire system operates stably and reliably, and can output smooth and accurate optimal flow estimates in real time, which significantly reduces the error in hydrogen production flow measurement and improves the accuracy and stability of flow measurement.
[0039] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, other modifications can be easily made. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.
Claims
1. A method for calculating hydrogen production flow rate based on the Kalman filter algorithm, characterized in that, Includes the following steps: S1. Deploy flow sensors in the gas pipeline of the hydrogen production system to collect the gas flow value in the gas pipeline in real time and form a real-time gas flow dataset. S2. Establish system state prediction equations and observation equations with gas flow rate as the state variable, and then update the system state prediction equations in real time based on real-time gas flow rate data. S3. The real-time measurement dataset collected in step S1 is preprocessed to remove outliers. The preprocessed measurement data is then used as an observation vector and input into a Kalman filter with pre-configured parameters. The parameters of the Kalman filter include the process noise covariance Q and the observation noise covariance R, which are determined based on the statistical analysis of sensor noise. S4. The Kalman filter, combined with the state equation of step S2, performs the prediction step to obtain the prior state prediction value of the flow rate at the current time k and the flow rate estimation covariance; then, combined with the observation vector of step S3, it performs the update step, and by calculating the Kalman gain to correct the prior prediction, it obtains the optimal prediction value of the gas flow rate at the current time. S5. Execute steps S1 to S4 in a loop according to the preset sampling cycle, continuously outputting smooth and accurate instantaneous gas flow values as the final flow measurement result of the hydrogen production system.
2. The hydrogen production flow rate calculation method based on the Kalman filter algorithm according to claim 1, characterized in that, In step S2, the system state prediction equation is as follows: ; Where A is the state transition matrix of the state equation, and W k It's process noise. The traffic forecast data represents time k. in, ; Δt is the preset sampling period, and it is assumed that the flow rate changes at a constant rate.
3. The hydrogen production flow rate calculation method based on the Kalman filter algorithm according to claim 2, characterized in that, In step S2, the observation equation is as follows: ; Wherein, the observation vector Z k The values are measured by the flow sensor; H is the observation matrix; V k It is observation noise; This represents the traffic forecast data at time k.
4. The hydrogen production flow rate calculation method based on the Kalman filter algorithm according to claim 3, characterized in that, In step S4, the Kalman filter performs the prediction step using the following formula to obtain the current flow prediction value and flow prediction variance; in, The prior estimate of the covariance of the flow rate at time k-1 is given. The prior estimate covariance of the flow rate at time k; The prior prediction of the flow rate at time k-1 is given. Let be the prior state prediction of the flow rate at time k; A is the state transition matrix of the state equation; Q is the process noise covariance.
5. The hydrogen production flow rate calculation method based on the Kalman filter algorithm according to claim 3, characterized in that, In step S4, the Kalman filter performs the update step using the following formula, utilizing the observation vector Z. k To correct the flow rate prediction, we obtain the optimal predicted gas flow rate for the current moment. : ; in, ; ; in, Let the posterior estimate of the flow rate at time k be the covariance. The prior estimate covariance of the flow rate at time k; Let be the posterior state prediction of the flow at time k. Let be the predicted prior state value of the flow at time k; R is the Kalman gain; R is the observation noise covariance matrix, I is the identity matrix, and H is the observation matrix; H T It is the transpose of the observation matrix.
6. The hydrogen production flow rate calculation method based on the Kalman filter algorithm according to claim 3, characterized in that, The flow sensor is a flow meter with an accuracy of less than ±3% FS.
7. A hydrogen production flow calculation system for implementing the method of any one of claims 1-6, characterized in that, include: Flow sensors, pressure sensors, and temperature sensors are installed in the gas pipeline of the hydrogen production system to synchronously and in real time collect initial flow, pressure, and temperature values. The data acquisition unit is used to receive real-time measurement signals output by each sensor and perform the preprocessing operation described in step S3. The processing unit is communicatively connected to the data acquisition unit. The processing unit has built-in storage of system state prediction equations and Kalman filters. The processing unit receives real-time gas flow data output by the data acquisition unit, performs prediction and update calculations according to the S4 process, and outputs the optimal flow estimate. Output unit: Electrically connected to the processing unit, used to receive the optimal flow estimate output by the processing unit, convert it into an identified signal, and transmit it.