A gas sensor calibration method and apparatus
By constructing a gas sensor calibration model and combining physical branch and migration branch models, the problems of low calibration efficiency and accuracy of NDIR carbon dioxide sensors were solved, and efficient and accurate gas sensor calibration was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU GERUAN INTELLIGENT TECH CO LTD
- Filing Date
- 2025-03-27
- Publication Date
- 2026-05-05
AI Technical Summary
Existing calibration methods for NDIR carbon dioxide sensors are inefficient and inaccurate. Traditional polynomial models are time-consuming and have a high error accumulation rate when temperatures fluctuate. Deep learning methods require a large amount of training data and are difficult to diagnose.
A gas sensor calibration model is constructed, including a physical branch model and a migration branch model. By determining the calibration matrix set, temperature gradient compensation coefficient, and signal-to-noise ratio, and combining the least squares method and GRU network, the model weights are dynamically adjusted to achieve static and dynamic prediction.
While reducing the amount of training data, it improves calibration efficiency and accuracy, can adapt to gas sensor calibration in different environments, and significantly reduces errors and drift.
Smart Images

Figure CN120404635B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of gas sensor technology, and in particular to a gas sensor calibration method and apparatus. Background Technology
[0002] Carbon dioxide molecules have a strong absorption characteristic for infrared light of a specific wavelength. Therefore, based on this characteristic, non-dispersive infrared (NDIR) carbon dioxide sensors can calculate the carbon dioxide concentration by measuring changes in light intensity and combining this with the Lambert-Beer Law.
[0003] Most existing NDIR carbon dioxide sensor calibration methods employ the following two approaches:
[0004] 1) Traditional polynomial models (such as poly55) require the collection of 36 calibration points over the entire temperature range (0-48℃), and the calibration takes up to 2 hours. Moreover, when the temperature fluctuation is >2℃ / min, the error accumulation rate is as high as 15ppm / min.
[0005] 2) Deep learning methods require more than 2,000 sets of training data, and the black-box nature of the model makes fault diagnosis difficult.
[0006] Therefore, the existing calibration methods for NDIR carbon dioxide sensors suffer from low efficiency and low accuracy. Summary of the Invention
[0007] To overcome the shortcomings of existing technologies, the present invention aims to provide a gas sensor calibration method and apparatus. This method can improve the calibration efficiency and accuracy of gas sensors.
[0008] To solve the above problems, the present invention is implemented according to the following solution:
[0009] A method for calibrating a gas sensor is provided, comprising:
[0010] Determine the calibration matrix set, temperature gradient compensation coefficient, and signal-to-noise ratio of the sensor to be calibrated;
[0011] Based on the calibration matrix set and the temperature gradient compensation coefficient, a physical branch model is constructed for static prediction of the calibration results of the sensor to be calibrated.
[0012] Based on the calibration matrix set and the signal-to-noise ratio, a migration branch model is constructed for dynamically predicting the calibration results of the sensor to be calibrated.
[0013] Construct a dynamic branching model to assign weights to the physical branching model and the migration branching model, respectively;
[0014] The physical branch model, the migration branch model, and the dynamic branch model constitute the calibration model of the sensor to be calibrated.
[0015] The sensor to be calibrated is calibrated according to the calibration model to obtain the calibration result used to indicate the output of the sensor after calibration.
[0016] Compared with the prior art, the beneficial effects of the gas sensor calibration method of the present invention are as follows: by constructing a calibration model by combining a physical branch model and a transfer branch model, compared with a single traditional polynomial model or deep learning method, it can reduce the amount of training data while simultaneously making static and dynamic predictions on the calibration results of the gas sensor, thereby improving calibration efficiency and calibration accuracy.
[0017] Optionally, the calibration matrix set includes multiple sets of calibration matrices; determining the calibration matrix set of the sensor to be calibrated includes:
[0018] The calibration points of the sensor to be calibrated are determined. The calibration points include the temperature set of the lowest, intermediate and highest ambient temperatures of the sensor to be calibrated, as well as the concentration set of the lowest and highest gas concentration values monitored by the sensor to be calibrated.
[0019] A temperature value is randomly selected from the set of temperatures and combined with any concentration value from the set of concentrations to obtain a set of test conditions;
[0020] Iterate through all temperature values in the temperature set to determine multiple sets of test conditions consisting of each temperature value and its combination with concentration values;
[0021] Test the output voltage of the sensor to be calibrated under each set of test conditions;
[0022] Each set of test conditions and its corresponding output voltage are used as a calibration matrix.
[0023] Optionally, determine the temperature gradient compensation coefficient of the sensor to be calibrated, including:
[0024] The sudden change temperature value is determined based on the intermediate temperature value and the preset temperature change value;
[0025] The output voltage of the sensor to be calibrated at the intermediate temperature value is taken as the voltage before the sudden change.
[0026] The output voltage of the sensor to be calibrated after a sudden change from the intermediate temperature value to the sudden change temperature value is taken as the voltage after the sudden change.
[0027] The voltage change value is determined based on the voltage before the mutation and the voltage after the mutation;
[0028] Repeat the above steps multiple times to obtain multiple voltage change values;
[0029] The temperature gradient compensation coefficient is determined by fitting the preset temperature change value and multiple voltage change values using the least squares method.
[0030] Optionally, determine the signal-to-noise ratio of the sensor to be calibrated, including:
[0031] The gas used to calibrate the sensor is illuminated with light intensity of the first preset wavelength band to obtain the light intensity signal power.
[0032] The gas used to calibrate the sensor is irradiated with light intensity of the second preset wavelength band to obtain the background noise power;
[0033] The signal-to-noise ratio is determined based on the light intensity signal power and the background noise power.
[0034] Optionally, based on the calibration matrix set and the temperature gradient compensation coefficients, a physical branch model is constructed for static prediction of the calibration results of the sensor to be calibrated, including:
[0035] Based on the calibration matrix set, the polynomial coefficient matrix is obtained;
[0036] Obtain the temperature change value of the sensor to be calibrated after a preset time step;
[0037] The physical branch model is obtained based on the polynomial coefficient matrix, the temperature gradient compensation coefficient, and the temperature change value.
[0038] Optionally, based on the calibration matrix set and the signal-to-noise ratio, a transfer branch model is constructed for dynamically predicting the calibration results of the sensor to be calibrated, including:
[0039] Determine the source domain training data for the cross-gas dataset, and perform source domain training on the training network based on the source domain training data to obtain the initial training network;
[0040] Based on the polynomial coefficient matrix and temperature gradient compensation coefficient of the physical branch model, the initial training network is fine-tuned in the target domain to obtain the transfer branch model; when the preset time sliding window is reached, the transfer branch model is dynamically adjusted.
[0041] Optionally, the cross-gas dataset includes the output voltages of various gas sensors at different gas concentrations and temperatures;
[0042] Identify the source domain training data across the gas dataset, including:
[0043] Determine the signal-to-noise ratio of the sensor to be calibrated in each gas environment;
[0044] The signal-to-noise ratio and the cross-gas dataset constitute the source domain training data.
[0045] Optionally, the training network is trained in the source domain based on the source domain training data to obtain an initial training network, including:
[0046] Based on the source domain training data, the network parameters and training parameter matrix of the training network are determined; the network parameters include the number of network layers and the number of nodes.
[0047] The initial training network is obtained based on the network parameters and the training parameter matrix.
[0048] Optionally, the dynamic branching model assigns weights to the physical branching model and the migration branching model, respectively, including:
[0049] Obtain the temperature change value of the sensor to be calibrated after a preset time step;
[0050] The environmental stability index is determined based on the temperature change value and the signal-to-noise ratio.
[0051] Based on the environmental stability index, determine the weights corresponding to the physical branch model and the migration branch model, respectively.
[0052] A computer device is also provided, including a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the gas sensor calibration method described above. Attached Figure Description
[0053] Figure 1 This is a flowchart of the calibration method of the present invention;
[0054] Figure 2 A flowchart for constructing the migration branch model for this invention;
[0055] Figure 3 This is an architecture diagram of the calibration model of this invention. Detailed Implementation
[0056] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0057] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims. In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0058] See Figure 1 As shown, a gas sensor calibration method of the present invention includes:
[0059] S1: Determine the calibration matrix set, temperature gradient compensation coefficient, and signal-to-noise ratio of the sensor to be calibrated, including:
[0060] The calibration matrix set includes multiple calibration matrices; each calibration matrix consists of a temperature value, a concentration value, and an output voltage. In practical applications, the emission intensity of the infrared light source will change with temperature. For example, high temperature environments can cause light source attenuation, directly affecting the light intensity received by the internal detector of the NDIR carbon dioxide sensor (gas sensor). That is, the sensitivity of the detector may drift with temperature, resulting in output voltage deviation. Furthermore, the absorption rate of carbon dioxide molecules to infrared light will change with temperature. For example, an increase in temperature may cause the absorption peak to broaden.
[0061] For NDIR carbon dioxide sensors (gas sensors), the calibration matrix set of the sensor to be calibrated is determined, including:
[0062] First, determine the calibration points of the sensor to be calibrated. The calibration points include the set of temperatures of the lowest, middle and highest ambient temperatures of the sensor, as well as the set of concentrations of the lowest and highest gas concentrations monitored by the sensor.
[0063] In one embodiment of the present invention, to ensure that the constructed calibration model covers the full temperature range of the environment in which the sensor to be calibrated may be located, and the full gas concentration range that the sensor to be calibrated can detect, and to ensure the reliability of the sensor to be calibrated in detecting gas concentrations, the sensor to be calibrated should be able to operate reliably within the temperature range of the temperature set. Furthermore, to reduce calibration data, when determining the calibration points, the minimum and maximum temperature values should be the upper and lower limits of the full temperature range, while the intermediate temperature value should be the ambient temperature where the sensor to be calibrated is most commonly located, i.e., the minimum temperature value is -10℃, the intermediate temperature value is 25℃, and the maximum temperature value is 60℃, thereby achieving full temperature range coverage. When determining the minimum gas concentration value, the average carbon dioxide concentration in the atmospheric environment should be considered to ensure that the sensor to be calibrated can detect carbon dioxide concentrations in common environments, i.e., the minimum gas concentration value is 400ppm. Since carbon dioxide concentrations can cause harm to the human body when they reach a certain level, the maximum gas concentration value needs to cover the risk warning threshold for harm to the human body, i.e., the maximum gas concentration value is 2000ppm.
[0064] Next, a temperature value is randomly selected from the temperature set and combined with any concentration value from the concentration set to obtain a set of test conditions. If the temperature set includes a minimum temperature value T1, an intermediate temperature value T2, and a maximum temperature value T3, and the concentration set includes a minimum gas concentration value C1 and a maximum gas concentration value C2, then assuming the intermediate temperature value T2 is randomly selected and combined with the minimum gas concentration value C1 from the concentration set, the test conditions for this set are [T2, C1]. This process iterates through all temperature values in the temperature set, determining multiple sets of test conditions for each temperature value and its combined concentration values. If the temperature set includes 3 temperature values and the concentration set includes 2 gas concentration values, there are a total of 6 sets of test conditions.
[0065] Finally, the output voltage of the sensor to be calibrated is tested under each set of test conditions. Specifically, the ambient temperature of the sensor to be calibrated is set to the temperature value in the test conditions, and the gas concentration environment is set to the concentration value in the test conditions, so as to determine the voltage level output by the sensor after detecting the gas concentration value when the sensor is at that temperature value. Each set of test conditions and its corresponding output voltage are used as a calibration matrix. This calibration matrix is used to represent the correspondence between environmental parameters (temperature, concentration) and the output voltage of the sensor to be calibrated, forming a mapping relationship from environmental parameters to electrical signals (output voltage).
[0066] The intermediate temperature value in the aforementioned temperature set represents the ambient temperature at which the sensor to be calibrated most frequently operates. The sensor's operation is more stable at this temperature compared to other temperatures. Therefore, after determining the calibration matrix set of the sensor to be calibrated, the temperature gradient compensation coefficient is determined based on the intermediate temperature value of the temperature set, including:
[0067] First, based on the intermediate temperature value and the preset temperature change value, the sudden temperature value is determined to conduct a temperature sudden change experiment on the ambient temperature of the sensor to be calibrated, and to determine the effect of the temperature sudden change on the gas concentration value detection of the sensor to be calibrated. In one embodiment of the present invention, the intermediate temperature value of 25°C is used as the starting point of the temperature sudden change experiment, which can ensure that the experimental conditions are consistent with the normal use scenario of the sensor to be calibrated, and provide a repeatable reference point for determining the temperature gradient compensation coefficient.
[0068] In one embodiment of the present invention, the preset temperature change value is 15°C and the sudden temperature value is 40°C. By setting the preset temperature change value to 15°C, it is ensured that the temperature change can cause a change in the output voltage of the sensor to be calibrated, while also ensuring that the sensor to be calibrated will not be damaged due to excessive temperature sudden change.
[0069] Next, a temperature mutation experiment is performed on the sensor to be calibrated. Specifically, the output voltage of the sensor at the intermediate temperature is taken as the voltage before the mutation; the output voltage of the sensor after the mutation from the intermediate temperature to the mutated temperature is taken as the voltage after the mutation; the voltage change value is determined based on the voltage before and after the mutation; the temperature mutation experiment is repeated multiple times for the sensor to be calibrated to ensure the accuracy of the finally determined temperature gradient compensation coefficient. Specifically, the above steps are repeated multiple times to obtain multiple voltage change values; a single voltage change value is used to indicate the influence of each temperature mutation on the output voltage of the sensor to be calibrated, that is, the deviation that will occur in the output voltage.
[0070] Finally, the temperature gradient compensation coefficient is determined by fitting the preset temperature change value and multiple voltage change values using the least squares method. By establishing a nonlinear mapping relationship between the temperature gradient compensation coefficient and the temperature change value using the least squares method, the voltage deviation data of multiple temperature change experiments can be determined, so as to determine the temperature gradient compensation coefficient (optimal value) used to compensate for the voltage deviation data. Finally, the temperature gradient compensation coefficient is found to be 0.05±0.005.
[0071] The NDIR carbon dioxide sensor detects the carbon dioxide concentration in its environment based on the absorption characteristics of carbon dioxide molecules to infrared light of a specific wavelength (4.26 μm band). When the carbon dioxide concentration in the environment where the NDIR carbon dioxide sensor is located increases, the carbon dioxide molecules absorb more infrared light, and the light intensity received by the detector inside the sensor will decrease, resulting in a decrease in signal power. That is, the signal power is non-linearly negatively correlated with the carbon dioxide concentration.
[0072] In actual measurements, noise (such as detector thermal noise and ambient light interference) can mask the true signal, leading to detection errors in the sensor. Therefore, for NDIR carbon dioxide sensors (gas sensors), the signal-to-noise ratio is determined to quantify the ratio of signal power to noise power, so as to determine the impact of signal power / noise power (signal-to-noise ratio) on the sensor output voltage at different concentrations.
[0073] In one embodiment of the present invention, determining the signal-to-noise ratio of the sensor to be calibrated includes:
[0074] First, the gas used to calibrate the sensor is illuminated with light intensity of a first preset wavelength band to obtain the light intensity signal power. The light intensity of the first preset wavelength band is the light intensity of the 4.26μm wavelength band, which is the absorption peak of carbon dioxide and can directly reflect the light absorption characteristics of carbon dioxide. The light intensity signal power received by the detector inside the sensor is then obtained.
[0075] Next, the gas used to calibrate the sensor is irradiated with light intensity of the second preset band to obtain the background noise power. The light intensity of the second preset band is the light intensity of the 3.9-4.5μm band. Carbon dioxide does not absorb the light intensity of this band and can directly reflect the light intensity change caused by noise to obtain the local noise power.
[0076] Finally, the signal-to-noise ratio is determined based on the light intensity signal power and the background noise power, and the calculation formula is as follows:
[0077]
[0078] Where SNR is the signal-to-noise ratio, P signal P represents the light intensity signal power. noise This represents the local noise power; by determining the signal-to-noise ratio, the impact of environmental interference (noise) on the detection results can be avoided when constructing the calibration model later.
[0079] S2: Based on the calibration matrix set and temperature gradient compensation coefficients, construct a physical branch model for static prediction of the calibration results of the sensor to be calibrated, including:
[0080] First, based on the calibration matrix set, the polynomial coefficient matrix is obtained. Specifically, the six calibration matrices in the calibration matrix set are substituted into the polynomial model, and the expression of the polynomial model is as follows:
[0081]
[0082] Among them, U i T represents the output voltage in the 6 calibration matrices. j Let C represent the temperature values in the six calibration matrices and C be the actual concentration. By substituting all the data points, an equation is generated for each data point. In this model, there are a total of 36 unknowns, which constitute the polynomial coefficient matrix A. For example, if six calibration points are collected, and each calibration point collects 60 seconds of time series data (e.g., 60 seconds × 10 Hz = 600 points / group), then the six calibration matrices can generate 3600 (6 × 60 × 10 = 3600) equations, which is sufficient to support the least squares method to fit the 36 coefficients.
[0083] In one embodiment of the present invention, since the number of equations (3600 equations) is much larger than the number of unknowns (36 unknowns), the Levenberg-Marquardt algorithm is used for nonlinear least squares fitting. This algorithm is iteratively optimized through the following steps:
[0084] Initialization: Randomly generate an initial coefficient matrix A0;
[0085] Iterative update: Calculate the predicted concentration C under the current unknowns. pred Compared with the actual concentration C ref The residual sum of squares (RSS), based on the residual adjustment factor, is expressed as follows:
[0086] A k+1 =A k -(J T J+λI0 -1 J T r
[0087] Where J is the Jacobian matrix of the residuals with respect to the coefficients, r is the residual vector, and λ is the damping factor (dynamically adjusted to balance gradient descent and Newton's method).
[0088] Convergence criterion: Stop when the residual RSS < 1e-6 (i.e., the error is less than 0.001%) or the number of iterations reaches 100.
[0089] After the above optimization, the final polynomial coefficient matrix A is obtained, and its expression is as follows:
[0090]
[0091] Wherein, the subscripts i and j represent the polynomial order of the output voltage and temperature, respectively. i∈[0,5] corresponds to the sixth-order nonlinear characteristic of the voltage, and j∈[0,5] corresponds to the sixth-order compensation term of the temperature. This polynomial coefficient matrix can be used to represent the nonlinear mapping weight of voltage and temperature to concentration, improve the calibration accuracy of the calibration model for the gas sensor, and thus improve the accuracy of the gas sensor detection results.
[0092] Next, the temperature change value of the sensor to be calibrated is obtained after a preset time step. When data is collected at each calibration point, the temperature of the sensor to be calibrated will also change at different times. The time step for data collection is the preset time step. Therefore, the temperature change value ΔT = |T t -T t-1 |In the middle, the temperature T is collected. t-1 and temperature T t The time interval is the preset time step.
[0093] Finally, based on the polynomial coefficient matrix, temperature gradient compensation coefficients, and temperature change values, the physical branch model is obtained, and its expression is as follows:
[0094]
[0095] Among them, C poly The figure shows the predicted carbon dioxide concentration from the physical branch model, where γ is the temperature gradient compensation coefficient, ΔT is the temperature change, and U is the actual voltage. J The reference voltage is the output voltage of the sensor to be calibrated when it is at the intermediate temperature value.
[0096] S3: Based on the calibration matrix set and signal-to-noise ratio, construct a transfer branch model for dynamically predicting the calibration results of the sensor to be calibrated, including:
[0097] See Figure 2The diagram shows a flowchart for constructing the transfer branch model. First, the source domain training data for the cross-gas dataset is determined. The training network is then trained using the source domain training data to obtain the initial training network. The cross-gas dataset includes the output voltages of various gas sensors at different gas concentrations and temperatures. Specifically, a tunable laser spectrometer is used to generate the cross-gas dataset, which contains 500 sets of data for each of the three gases: carbon dioxide, methane, and nitrous oxide. After determining the cross-gas dataset, the source domain training data is determined, including: determining the signal-to-noise ratio (SNR) of the sensor to be calibrated in each gas environment. This can be done using the method described above for determining the SNR of the sensor to be calibrated, which will not be detailed here. After obtaining the SNR, the source domain training data is constructed using the SNR and the cross-gas dataset. Each set of data in the source domain training data includes the output voltage, temperature, temperature change value, and SNR. The method for determining the temperature change value is the same as described above, and will not be detailed here.
[0098] Next, the training network is trained in the source domain using the source domain training data to obtain the initial training network, including:
[0099] Based on the source domain training data, the network parameters and training parameter matrix of the training network are determined. The training network is a GRU network. When the source domain training data is used as the input data of the training network, the output data is the gas concentration, that is, the input layer is a four-dimensional feature.
[0100] In one embodiment of the present invention, the network parameters include the number of network layers and the number of nodes. The number of network layers is the number of hidden layers, and the number of nodes is the number of hidden layer nodes. The network parameters are determined by comparative experiments. When the number of network layers increases from 2 to 3, the validation set decreases by 18.7% (from 42ppm to 34ppm). When the number of layers continues to increase to 4, the improvement is only 2.3%, but it brings a 37% increase in inference time. The number of nodes is optimized using the golden ratio method. The 32-16-8 structure can achieve the best accuracy balance while keeping the number of parameters <5k. Therefore, the number of network layers in the present invention is 3, and the number of nodes is 32.
[0101] After the source domain training data is input into the GRU network (training network), the GRU network with 3 layers and 32 nodes learns the relationship between these four-dimensional features and obtains a training parameter matrix including input gate weights, reset gate weights, and update gate weights. Finally, based on the network parameters and the training parameter matrix, the initial training network is obtained.
[0102] Next, the initial training network is fine-tuned in the target domain. Specifically, the initial training network is fine-tuned in the target domain based on the polynomial coefficient matrix and temperature gradient compensation coefficient of the physical branch model to obtain the transfer branch model. When the preset time sliding window is reached, the transfer branch model is dynamically adjusted.
[0103] In one embodiment of the present invention, the initial training network is fine-tuned in the target domain. Specifically, the physical branch and the transfer branch are jointly optimized based on the polynomial coefficient matrix and temperature gradient compensation coefficient of the physical branch model. A dynamic parameter freezing strategy is adopted, freezing the bottom-level parameters of the transfer branch every 100 steps and allowing only the top-level parameters to be updated, thereby preventing overfitting and preserving the general features learned from the source domain, thus obtaining the transfer branch model.
[0104] When the preset time sliding window (e.g., 24 hours) is reached, the model parameters are continuously updated through the sliding window mechanism, and the loss function is:
[0105] L online =0.7(C pred -C ref ) 2 +0.3|C t -C t-1 | 2
[0106] Among them, C pred For the model to predict concentration values, C ref For reference standard gas concentration values, C t With C t-1 These represent the concentration prediction values at the current time and the previous time window, respectively. The coefficients 0.7 and 0.3 were determined jointly through grid search and Bayesian optimization. Validation in 100 parameter combinations showed that this ratio optimally balances the relationship between instantaneous accuracy (the first term) and time series stability (the second term).
[0107] When the coefficient of the latter term (0.3 in the formula) exceeds 0.35, it will cause the model to become overly smooth, while when it is below 0.25, a concentration jump will occur. This loss function is applied simultaneously to the GRU network weight matrix of the transfer branch model and the temperature gradient compensation coefficient of the physical branch model through backpropagation. The polynomial coefficients A of the physical branch model are kept frozen during the online phase to ensure the stability of the base model.
[0108] After setting up the sliding window mechanism, a three-point check (e.g., 400 / 1000 / 2000ppm) is performed every 8 hours. If the error exceeds 5%, the transfer branch fine-tuning is triggered. The RMSProp optimizer is used to incrementally train the GRU network (training network), freezing the input gate and forget gate parameters (accounting for 70% of the total parameters), and only updating the output gate and 30% of the parameters of the fully connected layer. Experiments show that full parameter updates cause model oscillations (error fluctuations of ±15ppm), while the 10% update strategy reduces the fluctuation range to ±5ppm. Therefore, this invention selects the top 10% of highly sensitive neurons for updates through importance sampling, enabling the model to quickly adapt to environmental changes while maintaining overall robustness and achieving dynamic adjustment of the model.
[0109] S4: Construct a dynamic branching model to assign weights to the physical branching model and the migration branching model, respectively. Specifically, first determine the environmental stability index, whose expression is as follows:
[0110]
[0111] Where ESI is the environmental stability index, ΔT is the temperature change value, and SNR is the signal-to-noise ratio; by determining the environmental stability index, factors such as temperature change rate, signal-to-noise ratio, output voltage, and ambient temperature are comprehensively considered; based on the environmental stability index, the weights corresponding to the physical branch model and the migration branch model are determined, as expressed below:
[0112]
[0113] Where α is the weight corresponding to the physical branch model, (1-α) is the weight corresponding to the migration branch model, ESI is the environmental stability index, and k is the slope adjustment factor of the Sigmoid function. The optimal value is determined on the validation set through grid search, and the typical value range is 8-12 (when k=10, the minimum error is obtained under the critical conditions of ΔT=2℃ / min and SNR=15dB).
[0114] Experiments show that when k=10, the optimal balance can be achieved in scenarios with temperature fluctuations (±5℃) and signal interference (SNR=15-25dB). The value of k determines the steepness of the weight switching: if the value of k is too large, the model output will oscillate violently when the environment changes slightly (e.g., when k>15, a change of 0.1 in ESI will cause the α value to fluctuate by more than 0.4). If the value of k is too small, the model's response speed to sudden environmental changes will be reduced (e.g., when k<5, an ESI change of more than 0.3 is required to trigger the switching of the dominant mode). ESI is a comprehensive index that quantifies the degree of environmental stability.
[0115] When ΔT > 2℃ / min and ESI > 0.7, the system automatically switches to the physical branch model (α ≥ 0.8), meaning that the output of the physical branch model accounts for more than 80% of the total output. In this state, the system prioritizes the compensation model (physical branch model) with clear physical meaning.
[0116] When ΔT > 2℃ / min and ESI < 0.7, abrupt environmental changes weaken the temporal correlation of the data-driven model (transfer branch model), while the temperature gradient compensation term in the physical branch model... It can respond to temperature changes instantly, avoiding the accumulation of errors.
[0117] When SNR < 15 (ESI < 0.3), the sensor signal is severely polluted by environmental noise (signal-to-noise ratio drops by more than 32%). At this time, the voltage-temperature polynomial of the physical branch model is easily affected by outliers. However, the noise robustness feature obtained by the transfer branch model through pre-training (enhanced by cross-gas dataset) can effectively suppress impulse interference. Its GRU network gating mechanism can adaptively filter abnormal fluctuations. Therefore, when SNR < 15 (ESI < 0.3), the output of the transfer branch model is preferred.
[0118] In one embodiment of the present invention, the weight ratios of the physical branch model and the transfer branch model change depending on the ESI value. For example, when the temperature change is large, the weight of the physical branch model increases because its temperature gradient compensation coefficient can effectively suppress abrupt errors. Conversely, when the signal-to-noise ratio is low, the weight of the transfer branch model increases because its pre-trained noise robustness features can effectively suppress impulse interference. In this way, the dynamic branch model can adaptively adjust the weights of the two branch models according to the actual environmental conditions, thereby optimizing the model's output.
[0119] S5: The physical branch model, migration branch model, and dynamic branch model constitute the calibration model of the sensor to be calibrated; see [link / reference]. Figure 3 The diagram shows the architecture of the calibration model of this invention. The dynamic branch model assigns weights to the physical branch model and the migration branch model respectively, including: obtaining the temperature change value of the sensor to be calibrated after a preset time step; determining the environmental stability index based on the temperature change value and the signal-to-noise ratio; and determining the weights corresponding to the physical branch model and the migration branch model respectively based on the environmental stability index.
[0120] Among them, the physical branch model is based on an improved multinomial model, which can perform basic nonlinear fitting and temperature compensation for the output of the gas sensor; the transfer branch model uses a pre-trained GRU network, which can further optimize the output of the gas sensor using time-series data features; and the dynamic branch model allocates the weights of the two in real time according to the environmental stability index to achieve adaptive fusion. The three work together to make the calibration model have both the stability of the physical model and the flexibility of the data-driven model, which can adapt to the calibration needs of gas sensors in different environments and improve calibration accuracy and reliability.
[0121] S6: The sensor to be calibrated is calibrated according to the calibration model to obtain calibration results indicating the output of the sensor after calibration. Based on the constructed calibration model, the NDIR carbon dioxide gas sensor to be calibrated is calibrated. During the calibration process, the sensor is placed under different temperature and concentration conditions to collect data, and the collected data is input into the calibration model. The calibration model outputs the corresponding standard concentration value through the coordinated processing of the physical branch model, the migration branch model, and the dynamic branch model, thereby determining the relationship between the sensor's output and the standard concentration under different operating conditions. The final calibration result can accurately indicate the output of the sensor to be calibrated during actual testing after calibration, ensuring that its measurement accuracy meets the requirements of high-precision detection.
[0122] Next, a verification experiment is conducted to test the performance of the sensor to be calibrated according to the calibration method provided by the present invention, specifically as follows:
[0123] Extreme temperature change test: Using a rapid temperature change chamber (ESPEC TDB-2L) to simulate a temperature change of 25℃→40℃ / min, the traditional polynomial model showed an instantaneous error of 214ppm, while our calibration model controlled the error within 67ppm through dynamic weight adjustment (α decreased from 0.8 to 0.2).
[0124] 30-day long-term test: Continuous operation in a constant temperature and humidity chamber (25℃±1℃, 60%RH±5%). Traditional methods produce a drift error of 89ppm, while our online migration mechanism reduces the error to 31ppm, with a daily increase of ≤1.0ppm.
[0125] See Table 1 for a comparison of the results of the calibration model of this invention and the traditional polynomial model.
[0126] Table 1
[0127] Test Scenario index Traditional polynomial This invention (calibration model) Sudden temperature change (25→40℃) Maximum instantaneous error (ppm) 214 67 Low concentration (400ppm) RMSE (ppm) 52 28 30-day long-term operation Drift error (ppm) 89 31 Humidity >90% RH Error increment (ppm) +38 +19
[0128] Through the above implementation methods, a highly efficient and accurate NDIR gas sensor calibration method has been successfully achieved, significantly improving the sensor's environmental adaptability and long-term stability.
[0129] The present invention also provides a computer device, including a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, wherein the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the above-described calibration method.
[0130] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0131] The memory can be used to store the computer program or module. The processor implements various functions of the calibration method by running or executing the computer program or module stored in the memory and calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0132] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for calibrating a gas sensor, characterized in that, include: Determine the calibration matrix set, temperature gradient compensation coefficient, and signal-to-noise ratio of the sensor to be calibrated; The calibration matrix set includes multiple sets of calibration matrices; Each calibration matrix consists of a temperature value, a concentration value, and an output voltage. Based on the calibration matrix set and the temperature gradient compensation coefficients, a physical branch model is constructed for static prediction of the calibration results of the sensor to be calibrated, including: Based on the calibration matrix set, the polynomial coefficient matrix is obtained; Obtain the temperature change value of the sensor to be calibrated after a preset time step; Based on the polynomial coefficient matrix, the temperature gradient compensation coefficient, and the temperature change value, the physical branch model is obtained, and its expression is as follows: Where A is the polynomial coefficient matrix. This represents the output voltage in the 6 calibration matrices. This represents the temperature values in the six calibration matrices. The results of the physical branch model's prediction of carbon dioxide concentration are as follows: This is the temperature gradient compensation coefficient. This represents the temperature change value. This is the actual voltage. The reference voltage is the output voltage of the sensor to be calibrated when it is at the intermediate temperature value. Based on the calibration matrix set and the signal-to-noise ratio, a transfer branch model is constructed for dynamically predicting the calibration results of the sensor to be calibrated, including: The source domain training data of the cross-gas dataset is determined, and the training network is trained on the source domain training data to obtain the initial training network; the cross-gas dataset includes the output voltage of various gas sensors at different gas concentrations and temperatures. Based on the polynomial coefficient matrix and temperature gradient compensation coefficient of the physical branch model, the initial training network is fine-tuned in the target domain to obtain the transfer branch model; when the preset time sliding window is reached, the transfer branch model is dynamically adjusted. Identify the source domain training data across the gas dataset, including: Determine the signal-to-noise ratio of the sensor to be calibrated in each gas environment; The signal-to-noise ratio and the cross-gas dataset constitute the source domain training data; Construct a dynamic branching model to assign weights to the physical branching model and the migration branching model, respectively; The physical branch model, the migration branch model, and the dynamic branch model constitute the calibration model of the sensor to be calibrated. The sensor to be calibrated is calibrated according to the calibration model to obtain the calibration result used to indicate the output of the sensor after calibration.
2. The gas sensor calibration method according to claim 1, characterized in that, Determine the set of calibration matrices for the sensor to be calibrated, including: The calibration points of the sensor to be calibrated are determined. The calibration points include the temperature set of the lowest, intermediate and highest ambient temperatures of the sensor to be calibrated, as well as the concentration set of the lowest and highest gas concentration values monitored by the sensor to be calibrated. A temperature value is randomly selected from the set of temperatures and combined with any concentration value from the set of concentrations to obtain a set of test conditions; Iterate through all temperature values in the temperature set to determine multiple sets of test conditions consisting of each temperature value and its combination with concentration values; Test the output voltage of the sensor to be calibrated under each set of test conditions; Each set of test conditions and its corresponding output voltage are used as a calibration matrix.
3. The gas sensor calibration method according to claim 2, characterized in that, Determine the temperature gradient compensation coefficient of the sensor to be calibrated, including: The sudden change temperature value is determined based on the intermediate temperature value and the preset temperature change value; The output voltage of the sensor to be calibrated at the intermediate temperature value is taken as the voltage before the sudden change. The output voltage of the sensor to be calibrated after a sudden change from the intermediate temperature value to the sudden change temperature value is taken as the voltage after the sudden change. The voltage change value is determined based on the voltage before the mutation and the voltage after the mutation; Repeat the above steps multiple times to obtain multiple voltage change values; The temperature gradient compensation coefficient is determined by fitting the preset temperature change value and multiple voltage change values using the least squares method.
4. The gas sensor calibration method according to claim 2, characterized in that, Determine the signal-to-noise ratio of the sensor to be calibrated, including: The gas used to calibrate the sensor is illuminated with light intensity of the first preset wavelength band to obtain the light intensity signal power. The gas used to calibrate the sensor is irradiated with light intensity of the second preset wavelength band to obtain the background noise power; The signal-to-noise ratio is determined based on the light intensity signal power and the background noise power.
5. The gas sensor calibration method according to claim 1, characterized in that, The initial training network is obtained by training the training network in the source domain based on the source domain training data, including: Based on the source domain training data, the network parameters and training parameter matrix of the training network are determined; the network parameters include the number of network layers and the number of nodes. The initial training network is obtained based on the network parameters and the training parameter matrix.
6. A gas sensor calibration method according to claim 4, characterized in that, The dynamic branching model assigns weights to the physical branching model and the migration branching model, respectively, including: Obtain the temperature change value of the sensor to be calibrated after a preset time step; The environmental stability index is determined based on the temperature change value and the signal-to-noise ratio. Based on the environmental stability index, determine the weights corresponding to the physical branch model and the migration branch model, respectively.
7. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, at least one program, code set, or instruction set, wherein at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement a gas sensor calibration method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Electrochemical sensor calibration method and device
CN120609883A