NDIR gas concentration calibration and temperature compensation method based on feature space affine normalization
Patent Information
- Application Number
- CN202611233111.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-10-27
AI Technical Summary
[0008]鉴于上述问题,本发明提供一种基于特征量空间仿射归一化的NDIR气体浓度标定与温度补偿方法及系统,以至少部分解决现有NDIR气体传感器标定点多、温度补偿模型复杂、低浓度误差较大以及不同温度模型切换不连续的问题
本发明通过在特征量空间进行仿射归一化,将不同温度下的响应曲线映射至统一的参考温度曲线,实现温度补偿与浓度建模的解耦。
Smart Images

Figure CN122982964A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of gas detection and sensor algorithm technology, and more specifically to a method for NDIR gas concentration calibration and temperature compensation based on feature space affine normalization. Background Technology
[0002] Non-dispersive infrared (NDIR) gas sensors measure gas concentration by detecting the absorption of infrared light of a specific wavelength by a target gas. A typical NDIR gas sensor usually includes an infrared light source, a gas chamber, a measurement channel detector, and a reference channel detector. The target gas absorbs infrared light in the corresponding wavelength band of the measurement channel, while the reference channel reflects non-target absorption factors such as light source intensity and optical system attenuation. The concentration of the target gas can be calculated by the relationship between the measurement channel signal and the reference channel signal.
[0003] In practical applications, the output of NDIR gas sensors is affected by ambient temperature. Temperature changes can lead to variations in the intensity of infrared radiation, detector response, filter and optical structure characteristics, and gas absorption properties. The combined effect of these factors results in sensor response curves that are not entirely consistent at different temperatures.
[0004] Existing methods typically employ multi-point lookup tables, polynomial fitting, piecewise fitting, or neural networks for concentration calculation and temperature compensation. While these methods can improve accuracy to some extent, they often suffer from the following drawbacks: First, they require a large number of calibration points; second, the coupling of temperature compensation and concentration calculation makes the model difficult to interpret; third, the asymmetry of temperature drift between low and high temperature regions is difficult to handle uniformly; fourth, switching between multiple temperature models may introduce discontinuities; and fifth, extrapolation outside the specified intervals is unstable.
[0005] Especially for wide-range, wide-temperature-range NDIR gas sensors, since their measurement range simultaneously covers both the low-concentration high-sensitivity region and the high-concentration nonlinear region, the concentration response curve is difficult to accurately characterize across the entire range using only a few points or a single simple function. If a multi-temperature compensation model is directly established in the concentration space, or a lookup table model is established separately at each temperature point, it is usually necessary to increase the number of calibration points in both the concentration and temperature dimensions simultaneously. This results in high standard gas consumption, long calibration time, and low production line efficiency, which is detrimental to mass production.
[0006] Furthermore, existing methods often perform compensation directly in the concentration space or establish multiple concentration calculation models at different temperatures. Such methods easily lead to coupling between temperature compensation and concentration modeling, increasing model complexity and potentially causing discontinuities when switching between models at different temperatures. For low concentration ranges, conventional fitting methods may also introduce significant errors due to improper weighting of calibration points.
[0007] Therefore, there is an urgent need for an NDIR gas concentration calibration and temperature compensation method that can improve the accuracy of concentration measurement over a wide temperature range while reducing the number of calibration points, and taking into account the continuity, monotonicity, and embeddable implementation of the model. Summary of the Invention
[0008] In view of the above problems, the present invention provides a method and system for NDIR gas concentration calibration and temperature compensation based on affine normalization of feature space, so as to at least partially solve the problems of existing NDIR gas sensors having many calibration points, complex temperature compensation models, large errors at low concentrations, and discontinuous switching between different temperature models.
[0009] The core idea of this invention is to transfer temperature compensation from the concentration space to the characteristic space, establish an affine relationship between different temperature response curves and the reference temperature response curve in the characteristic space, and normalize the response curves at different temperatures to the reference temperature curve through offset compensation terms and gain compensation terms, so that the concentration calculation can be uniformly completed using a single interpolation model established at the reference temperature.
[0010] To achieve the above objectives, the present invention adopts the following technical solution:
[0011] In a first aspect, embodiments of the present invention provide a method for NDIR gas concentration calibration and temperature compensation based on affine normalization of characteristic quantity space, comprising: Calibration phase: Acquire the calibration data of the NDIR gas sensor at a reference temperature as reference calibration data, including each calibration concentration at the reference temperature and the logarithmic ratio characteristic quantity corresponding to the calibration concentration, wherein the logarithmic ratio characteristic quantity refers to the logarithmic ratio characteristic quantity between the measurement channel signal and the reference channel signal corresponding to each calibration concentration; A concentration relationship model is established based on reference calibration data, which can calculate the current gas concentration according to the input log ratio feature. Based on calibration data at different temperatures, an affine relationship model is established for different calibration temperatures relative to the reference temperature. Based on the discrete affine parameters in the affine relation model, a temperature compensation function is established between temperature and affine compensation parameters, including a temperature offset compensation function and a temperature gain compensation function. Measurement phase: The current temperature measured by the NDIR gas sensor is collected, and the real-time logarithmic ratio characteristic is calculated. The temperature compensation parameters at the current temperature are calculated based on the temperature compensation function, and the real-time logarithmic ratio characteristic is affine normalized. Based on the real-time logarithmic ratio characteristic value after affine normalization, the concentration relationship model is invoked to calculate the current gas concentration.
[0012] Furthermore, the logarithmic ratio characteristic is specifically calculated using the following formula:
[0013] in, This represents the measurement channel signal obtained when a calibration gas of the corresponding calibration concentration is introduced at the reference temperature. This represents the reference channel signal obtained when a calibration gas of the corresponding calibration concentration is introduced at the reference temperature. This represents the logarithmic ratio characteristic.
[0014] Furthermore, in the step of establishing a concentration relationship model based on reference calibration data that can calculate the current gas concentration according to the input log ratio feature, the concentration relationship model includes a piecewise cubic Hermite interpolation model or an extrapolation model. Specifically, when the actual value of the log ratio feature is greater than or equal to the minimum value of the log ratio feature in the reference calibration data, and less than or equal to the maximum value of the log ratio feature in the reference calibration data, a piecewise cubic Hermite interpolation model is constructed to calculate the gas concentration; otherwise, an extrapolation model is constructed to calculate the gas concentration.
[0015] Furthermore, a piecewise cubic Hermite interpolation model is constructed to calculate the gas concentration, specifically including: Each reference calibration data point is assigned an interpolation node; For any adjacent interpolation node interval The characteristic quantity R of the logarithmic ratio to be calculated within the interval is defined by the normalized interval variable t and the interpolation coefficients: in, , , , Each represents a different Hermite basis function used as an interpolation coefficient; and The log-ratio characteristic value corresponding to two adjacent interpolation nodes; Based on the interpolation coefficients, the concentration relationship model corresponding to the logarithmic ratio feature quantity R between two adjacent interpolation nodes is obtained:
[0016] in, and The calibration concentrations corresponding to two adjacent interpolation nodes. and These represent the interpolation curves at the nodes. and The first derivative at that point.
[0017] Furthermore, an extrapolation model is constructed to calculate the gas concentration, specifically including: When the value of the logarithmic ratio characteristic is less than the minimum value of the logarithmic ratio characteristic in the reference calibration data At that time, linear extrapolation is performed using the first derivative of the interpolation curve at the lower endpoint to obtain the first extrapolation model:
[0018] When the value of the logarithmic ratio feature is greater than the logarithmic ratio feature in the reference calibration data At that time, the first derivative of the interpolation curve at the high-end endpoint is used for linear extrapolation to obtain the second extrapolation model: in, and These are the endpoint concentrations corresponding to the minimum and maximum values of the log-ratio characteristic, respectively. and These represent the lower endpoints of the interpolation curve. and high-end endpoints The first derivative at that point.
[0019] Furthermore, based on calibration data at different temperatures, an affine relationship model is established between different calibration temperatures and the reference temperature, specifically including the following steps: For calibration temperatures other than the reference temperature, obtain calibration data at other calibration temperatures, including multiple calibration concentrations and the logarithmic ratio characteristic quantity corresponding to the calibration concentrations; For each other calibration temperature Affine models of different calibration temperatures relative to a reference temperature were established at the same calibration concentration:
[0020] in, Indicates reference temperature. Indicates at reference temperature Lower the calibrated concentration The logarithmic ratio characteristic value obtained by time calculation; Indicates at the calibrated temperature Lower the calibrated concentration The logarithmic ratio characteristic value obtained by time calculation; Indicates the calibrated temperature The corresponding proportionality coefficient; Indicates the calibrated temperature The corresponding offset, Indicates the first The first calibrated temperature, the first The affine fitting residuals corresponding to each calibrated concentration point.
[0021] Furthermore, a temperature compensation function is established between the temperature and the affine compensation parameters based on the discrete affine parameters in the affine relation model, specifically including the following steps: Based on the affine relationship model of different calibration temperatures relative to the reference temperature, the discrete affine parameters in the affine relationship model are extracted, including the scaling factor and offset corresponding to the calibration temperature. Based on the proportional coefficient and offset corresponding to the calibration temperature Define discrete temperature compensation terms for the calibration temperature, including temperature offset compensation terms and temperature gain compensation terms:
[0022] in, This represents the proportionality coefficient corresponding to the calibration temperature. This indicates the offset corresponding to the calibration temperature. Indicates the calibrated temperature The corresponding temperature offset compensation item, Indicates the calibrated temperature The corresponding temperature gain compensation term; Using each calibration temperature and its corresponding temperature offset compensation term and temperature gain compensation term as fitting data, a continuous temperature offset compensation function and a continuous temperature gain compensation function between temperature and affine compensation parameters are established respectively.
[0023] Furthermore, a continuous temperature offset compensation function and a continuous temperature gain compensation function are established between temperature and affine compensation parameters, specifically including the following steps: The temperature range is divided into a low-temperature zone and a high-temperature zone based on the reference temperature, and offset compensation functions, gain compensation functions, offset compensation functions, and gain compensation functions for the low-temperature zone, high-temperature zone, and high-temperature zone are established respectively. By fusing the low-temperature region offset compensation function and the high-temperature region offset compensation function using a temperature weighting function, a continuous temperature offset compensation function is obtained. By fusing the gain compensation functions in the low-temperature region and the high-temperature region using a temperature weighting function, a continuous temperature gain compensation function is obtained.
[0024] Furthermore, in the step of establishing a continuous temperature offset compensation function and a continuous temperature gain compensation function between temperature and affine compensation parameters, the specific functional forms of the continuous temperature offset compensation function and the continuous temperature gain compensation function include, but are not limited to: polynomial functions, piecewise interpolation functions, spline functions, or other functional forms that can realize continuous changes in temperature compensation parameters.
[0025] Furthermore, the temperature compensation parameters at the current temperature are calculated based on the temperature compensation function, and the real-time logarithmic ratio characteristic is affine normalized, specifically including the following steps: Substitute the current temperature into the temperature offset compensation function and the temperature gain compensation function respectively to obtain the corresponding temperature offset compensation term and temperature gain compensation term; Affine normalization is performed on the real-time logarithmic ratio feature based on the temperature offset compensation term and temperature gain compensation term obtained from the current temperature:
[0026] This represents the real-time logarithmic ratio characteristic after affine normalization, i.e., after temperature compensation. This represents a real-time logarithmic ratio characteristic. This represents the temperature offset compensation term obtained from the current temperature. This represents the temperature gain compensation term obtained from the current temperature.
[0027] Secondly, embodiments of the present invention provide an NDIR gas sensor system, including an infrared light source, a gas chamber, a measurement channel detector, a reference channel detector, a temperature sensor, and a signal processing unit. The infrared light source is used to emit infrared light; the gas chamber is used to contain the target gas and provide an optical path; the measurement channel detector is used to detect the infrared signal absorbed by the target gas and obtain a measurement channel signal; the reference channel detector is used to detect a reference band infrared signal and obtain a reference channel signal; and the temperature sensor is used to acquire the current ambient temperature. The signal processing unit stores an executable program that, when executed, enables the implementation of the method described in any of the first aspects of the present invention.
[0028] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a method for NDIR gas concentration calibration and temperature compensation based on affine normalization of characteristic quantity space, which has the following beneficial effects: This invention decouples temperature compensation from concentration modeling by performing affine normalization in the feature space to map response curves at different temperatures to a unified reference temperature curve.
[0029] The concentration relationship model in this invention includes a piecewise cubic Hermite interpolation model or an extrapolation model. The piecewise cubic Hermite interpolation model helps to ensure the monotonicity and physical rationality of the concentration output. The linear extrapolation model constructed by using endpoint derivatives helps to maintain the continuity and stability of the model endpoints.
[0030] This invention can use a single interpolation model to complete the concentration calculation over a wide temperature range, reducing model complexity.
[0031] This invention describes the temperature drift asymmetry between the low-temperature and high-temperature regions using a segmented temperature compensation model, and achieves continuous transition through a temperature weighting function, avoiding output jumps caused by model switching.
[0032] Experimental verification shows that, taking a CO2 sensor with a volume fraction range of 0 to 5% as an example, at calibration concentration points of 0 ppm, 500 ppm, 2000 ppm, 5000 ppm, 10000 ppm, 20000 ppm, and 50000 ppm, and calibration temperature points of -20℃, 0℃, 25℃, 40℃, and 60℃, it can achieve the accuracy requirement of ±50 ppm or ±2% of the reading, whichever is greater. This significantly reduces the number of calibration points, the consumption of calibration gas, and the calibration time. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0034] Figure 1 This is a schematic diagram of the overall process of the gas concentration calibration and temperature compensation method provided in the embodiments of the present invention.
[0035] Figure 2 A schematic diagram of the temperature weighting function curve provided for an embodiment of the present invention.
[0036] Figure 3 This is a schematic diagram of curve alignment for feature quantity space temperature normalization provided in an embodiment of the present invention.
[0037] Figure 4 This is a schematic diagram of the NDIR gas sensor system provided in an embodiment of the present invention. Detailed Implementation
[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] Example 1 Embodiment 1 of the present invention provides a method for NDIR gas concentration calibration and temperature compensation based on affine normalization of characteristic quantity space. The method includes a calibration stage and a measurement stage.
[0040] During the calibration phase, calibration data at the reference temperature is acquired and a concentration relationship model is established. Based on calibration data at different temperatures, affine relationship models are established for each calibration temperature relative to the reference temperature. Temperature offset compensation functions and temperature gain compensation functions are established based on the discrete affine parameters in the affine relationship models. During the measurement phase, the current temperature is acquired and the real-time logarithmic ratio characteristic is calculated. Compensation parameters at the current temperature are calculated based on the temperature compensation function, and the real-time logarithmic ratio characteristic is affine normalized. The current gas concentration is calculated using the concentration relationship model.
[0041] The following is in conjunction with the appendix Figure 1 - Appendix Figure 3 The principles of this invention will be explained in detail.
[0042] Calibration phase First, determine the calibration concentration point and calibration temperature point. Based on the measurement range and operating temperature range of the NDIR gas sensor, multiple calibration concentration points and multiple calibration temperature points are determined. The determined calibration concentration points cover the measurement range of the gas sensor, and the calibration temperature points cover the operating temperature range of the gas sensor. One of the calibration temperatures is selected as the reference temperature. .
[0043] In one specific embodiment, the NDIR gas sensor is a CO2 sensor in the range of 0 to 5% volume fraction, and the calibration concentration point can be selected as follows: 0 ppm, 500 ppm, 2000 ppm, 5000 ppm, 10000 ppm, 20000 ppm, 50000 ppm.
[0044] The calibration temperature point can be selected as follows: -20℃, 0℃, 25℃, 40℃, 60℃.
[0045] Among them, 25℃ is used as the reference temperature. The reference temperature is not limited to 25℃; other temperatures can be selected depending on the application scenario.
[0046] Secondly, obtain the calibration data of the NDIR gas sensor at a reference temperature as the reference calibration data. The specific steps are as follows: At reference temperature Below, for each calibration concentration point Introduce the calibration gas of the corresponding concentration and collect the measurement channel signal. and reference channel signal .
[0047] Based on the acquired measurement channel signal and reference channel signal, calculate the logarithmic ratio characteristic: in, Represents the logarithmic ratio characteristic quantity. Indicates the measurement channel signal. This indicates the reference channel signal.
[0048] Therefore, at the reference temperature Multiple sets of reference calibration data were obtained: in, Indicates at reference temperature Next, introduce the calibrated concentration. The logarithmic ratio characteristic quantity calculated when using the calibration gas. This indicates the number of calibration concentration points.
[0049] The advantage of using the logarithmic ratio as a feature quantity in this invention is that it can reduce the impact of light source intensity changes, optical path contamination, or detector common drift on the measurement results to a certain extent, and make the concentration response relationship more suitable for subsequent interpolation modeling.
[0050] Then, based on the reference calibration data, a concentration relationship model is established that can calculate the current gas concentration according to the input log ratio feature. In this invention, the concentration relationship model includes a piecewise cubic Hermite interpolation model or an extrapolation model: when the actual value of the log ratio feature is greater than or equal to the minimum value of the log ratio feature in the reference calibration data, and less than or equal to the maximum value of the log ratio feature in the reference calibration data, a piecewise cubic Hermite interpolation model is constructed to calculate the gas concentration; otherwise, an extrapolation model is constructed to calculate the gas concentration.
[0051] The steps for constructing a piecewise cubic Hermite interpolation model are as follows: Multiple sets of reference calibration data obtained at the reference temperature are used as interpolation nodes to establish gas concentration. Eigenvalue of logarithmic ratio A piecewise cubic Hermite interpolation model is used to calculate the gas concentration in the feature space corresponding to the reference temperature, based on the input logarithmic ratio feature.
[0052] Let the first Each node is ,in, For the first The log-ratio characteristic of each node. This corresponds to the calibration concentration. For any adjacent node interval... When the feature quantity to be calculated When the concentration is within this interval, the concentration is calculated using the cubic Hermite polynomial corresponding to that interval.
[0053] Specifically, define the normalized interval variable. : in, It is a normalized variable within the interval, with a value range of 0 to 1.
[0054] Gas concentration is calculated as follows:
[0055] in:
[0056] in, and The logarithmic ratio of two adjacent interpolation nodes is a characteristic quantity. and For the corresponding calibration concentration, and These represent the interpolation curves at the nodes. and The first derivative at a given point (i.e., the nodal derivative).
[0057] Preferably, the nodal derivatives in this invention are determined using a monotonicity-preserving algorithm to avoid overshoot or non-monotonic changes within adjacent node intervals. Since the gas concentration and logarithmic ratio characteristic of an NDIR gas sensor typically have a monotonic correspondence, local overshoot or non-monotonic changes during interpolation can lead to physically inconsistent concentration calculation results. Therefore, it is preferable to use the monotonicity-preserving piecewise cubic Hermite interpolation (PCHIP) method to construct the nodal derivatives, thereby improving the physical consistency and stability of the concentration calculation results.
[0058] The steps for building an extrapolation model are as follows: In actual measurements, due to noise, environmental fluctuations, or sensor drift, the compensated logarithmic ratio characteristic may be slightly smaller than the minimum node characteristic. or slightly larger than the maximum node feature value To ensure that the interpolation model can still provide continuous and physically reasonable concentration calculation results outside the node interval, this embodiment constructs a linear extrapolation model outside the interpolation interval based on the first derivative of the interpolation curve at the endpoints.
[0059] Specifically, when the feature quantity to be calculated is less than the minimum node feature quantity When using the derivative at the lower endpoints, linear extrapolation is performed: When the feature quantity to be calculated is greater than the maximum node feature quantity At that time, linear extrapolation is performed using the high-end endpoint derivative: in, and These represent the concentrations corresponding to the minimum and maximum nodes, respectively. and The piecewise cubic Hermite interpolation model is defined at the lower endpoint. and high-end endpoints The nodal derivative at a given point.
[0060] The linear extrapolation method described above directly uses the first derivative determined at the endpoints of the piecewise cubic Hermite interpolation model, which is consistent with the slope of the in-interval interpolation model at the endpoints. Therefore, this method does not require the establishment of an additional independent extrapolation slope calculation model, which can reduce computational complexity and maintain the continuity of function values and first derivatives at the endpoints both inside and outside the interpolation interval.
[0061] Meanwhile, compared to directly extending the cubic polynomial at the end to outside the interpolation interval, linear extrapolation based on the first derivative of the endpoint can reduce the risk of overshoot, non-monotonic changes or reverse concentration changes outside the interval, thereby improving the stability and physical rationality of the concentration calculation outside the interval.
[0062] Furthermore, during actual calibration or use, when the measured characteristic quantity approaches the range boundary and slightly exceeds the interpolation range due to noise, drift, or environmental disturbance, the linear extrapolation model can still output continuous concentration results, which is beneficial for evaluating the measurement error near the range boundary and improving the system's availability near the range boundary.
[0063] If necessary, lower and / or upper limits of concentration can be set for extrapolated results to avoid output results exceeding the physically reasonable range.
[0064] Next, based on calibration data at different temperatures, an affine relationship model between different calibration temperatures and a reference temperature needs to be established; the specific steps are as follows: Other calibration temperature points besides the reference temperature Below, relative to the reference temperature The same set of calibration concentration points The measurement is performed, the corresponding measurement channel signal and reference channel signal are acquired, and the logarithmic ratio characteristic is calculated.
[0065] This yields multi-temperature calibration data: ( ,in, Indicates the first Each calibrated temperature Next, enter the first A standard concentration The logarithmic ratio characteristic value is calculated when the calibration gas is used.
[0066] By measuring the same calibrated concentration point at the same reference temperature at different temperatures, we can compare the changes in characteristic quantities corresponding to the same gas concentration at different temperatures, thus providing a data basis for establishing the characteristic quantity mapping relationship between temperature and reference temperature.
[0067] For each calibrated temperature The logarithmic ratio characteristic of each calibrated concentration point at that temperature. , and reference temperature The logarithmic ratio characteristic of the same calibration concentration points Establish affine approximation relations: in, Indicates the first The proportionality coefficient corresponding to each calibration temperature. Indicates the first The offset corresponding to each calibration temperature The affine relation is represented in the first... The first calibrated temperature, the first The fitting residuals at each calibrated concentration point.
[0068] The affine relation indicates that the response curves at different temperatures, relative to the response curve at the reference temperature, mainly exhibit scale and offset changes along the characteristic axis. Since actual measurement data may be affected by sensor noise, calibration gas errors, and local nonlinear temperature drift, the affine relation is an approximate relationship established based on multiple calibration concentration points, rather than requiring each calibration data point to strictly satisfy the equation.
[0069] In this invention, the affine relation is established in the feature space, not the concentration space. That is, in the detection stage, this invention first performs temperature normalization on the feature quantities at the current temperature, and then uses a single concentration interpolation model at a reference temperature to calculate the current concentration, thereby achieving decoupling between temperature compensation and concentration modeling.
[0070] To achieve temperature normalization, it is also necessary to establish a temperature compensation function between temperature and affine compensation parameters based on the discrete affine parameters in the affine relation model, including a temperature offset compensation function and a temperature gain compensation function.
[0071] Specifically, the discrete affine parameters corresponding to each calibration temperature point can be solved by weighted regression. The specific steps are as follows: At the calibrated temperature Lower, calibrated concentration The logarithmic ratio characteristic quantity obtained by actual measurement and recording is recorded as the measured data. ; At reference temperature Below, same calibration concentration The logarithmic ratio characteristic obtained by actual measurement and recording is recorded as reference data. ; For each calibrated temperature The proportionality coefficient to be solved and offset Constructing affine prediction values The proportionality coefficient is obtained by solving the parameter when the sum of squared residuals is minimized using the weighted least squares method. and offset :
[0072] in, Indicates the first Each calibrated temperature The corresponding sum of squared residuals, For the first The regression weights corresponding to each calibrated concentration point; wherein, the regression weights for:
[0073] in, This is a preset constant, such as 200 ppm or 500 ppm, used to avoid divergence in the weights of low concentration points. Since the absolute error in the low concentration range has a more significant impact on the measurement results, increasing the weight of low concentration points in the regression can improve the temperature compensation accuracy in the low concentration range.
[0074] Solving for the results and Then, the discrete affine parameters corresponding to each calibration temperature point can be obtained, and based on these discrete affine parameters, the discrete temperature compensation term corresponding to each calibration temperature point can be further defined. Specifically, the obtained scaling factor... and offset , for the calibration temperature point Discrete affine parameters. Based on the scaling factor. and offset Define discrete temperature offset compensation terms for each calibration temperature point. and discrete temperature gain compensation term :
[0075]
[0076] Because of multiple calibration data, multiple sets of temperature compensation data at discrete temperature points can be obtained: {( )}and{( )}.
[0077] Based on the discrete temperature compensation data (discrete affine parameters), a continuous functional relationship between temperature and temperature compensation parameters (affine compensation parameters) can be further established, namely the temperature compensation function. This allows us to obtain not only the temperature compensation data at the calibration temperature point, but also the temperature compensation data at any temperature within the working temperature range during the measurement phase, without requiring it to coincide with the calibration temperature point.
[0078] Since the actual NDIR sensor's temperature response above and below the reference temperature may not be asymmetrical, this embodiment uses the reference temperature... To define the boundaries, the temperature range is divided into a low-temperature zone and a high-temperature zone, and compensation functions for the low-temperature zone and the high-temperature zone are established respectively.
[0079] The low-temperature region compensation function includes the low-temperature region offset compensation function. and gain compensation function in low temperature region The high-temperature zone compensation function includes the high-temperature zone offset compensation function. and high-temperature region gain compensation function .
[0080] In one specific embodiment, the low-temperature region compensation function and the high-temperature region compensation function can be established using a first-order polynomial, a second-order polynomial, piecewise linear interpolation, monotonic interpolation, or other function forms that can achieve continuous variation of temperature compensation parameters.
[0081] For example, a reference temperature can be used. The temperature range is divided into a low-temperature zone and a high-temperature zone, with the center as the center. A offset compensation function for the low-temperature zone is then established. Gain compensation function in low temperature region High-temperature zone offset compensation function and high-temperature region gain compensation function The above compensation functions are all in quadratic polynomial form:
[0082] Where T represents the real-time temperature. , , , The low-temperature region fitting coefficients are obtained by using the least squares method based on the discrete temperature compensation terms corresponding to each calibration temperature point below the reference temperature and the reference temperature. , , , The high-temperature region fitting coefficients are obtained by using the least squares method based on the reference temperature and the discrete temperature compensation terms corresponding to each calibration temperature point above the reference temperature.
[0083] Furthermore, the low-temperature model and the high-temperature model can be made to satisfy the following at the reference temperature: This ensures that no additional temperature correction is introduced at the reference temperature, keeping the characteristic quantities at the reference temperature constant.
[0084] Furthermore, the piecewise temperature compensation functions are continuously fused to obtain the final temperature compensation function. To avoid a hard switch between the low-temperature and high-temperature compensation models near the reference temperature, this embodiment introduces a temperature weighting function during the fusion process. It is used to continuously fuse the compensation functions for the low temperature region and the high temperature region.
[0085] In one specific embodiment, the temperature weighting function uses the Sigmoid function: in, For reference temperature; This parameter represents the temperature transition width, used to control the transition speed of the low-temperature and high-temperature compensation functions near the reference temperature. The desired smooth transition range near the reference temperature can be preset, or it can be optimized and determined using validation data, with evaluation indicators such as post-compensation concentration error, function continuity, or output smoothness during temperature changes. For example... Figure 2 As shown, this function approaches 0 in the low-temperature region, approaches 1 in the high-temperature region, and changes continuously near the reference temperature. This weighting function avoids the output discontinuity problem caused by direct switching between the low-temperature and high-temperature models.
[0086] In one specific embodiment, the reference temperature Temperature transition width parameter Desirable Alternatively, based on the sensor's temperature drift characteristics... to Select from the range.
[0087] When the temperature is lower than the reference temperature Approaching 0; when the temperature is higher than the reference temperature, Approaching 1; when the temperature is near the reference temperature, It changes continuously between 0 and 1.
[0088] The temperature offset compensation function after continuous fusion is: The temperature gain compensation function after continuous fusion is: Through the above continuous fusion, the low-temperature compensation model and the high-temperature compensation model can smoothly transition near the reference temperature, avoiding concentration output jumps caused by model switching and improving the stability of the system during temperature changes.
[0089] Measurement phase Real-time measurement data acquisition: During real-time measurement using the NDIR gas sensor, real-time measurement channel signals are acquired. Real-time reference channel signal and current temperature Among them, the current temperature It can be obtained by a temperature sensor, or by a temperature-sensitive element installed in a detector or circuit and then converted.
[0090] Calculate the real-time logarithmic ratio characteristic: Calculate the real-time logarithmic ratio characteristic based on the real-time measurement channel signal and the real-time reference channel signal.
[0091] in, This represents the real-time logarithmic ratio characteristic.
[0092] Temperature normalization of the real-time logarithmic ratio characteristic: Based on the current temperature The corresponding temperature offset compensation term is obtained from the temperature offset compensation function. and temperature gain compensation term .
[0093] Then, the real-time log-ratio feature quantity... After temperature normalization, the compensated logarithmic ratio characteristic is obtained:
[0094] in, This represents the logarithmic ratio characteristic after temperature compensation.
[0095] In the above formula, Used to correct lateral offset in the direction of the characteristic axis; This is used to correct scale variations along the characteristic axis. The gain compensation does not scale the concentration axis, but rather normalizes the scale differences along the characteristic axis.
[0096] like Figure 3 The figure shown is a schematic diagram of curve alignment for temperature normalization in the feature space according to the present invention.
[0097] The horizontal axis represents characteristic quantities. The vertical axis represents the gas concentration. Or its logarithmic form. The figure shows the sensor's response curves under different temperature conditions, including low-temperature curves, high-temperature curves, and a reference curve at a reference temperature.
[0098] The response curves at different temperatures exhibit the following characteristics in the characteristic space: the curve shifts along the characteristic axis; the scale relationship of the curve changes along the characteristic axis; and the slope or curvature of the curve may differ in local intervals.
[0099] In practical sensors, the influence of temperature mainly manifests as an overall shift and scale change in the direction of the characteristic axis; small nonlinear residuals may exist in local intervals. This invention preferably uses affine normalization to handle the main temperature drift effect, and improves the overall fitting accuracy through piecewise temperature modeling, weighted regression, and piecewise cubic Hermite interpolation.
[0100] To address the above problems, this invention introduces an affine transformation in the feature space:
[0101] in, Indicates temperature The resulting feature quantity offset compensation term, This represents the gain compensation term for characteristic quantities caused by temperature.
[0102] It should be noted that the gain compensation term This is used to describe the scale difference of response curves along the characteristic axis at different temperatures. This compensation is not for the concentration axis. Instead of scaling, scale the feature values. Normalization is performed to align the response curves at different temperatures with the reference temperature.
[0103] As shown by the arrows in the figure, the affine transformation can be understood as two consecutive normalization operations: First, through... Laterally shifting the characteristic values eliminates the overall offset differences between different temperature curves and the reference temperature curve; secondly, through... The scale of the translated feature quantities is normalized along the feature quantity axis to correct for the stretching or compression differences of different temperature curves along the feature quantity axis.
[0104] After the above processing, multiple response curves at different temperatures are uniformly mapped to the reference temperature curve in the characteristic space.
[0105] Unlike existing technologies that directly compensate in the concentration space or establish multiple concentration calculation models for different temperatures, this invention transfers temperature compensation from the concentration space to the feature space, transforming the complex temperature effect into an affine normalization problem in the feature space. It uses offset compensation terms and gain compensation terms to characterize the curve translation and scale change caused by temperature, respectively, so that the response curves at different temperatures can be uniformly mapped to the reference temperature curve.
[0106] Based on the above curve alignment mechanism, this invention decouples temperature compensation and concentration modeling, enabling measurement data at different temperatures to be processed using a single interpolation model. It maintains high accuracy while reducing the number of calibration points, and avoids discontinuity issues that may be caused by switching between multiple temperature models, thereby improving the stability and consistency of gas concentration calculation under wide temperature range conditions.
[0107] Therefore, this invention maps response curves at different temperatures to a unified reference temperature curve by performing affine normalization processing in the feature space, thereby transforming the complex multi-temperature modeling problem into a single reference curve modeling problem, significantly reducing system complexity and improving measurement stability.
[0108] Finally, the gas concentration is calculated based on the compensated logarithmic ratio characteristic. First, based on the characteristic quantity of the compensated logarithmic ratio. Determine its location within the interval, when When, choose The adjacent node interval The gas concentration was calculated using a piecewise cubic Hermite interpolation model.
[0109] Specifically, let:
[0110] The gas concentration is then:
[0111] in, , , and These are the Hermite basis functions defined above.
[0112] when At that time, the gas concentration was calculated using a low-end extrapolation model:
[0113] when At that time, the gas concentration was calculated using a high-end extrapolation model:
[0114] Final output gas concentration .
[0115] Through the above steps, the NDIR gas sensor only needs to collect real-time signals and the current temperature during real-time measurement to normalize the logarithmic ratio characteristic at different temperatures to the characteristic space corresponding to the reference temperature, and use a single concentration interpolation model to complete the gas concentration calculation.
[0116] Example 2: This embodiment provides an NDIR gas sensor system for performing the method described in Embodiment 1.
[0117] like Figure 4 As shown, the NDIR gas sensor in Embodiment 2 of the present invention may include an infrared light source 1, a gas chamber 2, a measurement channel detector 3, a reference channel detector 4, a temperature sensor 5, and a signal processing unit 6. The infrared light source 1 emits infrared light; the gas chamber 2 contains the gas to be measured and provides an optical path; the measurement channel detector 3 detects the infrared signal absorbed by the target gas; the reference channel detector 4 detects the infrared signal in a reference band; the temperature sensor 5 acquires the current ambient temperature; the signal processing unit 6 performs signal sampling, feature calculation, temperature compensation, and concentration calculation; bandpass filters 7 and 8 are used to select the infrared signals in the measurement channel and reference channel bands, respectively. The measurement channel detector 3 and the reference channel detector 4 respectively output measurement signals. With reference signal The signal processing unit 6 constructs feature quantities based on the obtained signal and performs subsequent calculations to finally obtain the concentration value at the current temperature.
[0118] The signal processing unit 6 can store the interpolation nodes, node derivatives, low-end endpoint derivatives, high-end endpoint derivatives, low-temperature compensation function parameters, high-temperature compensation function parameters, and temperature weighting function parameters at the reference temperature. It executes software programs to implement the method described in Example 1: reading the measurement channel signal, the reference channel signal, and the current temperature; calculating the real-time logarithmic ratio characteristic; normalizing the temperature according to the temperature compensation function; calculating the gas concentration based on the normalized logarithmic ratio characteristic by calling the interpolation model or endpoint extrapolation model; and outputting the gas concentration.
[0119] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0120] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for NDIR gas concentration calibration and temperature compensation based on affine normalization of characteristic quantity space, characterized in that, include: Calibration phase: Acquire the calibration data of the NDIR gas sensor at a reference temperature as reference calibration data, including each calibration concentration at the reference temperature and the logarithmic ratio characteristic quantity corresponding to the calibration concentration, wherein the logarithmic ratio characteristic quantity refers to the logarithmic ratio characteristic quantity between the measurement channel signal and the reference channel signal corresponding to each calibration concentration. A concentration relationship model is established based on reference calibration data, which can calculate the current gas concentration according to the input log ratio feature. Based on calibration data at different temperatures, an affine relationship model is established for different calibration temperatures relative to the reference temperature. Based on the discrete affine parameters in the affine relation model, a temperature compensation function is established between temperature and affine compensation parameters, including a temperature offset compensation function and a temperature gain compensation function. Measurement phase: The current temperature measured by the NDIR gas sensor is collected, and the real-time logarithmic ratio characteristic is calculated. The temperature compensation parameters at the current temperature are calculated based on the temperature compensation function, and the real-time logarithmic ratio characteristic is affine normalized. Based on the real-time logarithmic ratio characteristic value after affine normalization, the concentration relationship model is invoked to calculate the current gas concentration.
2. The method as described in claim 1, characterized in that, In the step of establishing a concentration relationship model based on reference calibration data that can calculate the current gas concentration according to the input log ratio feature, the concentration relationship model includes a piecewise cubic Hermite interpolation model or an extrapolation model. Specifically, when the actual value of the log ratio feature is greater than or equal to the minimum value of the log ratio feature in the reference calibration data, and less than or equal to the maximum value of the log ratio feature in the reference calibration data, a piecewise cubic Hermite interpolation model is constructed to calculate the gas concentration; otherwise, an extrapolation model is constructed to calculate the gas concentration.
3. The method as described in claim 2, characterized in that, Constructing a piecewise cubic Hermite interpolation model to calculate gas concentrations specifically includes: Each reference calibration data point is assigned an interpolation node; For any adjacent interpolation node interval The characteristic quantity R of the logarithmic ratio to be calculated within the interval is defined by the normalized interval variable t and the interpolation coefficients: in, , , , Each represents a different Hermite basis function used as an interpolation coefficient; and The log-ratio characteristic value corresponding to two adjacent interpolation nodes; Based on the interpolation coefficients, the concentration relationship model corresponding to the logarithmic ratio feature quantity R between two adjacent interpolation nodes is obtained: in, and The calibration concentrations corresponding to two adjacent interpolation nodes. and These represent the interpolation curves at the nodes. and The first derivative at that point.
4. The method as described in claim 2, characterized in that, Constructing an extrapolation model to calculate gas concentrations specifically includes: When the value of the logarithmic ratio characteristic is less than the minimum value of the logarithmic ratio characteristic in the reference calibration data At that time, linear extrapolation is performed using the first derivative of the interpolation curve at the lower endpoint to obtain the first extrapolation model: When the value of the logarithmic ratio feature is greater than the logarithmic ratio feature in the reference calibration data At that time, the first derivative of the interpolation curve at the high-end endpoint is used for linear extrapolation to obtain the second extrapolation model: in, and These are the endpoint concentrations corresponding to the minimum and maximum values of the log-ratio characteristic, respectively. and These represent the lower endpoints of the interpolation curve. and high-end endpoints The first derivative at that point.
5. The method as described in claim 1, characterized in that, Based on calibration data at different temperatures, an affine relationship model is established between different calibration temperatures and a reference temperature. This includes the following steps: For calibration temperatures other than the reference temperature, obtain calibration data at other calibration temperatures, including multiple calibration concentrations and the logarithmic ratio characteristic quantity corresponding to the calibration concentrations; For each other calibration temperature Affine models of different calibration temperatures relative to a reference temperature were established at the same calibration concentration: in, Indicates reference temperature. Indicates at reference temperature Lower the calibrated concentration The logarithmic ratio characteristic value obtained by time calculation; Indicates at the calibrated temperature Lower the calibrated concentration The logarithmic ratio characteristic value obtained by time calculation; Indicates the calibrated temperature The corresponding proportionality coefficient; Indicates the calibrated temperature The corresponding offset, Indicates the first The first calibrated temperature, the first The affine fitting residuals corresponding to each calibrated concentration point.
6. The method as described in claim 1, characterized in that, Based on the discrete affine parameters in the affine relation model, a temperature compensation function is established between temperature and affine compensation parameters, specifically including the following steps: Based on the affine relationship model of different calibration temperatures relative to the reference temperature, the discrete affine parameters in the affine relationship model are extracted, including the scaling factor and offset corresponding to the calibration temperature. Based on the scaling factor and offset corresponding to the calibration temperature, define discrete temperature compensation terms for the calibration temperature, including temperature offset compensation terms and temperature gain compensation terms: in, This represents the proportionality coefficient corresponding to the calibration temperature. This indicates the offset corresponding to the calibration temperature. Indicates the calibrated temperature The corresponding temperature offset compensation item, Indicates the calibrated temperature The corresponding temperature gain compensation term; Using each calibration temperature and its corresponding temperature offset compensation term and temperature gain compensation term as fitting data, a continuous temperature offset compensation function and a continuous temperature gain compensation function between temperature and affine compensation parameters are established respectively.
7. The method as described in claim 6, characterized in that, Establish continuous temperature offset compensation functions and continuous temperature gain compensation functions between temperature and affine compensation parameters, respectively, including the following steps: The temperature range is divided into a low-temperature zone and a high-temperature zone based on the reference temperature, and offset compensation functions, gain compensation functions, offset compensation functions, and gain compensation functions for the low-temperature zone, high-temperature zone, and high-temperature zone are established respectively. By fusing the low-temperature region offset compensation function and the high-temperature region offset compensation function using a temperature weighting function, a continuous temperature offset compensation function is obtained. By fusing the gain compensation functions in the low-temperature region and the high-temperature region using a temperature weighting function, a continuous temperature gain compensation function is obtained.
8. The method as described in claim 6, characterized in that, In the steps of establishing a continuous temperature offset compensation function and a continuous temperature gain compensation function between temperature and affine compensation parameters, the specific functional forms of the continuous temperature offset compensation function and the continuous temperature gain compensation function include: polynomial function, piecewise interpolation function, spline function, or other functional forms that can realize continuous change of temperature compensation parameters.
9. The method as described in claim 1, characterized in that, The temperature compensation parameters at the current temperature are calculated based on the temperature compensation function, and the real-time logarithmic ratio characteristic is affine normalized. The specific steps are as follows: Substitute the current temperature into the temperature offset compensation function and the temperature gain compensation function respectively to obtain the corresponding temperature offset compensation term and temperature gain compensation term; Affine normalization is performed on the real-time logarithmic ratio feature based on the temperature offset compensation term and temperature gain compensation term obtained from the current temperature: This represents the real-time logarithmic ratio characteristic after affine normalization, i.e., after temperature compensation. This represents a real-time logarithmic ratio characteristic. This represents the temperature offset compensation term obtained from the current temperature. This represents the temperature gain compensation term obtained from the current temperature.
10. An NDIR gas sensor system, characterized in that, The system includes an infrared light source, a gas chamber, a measurement channel detector, a reference channel detector, a temperature sensor, and a signal processing unit. The infrared light source emits infrared light; the gas chamber contains the target gas and provides an optical path; the measurement channel detector detects the infrared signal absorbed by the target gas and obtains the measurement channel signal; the reference channel detector detects a reference band infrared signal and obtains a reference channel signal; and the temperature sensor acquires the current ambient temperature. The signal processing unit stores an executable program that, when executed, can implement the method described in any one of claims 1-9.