NDIR-based total hydrocarbon concentration online detection method and system

By combining an NDIR sensor with a gas chromatograph and establishing a mapping relationship using a GRU-Attention neural network model, the influence of environmental parameter changes on the measurement of multi-component gas concentrations in NDIR detection was resolved, achieving high-precision real-time online detection of total hydrocarbon concentration and overcoming the limitations of traditional methods.

CN120992540APending Publication Date: 2025-11-21NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511107786.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing NDIR hydrocarbon gas detection methods cannot achieve high-precision measurements in real-world applications involving changes in temperature, humidity, and air pressure, and also suffer from problems such as spectral overlap and unstable component characterization.

Method used

By combining an NDIR sensor with a gas chromatograph, a mapping relationship between light absorption ratio, temperature, absolute humidity, gas pressure and total hydrocarbon concentration is established through a GRU-Attention neural network model. The key wavelength signal is dynamically weighted using the attention mechanism to suppress cross-interference from non-target gases and achieve real-time online detection.

Benefits of technology

It significantly improves the accuracy and stability of NDIR total hydrocarbon concentration measurement, solves the nonlinear drift problem caused by changes in environmental parameters, and achieves more reliable and accurate online monitoring in industrial settings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120992540A_ABST
    Figure CN120992540A_ABST
Patent Text Reader

Abstract

The invention discloses an NDIR-based total hydrocarbon concentration online detection method and system, and the method comprises the steps: collecting the temperature and air pressure of a gas sample through an NDIR detection module, and calculating the absolute humidity and the light absorption ratio; measuring the total hydrocarbon concentration of the gas sample using a gas chromatograph; according to the method, a GRU-Attention neural network model is constructed, the mapping relation from the light absorption ratio RLA, the temperature Temp, the air pressure P and the absolute humidity AH to the total hydrocarbon concentration CHC is established, the precision and adaptability of NDIR in the technical field of total hydrocarbon gas concentration detection are remarkably improved, and environment parameter self-adaptive compensation is achieved. The system comprises an NDIR detection module, a gas chromatography module, a processing unit and a communication unit, and can output compensated total hydrocarbon concentration in real time and transmit the total hydrocarbon concentration remotely, so that accurate measurement of the total hydrocarbon concentration by the NDIR is realized, each sensor provides multi-parameter data, a miniaturized product is designed, the cost is low, the measurement is fast, real-time monitoring can be realized, and a model is accurate and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of total hydrocarbon gas concentration measurement technology, and specifically to an online detection method and system for total hydrocarbon concentration based on NDIR. Background Technology

[0002] The detection of hydrocarbon gases plays a crucial role in various fields, including oil exploration, petrochemical industry, environmental monitoring, and deepwater exploration. These emissions mainly consist of alkanes, alkenes, and benzene derivatives with boiling points below 120°C. The high reactivity of these compounds promotes photochemical reactions in the troposphere, thus causing air pollution. Therefore, real-time online monitoring of their concentrations is essential, as it can both identify process anomalies (e.g., leaks and incomplete reactions) and proactively assess environmental health risks associated with teratogenic and carcinogenic components. Thus, high-precision real-time online monitoring of hydrocarbon gas concentrations has significant scientific and practical implications.

[0003] Several effective detection methods have been proposed in the field of hydrocarbon gas detection. For example, gas chromatography-flame ionization detection (GC-FID) has been proposed for the effective measurement of gases such as non-methane total hydrocarbons. Photoionization detection has been used to detect the concentration of volatile organic compounds (VOCs) in the air. However, existing methods suffer from serious drawbacks such as complex operation procedures and the inability to achieve real-time online detection. Non-dispersive infrared (NDIR) based on the Lambert-Beer law is a method for hydrocarbon gas detection that can provide online monitoring; however, its measurement accuracy is affected by three inherent challenges. These challenges include: the non-uniform absorption rate of mixed hydrocarbons at the target wavelength leading to spectral overlap; the dynamic fluctuation of the proportion of multiple components in actual oil-gas mixtures leading to unstable component characterization; and the nonlinear drift of concentration readings caused by changes in temperature, humidity, and air pressure. Previous studies have not yet solved the problem of the unpredictable impact of environmental parameter changes on the measurement of multi-component gas concentrations in NDIR hydrocarbon gas detection, making it impossible to achieve high-precision measurement of hydrocarbon gases in practical application scenarios with changes in temperature, humidity, and air pressure. Summary of the Invention

[0004] The purpose of this invention is to provide an online detection method and system for total hydrocarbon concentration based on NDIR, in order to solve the problem of unpredictable influence of environmental parameter changes on the measurement of multi-component gas concentrations in hydrocarbon gas detection, and the problem of not being able to achieve high-precision measurement of hydrocarbon gases in practical application scenarios with changes in temperature, humidity, and air pressure.

[0005] To achieve the above objectives, the present invention provides a method for online detection of total hydrocarbon concentration based on NDIR, comprising the following steps:

[0006] The temperature (Temp), relative humidity (RH), and air pressure (P) of the gas sample are collected using the NDIR detection module, and the absolute humidity (AH) and light absorptivity (RLA) are calculated.

[0007] The total hydrocarbon concentration (C) of a unit volume gas sample was measured using a gas chromatograph. HC ;

[0008] A GRU-Attention neural network model was constructed and trained, and the relationships between light absorptivity (RLA), temperature (Temp), absolute humidity (AH), air pressure (P), and total hydrocarbon concentration (C) were established based on gas samples of different concentrations. HC The mapping relationship between them; based on the obtained mapping relationship, the total hydrocarbon concentration C of the gas to be measured is calculated based on the data collected by the NDIR detection module. HC .

[0009] To optimize the above technical solution, the specific measures also include:

[0010] In the GRU-Attention neural network model, the time step of the GRU layer is set to an integer multiple of the gas sampling frequency, and the number of neurons in the hidden layer is 2 to 4 times the dimension of the input features.

[0011] Furthermore, in the GRU-Attention neural network model, the attention mechanism layer employs multi-head attention to focus on temperature (Temp), absolute humidity (AH), atmospheric pressure (P), and light absorptivity (RLA) on the total hydrocarbon concentration (C). HC Different influence weights are assigned, and residual connections are added.

[0012] Furthermore, the attention mechanism layer introduces feature grouping, dividing the input features into an environmental group including temperature (Temp), absolute humidity (AH), and air pressure (P), and an optical group including light absorption ratio (RLA). The environmental group uses a channel attention mechanism to calculate weights, while the optical group uses a time attention mechanism to calculate weights. The two weights are dynamically integrated through a gating fusion unit to output the final attention score.

[0013] The total gas concentration C can be expressed as C = C HC +AH, where C HC This represents the total hydrocarbon concentration.

[0014] Furthermore, absolute humidity (AH) is directly related to relative humidity (RH) and temperature. Absolute humidity (AH) can be obtained using the ideal gas law and the Antoni equation, i.e.:

[0015]

[0016] Where R is the universal gas constant, A, B, and C are Antoine coefficients, T(k) and T(°C) represent the temperatures on the Kelvin and Celsius scales, respectively, and M... H2ORH represents the molar mass of water, and RH represents relative humidity.

[0017] The formula for calculating the light absorptivity ratio (RLA) is as follows:

[0018]

[0019] Where U is the voltage value of the measurement channel, U0 is the measured value of the reference channel, and ε i q is the absorption coefficient. i Here, C represents the component distribution, C represents the gas concentration, and L represents the optical path length.

[0020] The total hydrocarbon concentration C of the gas sample was measured using a gas chromatograph. HC Specifically:

[0021] Furthermore, gas chromatography was used to separate the components of the vaporized sample based on differences in compound polarity or boiling point. The electrical signals were output by an FID detector and converted into concentration data. The total hydrocarbon peak area was subtracted from the oxygen peak area to obtain the total hydrocarbon concentration C. HC , is represented as:

[0022]

[0023] in, This indicates the volume fraction of total hydrocarbon concentration in the sample. V represents the molar mass of methane. m The value represents the molar volume of the gas, and D represents the dilution factor of the sample.

[0024] Furthermore, the mapping function f of the GRU-Attention neural network model is:

[0025] C HC =f(RLA,Temp,AH,P)

[0026] Where RLA represents light absorptivity, Temp represents temperature, AH represents absolute humidity, and P represents air pressure. This invention also proposes an online total hydrocarbon concentration detection system based on NDIR, comprising an NDIR detection module, a gas chromatograph, a processing unit, and a communication unit.

[0027] The NDIR detection module includes a gas micropump, a temperature and humidity sensor, and an NDIR sensor with built-in temperature and pressure sensors. It is used to collect the temperature (Temp), relative humidity (RH), and pressure (P) of the gas sample, and to calculate the absolute humidity (AH) and light absorption ratio (RLA).

[0028] A gas chromatograph, comprising an injection system, a separation system, a temperature control system, a gas path system, and a detection system, is used to measure the total hydrocarbon concentration C of the gas sample. HC ;

[0029] The processing unit is used to deploy a trained GRU-Attention neural network model. It receives light absorptivity (RLA), temperature (Temp), absolute humidity (AH), and atmospheric pressure (P) collected by the NDIR detection module and after conditioning and analog-to-digital conversion. After inputting these data into the GRU-Attention neural network model, it outputs the total hydrocarbon concentration (C). HC ;

[0030] Communication unit, used to transmit total hydrocarbon concentration C HC Temperature (Temp), absolute humidity (AH), air pressure (P), and light absorption ratio (RLA) are transmitted to the host computer to achieve real-time concentration monitoring.

[0031] The present invention also proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements an online detection method for total hydrocarbon concentration based on NDIR as described above.

[0032] The present invention also proposes a computer-readable storage medium storing a computer program that causes a computer to execute an online detection method for total hydrocarbon concentration based on NDIR as described above.

[0033] Compared with the prior art, the beneficial effects of the present invention are:

[0034] 1. This invention combines an NDIR sensor with a gas chromatograph to achieve real-time online detection of total hydrocarbon concentration, solving the problems of complex operation and inability to monitor in real time with traditional NDIR.

[0035] 2. This invention significantly improves the measurement accuracy of total hydrocarbon concentration by establishing a mapping relationship model based on GRU-Attention neural network and combining temperature, humidity, air pressure and light absorption ratio parameter data, thus solving the nonlinear drift problem caused by changes in environmental parameters in traditional methods.

[0036] 3. This invention compares a reference channel (without gas absorption) with a measurement channel, quantifies signal differences through light absorption ratio, and reduces background interference; the GRU-Attention neural network model automatically learns the spectral characteristics of different components, dynamically weights key wavelength signals through attention mechanism, suppresses cross-interference of non-target gases, solves the problem of spectral overlap, and makes it difficult for traditional NDIR to distinguish the absorption signals of different components.

[0037] 4. This invention significantly improves the environmental resistance, prediction accuracy, robustness, and stability of the online detection model for total hydrocarbon concentration under NDIR by combining feature grouping and differential attention. At the same time, it provides a good foundation for optimizing computational efficiency, ultimately achieving more reliable and accurate online monitoring in industrial settings.

[0038] 5. This invention can be widely applied to fields such as online atmospheric environment monitoring, industrial emission pollution monitoring, and petrochemicals, providing an efficient tool for environmental health risk assessment and process anomaly detection. Attached Figure Description

[0039] Figure 1 This is a diagram illustrating the implementation steps of the present invention.

[0040] Figure 2 This is a diagram illustrating the method for collecting input model data in an embodiment of the present invention.

[0041] Figure 3 This is a diagram illustrating the method for collecting output model data in an embodiment of the present invention.

[0042] Figure 4 This is a diagram of the GRU-Attention neural network model of the present invention.

[0043] Figure 5 This is a training result diagram of the GRU-Attention neural network model of this invention.

[0044] Figure 6 This is a physical image of the field data acquisition system according to an embodiment of the present invention.

[0045] Figure 7 This is a graph showing the relationship between the output signal of the uncalibrated sensor and the total hydrocarbon concentration.

[0046] Figure 8 The performance comparison analysis of different prediction models of this invention is shown in the figure. Detailed Implementation

[0047] The present invention will be further described in detail below through specific embodiments, but it should not be construed as limiting the scope of the subject matter of the present invention to the following embodiments. All technologies implemented based on the above content of the present invention fall within the scope of the present invention.

[0048] like Figure 1 As shown, this invention provides an online detection method for total hydrocarbon concentration based on NDIR, comprising the following steps:

[0049] The temperature (Temp), relative humidity (RH), and air pressure (P) of the gas sample are collected using the NDIR detection module, and the absolute humidity (AH) and light absorptivity (RLA) are calculated.

[0050] The total hydrocarbon concentration (C) of a gas sample was measured using a gas chromatograph. HC ;

[0051] A GRU-Attention neural network model was constructed and trained, and the relationships between light absorptivity (RLA), temperature (Temp), absolute humidity (AH), air pressure (P), and total hydrocarbon concentration (C) were established based on gas samples of different concentrations. HC The mapping relationship between them; based on the obtained mapping relationship, the total hydrocarbon concentration C of the gas to be measured is calculated based on the data collected by the NDIR detection module. HC .

[0052] Water vapor absorption across the entire spectrum is a crucial factor that must be considered, as it affects monitoring parameters and the final measurement accuracy. The total gas concentration C can be expressed as C = C0 HC +AH;

[0053] Where C HC This represents the total hydrocarbon concentration, while absolute humidity (AH) is directly related to relative humidity (RH) and temperature. Absolute humidity (AH) can be obtained using the ideal gas law and the Antoni equation.

[0054]

[0055] Where A, B, and C are Antoine coefficients, with empirical values ​​of A = 8.1332, B = 1762.39, and C = 235.66. R is the universal gas constant, quantitatively defined as 62.3637 L·mmHg / (K·mol). The molar mass of water is expressed as... This indicates that its precise value is 18.015 g / mol. T(k) and T(°C) represent the temperatures on the Kelvin and Celsius scales, respectively. Temperature (Temp) and atmospheric pressure (P) are the dependent variables of the absorption coefficient ε.

[0056] The light absorptivity ratio (RLA) can be precisely defined according to the Lambert-Beer law. The expression for RLA is:

[0057]

[0058] In the formula, U is the voltage value of the measurement channel, U0 is the measured value of the reference channel, and the absorption coefficient ε i and component distribution q i As can be seen from the above formula, the total concentration of the gas being measured is linearly correlated with RLA only when the composition and proportion of the gas remain constant.

[0059] In another embodiment of the present invention, an online detection system for total hydrocarbon concentration based on NDIR is proposed, comprising: an NDIR detection module, a gas chromatograph, a processing unit, and a communication unit;

[0060] The NDIR detection module includes a gas micropump, a temperature and humidity sensor, and an NDIR sensor with built-in temperature and pressure sensors. It is used to collect the temperature (Temp), relative humidity (RH), and pressure (P) of the gas sample, and to calculate the absolute humidity (AH) and light absorption ratio (RLA).

[0061] A gas chromatograph, comprising an injection system, a separation system, a temperature control system, a gas path system, and a detection system, is used to measure the total hydrocarbon concentration C of the gas sample. HC ;

[0062] The processing unit is used to deploy a trained GRU-Attention neural network model. It receives light absorptivity (RLA), temperature (Temp), absolute humidity (AH), and atmospheric pressure (P) collected by the NDIR detection module and after conditioning and analog-to-digital conversion. After inputting these data into the GRU-Attention neural network model, it outputs the total hydrocarbon concentration (C). HC ;

[0063] Communication unit, used to transmit total hydrocarbon concentration C via, for example, a 4G module. HC Temperature (Temp), absolute humidity (AH), air pressure (P), and light absorption ratio (RLA) are transmitted to the host computer to achieve real-time concentration monitoring.

[0064] In another embodiment of the present invention, an electronic device is proposed, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements an online detection method for total hydrocarbon concentration based on NDIR as described above.

[0065] In another embodiment of the present invention, a computer-readable storage medium is provided storing a computer program that causes a computer to execute an online total hydrocarbon concentration detection method based on NDIR as described above.

[0066] In the embodiments disclosed in this application, a computer storage medium may be a tangible medium that may contain or store programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of computer storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0067] like Figure 2As shown, in some embodiments, the system operation begins with the activation of the gas micropump by a host computer command. After activation, the sample gas first flows through a temperature and humidity sensor, which measures the relative humidity (RH) of the gas before it enters the NDIR sensor. Subsequently, the gas to be measured enters the system through the gas inlet and flows through the gas path section. The sample gas enters the NDIR sensor, which employs a dual-channel design, including a reference channel and a measurement channel. The NDIR sensor integrates a broad-spectrum infrared light source and is equipped with a bandpass filter with a center wavelength of 3.3 μm (bandwidth ±0.1 μm). Within the gas cell of the NDIR sensor, the filtered light interacts with the sample gas; the target gas molecules absorb light energy of a specific wavelength, causing attenuation of the light signal in the measurement channel. Simultaneously, the NDIR sensor also integrates a photodetector, converting the light intensity of the reference channel and the measurement channel into voltage signals, respectively. The system then calculates the light absorption ratio (RLA) (i.e., the negative logarithm of the ratio of the measurement channel voltage to the reference channel voltage), which directly reflects the concentration of the target gas. Furthermore, the NDIR sensor itself integrates a built-in temperature sensor and a pressure sensor for directly measuring the temperature and pressure of the sample gas inside the sensor.

[0068] Subsequently, the temperature (Temp) and pressure (P) of the sample gas measured by the NDIR sensor, the relative humidity (RH) of the gas sample detected by the temperature and humidity sensor at the inlet, and the calculated absolute humidity (AH) and light absorption ratio (RLA) are all sent to the core processor for processing.

[0069] In the core controller, the system amplifies and performs analog-to-digital conversion on all raw signals (including temperature (Temp), air pressure (P), absolute humidity (AH), and light absorptivity (RLA), and performs real-time compensation and correction calculations on the raw signals characterizing gas concentration to eliminate the interference of environmental factors on the final gas concentration reading, thereby obtaining an accurate and stable gas concentration value.

[0070] Preferably, all processed data (including compensated total hydrocarbon concentration, temperature, pressure, absolute humidity, and light absorptivity) is packaged and wirelessly transmitted back to a remote host computer via a 4G module. The host computer is responsible for data reception, real-time display, historical storage, trend analysis, and alarm triggering when necessary. The gas, after detection and analysis, is safely discharged from the system through the "gas outlet."

[0071] The entire process achieves a complete closed loop, from gas sampling, humidity pre-detection, NDIR optical detection, synchronous acquisition of multiple environmental parameters, centralized compensation and correction calculation, data processing, and wireless remote transmission to the host computer for monitoring.

[0072] In some implementations, such as Figure 3As shown. After the sample gas is injected into the column oven via a syringe, the system operation begins with the computer activating the throttling valve. Upon activation, the carrier gas (nitrogen) first enters the flow meter through the throttling valve, and the flow rate is controlled by the flow meter. After entering the column oven, the carrier gas first passes through a splitter, which adjusts the inflow gas flow rate to prevent excessive flow and column overload. Subsequently, the carrier gas introduces the sample gas into the hydrocarbon column. Due to the different polarities, boiling points, and chemical properties of the vaporized sample compounds, the column stabilizer has different adsorption and desorption capacities for these compounds, thus separating the different components. The column oven provides temperature control for the separation system to facilitate component separation. Finally, the total hydrocarbon concentration is detected using a flame ionization detector (FID). After detection, the exhaust gas at the gas outlet is measured using a soap bubble meter to measure the gas volumetric flow rate, which is then used to calibrate the relationship between the rotor flow meter or pressure indicator and the flow rate. The electrical signal output by the FID indirectly obtains the target gas concentration in the sample gas through an electrometer and an analog-to-digital converter module, and is stored in the computer data system.

[0073] The entire process can be divided into five parts: the sample introduction system, the separation system, the temperature control system, the gas path system, and the detection system. It achieves a complete closed loop from gas sampling, component separation, component concentration detection, data processing, and data acquisition.

[0074] use Figure 3 The gas chromatograph shown measures the total hydrocarbon concentration in the sample gas and uses it as a reference value. The gas chromatograph consists of five parts. The sample introduction system introduces the vaporized sample into the instrument; the core of the separation system is the gas chromatographic column. Due to the different polarities, boiling points, and other chemical properties of the vaporized sample compounds, the gas chromatographic column has different adsorption and desorption capacities for these compounds, thus separating the different components; the temperature control system provides temperature control for the separation system to facilitate component separation; the gas path system introduces an inert gas (such as nitrogen or argon) as a carrier gas into the gas chromatograph to drive the flow of the analyte gas; and finally, the detection system analyzes the sample concentration.

[0075] In some implementations, the gas chromatograph (GC) requires calibration using a 100 mL syringe as a dilution container. Methane standard gas is serially diluted with ambient air at a 1:1 volume ratio to prepare calibration series with five concentration gradients in both high and low concentration ranges. High and low concentration calibration curves are established based on the estimated sample concentrations. The high-concentration calibration curve has concentrations of 50.0 μmol / mol, 100 μmol / mol, 200 μmol / mol, 400 μmol / mol, and 800 μmol / mol; the low-concentration calibration curve has concentrations of 1.00 μmol / mol, 2.00 μmol / mol, 4.00 μmol / mol, 8.00 μmol / mol, and 16.0 μmol / mol. When plotting the curves, 1 mL aliquots of the calibration series are injected into the gas chromatograph in ascending order of concentration. A total hydrocarbon calibration curve is generated by plotting the measured concentrations on the x-axis and the corresponding peak areas on the y-axis.

[0076] After calibration, 1 ml of sample gas was injected under the same operating conditions. The total hydrocarbon peak area was obtained by subtracting the oxygen peak area from the chromatogram. Total hydrocarbon concentration C HC Represented as:

[0077]

[0078] in The total hydrocarbon concentration (volume fraction) in the sample is obtained from the calibration curve. The molar mass of methane... The molar volume of a gas under standard conditions (273.5 K, 101.325 kPa) is expressed by V. m The value is 22.4 L / mol. Additionally, D indicates the sample dilution factor.

[0079] like Figure 4 As shown, in some embodiments, the present invention systematically organized and analyzed 517 sets of experimental result datasets, establishing a mapping relationship between light absorptivity (RLA), temperature (Temp), absolute humidity (AH), and atmospheric pressure (P) and light absorptivity. This model constructs a mapping from NDIR-derived light absorptivity (RLA) to gas chromatograph (GC) verification concentration through a four-dimensional feature space defined by RLA, temperature (Temp), atmospheric pressure (P), and absolute humidity (AH). By explicitly considering the interdependence among these variables, the total hydrocarbon concentration C... HC Represented as:

[0080] C HC =f(RLA,Temp,AH,P)

[0081] In the formula, f is the mapping function of the GRU-Attention neural network model. This method achieves robust concentration correction while maintaining compatibility with edge deployment constraints in industrial environments.

[0082] Adopting such Figure 4 The GRU-Attention neural network model architecture shown is used for hydrocarbon mixture analysis. The GRU-Attention neural network model is a core component of the NDIR hydrocarbon concentration correction method. This model establishes the nonlinear effects of the sensor response values ​​measured by NDIR, temperature (Temp), air pressure (P), calculated absolute humidity (AH), and light absorbance ratio, as well as the total hydrocarbon concentration (C) measured by gas chromatography. HC The mapping relationship between them. The training dataset includes multiple labeled samples, mapping measurements of light absorbance ratio (RLA), temperature (Temp), absolute humidity (AH), and atmospheric pressure (P) to the corresponding gas chromatographically validated total hydrocarbon concentration (C). HC pair.

[0083] In some implementations, the GRU-Attention neural network model sets the time step of the GRU layer to an integer multiple of the gas sampling frequency and sets the number of hidden layer neurons to three times the dimension of the input features, thus balancing computational efficiency and fitting ability.

[0084] In the GRU-Attention neural network model, the attention mechanism layer uses multi-head attention to focus on temperature (Temp), absolute humidity (AH), atmospheric pressure (P), and light absorptivity (RLA) on the total hydrocarbon concentration (C). HC Different influence weights are used, and residual connections are added to alleviate gradient vanishing and enhance the stability of deep training.

[0085] The attention mechanism layer introduces feature grouping, dividing the input features into an environmental group (including temperature (Temp), absolute humidity (AH), and atmospheric pressure (P)) and an optical group (including light absorptivity (RLA)). The environmental group uses a channel attention mechanism to calculate weights, while the optical group uses a temporal attention mechanism. These two weights are dynamically integrated through a gated fusion unit to output the final attention score. By more accurately capturing the differential dependencies between features, key time points, and dynamic weight integration, the model can more accurately fit the complex physicochemical processes of gas concentration changes.

[0086] Reference values ​​from the test dataset and the model's prediction performance are as follows: Figure 5As shown, this invention organizes the collected 517 sets of experimental results datasets according to the total hydrocarbon concentration, allocating the initial 415 sets of data as the training dataset for the GRU attention neural network model. Subsequently, this invention uses the final 102 sets of data as the prediction dataset to evaluate the model's performance. The evaluation metrics for model performance are the mean relative error (MRE) and the coefficient of determination (R²). 2 ) and standard deviation (SD).

[0087] The experimental gas samples were taken from an oil depot belonging to Sinopec in Henan Province, and the measurements were conducted at Sinopec Henan Petroleum Branch. The data collection process is as follows: Figure 6 As shown. A total of 517 datasets were collected during the entire experiment to train and test the model of this invention. In these 517 datasets, the total hydrocarbon concentration C... HC From 150 to 5000 mg / m 3 Varying. Temperature varies between -12℃ and 43℃, and absolute humidity ranges from 0.8 to 8.8 g / m³. 3 The pressure fluctuates between 100.3 and 101.2 kPa, and the sensor output signal is measured between 0.01 and 0.22. The laboratory gas chromatography FID value is used as a reference value.

[0088] This invention systematically organized and analyzed 517 sets of experimental result datasets, establishing the relationship between the uncalibrated sensor output signal and the total hydrocarbon concentration value, such as... Figure 7 As shown. From Figure 7 It can be seen that there is a statistically significant positive correlation between the sensor output signal and the total hydrocarbon concentration.

[0089] Meanwhile, this invention employs ordinary least squares (OLS) multiple regression, support vector machine regression (SVR), recurrent neural network (RNN), and gated recurrent unit (GRU) models to evaluate the performance of the actual and predicted values ​​on the test dataset. Comparative analysis is as follows: Figure 8 As shown in Table 1, the GRU neural network model demonstrates significant advantages. Compared to OLS, the error of this model is reduced by 94.3%. The performance of this model is significantly improved after introducing the attention mechanism.

[0090] Table 1 Prediction results of different models

[0091]

[0092] This invention marks the first successful application of NDIR technology for high-precision real-time online total hydrocarbon monitoring in industrial environments, overcoming key challenges posed by environmental fluctuations and multi-component interference. It is also the first to utilize NDIR technology for real-time hydrocarbon emission monitoring, overcoming the limitations of traditional methods such as gas chromatography and catalytic conversion. Furthermore, a model based on a gated recirculating unit (GRU) was constructed to establish a mapping relationship between temperature, humidity, air pressure, sensor response, and total hydrocarbon concentration. Considering the relatively limited size of the dataset, an attention mechanism commonly used in few-shot learning was introduced to enhance the model's generalization ability.

[0093] This invention utilizes a GRU-Attention neural network model to correct for complex nonlinear variations introduced by environmental factors and the proportions of hydrocarbon mixture components. Total hydrocarbon data obtained through gas chromatography is used, and this algorithm is applied to correct the measurement results of the NDIR detection module within a total hydrocarbon concentration range of 150–5000 mg / m³. 3 Temperature range: -12℃ to 43℃; absolute humidity range: 0.8 to 8.8 g / m³ 3 Under atmospheric pressure conditions of 100.3–101.2 kPa, the model's average correction error is 1.7%. This advancement provides crucial technical support for expanding the application of NDIR technology in the detection of atmospheric hydrocarbon gaseous pollutants. The model's training time is approximately one minute, and its prediction response time is less than one second. By simultaneously addressing persistent issues in NDIR applications—spectral interference, compositional variations, and environmental instability—it establishes an effective paradigm for industrial hydrocarbon monitoring, significantly improving the accuracy and adaptability of optical gas sensing technology.

[0094] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications, equivalent substitutions, and improvements made by those skilled in the art to the above embodiments without departing from the scope of the technical solution of the present invention, based on the technical essence of the present invention, shall still fall within the protection scope of the technical solution of the present invention.

Claims

1. A method for online detection of total hydrocarbon concentration based on NDIR, characterized in that, include: The temperature (Temp), relative humidity (RH), and air pressure (P) of the gas sample are collected using the NDIR detection module, and the absolute humidity (AH) and light absorptivity (RLA) are calculated. The total hydrocarbon concentration (C) of a gas sample was measured using a gas chromatograph. HC ; A GRU-Attention neural network model was constructed and trained, and the relationships between light absorptivity (RLA), temperature (Temp), absolute humidity (AH), air pressure (P), and total hydrocarbon concentration (C) were established based on gas samples of different concentrations. HC The mapping relationship between them; based on the obtained mapping relationship, the total hydrocarbon concentration C of the gas to be measured is calculated based on the data collected by the NDIR detection module. HC .

2. The method for online detection of total hydrocarbon concentration based on NDIR according to claim 1, characterized in that: In the GRU-Attention neural network model, the time step of the GRU layer is set to an integer multiple of the gas sampling frequency, and the number of neurons in the hidden layer is 2 to 4 times the dimension of the input features.

3. The method for online detection of total hydrocarbon concentration based on NDIR according to claim 1, characterized in that: In the GRU-Attention neural network model, the attention mechanism layer uses multi-head attention to focus on temperature (Temp), absolute humidity (AH), atmospheric pressure (P), and light absorptivity (RLA) on the total hydrocarbon concentration (C). HC Different influence weights are assigned, and residual connections are added.

4. The method for online detection of total hydrocarbon concentration based on NDIR according to claim 3, characterized in that: The attention mechanism layer introduces feature grouping, dividing the input features into an environmental group including temperature (Temp), absolute humidity (AH), and air pressure (P), and an optical group including light absorption ratio (RLA). The environmental group uses a channel attention mechanism to calculate weights, while the optical group uses a temporal attention mechanism. The two weights are dynamically integrated through a gating fusion unit to output the final attention score.

5. The method for online detection of total hydrocarbon concentration based on NDIR according to claim 1, characterized in that: The formula for calculating the absolute humidity AH is: Where R represents the universal gas constant, A, B, and C represent the Antoine coefficients, and T(k) and T(°C) represent the temperatures on the Kelvin and Celsius scales, respectively. RH represents the molar mass of water, and RH represents relative humidity.

6. The method for online detection of total hydrocarbon concentration based on NDIR according to claim 1, characterized in that: The formula for calculating the light absorptivity ratio (RLA) is as follows: Where U is the voltage value of the measurement channel, U0 is the measured value of the reference channel, and ε i q is the absorption coefficient. i Here, C represents the component distribution, C represents the gas concentration, and L represents the optical path length.

7. The method for online detection of total hydrocarbon concentration based on NDIR according to claim 1, characterized in that: The total hydrocarbon concentration C of the gas sample was measured using a gas chromatograph. HC Specifically: Gas chromatography was used to separate components of a vaporized sample based on differences in compound polarity or boiling point. The resulting electrical signal was output via an FID detector and converted into concentration data. The total hydrocarbon peak area was subtracted from the oxygen peak area to obtain the total hydrocarbon concentration (C). HC , is represented as: in, This indicates the volume fraction of total hydrocarbon concentration in the sample. V represents the molar mass of methane. m The value represents the molar volume of the gas, and D represents the dilution factor of the sample.

8. An online total hydrocarbon concentration detection system based on NDIR, characterized in that: Includes an NDIR detection module, a gas chromatograph, a processing unit, and a communication unit: The NDIR detection module includes a gas micropump, a temperature and humidity sensor, and an NDIR sensor with built-in temperature and pressure sensors. It is used to collect the temperature (Temp), relative humidity (RH), and pressure (P) of the gas sample, and to calculate the absolute humidity (AH) and light absorption ratio (RLA). A gas chromatograph, comprising an injection system, a separation system, a temperature control system, a gas path system, and a detection system, is used to measure the total hydrocarbon concentration C of the gas sample. HC ; The processing unit is used to deploy a trained GRU-Attention neural network model. It receives light absorptivity (RLA), temperature (Temp), absolute humidity (AH), and atmospheric pressure (P) collected by the NDIR detection module and after conditioning and analog-to-digital conversion. After inputting these data into the GRU-Attention neural network model, it outputs the total hydrocarbon concentration (C). HC ; Communication unit, used to transmit total hydrocarbon concentration C HC Temperature (Temp), absolute humidity (AH), air pressure (P), and light absorption ratio (RLA) are transmitted to the host computer to achieve real-time concentration monitoring.

9. An electronic device, characterized in that, include: The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements an online method for detecting total hydrocarbon concentration based on NDIR as described in any one of claims 1-7.

10. A computer-readable storage medium storing a computer program that causes a computer to perform an online detection method for total hydrocarbon concentration based on NDIR as described in any one of claims 1-7.