A temperature and humidity compensation method and system for a gas sensor

By obtaining the temperature, humidity and concentration timing data of the gas sensor, establishing a quantification model for cross-influence of temperature and humidity and performing dynamic switching compensation, the problem of temperature and humidity cross-interference of the gas sensor is solved, and efficient gas concentration monitoring is achieved.

CN120217720BActive Publication Date: 2025-08-29YANTAI UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510683601.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-08-29
Estimated Expiration
2045-05-26

AI Technical Summary

Technical Problem

The temperature and humidity compensation method of existing gas sensors cannot effectively deal with temperature and humidity cross-interference, resulting in measurement errors. The existing methods are costly and time-consuming to train, making it difficult to adapt to different environmental conditions.

Method used

The timing data of the temperature, humidity and gas concentration of the gas sensor are obtained through equal time steps, outlier values ​​are eliminated and preprocessed, a quantification model of temperature and humidity cross-influence is established, a random search is used to optimize the model parameters, and a dynamic switching compensation mode is used for filtering and compensation.

Benefits of technology

It effectively reduces the parameter calibration time, improves the accuracy and reliability of gas concentration monitoring, adapts to the real-time and noise immunity requirements in complex environments, and avoids compensation lag or over-correction problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120217720B_ABST
    Figure CN120217720B_ABST
Patent Text Reader

Abstract

The present invention provides a temperature and humidity compensation method and system for a gas sensor, relating to the technical field of temperature and humidity compensation methods. The method comprises simultaneously acquiring time series data of the temperature and humidity of the space in which the gas sensor is located, and the gas concentration output by the gas sensor, to obtain a temperature input coefficient and a humidity input coefficient; establishing a temperature and humidity cross-effect quantification model to obtain a gas concentration error caused by temperature and humidity changes in the gas sensor; filtering the gas concentration data output by the sensor before compensation, constructing a weighted comprehensive index of temperature and humidity changes, and using a dynamic switching compensation mode to compensate for the filtered gas concentration data. The temperature and humidity cross-effect quantification model is established, and the temperature input coefficient and humidity input coefficient are input into the established temperature and humidity cross-effect quantification model to obtain a gas concentration error. Based on the gas concentration error, a dynamic switching compensation mode is used according to changes in ambient temperature and humidity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of temperature and humidity compensation methods, and in particular to a temperature and humidity compensation method and system for a gas sensor. Background Art

[0002] In gas sensor applications, crosstalk between temperature and humidity is a major factor contributing to measurement errors. Traditional compensation methods typically rely on a single linear correction model for either temperature or humidity, ignoring the nonlinear coupling effect between the two. Furthermore, they rely on empirical formulas with fixed parameters, making them difficult to adapt to diverse environmental conditions.

[0003] Prior art publication CN114461621A discloses a method for determining gas concentration compensation values ​​based on a BP neural network algorithm. This method inputs the gas sensor's measured values, the current ambient temperature, and the current ambient humidity into a BP neural network optimized by an artificial bee colony algorithm to obtain the gas concentration compensation value. However, this method has high training costs and is time-consuming. It cannot specifically suppress temperature and humidity interference and does not consider the temperature-humidity coupling effect. If the input is abnormal, an abnormal compensation value may be output. Therefore, it is necessary to obtain time series data of temperature, humidity, and gas concentration at equal time steps, remove outliers, and preprocess them. A temperature and humidity cross-quantization model must be established, and the temperature and humidity input coefficients must be input into the model. A random search is then used for parameter optimization, making the model more efficient and less prone to local optimality. Furthermore, the compensation process uses dynamic switching compensation modes, meeting the real-time and noise immunity requirements in a balanced dynamic environment. Furthermore, compensation lag or overcorrection are less likely to occur in scenarios with sudden temperature and humidity changes, thereby improving the accuracy and reliability of gas concentration monitoring.

[0004] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not form the prior art that is already known to a person of ordinary skill in the art. Summary of the Invention

[0005] The object of the present invention is to provide a temperature and humidity compensation method and system for a gas sensor to solve the problems raised in the above background technology.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] A temperature and humidity compensation method for a gas sensor, comprising the following steps:

[0008] S1: Acquire the time series data of the temperature, humidity, and original gas concentration output by the gas sensor in the space where the gas sensor is located at the same time step, remove outliers from the time series data of gas concentration, preprocess the time series data of temperature and humidity, and obtain the temperature input coefficient and humidity input coefficient;

[0009] S2: Establish a quantitative model for the cross-effect of temperature and humidity. Input the temperature input coefficient and humidity input coefficient into the established quantitative model to obtain the gas concentration error caused by temperature and humidity changes in the gas sensor. Use random search to optimize the model parameters.

[0010] S3: Filter the gas concentration data output by the sensor before compensation, and construct a weighted comprehensive index of temperature and humidity changes. Based on the optimized gas concentration error model, dynamically switch the compensation mode to compensate for the filtered gas concentration data.

[0011] Furthermore, the method for removing outliers is:

[0012] Set the sliding window size to , calculate the median concentration in the sliding window, and the absolute deviation of the median gas concentration in the window, set the abnormality judgment threshold, and set the screening condition as ;

[0013] in, represents the number of time steps; represents the time step position; express Time step anomaly determination threshold; express The standard deviation corresponding to the median absolute deviation of the gas concentration at the time step; express median gas concentration at the time step;

[0014] like , further processing is performed according to the isolated abnormal points; otherwise, the original gas concentration data at that time point is retained;

[0015] For isolated outliers, there are:

[0016] ;

[0017] in, and Respectively Time step and Gas concentration value at the time step; express Concentration correction value for the location.

[0018] Furthermore, set the filter condition as The specific process is:

[0019] get Sequence of gas concentrations at time steps: ,

[0020] in, Relative to the current time step , No. Gas concentration value at a time point;

[0021] Arrange all data points in the window in ascending order to obtain an ordered sequence:

[0022] ;

[0023] ;

[0024] in, represents the median gas concentration; Indicates that the gas concentration is in ascending order The concentration value of the location; represents the median concentration within the time window; Indicates the sequence number index;

[0025] based on ,get The absolute deviation sequence of gas concentration at the position: ,

[0026] Calculate the absolute difference from the median for each window data point:

[0027] ;

[0028] in, Represents the position index of the gas concentration sequence within the window; Indicates the The absolute deviation of each data point from the median; express The concentration value at

[0029] Arrange the absolute deviations in ascending order to obtain an ordered sequence:

[0030] ;

[0031] Extract the median absolute deviation:

[0032] ;

[0033] in, represents the median absolute deviation of gas concentration; Indicates ascending order Absolute deviation of gas concentration at ; represents the median absolute deviation of the concentration within the time window;

[0034] Convert the median absolute deviation of gas concentrations to standard deviation:

[0035] ;

[0036] in, represents the standard deviation of the median gas concentration;

[0037] Define the dynamic threshold for abnormality determination:

[0038] ;

[0039] in, Indicates a dynamic threshold.

[0040] Furthermore, the time series data of temperature and humidity are preprocessed to obtain the temperature input coefficient and humidity input coefficient of each time step based on the following formula;

[0041] ;

[0042] ;

[0043] in, Represents the time step The original measured value of temperature; Represents the time step The raw humidity measurement value; Indicates the minimum reference value of temperature; represents the temperature input coefficient; represents the humidity input coefficient; Represents the humidity nonlinear scaling factor.

[0044] Furthermore, the equation for the quantitative model of the cross-effect of temperature and humidity is:

[0045] ;

[0046] in, The weight coefficient representing the temperature change rate; Indicates temperature and humidity compensation concentration; Represents the temperature and humidity synergy weight coefficient.

[0047] Furthermore, random search is used to optimize the model parameters. The specific steps are as follows:

[0048] right Random sampling, generating Group candidate parameters

[0049] ;

[0050] in, Indicates the number of sampling times; Indicates the total number of samples; express The value range is Continuous uniform distribution of express The value range is Continuous uniform distribution of

[0051] For each set of data , calculate the mean square error :

[0052] ;

[0053] in,

[0054] ;

[0055] Indicates the Group Corresponding temperature and humidity compensation concentration; represents the mean square error; Indicates the Group Candidate parameters for Indicates the Group Candidate parameters for; express and Parameter combination index; Indicates the actual observed concentration change value; Indicates the total number of gas concentration samples;

[0056] Choose the parameter combination with the smallest mean squared error:

[0057] ;

[0058] express The optimal parameters of express The optimal parameters of

[0059] The optimized model is:

[0060] ;

[0061] Indicates the optimized temperature and humidity compensation concentration.

[0062] Furthermore, the gas concentration data output by the sensor before compensation is filtered using an FIR filter. The original output concentration of the sensor Perform filtering:

[0063] ;

[0064] in,

[0065] ;

[0066] in, Represents the time step after filtering The sensor output concentration; Represents the filter index; Represents the FIR filter coefficients; Represents the time step The original output concentration of the sensor; Indicates the filter order; Indicates the filter cutoff frequency; Represents the filter tap index; represents the window shape parameters; represents the zero-order modified Bessel function.

[0067] Furthermore, the dynamic switching compensation mode includes calculating the rate of change of temperature and humidity, and setting the time window length to :

[0068] ;

[0069] ;

[0070] in, represents the average absolute fluctuation rate of temperature change; Represents the time step Temperature value; Represents the time step Temperature value; Indicates the average absolute fluctuation rate of humidity change; Represents the time step Humidity value; Represents the time step Humidity value; Indicates the length of the time window;

[0071] Construct a weighted comprehensive index of temperature and humidity changes:

[0072] ;

[0073] Among them, according to the sensor specifications, you can set ; ; Represents the weighted comprehensive index of temperature and humidity; Indicates the maximum reference value of temperature change rate; Indicates the maximum reference value of humidity change rate; represents the temperature sensitivity coefficient; Indicates the humidity sensitivity coefficient;

[0074] if , then the compensation algorithm is ;

[0075] in, Represents the time step Compensated concentration;

[0076] if , then the compensation algorithm is ;in, ; Represents the time step Humidity value; Represents the time step Humidity value; Indicates the adjustment weight coefficient of humidity deviation; represents the intercept term; represents the first-order humidity hysteresis coefficient; represents the second-order humidity hysteresis coefficient; Indicates the preset reference temperature; represents the temperature scaling factor;

[0077] if , then the compensation algorithm is:

[0078] ;

[0079] in, , ;

[0080] in, represents the dynamic weight parameter; Indicates that at time step Compensation concentration value; Indicates that at time step Compensation concentration value; Indicates that at time step Concentration compensation value; Indicates that at time step Concentration compensation value.

[0081] The present invention further provides a temperature and humidity compensation system for a gas sensor, the system being used to perform the above-mentioned compensation method, comprising:

[0082] The data acquisition module simultaneously obtains the time series data of the temperature, humidity and gas concentration output by the gas sensor in the space where the gas sensor is located at the same time step, removes outliers from the time series data of gas concentration, pre-processes the time series data of temperature and humidity, and obtains the temperature input coefficient and humidity input coefficient;

[0083] The state compensation module is used to establish a quantitative model of the cross-effect of temperature and humidity. The temperature input coefficient and humidity input coefficient are input into the established quantitative model of the cross-effect of temperature and humidity to obtain the gas concentration error caused by the temperature and humidity changes of the gas sensor, and the model parameters are optimized using random search.

[0084] The dynamic adjustment module is used to filter the gas concentration data output by the sensor before compensation and construct a weighted comprehensive index of temperature and humidity changes. Based on the optimized gas concentration error model, the filtered gas concentration data is compensated by dynamically switching the compensation mode.

[0085] Compared with the prior art, the present invention has the following beneficial effects:

[0086] The temperature, humidity and time series data of the space where the gas sensor is located and the original gas concentration output by the gas sensor are obtained at the same time step, and the outliers of the time series data of the gas concentration are eliminated to effectively distinguish the real concentration fluctuations and avoid the outliers from contaminating the input of the subsequent model. The time series data of temperature and humidity are preprocessed, and the original data are mapped into the separable feature space. A temperature and humidity cross-influence quantification model is established to quantify the contribution of the synergistic effect of temperature and humidity to the concentration error. The temperature input coefficient and the humidity input coefficient are input into the established temperature and humidity cross-influence quantification model to obtain the gas concentration error caused by the temperature and humidity changes of the gas sensor, and the model parameters are optimized by random search to effectively reduce the parameter calibration time. The gas concentration data output by the sensor before compensation is filtered, and a weighted comprehensive index of temperature and humidity changes is constructed so that the compensation mode automatically switches with the environmental stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] Figure 1 Schematic diagram of the flow of the temperature and humidity compensation method for the gas sensor of the present invention.

[0088] Figure 2 It is a schematic block diagram of the temperature and humidity compensation system of the gas sensor in the present invention. DETAILED DESCRIPTION

[0089] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to specific embodiments.

[0090] It should be noted that, unless otherwise defined, the technical or scientific terms used in the present invention should have the usual meanings understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative position relationships. When the absolute position of the object being described changes, the relative position relationship may also change accordingly.

[0091] Example:

[0092] See also Figure 1 , the present invention provides a technical solution:

[0093] A temperature and humidity compensation method for a gas sensor, comprising the following steps:

[0094] S1: Acquire the time series data of the temperature, humidity, and original gas concentration output by the gas sensor in the space where the gas sensor is located at the same time step, remove outliers from the time series data of gas concentration, preprocess the time series data of temperature and humidity, and obtain the temperature input coefficient and humidity input coefficient;

[0095] The method for removing the outliers is:

[0096] Set the sliding window size to , calculate the median concentration in the sliding window, and the absolute deviation of the median gas concentration in the window, set the abnormality judgment threshold, and set the screening condition as ;

[0097] in, represents the number of time steps; represents the time step position; express Time step anomaly determination threshold; express The standard deviation corresponding to the median absolute deviation of the gas concentration at the time step; express median gas concentration at the time step;

[0098] like , further processing is performed according to the isolated abnormal points; otherwise, the original gas concentration data at that time point is retained;

[0099] For isolated outliers, there are:

[0100] ;

[0101] in, and Respectively Time step and Gas concentration value at the time step; express Concentration correction value for the location.

[0102] The setting filtering conditions are The specific process is:

[0103] get Sequence of gas concentrations at time steps: ,

[0104] in, Relative to the current time step , No. Gas concentration value at a time point;

[0105] When the sampling points in the sliding window are incomplete, the gas concentration value in the middle of the window can be copied as the gas concentration sampling points on both sides, so as to obtain the gas concentration sequence in the complete time window;

[0106] Arrange all data points in the window in ascending order to obtain an ordered sequence:

[0107] ;

[0108] ;

[0109] in, represents the median gas concentration; Indicates that the gas concentration is in ascending order The concentration value of the location; represents the median concentration within the time window; Indicates the sequence number index;

[0110] based on ,get The absolute deviation sequence of gas concentration at the position: ,

[0111] Calculate the absolute difference from the median for each window data point:

[0112] ;

[0113] in, Represents the position index of the gas concentration sequence within the window; Indicates the The absolute deviation of each data point from the median; express The concentration value at

[0114] Arrange the absolute deviations in ascending order to obtain an ordered sequence:

[0115] ;

[0116] Extract the median absolute deviation:

[0117] ;

[0118] in, represents the median absolute deviation of gas concentration; Indicates ascending order Absolute deviation of gas concentration at ; represents the median absolute deviation of the concentration within the time window;

[0119] Convert the median absolute deviation of gas concentrations to standard deviation:

[0120] ;

[0121] in, represents the standard deviation of the median gas concentration;

[0122] Define the dynamic threshold for abnormality determination:

[0123] ;

[0124] in, Indicates a dynamic threshold.

[0125] The temperature and humidity time series data are preprocessed to obtain the temperature input coefficient and humidity input coefficient of each time step based on the following formula;

[0126] ;

[0127] ;

[0128] in, Represents the time step The original measured value of temperature; Represents the time step The raw humidity measurement value; Indicates the minimum reference value of temperature; represents the temperature input coefficient; represents the humidity input coefficient; Represents the humidity nonlinear scaling factor.

[0129] in, It is the temperature input coefficient after nonlinear transformation, which reflects the logarithmic normalized response of temperature to sensor sensitivity. By introducing the natural logarithmic function, the original Mapped into non-negative continuous space, when near hour, The response to small temperature rise is more significant, avoiding low temperature leakage compensation; at high temperature, The growth rate slows down, which fits the high temperature saturation characteristics of the sensor, and the compensation amount converges gradually; For each additional unit, The decreasing increment reflects the marginal decreasing effect of temperature on the sensor; As the temperature compensation baseline, it eliminates interference from invalid temperature zones; and There is a strict positive correlation, but the nonlinear strength decreases with increasing temperature.

[0130] in, It is the humidity input coefficient after exponential transformation, which reflects the nonlinear saturation mapping of humidity to sensor response. Compress to In the interval, when As it approaches positive infinity, tends to 1, suppressing overcompensation in high humidity areas; parameter Adjust humidity sensitivity, when parameter When smaller, and Approximate linear relationship, when the parameter When the humidity is large, the change in humidity has almost no effect on the compensation amount, and automatic truncation is achieved; the independent variable and The two are strictly positively correlated through an exponential decay function. When increasing, The speed increase changes from fast to slow, which is consistent with the gradual interference of humidity on the sensor.

[0131] S2: Establish a quantitative model for the cross-effect of temperature and humidity. Input the temperature input coefficient and humidity input coefficient into the established quantitative model to obtain the gas concentration error caused by temperature and humidity changes in the gas sensor. Use random search to optimize the model parameters.

[0132] The equation of the temperature and humidity cross-effect quantitative model is:

[0133] ;

[0134] in, The weight coefficient representing the temperature change rate; Indicates temperature and humidity compensation concentration; Represents the temperature and humidity synergy weight coefficient.

[0135] In the above model formula, the dependent variable Indicates the concentration compensation amount of the gas sensor caused by changes in ambient temperature and humidity. By decoupling the independent effects of temperature and humidity and the correction value that needs to be superimposed after the synergistic effect, the compensation accuracy in complex environments is significantly improved. and They are the temperature and humidity characteristic coefficients after nonlinear preprocessing, and the two are superimposed by linear weights Quantify the independent effects of temperature and humidity, and then use the synergistic effect term The nonlinear amplification and inhibition effects caused by the combination of the two are Adjust the primary and secondary weights of temperature and humidity, Controlling the intensity of synergy, and and There is a positive correlation between the two. When the temperature and humidity increase, the compensation amount increases. However, when When it is negative and its absolute value is large enough, such as in extremely low or high temperature scenarios, the synergistic term may weaken the compensation amount and form a local negative correlation. This dynamic relationship enables the model to adaptively suppress overcompensation and maintain stability in complex environments.

[0136] The random search optimizes the model parameters, and the specific steps are as follows:

[0137] right Random sampling, generating Group candidate parameters

[0138] ;

[0139] in, Indicates the number of sampling times; Indicates the total number of samples; express The value range is Continuous uniform distribution of express The value range is Continuous uniform distribution of

[0140] For each set of data , calculate the mean square error :

[0141] ;

[0142] in,

[0143] ;

[0144] Indicates the Group Corresponding temperature and humidity compensation concentration; represents the mean square error; Indicates the Group Candidate parameters for Indicates the Group Candidate parameters for; express and Parameter combination index; Indicates the actual observed concentration change value; Indicates the total number of gas concentration samples;

[0145] Choose the parameter combination with the smallest mean squared error:

[0146] ;

[0147] express The optimal parameters of express The optimal parameters of

[0148] The optimized model is:

[0149] ;

[0150] Indicates the optimized temperature and humidity compensation concentration.

[0151] S3: Filter the gas concentration data output by the sensor before compensation, and construct a weighted comprehensive index of temperature and humidity changes. Based on the optimized gas concentration error model, dynamically switch the compensation mode to compensate for the filtered gas concentration data.

[0152] The gas concentration data output by the sensor before compensation is filtered by using an FIR filter. The original output concentration of the sensor Perform filtering:

[0153] ;

[0154] in

[0155] ;

[0156] in, Represents the time step after filtering The sensor output concentration; Represents the filter index; Represents the FIR filter coefficients; Represents the time step The original output concentration of the sensor; Indicates the filter order; Indicates the filter cutoff frequency; Represents the filter tap index; represents the window shape parameters; represents the zero-order modified Bessel function.

[0157] The dynamic switching compensation mode includes calculating the rate of change of temperature and humidity and setting the time window length to :

[0158] ;

[0159] ;

[0160] in, represents the average absolute fluctuation rate of temperature change; Represents the time step Temperature value; Represents the time step Temperature value; Indicates the average absolute fluctuation rate of humidity change; Represents the time step Humidity value; Represents the time step Humidity value; Indicates the length of the time window;

[0161] Construct a weighted comprehensive index of temperature and humidity changes:

[0162] ;

[0163] Among them, according to the sensor specifications, you can set ; ; Represents the weighted comprehensive index of temperature and humidity; Indicates the maximum reference value of temperature change rate; Indicates the maximum reference value of humidity change rate; represents the temperature sensitivity coefficient; Indicates the humidity sensitivity coefficient;

[0164] if , then the compensation algorithm is ;

[0165] in, Represents the time step Compensated concentration;

[0166] if , then the compensation algorithm is ;in, ; Represents the time step Humidity value; Represents the time step Humidity value; Indicates the adjustment weight coefficient of humidity deviation; represents the intercept term; represents the first-order humidity hysteresis coefficient; represents the second-order humidity hysteresis coefficient; Indicates the preset reference temperature; represents the temperature scaling factor;

[0167] In the above formula, the error function Temperature deviation from reference value The nonlinear response of Type nonlinear modulation, when When , the error function approaches , compensation intensity saturation; Used to control the temperature sensitive bandwidth; solves the problem of sensor sensitivity drifting with temperature, such as when the sensitivity decreases at high temperature, the denominator increases to reduce the output value; based on the current humidity With predicted humidity The residual of the compensation method can eliminate the transient interference caused by humidity mutation. The concentration error after compensation is lower than that of the traditional fixed threshold method, and the response delay to the step change of temperature and humidity is shortened to within 3 seconds. Capture humidity change trends and trigger compensation when the actual humidity deviates from the predicted value; Adjust the humidity compensation sensitivity; when hour, The value is positive, the denominator increases, The compensation value is reduced, which suppresses the attenuation of high temperature sensitivity. On the contrary, the compensation value is reversed at low temperature, and the faster the temperature change speed, the more stable the correlation is, thus avoiding oscillation. When the humidity rises abnormally, the compensation item Make Reduced, offsetting the humidity interference; if Stable, that is , the compensation amount tends to zero; and The weight determines the inertia of humidity change.

[0168] if , then the compensation algorithm is:

[0169] ;

[0170] in, , ;

[0171] in, represents the dynamic weight parameter; Indicates that at time step Compensation concentration value; Indicates that at time step Compensation concentration value; Indicates that at time step Concentration compensation value; Indicates that at time step Concentration compensation value.

[0172] In the above formula, the weight Balance the current time step filter Second-order extrapolation term with historical correction value , When it is high, it relies on the current data and suppresses high-frequency noise. When the concentration is low, it relies on the historical term and uses the extrapolation term to capture the slow change trend of the concentration, thus reducing the response delay. Dynamic parameter adjustment , realizing the free switching between stable and sensitive modes; the second-order extrapolation term Equivalent to linear prediction, historical item ratio Up to 40%, used to smooth slowly varying signals; Will Compress to , dynamic adjustment ,when As it approaches positive infinity, Tends to 0.6, strengthen the anti-interference of historical time step data, when When it approaches 0, the scene is relatively stable. As it approaches negative infinity, tends to 0.8, giving priority to responding to the current time step signal; if , that is, as the concentration increases, the extrapolation term further increases , which is a positive feedback; if , that is, the concentration decreases and the extrapolation term decreases , accelerating trend convergence, showing negative inhibition; temperature and humidity weighted comprehensive index With weight Negative correlation, when When it increases, decreases, the influence of the historical term increases, and a dynamic damping effect is formed.

[0173] See also Figure 2 The present invention further provides a temperature and humidity compensation system for a gas sensor, the system being configured to execute the compensation method according to any one of claims 1 to 8, comprising:

[0174] The data acquisition module simultaneously obtains the time series data of the temperature, humidity and gas concentration output by the gas sensor in the space where the gas sensor is located at the same time step, removes outliers from the time series data of gas concentration, pre-processes the time series data of temperature and humidity, and obtains the temperature input coefficient and humidity input coefficient;

[0175] The state compensation module is used to establish a quantitative model of the cross-effect of temperature and humidity. The temperature input coefficient and humidity input coefficient are input into the established quantitative model of the cross-effect of temperature and humidity to obtain the gas concentration error caused by the temperature and humidity changes of the gas sensor, and the model parameters are optimized using random search.

[0176] The dynamic adjustment module is used to filter the gas concentration data output by the sensor before compensation and construct a weighted comprehensive index of temperature and humidity changes. Based on the optimized gas concentration error model, the filtered gas concentration data is compensated by dynamically switching the compensation mode.

[0177] The above formulas are all dimensionless and numerical calculations. The formulas are obtained by collecting a large amount of data and performing software simulation to obtain the most recent real situation. The preset parameters in the formulas are set by technicians in this field according to actual conditions.

[0178] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraints of the technical solution.

[0179] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, and may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment as needed.

[0180] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.

Claims

1. A temperature and humidity compensation method for a gas sensor, characterized in that: include: S1: Acquire the time series data of the temperature, humidity, and original gas concentration output by the gas sensor in the space where the gas sensor is located at the same time step, remove outliers from the time series data of gas concentration, preprocess the time series data of temperature and humidity, and obtain the temperature input coefficient and humidity input coefficient; S2: Establish a quantitative model for the cross-effect of temperature and humidity. Input the temperature input coefficient and humidity input coefficient into the established quantitative model to obtain the gas concentration error caused by temperature and humidity changes in the gas sensor. Use random search to optimize the model parameters. S3: Filter the gas concentration data output by the sensor before compensation and construct a weighted comprehensive index of temperature and humidity changes. The weighted comprehensive index is used as a screening condition for dynamic compensation switching. Based on the optimized gas concentration error model, the filtered gas concentration data is compensated using a dynamic switching compensation mode. The equation of the temperature and humidity cross-effect quantitative model is: Where λ represents the weight coefficient of temperature change rate; ΔC(t) represents the temperature and humidity compensation concentration; η represents the temperature and humidity synergy weight coefficient; represents the temperature input coefficient; represents the humidity input coefficient; The dynamic switching compensation mode includes calculating the rate of change of temperature and humidity and setting the time window length to K: Among them, R T represents the average absolute fluctuation rate of temperature change; T t-i Indicates the temperature value at time step ti; T t-i-1 represents the temperature value at time step ti-1; R H Represents the average absolute fluctuation rate of humidity change; H t-i Represents the humidity value at time step ti; H t-i-1 represents the humidity value at time step ti-1; K represents the length of the time window; Construct a weighted comprehensive index of temperature and humidity changes: Among them, R can be set according to the sensor specifications T,max =3℃ / min; R H,max =10%RH / min; J represents the weighted comprehensive index of temperature and humidity; R T,max Indicates the maximum reference value of temperature change rate; R H,max Indicates the maximum reference value of humidity change rate; α indicates the temperature sensitivity coefficient; γ indicates the humidity sensitivity coefficient; If J<0.5, the compensation algorithm is Among them, C corr (t) represents the concentration after compensation at time step t; represents the sensor output concentration at time step t after filtering; ΔC * (t) represents the optimized temperature and humidity compensation concentration; If 0.5≤J<0.8, the compensation algorithm is in, H(t) represents the humidity value at time step t; H(t-2) represents the humidity value at time step t-2; μ represents the adjustment weight coefficient of humidity deviation; β0 represents the intercept term; β1 represents the first-order humidity hysteresis coefficient; β2 represents the second-order humidity hysteresis coefficient; T ref represents the preset reference temperature; θ represents the temperature scaling factor; T(t) represents the original temperature measurement value at time step t; If J ≥ 0.8, the compensation algorithm is: Where, w = 0.7-0.1·tanh(5J), w represents the dynamic weight parameter; C corr (t) represents the compensation concentration value at time step t; C corr (t-1) represents the compensation concentration value at time step t-1; C corr (t-2) represents the concentration compensation value at time step t-2; C corr (t) represents the concentration compensation value at time step t.

2. A temperature and humidity compensation method for a gas sensor according to claim 1, characterized in that: The method for removing the outliers is: Set the sliding window size to W = 2k + 1, calculate the median concentration in the sliding window, and the absolute deviation of the median gas concentration in the window, set the abnormality judgment threshold, and set the screening condition to Where k represents the number of time steps; t represents the time step position; τ(t) represents the anomaly judgment threshold at time step t; σ(t) represents the standard deviation corresponding to the absolute deviation of the median gas concentration at time step t; represents the median gas concentration at time step t; like Further processing is performed according to the isolated abnormal points; otherwise, the original gas concentration data at that time point is retained; For isolated outliers, there are: Where, C(t-1) and C(t+1) represent the gas concentration values ​​at time step t-1 and time step t+1 respectively; C corrected (t) represents the concentration correction value at position t.

3. A temperature and humidity compensation method for a gas sensor according to claim 2, characterized in that: The setting filtering conditions are The specific process is: Get the gas concentration sequence of time step t: C(tk), C(t-k+1), ..., C(t), ..., C(t+k), Where C(t+k) represents the gas concentration value at the kth time point relative to the current time step t; Arrange all data points in the window in ascending order to obtain an ordered sequence: C (1) ≤C (2) ≤…≤C (2n+1) in, Indicates the median gas concentration; C (2n+1) Indicates the concentration value at position 2n+1 in ascending order of gas concentration; C (n+1) represents the median concentration within the time window; n represents the sequence number index; based on Obtain the absolute deviation sequence of gas concentration at position t: Calculate the absolute difference from the median for each window data point: Where m represents the position index of the gas concentration sequence within the window; d m represents the absolute deviation of the mth data point from the median; C(t-k+m-1) represents the concentration value at t-k+m-1; Arrange the absolute deviations in ascending order to obtain an ordered sequence: d (1) ≤d (2) ≤…≤d (2n+1) Extract the median absolute deviation: MAD(t)=d (n+1) Wherein, MAD(t) represents the median absolute deviation of gas concentration; d (2n+1) Indicates the absolute deviation of gas concentration at 2n+1 in ascending order; d (n+1) represents the median absolute deviation of the concentration within the time window; Convert the median absolute deviation of gas concentrations to standard deviation: σ(t)=1.4826·MAD(t) Where σ(t) represents the standard deviation of the median gas concentration; Define the dynamic threshold for abnormality determination: τ(t)=3 Where τ(t) represents the dynamic threshold.

4. A temperature and humidity compensation method for a gas sensor according to claim 1, characterized in that: The temperature and humidity time series data are preprocessed to obtain the temperature input coefficient and humidity input coefficient of each time step based on the following formula; Where T(t) represents the original temperature measurement value at time step t; H(t) represents the original humidity measurement value at time step t; T min Indicates the minimum reference value of temperature; represents the temperature input coefficient; represents the humidity input coefficient; α represents the humidity nonlinear scaling coefficient.

5. The temperature and humidity compensation method for a gas sensor according to claim 1, characterized in that: The random search optimizes the model parameters, and the specific steps are as follows: Randomly sample i=1,2,…,W times to generate W groups of candidate parameters Where i represents the number of sampling times; W represents the total number of samples; Represents λ i The value range is [0,1] continuous uniform distribution; represents η i The value range is [0,1.5] continuous uniform distribution; For each set of data (λ i ,η i ), calculate the mean square error f(λ i ,η i ): in, ΔC i (t) represents the i-th group (λ i ,η i ) corresponding to the temperature and humidity compensation concentration; f(λ i ,η i ) represents the mean square error; λ i represents the candidate parameters of group i λ, η i represents the candidate parameter of the i-th group η; i represents the parameter combination index of λ and η; ΔC real (t) represents the actual observed concentration change value; N represents the total number of gas concentration samples; λ represents the weight coefficient of temperature change rate; η represents the temperature and humidity synergy weight coefficient; Choose the parameter combination with the smallest mean squared error: λ * represents the optimal parameter of λ; η * represents the optimal parameter of η; The optimized model is: ΔC * (t) represents the optimized temperature and humidity compensation concentration; represents the temperature input coefficient; Represents the humidity input coefficient.

6. A temperature and humidity compensation method for a gas sensor according to claim 1, characterized in that: The gas concentration data output by the sensor before compensation is filtered by using an FIR filter, and the original output concentration C of the sensor at time step t before compensation is filtered. raw (t) Filtering: in, in, represents the sensor output concentration at time step t after filtering; a represents the filter index; h(a) represents the FIR filter coefficient; C raw (ta) represents the original output concentration of the sensor at time step ta; M represents the filter order; β represents the window shape parameter; I0 represents the zero-order modified Bessel function.

7. A temperature and humidity compensation system for a gas sensor, characterized in that: The system is used to perform the compensation method according to any one of claims 1 to 6, comprising: The data acquisition module simultaneously obtains the time series data of the temperature, humidity and gas concentration output by the gas sensor in the space where the gas sensor is located at the same time step, removes outliers from the time series data of gas concentration, pre-processes the time series data of temperature and humidity, and obtains the temperature input coefficient and humidity input coefficient; The state compensation module is used to establish a quantitative model of the cross-effect of temperature and humidity. The temperature input coefficient and humidity input coefficient are input into the established quantitative model of the cross-effect of temperature and humidity to obtain the gas concentration error caused by the temperature and humidity changes of the gas sensor, and the model parameters are optimized using random search. The dynamic adjustment module is used to filter the gas concentration data output by the sensor before compensation, and construct a weighted comprehensive index of temperature and humidity changes. The weighted comprehensive index is used as the screening condition for dynamic compensation switching. Based on the optimized gas concentration error model, the dynamic switching compensation mode is used to compensate for the filtered gas concentration data.

Citation Information

Patent Citations

  • Temperature and humidity compensation method and device for gas sensor

    CN114461621A

  • Poultry house gas pollutant sensor temperature and humidity compensation method

    CN119355208A

  • System for monitoring NO2 in air

    CN211978750U