Gas detection method
By combining physical models and data-driven methods, a correction model is constructed, which solves the problem of insufficient detection accuracy of carbon dioxide and oxygen in high-pressure environments, and accurately gas detection in high-pressure environments is achieved.
Patent Information
- Application Number
- CN202510528301.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-04-25
AI Technical Summary
Traditional gas detection methods lack detection accuracy of carbon dioxide and oxygen in high-pressure environments, and existing compensation methods ignore the relationship between the two, resulting in large deviations in the detection results.
Using a coordinated pressure compensation scheme combining physical model-driven and data-driven, a correction model based on Bill Lambert's law and Nernst equation is constructed to synergize gas concentration through air pressure sensors, Kalman filtering algorithms, multivariate linear regression and model-driven backpropagation networks.
The accuracy of carbon dioxide and oxygen detection in high-pressure environments is improved, and the pressure correction accuracy is improved through the combination of physical models and data-driven.
Smart Images

Figure CN120064191B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of gas detection, and particularly to a gas detection method. Background Art
[0002] Traditional gas detection means have frequent problems in detecting carbon dioxide and oxygen under high-pressure environments. The physical properties of gases change due to high pressure, interfering with the detection principle and resulting in large deviations in detection results. There is an urgent need for innovative detection methods to improve accuracy.
[0003] However, in the existing pressure compensation methods for carbon dioxide and oxygen detection, unidirectional compensation is carried out through the fitting of physical models or through neural networks based on data-driven methods, ignoring the relationship between the two and having insufficient pressure compensation accuracy. Summary of the Invention
[0004] In view of the deficiencies of the existing technology, the present invention provides a gas detection method to provide a collaborative pressure compensation scheme combining physical model-driven and data-driven methods, improve pressure correction accuracy, and achieve accurate gas detection under high-pressure environments.
[0005] The technical solution to achieve the object of the present invention is as follows:
[0006] A gas detection method, comprising the following specific steps:
[0007] The air pressure at the current moment is converted into voltage through the cooperation of the thin film, flexible resistor, and constant current source circuit in the air pressure sensor and the digital signal at the current moment is obtained through analog-to-digital conversion . The state transition equation and observation equation based on the working principle of the air pressure sensor are established using the Kalman filtering algorithm, and the Kalman filtering gain is calculated in combination with the digital observation value at the current moment to update and obtain the denoised air pressure at the current moment , where the digital observation value is the observation result of the digital signal ; The spectral absorption characteristics related to carbon dioxide are fitted by multiple linear regression to obtain the preliminary concentration of carbon dioxide at the current moment , and the loop current generated by the oxidation-reduction reaction at the current moment is measured using an electrochemical oxygen sensor to obtain the preliminary concentration of oxygen at the current moment ;
[0008] ;
[0009] Design a model-driven backpropagation network, and construct correction models for air pressure based on the Beer-Lambert law and the Nernst equation respectively ; design a double-hidden-layer structure. Among them, the first hidden layer substitutes the denoised air pressure at the current moment into the correction model , and combines the non-linear mapping of the preliminary concentration at the current moment to perform a primary pressure correction. The second hidden layer learns the potential relationship between the primary pressure correction result, the measurement device parameters and the denoised air pressure through non-linear mapping to perform a secondary pressure correction, and obtains the concentration at the current moment through linear modulation. The correction model includes an absorption rate correction model and a diffusion rate correction model . The preliminary concentration at the current moment includes the preliminary concentration of carbon dioxide and the preliminary concentration of oxygen . The concentration at the current moment includes the concentration of carbon dioxide and the concentration of oxygen . .
[0010] Furthermore, the air pressure at the current moment is converted into a digital signal at the current moment by a pressure sensor, including the following specific steps:
[0011] Based on Hooke's law, the film deformation amount at the current moment is equal to the product of the air pressure at the current moment and the film area divided by the film stiffness coefficient ;
[0012] The film deformation drives the displacement of the thimble, causing a resistance change. The displacement amount of the thimble is equal to the film deformation amount . The resistance change amount at the current moment is equal to the product of the displacement amount of the thimble and the displacement-resistance conversion coefficient ;
[0013] Based on Ohm's law, the change in resistance causes the voltage of the constant current source circuit to change. At the current moment, the constant current source circuit Voltage Change to built-in resistance value and resistance change The sum multiplied by the constant current ;
[0014] The current moment Voltage Generate the current time through analog-to-digital conversion Digital signal .
[0015] Furthermore, the current moment is obtained through the Kalman filter algorithm Denoising pressure , including the following specific steps:
[0016] Defining the current moment The pressure state vector Including the current time Air pressure and the rate of change of air pressure ;
[0017] Constructing the current moment Air pressure The state transfer equation of the last moment Air pressure To the current time Air pressure The change in air pressure is equal to the current moment The first process noise Add a moment The rate of change of air pressure The product of the elapsed time and the current time The rate of change of air pressure Equal to the previous moment The rate of change of air pressure Add current time The second process noise , extract the current moment based on the matrix form of the state transfer equation The state transition matrix and the current moment The process noise covariance matrix ;
[0018] Obtaining digital signals based on the working principle of air pressure sensor About air pressure The conversion equation of the digital signal Equal to constant bias Add the first gas parameter The product with air pressure , introducing observation noise and the rate of change of air pressure For the linear influence on the digital signal , construct the digital observation value Regarding air pressure The observation equation, that is, the digital observation value is equal to the product of the first air-sensing parameter and air pressure plus the second air-sensing parameter and the product of the rate of change of air pressure plus the observation noise . Extract the observation matrix and the observation noise covariance matrix at the current moment ;
[0019] Superimpose the process noise covariance matrix on the generalized congruent transformation of the estimated covariance matrix at the previous moment and the state transition matrix at the current moment to obtain the prior estimated covariance matrix at the current moment . The prior estimated covariance matrix reflects the estimated uncertainty considering the process noise under the prior condition of the known estimated covariance matrix at the previous moment . The generalized congruent transformation of the first matrix and the second matrix is defined as the continuous multiplication of the second matrix, the first matrix, and the transpose of the second matrix;
[0020] Multiply the sum of the generalized congruent transformation of the prior estimated covariance matrix at the current moment and the observation matrix by the transpose of the observation matrix and the observation noise covariance matrix at the current moment to obtain the Kalman gain at the current moment . The Kalman gain at the current moment determines the confidence level of the digital observation value at the current moment ;
[0021] Use the product of the Kalman gain at the current moment and the observation residual at the current moment to correct the previous moment The pressure state estimation vector , get the current time The pressure state estimation vector , current moment The pressure state estimation vector Including the current time Denoising pressure and the estimated rate of change of air pressure , where the current moment The observed residual For the current moment Numerical observations of Subtract the observation matrix With the previous moment The pressure state estimation vector The product of
[0022] Through the identity matrix With the current moment Kalman gain and the observation matrix The difference of the product of the corrected prior estimate covariance matrix , get the current time The estimated covariance matrix of .
[0023] Specifically, at the current moment Infrared light is emitted to the gas to be tested and the infrared spectrum of the gas to be tested is obtained through a spectrometer to identify the carbon dioxide-related The characteristic absorption peak intensity is calculated by multivariate linear regression. The intensity of the characteristic absorption peak is multiplied by the corresponding regression coefficient and superimposed with the intercept reflecting the measurement error of the spectrometer and the environmental factors not taken into account to generate the current moment Initial concentration of carbon dioxide , the regression coefficients are obtained in advance by least squares fitting.
[0024] Specifically, at the current moment Electrochemical oxygen sensor is used to measure the initial oxygen concentration The anode and cathode in the electrochemical oxygen sensor undergo oxidation and reduction reactions with oxygen to promote the flow of electrons and generate the current moment Loop current , initial oxygen concentration is the initial value of oxygen concentration Add current time Loop current and initial value of loop current The difference is multiplied by the sensor sensitivity .
[0025] Further, the Beer-Lambert law is used to establish an absorption rate correction model , the absorption rate correction model has a positive correlation with the standard absorption rate , and the positive correlation coefficient is the power function form of the ratio of the air pressure to the standard air pressure , and the exponent of the power function is the pressure sensitivity index , the standard absorption rate is the absorption rate of carbon dioxide to infrared light under the standard air pressure , and the absorption rate correction model describes the change of the absorption rate of carbon dioxide with the same concentration to the same infrared light under different air pressures . The higher the absorption rate, the more accurate the measurement of the spectrometer.
[0026] Further, the Nernst equation is used to establish a diffusion rate correction model , the diffusion rate correction model has a positive correlation with the standard diffusion rate , and the positive correlation coefficient is the linear function form of the difference between the air pressure and the standard air pressure , and the linear coefficient of the linear function is the pressure sensitivity coefficient , the standard diffusion rate is the diffusion rate of oxygen under the standard air pressure , and the diffusion rate correction model describes the diffusion ability of oxygen with the same concentration under different air pressures . The stronger the diffusion ability, the more sufficient the oxidation-reduction reaction of oxygen in the electrochemical oxygen sensor, and the more accurate the measurement of the electrochemical oxygen sensor.
[0027] Further, the model-driven backpropagation network includes a first hidden layer, a second hidden layer, and an output layer;
[0028] The first hidden layer substitutes the denoised air pressure at the current moment into the correction model , and obtains the physical correction coefficient at the current moment , combines the denoised air pressure at the current moment with the preliminary concentration to form a first superimposed input , and maps the linear modulation of the first superimposed input through the ReLU activation function to analyze the non-linear correlation between the preliminary concentration and the denoised air pressure , and generates the current moment The first hidden representation , multiply the first hidden representation by the physical correction coefficient to generate a first corrected representation ;
[0029] The second hidden layer obtains the measurement device parameters , and combines them with the first corrected representation at the current moment and the denoised air pressure to construct a second superimposed input . Map the linear modulation of the second superimposed input through the ReLU activation function to analyze the non-linear correlation between the measurement device parameters and the denoised air pressure at the current moment to generate a second hidden representation , where the measurement device parameters include the initial light intensity of the spectrometer and the initial loop current value of the electrochemical oxygen sensor ;
[0030] The output layer linearly modulates the second hidden representation at the current moment to generate the concentration at the current moment .
[0031] Specifically, the model-driven backpropagation network needs to collect the preliminary concentrations obtained from multiple groups of gas samples with known measured concentrations , the denoised air pressure during measurement and the measurement device parameters during the pre-training stage and construct a training set. The loss function is defined as the error between the concentration output by the model-driven backpropagation network and the known concentration of the gas sample. Backpropagation is performed based on the gradient of the loss function with respect to the network parameters involved in the model-driven backpropagation network, and iterative training is performed using stochastic gradient descent or the Adam optimizer.
[0032] Furthermore, as an improvement, an improved particle swarm algorithm is used instead of the traditional pre-training method, including the following specific steps:
[0033] Set the maximum number of iterations , randomly generate particle position and velocity vectors at the 0th round. The position and velocity vectors of each particle represent a set of network parameters and the forward direction respectively ;
[0034] Use the particles in the initial round as network parameters for training, obtain the loss of each particle in the initial round, and update the global optimal position and the global optimal loss to the position and loss corresponding to the particle with the smallest loss among the particles in the initial round respectively;
[0035] Start a new round of iteration. In the th round, the th particle retains part of the velocity vector in the th round through the inertia weight, and updates and obtains the velocity vector in the th round by referring to the error between the global optimal position and the position in the th round through the learning factor, and superimposes it with the position in the th round to obtain the position in the th round ;
[0036] Use the position of the particle in the th round as network parameters for training, obtain the loss of the particle in the th round . Consider the first particles with the smallest loss in the th round and the remaining particles as the advanced particles and the backward particles in the th round respectively;
[0037] Randomly pair advanced particles in the th round to generate groups of advanced particle pairs. For the first advanced particle and the second advanced particle in the th group of advanced particle pairs, distribute the genetic weight inversely according to the losses of the advanced particle and the advanced particle in the th round, and perform weighted summation on the positions and velocity vectors of the advanced particle and the advanced particle in the th round according to the genetic weight to obtain the high-quality offspring particles of the th group of advanced particle pairs in the The position and velocity vectors of the wheel, ;
[0038] Random pairing of the lagging particles generated in the round to form groups of lagging particle pairs. For the first lagging particle and the second lagging particle in the group of lagging particle pairs, randomly extract and recombine the position and velocity vectors of the lagging particle and the lagging particle in the round to obtain the position and velocity vectors of the mutant offspring particles of the group of lagging particle pairs in the round, ; ;
[0039] Adopt of the offspring particles in the round to replace the lagging particles in the round, and use the positions of the offspring particles in the round as network parameters respectively and perform training to obtain the loss of each offspring particle in the round. Among them, the offspring particles in the round include high-quality offspring particles in the round and mutant offspring particles in the
[0040] Update the global optimal position and the global optimal loss to the position and loss corresponding to the particle with the minimum loss among the particles and offspring particles in the round, and calculate the mean squared error of the loss in the round;
[0041] When the mean squared error of the loss in the round is less than the minimum value or the number of rounds is equal to the maximum number of iteration rounds , stop the iteration and fix the updated global optimal position in the round as the network parameter. In other cases, jump to start a new round of iteration.
[0042] Compared with the prior art, the present invention adopts a model-driven backpropagation network, constructs a correction model of the infrared light absorption rate of carbon dioxide with respect to air pressure based on the Beer-Lambert law, constructs a correction model of the diffusion rate of oxygen with respect to air pressure based on the Nernst equation, substitutes the denoised air pressure at the current moment into the correction model and multiplies it by the non-linear mapping of the preliminary concentration at the current moment, and through the physical model to constrain the data-driven, collaboratively generates a primary correction representation, further analyzes the potential relationship among the primary correction representation, the measurement device parameters and the denoised air pressure at the current moment through the non-linear mapping, generates a second hidden representation and increases the stability through linear modulation to obtain the concentration at the current moment, effectively combines the physical model and the data-driven, improves the pressure correction accuracy, and realizes the accurate detection of carbon dioxide and oxygen in a high-pressure environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a flow chart of the gas detection method in the present invention;
[0044] Figure 2 It is a working schematic diagram of the air pressure sensor in the present invention;
[0045] Figure 3 It is a schematic diagram of the model-driven backpropagation network in the present invention;
[0046] Figure 4 It is a flow chart of the improved particle swarm optimization algorithm in the present invention.
[0047] Reference numerals: 1, thin film; 2, thimble; 3, flexible resistor; 4, constant current source; 5, built-in resistor; 6, voltage measuring device; 7, analog-to-digital converter. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0048] The present invention will be further described in detail below with reference to the drawings and embodiments.
[0049] Embodiment 1
[0050] As Figure 1 shown, a specific embodiment of the present invention discloses a gas detection method, which includes the following specific steps:
[0051] Adopt an air pressure sensor based on Hooke's law and Ohm's law, and convert the air pressure at the current moment into an observable voltage through the cooperation of a thin film, a flexible resistor and a constant current source circuit, and obtain the digital signal at the current moment after analog-to-digital conversion, introduce the Kalman filtering algorithm, establish a state transition equation and an observation equation based on the working principle of the air pressure sensor, and use probability statistics and recursive filtering to combine with the digital observation value at the current moment to obtain the digital signal at the current moment through the digital observation value at the current moment Calculate the Kalman filter gain to update the current moment Denoising pressure , where the numerical observation value For digital signals Observation results of
[0052] At the present moment The multivariate linear regression analysis was used to analyze the spectral absorption characteristics related to carbon dioxide in the infrared spectrum obtained by the spectrometer to obtain the current moment Initial concentration of carbon dioxide , at the current moment The electrochemical oxygen sensor measures the redox reaction at the current moment. The loop current formed To get the current time Initial oxygen concentration ;
[0053] Design a model-driven back propagation network and construct a model for air pressure based on Beer-Lambert's law and Nernst equation. Correction model , design a double hidden layer structure, where the first hidden layer stores the current moment Denoising pressure Substitute into the correction model , and combined with the current moment Initial concentration The nonlinear mapping is used to perform a pressure correction. The second hidden layer learns the pressure correction result and the measurement equipment parameters through nonlinear mapping. and denoised pressure The potential correlation of is used to perform secondary pressure correction, and the current moment is obtained through linear modulation Concentration , correction model Includes absorption correction model and diffusivity correction model , current moment Initial concentration Including preliminary CO2 concentration and initial oxygen concentration , measuring device parameters Including the initial light intensity of the spectrometer and initial value of loop current of electrochemical oxygen sensor , current moment Concentration Including carbon dioxide concentration and oxygen concentration .
[0054] like Figure 2As shown, further, a pressure sensor based on Hooke's law and Ohm's law is used to convert the current moment Air pressure Convert to current moment Digital signal , including the following specific steps:
[0055] Current moment Air pressure When acting on film 1, based on Hooke's law, at the current moment The film stress For air pressure With film area The product of, at the current moment The film deformation Equal to the film force Divided by the film stiffness coefficient , as follows:
[0056] ;
[0057] The deformation of the film drives the ejector pin 2 to move the same distance, that is, the ejector pin displacement Equal to the film deformation , ejector pin 2 is connected to flexible resistor 3, and the displacement of ejector pin 2 causes flexible resistor 3 to The resistance change , resistance change Displacement of ejector pin Directly proportional, as follows:
[0058] ,
[0059] in, is the displacement-resistance conversion coefficient of the flexible resistor 3;
[0060] The constant current source circuit formed by the constant current source 4 is connected to the flexible resistor 3. When the resistance change of the flexible resistor 3 is At the current moment, the constant current source circuit Voltage The changes based on Ohm's law are as follows:
[0061] ,
[0062] in, and are the constant current of the constant current source circuit and the built-in resistance value of the built-in resistor 5 respectively;
[0063] Use voltage measuring device 6 to measure and obtain voltage And converted to the current time by analog-to-digital converter 7 Digital signal is as follows:
[0064] ,
[0065] Among them, and are the analog-to-digital conversion coefficient and the analog-to-digital conversion offset respectively.
[0066] Furthermore, although the digital observation value obtained by combining the working principle of the barometric pressure sensor with the observation of the digital signal at the current moment Digital signal can directly obtain the barometric pressure at the current moment through reverse calculation , barometric pressure , but the barometric pressure sensor will be affected by noise interference during actual measurement, and there are large errors in reverse calculating the barometric pressure . Introduce the Kalman filter algorithm, establish the state transition equation and the observation equation based on the working principle of the barometric pressure sensor, and use probability statistics and recursive filtering to combine with the digital observation value calculate the Kalman filter gain and obtain the denoised barometric pressure at the current moment , including the following specific steps:
[0067] Define the barometric pressure state vector at the current moment , among which, and are the barometric pressure and the barometric pressure change rate at the current moment respectively. Ideally, the barometric pressure changes uniformly with time. Considering the environmental volatility, introduce process noise to construct the barometric pressure state transition equation. The barometric pressure state transition equation describes the barometric pressure change law from the previous moment to the current moment , which is as follows:
[0068] ,
[0069] Among them, and are the barometric pressure and the barometric pressure change rate at the previous moment respectively, and are the first process noise and the second process noise at the current moment respectively, and they follow the Gaussian distribution;
[0070] Define the state transition matrix at the current moment to describe the situation without process noise from the previous moment To the current moment The law of air pressure change is as follows:
[0071] ;
[0072] Define the process noise covariance matrix at the current moment for describing the first process noise introduced at the current moment and the second process noise as follows: Specifically:
[0073] ;
[0074] Ideally, according to the working principle of the air pressure sensor, reverse-infer the digital signal at any moment Regarding the air pressure The conversion equation is as follows:
[0075] ,
[0076] where is the first air-sensing parameter, is the constant bias. Considering the influence of the observation noise and the fluctuation of the air pressure change rate on the observation of the digital signal , according to the state transition equation, it can be known that the influence of the air pressure change rate on the digital observation value is a linear superposition. Then the observation equation of the digital observation value regarding the air pressure is specifically: ,
[0077] where is the second air-sensing parameter, is the observation noise, following a Gaussian distribution, replaces the constant bias introducing a certain volatility;
[0078] Define the observation matrix to describe the influence of the air pressure and the air pressure change rate on the digital observation value . Define the observation noise covariance matrix at the current moment for describing the observation noise introduced at the current moment as follows: ;
[0079] Obtain the estimated covariance matrix at the previous moment , based on the conditional probability and the state transition matrix at the current moment to calculate the prior estimate covariance matrix at the current moment as follows: , specifically as follows:
[0080] ,
[0081] Among them, is the transpose of the state transition matrix at the current moment, and the prior estimate covariance matrix describes the estimation uncertainty considering the process noise under the prior condition of knowing the estimation covariance matrix at the previous moment ;
[0082] Based on the observation matrix and the observation noise covariance matrix at the current moment to calculate the Kalman gain at the current moment , where is the transpose of the observation matrix, and the Kalman gain at the current moment further considers the estimation uncertainty when considering the observation noise. The Kalman gain determines the confidence level of the digital observation value when updating to obtain the barometric state estimation vector at the current moment ;
[0083] According to the Kalman gain at the current moment and combining with the digital observation value at the current moment to update the barometric state estimation vector at the previous moment to obtain the barometric state estimation vector at the current moment , specifically as follows: , that is, by using the Kalman gain at the current moment to weight the observation residual to remove the noise, the barometric state estimation vector , where and are respectively the denoised barometric pressure and the barometric pressure estimation change rate at the current moment ;
[0084] According to the Kalman gain at the current moment Combine the prior estimate covariance matrix Update and obtain the estimate covariance matrix at the current moment wherein, , is the identity matrix, and the uncertainty of the prior estimate covariance matrix is adjusted through the Kalman gain such that each time the Kalman filtering algorithm is executed, the estimate covariance matrix will gradually converge and the estimation uncertainty of the air pressure state vector will gradually decrease. Specifically, at the current moment
[0085] infrared light with an initial light intensity and a continuous wavelength range is emitted to the gas to be measured. At the other end of the optical path, the infrared light passing through the gas to be measured is collected by a spectrometer and dispersed according to the wavelength to obtain the infrared spectrum of the gas to be measured, and the intensity of characteristic absorption peaks related to carbon dioxide are identified , , is the intensity of the th characteristic absorption peak related to carbon dioxide. Through multiple linear regression, the intensities of characteristic absorption peaks are linearly summed to obtain the initial concentration of carbon dioxide at the current moment , specifically as follows:
[0086] ,
[0087] wherein, is the intercept, resulting from the measurement error of the spectrometer and environmental factors not taken into account, including the constant offsets caused by temperature and air pressure is the regression coefficient of the th characteristic absorption peak intensity , and the regression coefficient is obtained by pre-measuring multiple groups of carbon dioxide gas samples with different concentrations and fitting them using the least squares method.
[0088] Specifically, at the current moment , an electrochemistry oxygen sensor is used to measure the preliminary oxygen concentration . In the electrochemistry oxygen sensor, the anode and the cathode on the electrode surface are connected through an electrolyte. Oxygen undergoes an oxidation reaction with the metal material at the anode and releases electrons, and the electrons are transferred to the cathode through an external circuit. Oxygen obtains electrons at the cathode and undergoes a reduction reaction, thereby generating the loop current at the current moment . Based on the sensor sensitivity of the electrochemistry oxygen sensor, the preliminary oxygen concentration is calculated, specifically as:
[0089] ,
[0090] Among them, and are the initial oxygen concentration and the initial loop current respectively, is the sensor sensitivity, which is equal to the change in loop current divided by the change in oxygen concentration . The change in loop current at the current moment and the change in oxygen concentration are respectively equal to the loop current at the current moment minus the initial loop current and the initial oxygen concentration at the current moment minus the initial oxygen concentration .
[0091] Specifically, whether the model-driven backpropagation network corrects to obtain the carbon dioxide concentration or corrects to obtain the oxygen concentration , it has the same network structure and similar processing methods. The difference lies in:
[0092] When the model-driven backpropagation network corrects the initial carbon dioxide concentration at the current moment for pressure correction, the correction model selects the absorption rate correction model , and the measurement device parameter is the initial light intensity , and the output is the carbon dioxide concentration ;
[0093] When the model-driven backpropagation network corrects the initial oxygen concentration at the current moment for pressure correction, the correction model selects the diffusion rate correction model , and the measurement device parameter is the initial loop current , and the output is the oxygen concentration .
[0094] Furthermore, the Beer-Lambert law is used to establish the absorption rate correction model . The absorption rate correction model has a positive correlation with the standard absorption rate , and the positive correlation coefficient is in the form of a power function of the ratio of the air pressure to the standard air pressure . The absorption rate correction model The details are as follows:
[0095] ,
[0096] Among them, the standard absorption rate is the absorption rate of carbon dioxide for infrared light under standard atmospheric pressure , and is the pressure sensitivity index, which is determined during the pre-training of the model-driven backpropagation network. The absorption rate correction model describes the change in the absorption rate of carbon dioxide with the same concentration for the same infrared light under different atmospheric pressures . The higher the absorption rate, the more accurate the measurement of the spectrometer.
[0097] Furthermore, the Nernst equation is used to establish the diffusion rate correction model , and the diffusion rate correction model shows a positive correlation with the standard diffusion rate , and the positive correlation coefficient is in the form of a linear function of the difference between the atmospheric pressure and the standard atmospheric pressure . The diffusion rate correction model is specifically as follows:
[0098] ,
[0099] Among them, the standard diffusion rate is the diffusion rate of oxygen under standard atmospheric pressure , is the pressure sensitivity coefficient, which is determined during the pre-training of the model-driven backpropagation network. The diffusion rate correction model describes the diffusion ability of oxygen with the same concentration under different atmospheric pressures . The stronger the diffusion ability, the more sufficient the redox reaction of oxygen in the electrochemical oxygen sensor, and the more accurate the measurement of the electrochemical oxygen sensor.
[0100] As Figure 3 shown, furthermore, the model-driven backpropagation network includes a first hidden layer, a second hidden layer, and an output layer;
[0101] The first hidden layer substitutes the denoised atmospheric pressure at the current moment into the correction model , obtains the physical correction coefficient at the current moment , combines the denoised atmospheric pressure at the current moment with the preliminary concentration to form the first superimposed input , and passes the first superimposed input Perform mapping on the linear modulation to analyze the initial concentration And the denoised air pressure The non-linear correlation of generates the first hidden representation at the current moment Specifically as follows:
[0102]
[0103] And Are respectively the first weight matrix and the first bias of the first hidden layer. Multiply the first hidden representation By the physical correction coefficient To obtain the first corrected representation of the first hidden layer Among them, the first hidden representation Is obtained based on a data-driven neural network, and the physical correction coefficient Is driven by a correction model. Multiply the physical correction coefficient By the first hidden representation During the pre-training stage, when calculating the gradient, the correction model can be used to constrain the learning of the first hidden representation While enhancing the non-linear expression ability of the first hidden representation It also satisfies the physical laws or equations corresponding to the correction model;
[0104] The second hidden layer obtains the measurement device parameters Combined with the first corrected representation at the current moment And the denoised air pressure To construct the second superimposed input Perform mapping on the linear modulation of the second superimposed input To analyze the non-linear correlation between the measurement device parameters And the denoised air pressure On the basis of the first correction and act on the first corrected representation To generate the second hidden representation at the current moment Specifically as follows:
[0105]
[0106] Among them, And Are respectively the second weight matrix and the second bias of the second hidden layer;
[0107] The output layer then performs a linear modulation once to stabilize the output of the model-driven backpropagation network, generating the concentration at the current moment Among them, and are the output weight matrix and output bias of the output layer, respectively.
[0108] Specifically, the model-driven backpropagation network needs to collect the initial concentrations obtained from multiple groups of gas samples with known concentrations measured during the pre-training stage , the denoising air pressure during measurement and the measurement device parameters and construct a training set. The loss function is defined as the error between the concentration output by the model-driven backpropagation network and the known concentration of the gas sample. Based on the gradient of the loss function with respect to the network parameters involved in the model-driven backpropagation network, backpropagation is performed, and stochastic gradient descent or the Adam optimizer is used for iterative training. By continuously adjusting the network parameters along the negative gradient direction to reduce the loss, when the loss converges, the pre-training of the model-driven backpropagation network is completed and the network parameters are fixed. The network parameters include the pressure sensitivity index in the absorption rate correction model , the pressure sensitivity coefficient in the diffusion rate correction model , the first weight matrix and the first bias of the first hidden layer and the second bias , the second weight matrix and the output bias of the output layer.
[0109] As Figure 4 shown, further, considering that the traditional stochastic gradient descent or Adam optimizer is sensitive to the initial values during the pre-training of the model-driven backpropagation network, that is, improper selection of the initial values of the network parameters will greatly affect the performance of the model-driven backpropagation network, and the initial value setting has strong empiricism and requires a large number of experiments for adjustment and trial. At the same time, the traditional pre-training method of the model-driven backpropagation network is prone to falling into the local optimal problem. Therefore, an improved particle swarm optimization algorithm is used to replace the traditional pre-training method. The improved particle swarm optimization algorithm introduces genetic mutation operations into the traditional particle swarm optimization algorithm, including the following specific steps:
[0110] Set the maximum number of iteration rounds , and randomly generate the position and velocity vectors of the particles at the initial round (round 0) in the solution space. The position of each particle represents a set of network parameters, the velocity vector of each particle represents the forward direction of the particle in the solution space, and the magnitude of the velocity vector is the forward distance of the particle in the solution space. The dimension of the position is equal to the dimension of the velocity vector, which is equal to the dimension of the solution space and equal to the total number of network parameters of the model-driven backpropagation network. is the total number of particles and is a multiple of 4;
[0111] For the initial round, each of the particles is used as the network parameter of the model-driven backpropagation network and undergoes a single-round training using the training set to obtain the loss of each particle in the initial round. The global optimal position and the global optimal loss are respectively updated to the position and loss corresponding to the particle with the smallest loss among the particles in the initial round;
[0112] Start a new round of iteration. In the th round, the th particle at the th round updates its velocity vector based on the global optimal position and combines with the inertia weight to obtain the velocity vector at the th round, specifically as follows:
[0113] ,
[0114] wherein, is the position of the particle at the th round, and are respectively the learning factor and the random coefficient at the th round. The random coefficient is between 0 and 1, ;
[0115] The particle starts from the position at the th round and updates to obtain the position of the particle at the th round according to the velocity vector at the th round;
[0116] The position of the particle at the th round is used as the network parameter of the model-driven backpropagation network and undergoes a single-round training using the training set to obtain the loss of the particle at the th round;
[0117] Among the particles, the top with the smallest loss at the particles and the remaining The particles are regarded as Round of advanced particles and The lagging particles of the wheel;
[0118] Will No. The advanced particles of the round are randomly paired to generate Group of advanced particle pairs, for the Advanced Particle Pairs ,in, and Respectively The first advanced particle and the second advanced particle in the advanced particle pair are Wheel of Advanced Particles Loss and advanced particles Loss The inverse of the ratio generates the Group genetic weight pair ,in, and Advanced Particles and advanced particles The genetic weight of the advanced particles and advanced particles In the The position and velocity vectors of the wheels are weighted and summed according to the corresponding genetic weights to generate the first Advanced Particle Pairs The high-quality offspring particles are The position and velocity vector of the wheel are obtained No. The position and velocity vectors of the wheel's high-quality descendant particles, where ;
[0119] Will No. The lagging particles of the round are randomly paired and generated The lagging particle pair, for the Group backward particle pair ,in, and Respectively The first and second lagging particles in the lagging particle pair are set to and lagging particles In the The corresponding elements in the wheel position and velocity vectors are randomly extracted and reorganized into Group backward particle pair The mutant offspring particle is The position and velocity vectors of the wheels, a total of offspring particles of the th wheel are obtained, where ;
[0120] Use offspring particles of the th wheel to replace backward particles of the th wheel, and use the positions of offspring particles of the th wheel as the network parameters of the model-driven backpropagation network respectively and perform single-round training using the training set to obtain the loss of each offspring particle in the th wheel. Among them, the offspring particles of the th wheel include high-quality offspring particles of the th wheel and mutated offspring particles of the th wheel. Since the high-quality offspring particles are generated by genetic inheritance of advanced particles with good training effects in the th wheel, compared with the backward particles of the th wheel, they are closer to the globally optimal network parameters, effectively improving the training efficiency of the model-driven backpropagation network. At the same time, the mutated offspring particles are randomly generated based on the backward particles with poor training effects in the th wheel, which can effectively expand the search range of particles in the solution space and avoid falling into the local optimum problem;
[0121] Update the globally optimal position and the globally optimal loss to the positions and losses corresponding to the particles with the smallest losses among the particles and offspring particles in the th wheel respectively, and calculate the mean square error of the loss of the th wheel based on the losses of all particles and offspring particles in the th wheel;
[0122] When the mean square error of the loss of the th wheel is less than the minimum value or the number of rounds is equal to the maximum number of iteration rounds , stop the iteration of the improved particle swarm algorithm, and use the globally optimal position updated in the th wheel as the network parameters of the pre-trained model-driven backpropagation network and fix them;
[0123] When the mean square error of the loss of the th wheel is greater than the minimum value and the number of rounds is less than the maximum number of iteration rounds When it is time, jump to start a new round of iteration.
[0124] The present invention discloses a gas detection method. The preliminary concentrations of carbon dioxide and oxygen at the current moment and the denoised air pressure processed by the Kalman filtering algorithm are measured and obtained. A model-driven backpropagation network is adopted to construct a correction model for air pressure based on the Beer-Lambert law and the Nernst equation. The denoised air pressure at the current moment is substituted into the correction model, and a first corrected representation is jointly generated in cooperation with the non-linear mapping of the preliminary concentration at the current moment. A second hidden representation is generated based on the non-linear correlation mapping of the first corrected representation, the measurement device parameters, and the denoised air pressure at the current moment. The concentration at the current moment is obtained through linear modulation. Through the cooperative pressure compensation combining physical model driving and data driving, the pressure correction accuracy is improved, and the accurate detection of carbon dioxide and oxygen in a high-pressure environment is realized.
[0125] The above are only the preferred embodiments of the present invention. The protection scope of the present invention is not limited to the above embodiments. All technical solutions falling within the idea of the present invention belong to the protection scope of the present invention. It should be noted that for those of ordinary skill in the art in this technical field, several improvements and refinements made without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A gas detection method, characterized in that, It includes the following specific steps: Measure the initial carbon dioxide concentration and initial oxygen concentration at the current moment, and obtain the denoised air pressure at the current moment by combining a barometric pressure sensor and a Kalman filtering algorithm; Design a model-driven backpropagation network with a double hidden layer structure, construct correction models for air pressure based on the Beer-Lambert law and the Nernst equation respectively, substitute the denoised air pressure at the current moment into the correction models through the first hidden layer and multiply it by the non-linear mapping of the initial concentration at the current moment, generate a first correction representation through the cooperation of model-driven and data-driven, learn the non-linear correlation between the first correction representation, measurement device parameters and the denoised air pressure at the current moment through the second hidden layer to generate a second hidden representation, and use the linear modulation of the second hidden representation as the concentration at the current moment. The correction models include an absorption rate correction model and a diffusion rate correction model. The initial concentration includes the initial carbon dioxide concentration and the initial oxygen concentration. The concentration at the current moment includes the carbon dioxide concentration and the oxygen concentration; Among them, the first hidden layer substitutes the denoised air pressure at the current moment into the correction model to obtain the physical correction coefficient at the current moment, combines the denoised air pressure at the current moment with the initial concentration and maps to generate the first hidden representation at the current moment, and multiplies the first hidden representation by the physical correction coefficient to generate a first correction representation; The second hidden layer combines the measurement device parameters, the first correction representation at the current moment and the denoised air pressure and maps to generate the second hidden representation at the current moment; The model-driven backpropagation network is pre-trained based on an improved particle swarm optimization algorithm. In each round of the improved particle swarm optimization algorithm, advanced particles and lagging particles are divided according to the loss, and weighted sum pairing and random recombination pairing are performed on the advanced particles and the lagging particles respectively.
2. The gas detection method according to claim 1, characterized in that, The Beer-Lambert law is used to construct the absorption rate correction model. The absorption rate correction model is positively correlated with the standard absorption rate, and the positive correlation coefficient is in the form of a power function of the ratio of the air pressure to the standard air pressure. The exponent of the power function is the pressure sensitivity index. The standard absorption rate is the absorption rate of carbon dioxide to infrared light under the standard air pressure. The absorption rate correction model describes the relationship between the absorption rate of carbon dioxide to infrared light and the change in air pressure. The absorption rate affects the measurement accuracy of the carbon dioxide concentration.
3. The gas detection method according to claim 1, wherein The Nernst equation is used to establish the diffusion rate correction model. The diffusion rate correction model is positively correlated with the standard diffusion rate, and the positive correlation coefficient is in the form of a linear function of the difference between the air pressure and the standard air pressure. The linear coefficient of the linear function is the pressure sensitivity coefficient. The standard diffusion rate is the diffusion rate of oxygen under the standard air pressure. The diffusion rate correction model describes the diffusion ability of oxygen with the same concentration under different air pressures. The diffusion ability affects the measurement accuracy of the oxygen concentration.
4. The gas detection method according to claim 1, wherein The model-driven backpropagation network includes a first hidden layer, a second hidden layer and an output layer; The first hidden layer substitutes the denoised air pressure at the current moment into the correction model to obtain the physical correction coefficient at the current moment, combines the denoised air pressure at the current moment with the preliminary concentration to form the first superimposed input, maps the linear modulation of the first superimposed input through the ReLU activation function to analyze the non-linear correlation between the preliminary concentration and the denoised air pressure, generates the first hidden representation at the current moment, and multiplies the first hidden representation by the physical correction coefficient to generate the first corrected representation; The second hidden layer obtains the measurement device parameters, combines them with the first corrected representation and the denoised air pressure at the current moment to construct the second superimposed input, maps the linear modulation of the second superimposed input through the ReLU activation function to analyze the non-linear correlation between the measurement device parameters and the denoised air pressure, and generates the second hidden representation at the current moment, where the measurement device parameters include the initial light intensity and the initial value of the loop current; The output layer linearly modulates the second hidden representation at the current moment to generate the concentration at the current moment.
5. The gas detection method according to claim 1 or 4, characterized in that, The model-driven backpropagation network is pre-trained based on the improved particle swarm optimization algorithm, including the following specific steps: Initialization The position and velocity vectors of particles, where the position and velocity vectors are a set of network parameters and the forward direction respectively; is the total number of particles; Obtain the loss based on the position initialized by each particle and determine the global optimal position and the global optimal loss; In each round, each particle updates to obtain the velocity vector and position of this round based on the velocity vector of the previous round, in combination with the global optimal position and the position of the previous round; Obtain the loss based on the position updated by each particle in this round and divide the advanced particles and backward particles in this round. Pair the advanced particles in this round and weighted sum the two paired advanced particles to generate the corresponding high-quality offspring particles. Pair the backward particles in this round and randomly recombine the two paired backward particles to generate the corresponding mutant offspring particles; Replace the backward particles in this round with the offspring particles in this round, obtain the loss based on the position of each offspring particle in this round, re-determine the global optimal position and the global optimal loss in this round and calculate the mean square error of the loss in this round. The offspring particles include high-quality offspring particles and mutant offspring particles; When the mean square error of the loss in this round is less than the minimum value or the number of rounds in this round is equal to the maximum number of iterations, stop the iteration and use the globally optimal position updated in this round as the network parameters. Otherwise, jump to start a new round of iteration.
6. The gas detection method according to claim 1, characterized in that, Measuring the preliminary concentrations of carbon dioxide and oxygen at the current moment, and combining the air pressure sensor and the Kalman filtering algorithm to obtain the denoised air pressure at the current moment, including the following specific steps: Use multiple linear regression to fit the spectral absorption characteristics related to carbon dioxide to obtain the preliminary concentration of carbon dioxide at the current moment; Use an electrochemical oxygen sensor to measure the loop current generated by the redox reaction at the current moment to obtain the preliminary concentration of oxygen at the current moment; Convert the air pressure at the current moment into a voltage through the cooperation of the thin film, flexible resistor and constant current source circuit in the air pressure sensor and obtain the digital signal after analog-to-digital conversion. Use the Kalman filtering algorithm to establish the state transition equation and observation equation based on the working principle of the air pressure sensor, and calculate the Kalman filter gain in combination with the digital observation value at the current moment to update and obtain the denoised air pressure at the current moment, where the digital observation value is the observation result of the digital signal.
7. The gas detection method according to claim 1 or 6, characterized in that, The Kalman filter algorithm is used to obtain the denoised air pressure at the current moment, and it includes the following specific steps: Construct the state transition equation of the air pressure at the current moment, and organize and extract the state transition matrix and the process noise covariance matrix at the current moment. The state transition equation is used to describe the change trends of the air pressure and the air pressure change rate over time; Based on the working principle of the air pressure sensor, comprehensively considering the influence of the observation noise and the air pressure change rate on the digital signal, construct an observation equation to describe the linear relationship between the digital observation value and the air pressure and the air pressure change rate, and organize and extract the observation matrix and the observation noise covariance matrix at the current moment; Combine the estimated covariance matrix at the previous moment with the state transition matrix at the current moment to obtain the prior estimated covariance matrix at the current moment, and combine the observation matrix and the observation noise covariance matrix to calculate the Kalman gain at the current moment; Use the product of the Kalman gain at the current moment and the observation residual at the current moment to correct and obtain the air pressure state estimation vector at the current moment. The air pressure state estimation vector at the current moment includes the denoised air pressure at the current moment. Correct the prior estimated covariance matrix by the difference between the identity matrix and the product of the Kalman gain and the observation matrix at the current moment to obtain the estimated covariance matrix at the current moment.
8. The gas detection method according to claim 6, wherein The conversion of the air pressure at the current moment into a voltage through the cooperation of the thin film, flexible resistor and constant current source circuit in the air pressure sensor and the subsequent analog-to-digital conversion to obtain the digital signal at the current moment includes the following specific steps: Based on Hooke's law, the deformation amount of the thin film at the current moment is equal to the product of the air pressure at the current moment and the thin film area divided by the stiffness coefficient of the thin film; The deformation of the thin film drives the displacement of the thimble, which causes a change in resistance. The displacement amount of the thimble is equal to the deformation amount of the thin film, and the resistance change amount at the current moment is equal to the product of the displacement amount of the thimble and the displacement-resistance conversion coefficient; Based on Ohm's law, the change in resistance causes a change in the voltage of the constant current source circuit. The voltage of the constant current source circuit at the current moment becomes the sum of the internal resistance value and the resistance change amount multiplied by the constant current; Generate the digital signal at the current moment by performing analog-to-digital conversion on the voltage at the current moment.
9. The gas detection method according to claim 6, characterized in that The acquisition of the preliminary carbon dioxide concentration at the current moment includes: Emit infrared light to the gas to be measured at the current moment, and obtain the infrared spectrum of the gas to be measured through a spectrometer. Identify the intensity of the characteristic absorption peak related to carbon dioxide. Multiply the intensity of all relevant characteristic absorption peaks by the corresponding regression coefficients and add the intercept reflecting the measurement error of the spectrometer and environmental factors to generate the initial carbon dioxide concentration at the current moment. The regression coefficients are obtained by least squares fitting in advance.
10. The gas detection method according to claim 6, characterized in that, The electrochemical oxygen sensor includes an anode and a cathode. The anode and the cathode respectively undergo an oxidation reaction and a reduction reaction with oxygen at the current moment to promote the flow of electrons, generating the loop current at the current moment. The preliminary oxygen concentration is the initial value of the oxygen concentration plus the difference between the loop current at the current moment and the initial value of the loop current multiplied by the sensor sensitivity.
Citation Information
Patent Citations
Method and sensor for detecting gas concentration based on data physical double-drive model
CN118655187A
Intelligent induction type cable quick connector plugging method
CN119249658A