Disclosure of Invention
The invention mainly aims to provide a gas sensing compensation method, a device and computer equipment, so as to realize the purpose of comprehensively correcting measurement errors caused by various factors, ensuring that a gas sensor can stably and accurately output measurement results under complex and changeable environmental conditions, providing reliable data support for application in various fields and improving the overall performance and practicability of the gas sensor.
In order to achieve the above object, the present invention provides a gas sensing compensation method, comprising the steps of:
Acquiring original output signals of the gas sensor under various environmental conditions within a preset duration, and simultaneously recording corresponding environmental parameters, wherein the environmental parameters comprise temperature, humidity, air pressure and gas concentration data, the gas sensor is divided into a reference group and a test group, the reference group is used for acquiring a data development algorithm, and the test group is used for an actual gas detection verification algorithm;
based on the collected original output signals and corresponding environmental data, constructing a gas compensation model for describing the inherent relation among sensor output, environmental parameters and actual gas concentration, wherein the gas compensation model integrates hardware compensation and software algorithm compensation, the hardware compensation performs preliminary compensation of gas in the environment through serial-parallel circuit design, and the software algorithm compensation comprises a temperature compensation algorithm, a humidity compensation algorithm, a gas concentration compensation algorithm and a zero offset calibration algorithm;
The method comprises the steps of acquiring current environmental parameters in real time through a gas sensor, inputting the current environmental parameters into a gas compensation model, and correcting and calculating output signals of the gas sensor through the gas compensation model to obtain compensated gas concentration signals.
Further, the circuit design in the hardware compensation is to connect a thermistor and a humidity resistor in series or in parallel in the circuit, adjust the output signal of the gas sensor based on the environmental temperature change by using the thermistor, adjust the output signal of the gas sensor based on the environmental humidity change by using the humidity resistor, and perform the preliminary compensation of the multiple environmental factors on the hardware level.
Further, the temperature compensation algorithm adopts a multi-sensor compensation and software algorithm to compensate, the difference of signal output of the gas sensor A and the signal output of the gas sensor B within the preset response time are similar through two characteristics, and the formula of the temperature compensation algorithm is as follows:
Wherein S A (T) is an output signal of the gas sensor A at the temperature T, S B (T, C) is an original output signal of the gas sensor B at the temperature T and the gas concentration C, S' B (T, C) is an output signal of the gas sensor B after temperature compensation, beta T is an influence coefficient of the temperature on the output of the gas sensor B, and T 0 is a standard temperature;
And calculating and adjusting the signal output of the gas sensor B, wherein the gas sensor A is sealed to serve as a temperature sensor and is only used for acquiring environmental temperature change, and the gas sensor B is used for actual gas detection and receiving a temperature compensation signal from the gas sensor A.
Further, the humidity compensation algorithm monitors the environmental humidity change within a preset humidity response range of a preset response time by adding a humidity resistor in the circuit, and adjusts the output of the gas sensor through the circuit by utilizing a humidity software algorithm according to a humidity resistor output signal, wherein the humidity compensation algorithm formula comprises:
Wherein R h is the resistance value of the humidity resistor under the current humidity H, R h0 is the resistance value under the standard humidity H 0, and alpha h is the sensitivity coefficient of the humidity resistor;
S is an actual output signal of the gas sensor, S 0 is an output signal under standard humidity, and beta H is an influence coefficient of humidity on the sensor output;
s c is the sensor output signal after humidity compensation.
Further, the gas concentration compensation algorithm calibrates the gas sensor by using standard gas, establishes a mathematical model formula between the gas concentration and the sensor output, and adjusts the output of the gas sensor in real time according to the established mathematical model, wherein the mathematical model formula comprises:
c is gas concentration, S is sensor output signal, and f is specific functional relation;
a. b is a coefficient determined by calibration.
Further, the zero offset calibration algorithm automatically calibrates the gas sensor periodically or in real time, compares the current gas sensor output value with a preset zero reference value, calculates a zero offset value according to a zero adjustment formula and adjusts the gas sensor output signal when the deviation exceeds a set threshold value.
Further, an algorithm in software algorithm compensation in the gas compensation model has self-adaptive capability, compensation parameters are dynamically adjusted and selected according to a preset judgment logic rule according to the change rate and the fluctuation range of an environmental factor, and correction of output signals of the gas sensor under different environmental conditions is carried out, wherein the judgment logic rule is that reinforcement compensation is carried out when the change rate of the environmental parameter is larger than a preset first change rate and the fluctuation range is larger than a preset first fluctuation range, and conventional compensation is carried out when the change rate of the environmental parameter is smaller than a preset second change rate and the fluctuation range is smaller than a preset second fluctuation range.
Furthermore, hardware compensation in the gas compensation model is performed by adjusting output signals of the gas sensor through a voltage dividing resistor and an operational amplifier in addition to primary compensation of serial-parallel circuit design, and comprehensive compensation of multiple environmental factors on a hardware level is performed by adjusting the output signals of the gas sensor according to the output of the environmental sensor, wherein each algorithm of software algorithm compensation is independently used or combined to be used in the operation process according to actual environments and measurement requirements, and compensation of the output signals of the gas sensor under various environments is performed.
The invention also provides a gas sensing compensation method, a device and computer equipment, comprising the following steps:
the system comprises a data acquisition module, a data acquisition module and a data verification module, wherein the data acquisition module is used for acquiring original output signals of gas sensors under various environmental conditions within a preset duration, and recording corresponding environmental parameters, wherein the environmental parameters comprise temperature, humidity, air pressure and gas concentration data, the gas sensors are divided into a reference group and a test group, the reference group is used for acquiring a data development algorithm, and the test group is used for an actual gas detection verification algorithm;
A model construction module for constructing a gas compensation model for describing the inherent relation of sensor output, environmental parameters and actual gas concentration based on the collected original output signals and corresponding environmental data, wherein the gas compensation model integrates hardware compensation and software algorithm compensation, the hardware compensation performs preliminary compensation of gas in the environment through serial-parallel circuit design, and the software algorithm compensation comprises a temperature compensation algorithm, a humidity compensation algorithm, a gas concentration compensation algorithm and a zero offset calibration algorithm;
the calculation compensation module is used for acquiring the current environmental parameters in real time through the gas sensor, inputting the current environmental parameters into the gas compensation model, and correcting and calculating the output signals of the gas sensor through the gas compensation model to obtain compensated gas concentration signals.
The invention also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the gas sensing compensation method when executing the computer program.
The present invention also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of the gas sensing compensation method described above.
The gas sensing compensation method and device provided by the invention have the following beneficial effects:
(1) By considering factors which influence the measurement accuracy in multiple aspects such as dynamic changes of temperature, humidity and air pressure and gas concentration, zero drift and the like, and constructing a gas compensation model to carry out corresponding compensation, the measurement error caused by the external environment and the characteristics of the gas sensor is effectively corrected, so that the gas sensor can stably and accurately output a measurement result in a complex and changeable environment, and reliable gas concentration data is obtained.
(2) The method comprises the steps of combining hardware compensation with software algorithm compensation, wherein the hardware compensation is designed through a series-parallel circuit (such as a serial thermistor or a parallel thermistor, a humidity resistor and the like), and a divider resistor, an operational amplifier and the like are utilized to adjust output signals of the gas sensor according to output of the environmental sensor, so that the environment factors can be primarily and comprehensively compensated on a hardware level, the software algorithm compensation covers a plurality of specific algorithms such as a temperature compensation algorithm, a humidity compensation algorithm, a gas concentration compensation algorithm and a zero offset calibration algorithm, and each algorithm can be independently or jointly used according to actual environment and measurement requirements, and the method further has self-adaption capability, and can dynamically adjust and select compensation parameters according to preset judgment logic rules according to change rates and fluctuation amplitudes of the environment factors, so that the method is suitable for environment conditions of different change conditions, and the practicability of the gas sensor in various scenes is greatly enhanced.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, a flow chart of a gas sensing compensation method according to the present invention includes the following steps:
S1, acquiring original output signals of gas sensors under various environmental conditions within preset time, and simultaneously recording corresponding environmental parameters, wherein the environmental parameters comprise temperature, humidity, air pressure and gas concentration data, the gas sensors are divided into a reference group and a test group, the reference group is used for acquiring a data development algorithm, and the test group is used for an actual gas detection verification algorithm;
S2, constructing a gas compensation model for describing the inherent relation among sensor output, environmental parameters and actual gas concentration based on the acquired original output signals and corresponding environmental data, wherein the gas compensation model integrates hardware compensation and software algorithm compensation, the hardware compensation performs preliminary compensation of gas in the environment through serial-parallel circuit design, and the software algorithm compensation comprises a temperature compensation algorithm, a humidity compensation algorithm, a gas concentration compensation algorithm and a zero offset calibration algorithm;
s3, acquiring current environmental parameters in real time through a gas sensor, inputting the current environmental parameters into the gas compensation model, and correcting and calculating output signals of the gas sensor through the gas compensation model to obtain compensated gas concentration signals.
As described in step S1, the original output signals of the gas sensor under various environmental conditions within the preset time period are obtained, and corresponding environmental parameters including temperature, humidity, air pressure and gas concentration data are recorded at the same time, wherein the gas sensor is divided into a reference group and a test group, the reference group is used for acquiring a data development algorithm, and the test group is used for an actual gas detection verification algorithm. And collecting original output signals of the gas sensor in a specific time range, wherein the signals are values directly output after the sensor senses the gas based on the environment without any compensation correction. At the same time, corresponding environmental parameters including temperature, humidity, air pressure and gas concentration data are synchronously recorded, the temperature influences the physical characteristics of sensor materials so as to change the sensor output, the humidity change possibly causes the surface of the sensor to generate moisture absorption or dehydration phenomenon, the interaction of air molecules and the sensor surface is interfered to influence the output, the air pressure change can lead to the diffusion and adsorption behaviors of left and right gases to cause the deviation of the sensor output, and the condition of the gas concentration is also an important factor to be considered in the subsequent analysis and compensation because the performance of the sensor output is different under different concentrations. The gas sensor is divided into a reference group and a test group, wherein the reference group is used for collecting data to develop an algorithm, for example, the reference group is used for analyzing the internal correlation between environmental factors and output signals under different environmental conditions such as temperature, humidity and the like and corresponding output signal conditions, so as to provide raw data materials for developing temperature compensation algorithms, humidity compensation algorithms and the like. The test group focuses on the effectiveness of the actual gas detection verification algorithm, and after a corresponding compensation algorithm is developed based on the data collected by the reference group to form a gas compensation model, the test group is required to be utilized in a real gas detection scene to check whether the algorithms and the model can truly correct measurement errors and improve measurement accuracy.
As described in the above step S2, based on the collected original output signal and the corresponding environmental data, a gas compensation model for describing the inherent relationship among the sensor output, the environmental parameter and the actual gas concentration is constructed, and the gas compensation model integrates hardware compensation and software algorithm compensation, wherein the hardware compensation performs preliminary compensation of the gas in the environment through serial-parallel circuit design, and the software algorithm compensation comprises a temperature compensation algorithm, a humidity compensation algorithm, a gas concentration compensation algorithm and a zero offset calibration algorithm.
And (2) constructing a gas compensation model based on the original output signals obtained in the step (S1) and corresponding environmental data, wherein the original output signals reflect actual measurement performances of the gas sensor when the gas sensor is not corrected under different environmental conditions, and the environmental data (such as temperature, humidity, air pressure, gas concentration and the like) reflect specific conditions of external influence factors. Through operations such as a large amount of analysis, induction, mathematical modeling and the like on the data of the two aspects, an internal and regular relation among sensor output, environmental parameters and actual gas concentration is found out, and then a gas compensation model is constructed. The model aims at outputting a gas concentration signal which is compensated and corrected and is closer to a true value through the internal operation processing by inputting related data such as environmental parameters, original output signals of a sensor and the like. The hardware compensation is mainly to realize the preliminary compensation of the gas in the environment through the serial-parallel circuit design. For example, specific electronic components such as a thermistor and a humidity resistor are connected in series or in parallel in a circuit. The thermistor can change the resistance value along with the change of the ambient temperature, and then the output signal of the gas sensor is adjusted based on the change of the resistance value, so that the measurement error caused by temperature fluctuation can be offset to a certain extent, and the humidity-sensitive resistor correspondingly changes the resistance according to the change of the ambient humidity, so that the output signal of the gas sensor is adjusted through the circuit effect, and the interference caused by the change of the humidity is reduced. Wherein, for the thermistor, the resistance value of the thermistor at the current temperature T is R T, the resistance value at the standard temperature T 0 is R T0, and the temperature coefficient of the thermistor is alpha T The resistance value of the humidity sensitive resistor under the current humidity H is set as R h, the resistance value of the humidity sensitive resistor under the standard humidity H 0 is set as R h0, and the sensitivity coefficient of the humidity sensitive resistor is alpha h Also, the resistance change in the hardware circuit acts on the gas sensor output.
For the temperature compensation algorithm, when the ambient temperature changes, the output of the gas sensor is affected, and the algorithm is to correct the error caused by the temperature change. For example, by using the difference in signal output of the gas sensor a and the gas sensor B, which are similar in characteristics and within a preset response time, the signal output of the gas sensor B is calculated and adjusted according to a specific temperature compensation algorithm formula. The gas sensor A can be used as a simple temperature sensor after being sealed, and is only used for acquiring environmental temperature change, and the gas sensor B is used for detecting actual gas and receiving a temperature compensation signal from the gas sensor A, so that the compensation of the influence on temperature factors is realized. Let the output signal of the gas sensor A at the temperature T be S A (T), the original output signal of the gas sensor B at the temperature T and the gas concentration C be S B (T, C), the output signal of the gas sensor B after temperature compensation be S' B (T, C), the influence coefficient of the temperature on the output of the gas sensor B be beta T, thenWherein T 0 is the standard temperature.
For the temperature compensation algorithm, the humidity change of the environment is monitored by adding a humidity sensitive resistor in the circuit, and the humidity change is limited in a preset response time length and a preset humidity response range. The humidity-sensitive resistor can output a corresponding signal according to the change of humidity, and then the output of the gas sensor is further adjusted by utilizing the signal through a circuit according to a humidity software algorithm, so that the deviation caused by humidity factors is reduced in the output result, and the actual gas concentration condition is reflected more accurately. Setting the resistance value of the humidity-sensitive resistor at the current humidity H as R h, the resistance value at the standard humidity H 0 as R h0 and the sensitivity coefficient of the humidity-sensitive resistor as alpha h The actual output signal of the gas sensor is S, the output signal under standard humidity is S 0, the influence coefficient of humidity on the sensor output is beta H, S=S 0(1+βH H), the sensor output signal after humidity compensation is S c 。
For the air pressure compensation algorithm, the standard gas is utilized to calibrate the gas sensor, namely, the standard gas with known concentration is determined in advance, the sensor acts with the standard gas and records corresponding output signals, a mathematical model formula (such as a formula containing coefficients a and b, a specific functional relation f and the like) between the gas concentration and the sensor output is established based on the data, and then in actual measurement, the standard gas sensor can be adjusted in real time according to the established mathematical model and the real-time output signals of the sensor, so that the measured gas concentration is closer to a real value. Let the gas concentration be C and the sensor output signal be S, the mathematical model obtained by calibration experiments be c=f (S), where f is a specific functional relation, e.g. c=as+b (a, b are coefficients determined by calibration), according to which the corresponding gas concentration C can be calculated when the sensor output signal S is obtained and the sensor output adjusted accordingly.
For the zero compensation algorithm, the gas sensor may have a zero drift problem during use, that is, its output may deviate from a preset zero reference value even in the absence of the target gas. The algorithm can automatically calibrate the gas sensor regularly or in real time, compares the current gas sensor output value with a preset zero reference value, accurately calculates a zero drift value according to a zero adjustment formula once the deviation exceeds a set threshold value, correspondingly adjusts the gas sensor output signal, ensures the accuracy of the sensor in a zero state, and avoids the increase of measurement errors caused by accumulation of zero drift. Let the current gas sensor output value be S current, the preset zero reference value be S zero, the threshold be Δs, and when |s current - Szero | > Δs, the zero drift value Δs zero = Scurrent - Szero, the adjusted gas sensor output signal S adjusted = Scurrent - Szero .
The algorithm in the software algorithm compensation has self-adaptive capability, dynamically adjusts and selects compensation parameters according to the change rate and fluctuation amplitude of the environmental factors and according to a preset judgment logic rule, and corrects the output signals of the gas sensor under different environmental conditions, wherein the judgment logic rule is that when the change rate of the environmental parameters is larger than a preset first change rate A1 and the fluctuation amplitude is larger than a preset first fluctuation amplitude A1, reinforcement compensation is carried out, and when the change rate V2 of the environmental parameters is smaller than a preset second change rate and the fluctuation amplitude is smaller than a preset second fluctuation amplitude A2, conventional compensation is carried out.
Let the change of the environmental parameter (such as temperature, humidity, etc.) from time t 1 to t 2 be ΔE, the rate of changeThe fluctuation amplitude A can be obtained by counting the difference between the maximum value E max and the minimum value E min of the environmental parameters in a period of time, namely. In the case of the reinforcement compensation and the conventional compensation, the correlation coefficient (e.g., β T in the case of temperature compensation, β H in the case of humidity compensation, etc.) in each compensation algorithm (temperature, humidity, gas concentration, zero point offset calibration) is adjusted according to a predetermined rule, for example, the correlation coefficient is increased by a certain proportion in the case of the reinforcement compensation.
And (3) acquiring the current environmental parameter in real time through the gas sensor, inputting the current environmental parameter into the gas compensation model, and correcting and calculating the output signal of the gas sensor through the gas compensation model to obtain a compensated gas concentration signal.
And acquiring various parameters of the current environment in real time by utilizing the environment sensing function of the gas sensor, and inputting the current environment parameters which are acquired in real time into a previously constructed gas compensation model. The gas compensation model is formed by a series of operations such as analysis, modeling and the like based on a large number of original output signals acquired in advance and corresponding environmental data, has determined the internal relation among sensor output, environmental parameters and actual gas concentration, and integrates various compensation mechanisms such as hardware compensation, software algorithm compensation and the like. After the gas compensation model receives the input current environmental parameters, the original signals currently output by the gas sensor are comprehensively and pointedly expanded and calculated according to hardware compensation logic (such as adjusting the influence caused by temperature and humidity changes through elements such as a thermistor, a humidity resistor and the like which are connected in series and parallel in a circuit) and software algorithm compensation logic (such as a temperature compensation algorithm, a humidity compensation algorithm, a gas concentration compensation algorithm, a zero point offset calibration algorithm and the like, and respectively correcting measurement errors caused by different factors). For example, if the current ambient temperature increases, the temperature compensation algorithm may coordinate with the various compensation mechanisms based on information such as the input temperature parameter and a predetermined correlation coefficient of temperature effects on the sensor output.
After the correction calculation flow in the gas compensation model, the compensated gas concentration signal can be finally obtained. Compared with the original signal originally output by the gas sensor, the signal has the advantages that the measurement error caused by the interference of environmental factors and the characteristics (such as zero drift and the like) of the sensor is eliminated or greatly reduced, and the actual gas concentration condition in the current environment is reflected more accurately.
In one embodiment, four gas sensors A, B, C and D with similar characteristics are selected, sensor A is used as a reference sensor to be divided into a reference group for acquiring a data development algorithm, and sensor B, C, D is divided into a test group for an actual gas detection verification algorithm. The gas sensors a and B are mounted on a circuit board and a temperature sensor (e.g., a thermistor) is placed in close proximity to it to ensure that the sensors accurately sense environmental changes and are connected to the data acquisition circuit. When the ambient temperature changes, the resistance of the temperature sensor (thermistor) changes, and the output signal S A (T) of the gas sensor a changes through circuit elements such as a voltage dividing resistor and an operational amplifier, and the original output signal S B (T, C) of the gas sensor B is also affected (where T is the current temperature and C is the gas concentration). The microprocessor collects output signals S A (T) and S B (T, C) of the gas sensors A and B in real time through the A/D converter.
The output signal of the gas sensor a at the standard temperature T 0 is known as S A(T0), and the influence coefficient β T of the temperature on the output of the gas sensor B. The calculation is carried out according to a temperature compensation algorithm formula:
For example, if the standard temperature t0=25 ℃, S A (25) =1.0, when the ambient temperature t=30 ℃, S A(30)=1.2,SB(30,C)=1.5,βT =0.05. Then β T(SA(T)-SA(T0))=0.05 (1.2-1.0) =0.01, and finally a temperature compensated gas sensor B output signal S' B (30, c) =1.5-0.01=1.49 is obtained. At this time, only temperature compensation is considered, and the output signal S' B (T, C) of the temperature-compensated gas sensor B is used in the subsequent gas concentration calculation or other data processing links, so as to observe the effect of improving the measurement accuracy when the temperature compensation is independently applied.
If the temperature changes, the ambient humidity changes. According to a humidity compensation algorithm, setting the resistance value of the humidity-sensitive resistor at standard humidity H 0 =50% as R h0, setting the sensitivity coefficient of the humidity-sensitive resistor as alpha h, and setting the current humidity H 0 =60%, wherein the resistance value of the humidity-sensitive resistor is. Knowing the standard output signal s0=2.0 of the gas sensor at standard humidity, the influence coefficient β H =0.03 of humidity on the sensor output is according to the formulaThe actual output signal S after humidity is calculated, i.e. s=2.0 (1+0.03×60%) = 2.036. Then according to the humidity compensation formulaThe compensated sensor output signal sc= 2.036 (1-0.03×60%) = 1.994 is calculated. And then, combining the humidity compensated signal S c with the temperature compensated signal S' B (T, C) according to a specific fusion rule (such as weighted average and the like) to obtain an output signal of the gas sensor B which is subjected to temperature and humidity compensation simultaneously, wherein the output signal is used for more accurate gas concentration calculation or data processing so as to show the effect improvement during the combined compensation of the temperature and humidity parameters.
Further consider the combined application of other environmental parameters such as air pressure (assuming that the air pressure sensor is also installed and collecting data), and the air concentration compensation algorithm and zero-point offset calibration algorithm. For air pressure compensation, assuming that the air pressure sensor measures the current air pressure P, the standard air pressure P 0, the influence coefficient of the air pressure on the output of the air sensor B is beta P, and the output signal change quantity delta S P = βP (P-P0) caused by air pressure change, the air sensor B after air pressure compensation outputs a signal(S' B (T, C) here is the original output signal without barometric pressure compensation).
And then combining the signals after temperature, humidity and air pressure compensation. One common combination is weighted averaging, with a temperature compensation signal weight of ω T, a humidity compensation signal weight of ω H, a barometric pressure compensation signal weight of ω P (and ω T+ωH+ωP =1), the combined signal being:
Mathematical model between gas concentration and sensor output established by calibrating gas sensor with standard gas (E.g., c=0.5s+5, here, the coefficient obtained by calibration). To combine the signalsSubstituting into the gas concentration compensation model to obtain a preliminary gas concentration compensation value。
According to the zero-point offset calibration algorithm, a zero-point reference value S zero =0.1 is preset, a threshold value Δs=0.05 is set, and the sensor output value S current is monitored in real time during the measurement process (S current is a signal compensated by the previous temperature, humidity, air pressure and gas concentration). If |s current - Szero | > Δs, a zero drift value Δs zero = Scurrent - Szero is calculated and the adjusted gas sensor output signal S adjusted = Scurrent - Szero.
Finally, substituting the signal S adjusted after zero point offset calibration into the gas concentration compensation model againAnd (3) obtaining a final high-precision gas concentration value C final = f ( Sadjusted). And compares this final value with the data collected by sensors C and D in the same environment. If deviation is found, the coefficients (such as temperature compensated beta T, humidity compensated beta H, air pressure compensated beta P, a and b in a gas concentration compensation model and the like) in each compensation algorithm are adjusted according to the deviation condition so as to optimize the whole multi-parameter combination compensation algorithm and improve the measurement accuracy and reliability of the gas sensor under different environmental conditions.
By the multi-parameter combination compensation algorithm, the influence of environmental factors on the output of the gas sensor can be comprehensively considered, errors are reduced to the maximum extent, and measurement accuracy is improved.
In yet another embodiment, the reference group sensor a and standard gases of different concentrations (e.g., C 1=10ppm,C2=20ppm,C3 =30 ppm, etc.) are used to test the gas sensor, resulting in a corresponding sensor output signal S 1,S2,S3, etc. Establishing a mathematical model between gas concentration and sensor output by data fitting. Let the fitted model be c=0.5s+5.
In actual measurement, the microprocessor collects the output signal S of the test group gas sensor (e.g., B, C, D). Substituting S into the model c=0.5s+5 calculates the gas concentration C. For example, when s=15, c=0.5×15+5=12.5 ppm. At this time, a preliminary gas concentration value is calculated by using a gas concentration compensation algorithm alone, and the accuracy of the preliminary gas concentration value is observed.
In yet another embodiment, a gas analyzer incorporating the gas sensing compensation technique of the present invention is used in the context of industrial exhaust emission monitoring. The gas analyzer is equipped with a plurality of gas sensors for detecting harmful gas components such as sulfur dioxide (SO 2), nitrogen oxides (NOx), carbon monoxide (CO) and the like in the exhaust gas.
During the calibration phase of the instrument, the gas sensors are divided into a reference group and a test group. The sensors of the reference group are placed in a laboratory environment whose temperature, humidity, barometric pressure, etc. parameters can be precisely controlled and tested using standard gases of different concentrations (e.g., 5ppm, 10ppm, 20ppm, etc. SO 2 concentration, 1ppm, 5ppm, 10ppm, etc. NOx concentration, 2ppm, 5ppm, 8ppm, etc. CO concentration), while recording the sensor's raw output signals and corresponding environmental parameters. These data are used to construct a gas compensation model.
For the hardware compensation part, a high-precision thermistor and a humidity resistor are connected in series in the sensor circuit. Taking a sensor for detecting SO 2 as an example, when the ambient temperature rises, the resistance of the thermistor changes, and the power supply voltage or current of the sensor is changed through a specific circuit design, SO that the output signal of the SO 2 sensor is initially adjusted. When the standard temperature is 25 ℃, the resistance value of the thermistor is R 1, and when the temperature is increased to 35 ℃, the resistance value of the thermistor is changed into R 2 according to the temperature coefficient of the thermistor, and the change ensures that the output signal of the sensor is compensated to a certain degree on the hardware level, so that the influence of the temperature on the measurement result is reduced. Similarly, the humidity sensor adjusts the sensor output according to the change of the ambient humidity, and when the humidity is increased from 40% RH to 60% RH, the resistance value of the humidity sensor is changed, so that the circuit parameters are affected, and the measurement deviation caused by the humidity factor is compensated.
In terms of software algorithm compensation, corresponding compensation algorithms are applied to the sensors of different gases, respectively. For the temperature compensation algorithm of the SO 2 sensor, two gas sensors A and B with similar characteristics are arranged, and the sensor A is sealed to serve as a temperature sensor. During one measurement, the ambient temperature varies from 20 ℃ to 30 ℃, knowing the standard temperature T 0 = 25 ℃, the output signal SA (25) =0.8 of sensor a, when T = 30 ℃, SA (30) =1.0, the original output signal SB (30, 10) =1.3 of sensor B at a temperature T = 30 ℃ and SO 2 concentration C = 10ppm, the temperature impact coefficient βt = 0.04 on the output of sensor B. According to the formula of the temperature compensation algorithm, the method comprises the following steps of:
S'B(30, 10) = SB(30, 10) - βT(SA(T) - SA(T0)) = 1.3 - 0.04×(1.0 - 0.8) = 1.292
In the humidity compensation algorithm, the resistance value of the humidity-sensitive resistor is Rh 0 under the condition that the standard humidity H 0 =50%, the sensitivity coefficient is alpha H, and the current humidity H=70%, so that the resistance value of the humidity-sensitive resistor is correspondingly changed. The standard output signal S 0 =1.5 of the SO 2 sensor at standard humidity is known, and the influence coefficient βh=0.03 of humidity on the sensor output. Firstly, calculating an actual output signal S after being affected by humidity:
S = S0(1 + βHH) = 1.5×(1 + 0.03×70%) = 1.5315
and calculating a compensated sensor output signal Sc according to a humidity compensation formula:
Sc = S×(1 - βHH) = 1.5315×(1 - 0.03×70%) = 1.483
The gas concentration compensation algorithm compensates using a mathematical model built from pre-calibrated standard gas data. For example, for an SO 2 sensor, the mathematical model obtained by calibration is c=0.6s+3 (where a=0.6, b=3). In actual measurement, when the sensor output signal s= 1.292 (temperature compensated signal), a preliminary gas concentration compensation value C is calculated:
C = 0.6×1.292 + 3 = 3.7752ppm
The zero offset calibration algorithm automatically calibrates the sensor periodically. Preset zero reference value S zero =0.05, and threshold Δs=0.03. During the measurement, if the deviation of the current sensor output values S current and S zero exceeds a threshold value, an adjustment is performed. For example, in some measurement, S current =0.08, the zero drift value Δs zero = Scurrent - Szero =0.03 is calculated, and the adjusted gas sensor output signal S adjusted = Scurrent - ΔSzero =0.05.
After the application and debugging of the gas sensing compensation technique is completed, the gas analyzer is subjected to an accuracy test. The instrument was tested using a series of standard gases of known concentration and the error between the measurement and standard values was recorded.
For SO 2 gas detection, in the standard gas test with the concentration of 5ppm, when the compensation technology is not applied, the measured value fluctuates between 4.5ppm and 5.5ppm, the average error is +/-0.5 ppm, and after the compensation technology is applied, the measured value is stabilized within the range of 4.9ppm to 5.1ppm, and the average error is reduced to +/-0.1 ppm. In the standard gas tests of 10ppm and 20ppm, the errors at the time of uncompensation are +/-1 ppm and +/-1.5 ppm respectively, and the errors after compensation are reduced to +/-0.2 ppm and +/-0.3 ppm.
For NOx gas detection, the measurement error can reach +/-0.2 ppm when uncompensated under the standard gas test of 1ppm, the error after compensation is controlled within +/-0.05 ppm, and the average error after uncompensated is +/-0.5 ppm and +/-0.8 ppm in the standard gas test of 5ppm and 10ppm, and the error is reduced to +/-0.1 ppm and +/-0.2 ppm respectively after the compensation technology is applied.
For CO gas detection, the uncompensated measurement error ranges were ± 0.3ppm, ± 0.6ppm and ± 0.9ppm, respectively, in the standard gas tests of 2ppm, 5ppm and 8ppm, the error after compensation was significantly reduced to ± 0.05ppm, ± 0.1ppm and ± 0.15ppm, respectively.
In the actual industrial exhaust emission monitoring process, a sensor of the gas analyzer acquires current environmental parameters (temperature, humidity, air pressure and the like) and gas concentration signals in real time. And inputting the environmental parameters into a constructed gas compensation model, wherein hardware compensation and software algorithm compensation in the model work cooperatively, and correcting and calculating the sensor output signal. For example, for the NOx sensor, after the compensation of factors such as temperature, humidity, air pressure and zero offset is considered, a compensated gas concentration signal is obtained and displayed on a display screen of an instrument, so that accurate exhaust gas component monitoring data is provided for an environmental protection department, and the exhaust gas emission of an industrial enterprise is ensured to meet environmental protection standards.
According to the embodiment, the gas sensing compensation technology is applied to a gas detection instrument, so that the accuracy and reliability of the instrument for detecting various gases in a complex industrial environment can be effectively improved, and the requirements of practical application are met.
Referring to fig. 2, a block diagram of a gas sensor compensation device according to an embodiment of the invention includes:
the data acquisition module is used for acquiring original output signals of the gas sensor under various environmental conditions within a preset duration and recording corresponding environmental parameters;
The model construction module is used for constructing a gas compensation model for describing the inherent relation between sensor output, environmental parameters and actual gas concentration based on the acquired original output signals and corresponding environmental data;
the calculation compensation module is used for acquiring the current environmental parameters in real time through the gas sensor, inputting the current environmental parameters into the gas compensation model, and correcting and calculating the output signals of the gas sensor through the gas compensation model to obtain compensated gas concentration signals.
For the specific implementation of each module in the above device example, please refer to the above method embodiment, and no detailed description is given here.
Referring to fig. 3, in an embodiment of the present invention, there is further provided a computer device, which may be a server, and an internal structure thereof may be as shown in fig. 3. The computer device includes a processor, a memory, a display screen, an input device, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used for communicating with an external terminal through a network connection. Which computer program, when being executed by a processor, carries out the above-mentioned method.
It will be appreciated by those skilled in the art that the architecture shown in fig. 3 is merely a block diagram of a portion of the architecture in connection with the present inventive arrangements and is not intended to limit the computer devices to which the present inventive arrangements are applicable.
An embodiment of the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above method. It is understood that the computer readable storage medium in this embodiment may be a volatile readable storage medium or a nonvolatile readable storage medium.
In summary, the invention provides a gas sensing compensation method, which comprises the steps of obtaining original output signals of a gas sensor under various environmental conditions within a preset time period, recording corresponding environmental parameters, constructing a gas compensation model for describing the inherent relation between sensor output and environmental parameters and actual gas concentration based on the collected original output signals and the corresponding environmental data, obtaining current environmental parameters through the gas sensor in real time, inputting the current environmental parameters into the gas compensation model, correcting and calculating the output signals of the gas sensor through the gas compensation model to obtain compensated gas concentration signals, so as to realize omnibearing correction of measurement errors caused by various factors, ensure that the gas sensor can stably and accurately output measurement results under complex and changeable environmental conditions, and provide reliable data support for various fields of application, thereby improving the overall performance and practicability of the gas sensor.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present invention and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, apparatus, article, or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or equivalent processes using the descriptions and drawings of the present invention or direct or indirect application in other related technical fields are included in the scope of the present invention.