A gas concentration calculation method, device, equipment and storage medium
By combining sensors, edge computing, and cloud computing in a gas concentration calculation method, and utilizing multi-model fusion technology, the nonlinear error problem of nondispersive infrared sensors under the influence of environmental factors was solved, achieving high-precision and rapid gas concentration detection.
Patent Information
- Application Number
- CN202110947723.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-18
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-08-18
AI Technical Summary
In existing technologies, nondispersive infrared sensors cannot effectively correct nonlinear errors caused by environmental factors such as temperature, humidity and pressure when detecting gas concentration. Furthermore, the training speed of neural network algorithms is slow and cannot fully correct sensor parameters, resulting in insufficient detection accuracy.
By combining sensor-end, edge-end, and cloud-end approaches, time-series data on gas concentration is collected and processed. Gas concentration prediction models at the edge end and cloud end are used to normalize and predict the data, and multi-model fusion is performed in the cloud to comprehensively consider the impact of environmental factors on gas concentration, ultimately obtaining the true gas concentration.
It improves the accuracy and speed of gas concentration detection, can more comprehensively consider the impact of environmental factors on gas diffusion, reduces training time, and provides more accurate gas concentration calculation results.
Smart Images

Figure CN113758890B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of data processing, in particular, to a gas concentration calculation method, device, equipment and storage medium. BACKGROUND
[0002] In process industries, such as chemical industry, petroleum refining, electronic industry and indoor air quality detection, a large amount of CO, SO2, NO X , formaldehyde and acetone and other gases affecting human health and environment are often produced. Because optical sensors have the characteristics of fast detection, high sensitivity and the like, they are widely used in the detection of gas concentration. Among them, the non-dispersive infrared (NDIR) sensor is a commonly used optical sensor for detecting gas concentration. When the gas enters the gas chamber of the gas sensor, the sensor emits infrared light through the gas chamber. The infrared light source of the sensor passes through the measured gas according to the designed light path, passes through the narrow-band filter, and reaches the infrared detector. By measuring the intensity change of the infrared light entering the infrared detector, the concentration of the measured gas is detected. However, temperature, humidity and pressure and other environmental factors cause the detection accuracy of the NDIR sensor to have obvious nonlinear errors, so it is necessary to correct the nonlinear errors caused by environmental factors. In the prior art, the mainstream error correction method is algorithm correction, and the neural network is the research focus of algorithm correction. The nonlinear error of the sensor is corrected through the neural network.
[0003] In the prior art, the neural network is mainly used for the correction and compensation of a small number of parameters, and cannot correct and compensate all parameters at the same time. Moreover, the existing neural network algorithm for improving the detection accuracy of the sensor is based on the BP algorithm and its improved algorithm, which appeared earlier, has a slow training speed, and has great limitations in solving the optimal solution. Moreover, the existing technology does not consider the causality of the diffusion of the gas in the gas chamber, so it cannot eliminate the principle error. SUMMARY
[0004] Embodiments of the present application provide a gas concentration calculation method, device, equipment and storage medium, which aims to accurately detect the concentration of the gas.
[0005] The first aspect of the embodiments of the present application provides a gas concentration calculation method, which comprises:
[0006] Collecting relevant time series data of the gas to be detected by the gas concentration sensor end, processing the time series data to obtain processed time series data;
[0007] According to the processed time series data, the gas concentration calculation is performed to obtain the sensor end gas concentration calculation value, and the processed time series data is transmitted to the edge end;
[0008] normalize the processed time-series data through the edge terminal to obtain normalized data;
[0009] input the normalized data into a gas concentration prediction model on the edge terminal to obtain an edge-terminal gas concentration prediction value, and transmit the normalized data to the cloud;
[0010] input the normalized data into a gas concentration prediction model on the cloud to obtain a cloud-terminal gas concentration prediction value;
[0011] fuse the sensor-terminal gas concentration calculation value, the edge-terminal gas concentration prediction value, and the cloud-terminal gas concentration prediction value to obtain a real gas concentration.
[0012] Optionally, related time-series data of a to-be-detected gas is collected through a gas concentration sensor terminal, the time-series data is processed to obtain processed time-series data, including:
[0013] abnormal values in the time-series data are removed to exclude abnormal data in the time-series data;
[0014] the time-series data is subjected to data smoothing processing to obtain the processed time-series data.
[0015] Optionally, the time-series data includes time-series data of absorbance, wind speed, wind direction, temperature, humidity, and air pressure.
[0016] Optionally, a sensor-terminal gas concentration calculation value is obtained through gas concentration calculation based on the processed time-series data, including:
[0017] the processed time-series data is combined with a fitted absorbance-concentration curve to obtain the sensor-terminal gas concentration calculation value through calculation using a fitting function.
[0018] Optionally, the processed time-series data is normalized through the edge terminal to obtain normalized data, including:
[0019] the time-series data of absorbance, temperature, humidity, and air pressure is converted into data of the same order of magnitude using a conversion function;
[0020] the time-series data of wind speed and wind direction is corrected to realize normalization of the time-series data of wind speed and wind direction.
[0021] Optionally, the training step of the gas concentration prediction model includes:
[0022] a gas with a known concentration is collected using the gas concentration sensor to obtain processed time-series data corresponding to the gas;
[0023] input the processed time sequence data into the gas concentration prediction model to obtain a predicted gas concentration;
[0024] adjust parameters of the gas concentration prediction model according to a difference between the predicted gas concentration and the known concentration of the gas, to obtain a trained gas concentration prediction model.
[0025] Optionally, the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value are fused to obtain a real gas concentration, including:
[0026] input the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value into a real gas concentration prediction model on the cloud;
[0027] perform weighted average on the input values through the real gas concentration prediction model to obtain the real gas concentration.
[0028] The second aspect of the embodiment of the application provides a gas concentration calculation device, which includes:
[0029] a time sequence data processing module, configured to collect relevant time sequence data of a to-be-detected gas through a gas concentration sensor end, process the time sequence data to obtain processed time sequence data;
[0030] a sensor-end calculation module, configured to perform gas concentration calculation according to the processed time sequence data to obtain a sensor-end gas concentration calculation value, and transmit the processed time sequence data to an edge end;
[0031] a normalization module, configured to perform normalization processing on the processed time sequence data through the edge end to obtain normalized data;
[0032] an edge-end calculation module, configured to input the normalized data into a gas concentration prediction model on the edge end to obtain an edge-end gas concentration prediction value, and transmit the normalized data to a cloud end;
[0033] a cloud-end calculation module, configured to input the normalized data into a gas concentration prediction model on the cloud end to obtain a cloud-end gas concentration prediction value;
[0034] a real gas concentration calculation module, configured to fuse the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value to obtain a real gas concentration.
[0035] Optionally, the time sequence data processing module includes:
[0036] An outlier removal submodule is configured to remove outliers from the time-series data.
[0037] A smoothing processing submodule is configured to perform data smoothing processing on the time-series data to obtain the processed time-series data.
[0038] Optionally, the time-series data includes time-series data of absorbance, wind speed, wind direction, temperature, humidity, and air pressure.
[0039] Optionally, the sensor-side computing module includes:
[0040] A sensor-side computing submodule is configured to use the processed time-series data to fit an absorbance-concentration curve, and use a fitting function to calculate a sensor-side gas concentration calculation value.
[0041] Optionally, the normalization module includes:
[0042] A first data normalization submodule is configured to use a conversion function to convert the time-series data of absorbance, temperature, humidity, and air pressure into data of the same order of magnitude.
[0043] A second data normalization submodule is configured to correct the time-series data of wind speed and wind direction, thereby normalizing the time-series data of wind speed and wind direction.
[0044] Optionally, the device further includes:
[0045] A sample collection module is configured to use the gas concentration sensor to collect a gas with a known concentration, and obtain processed time-series data corresponding to the gas.
[0046] A model training module is configured to input the processed time-series data into the gas concentration prediction model to obtain a predicted gas concentration.
[0047] A parameter adjustment module is configured to adjust parameters of the gas concentration prediction model according to a difference between the predicted gas concentration and the concentration of the gas with the known concentration, to obtain a trained gas concentration prediction model.
[0048] Optionally, the real gas concentration calculation module includes:
[0049] A data input submodule is configured to input the sensor-side gas concentration calculation value, the edge-side gas concentration prediction value, and the cloud-side gas concentration prediction value into a real gas concentration prediction model on the cloud.
[0050] A real gas concentration calculation submodule is configured to perform weighted averaging on the input values by using the real gas concentration prediction model to obtain the real gas concentration.
[0051] The third aspect of the embodiment of the present application provides a readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps in the method according to the first aspect of the present application.
[0052] The fourth aspect of the embodiment of the present application provides an electronic device, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor realizes the steps of the method according to the first aspect of the present application when executing the computer program.
[0053] The gas concentration calculation method provided by the present application comprises the following steps: collecting relevant time sequence data of a to-be-detected gas at a sensor end through a gas concentration sensor; processing the time sequence data to obtain processed time sequence data; calculating the gas concentration according to the processed time sequence data to obtain a sensor-end gas concentration calculation value, and transmitting the processed time sequence data to an edge end; performing normalization processing on the processed time sequence data through the edge end to obtain normalized data; inputting the normalized data into a gas concentration prediction model on the edge end to obtain an edge-end gas concentration prediction value, and transmitting the normalized data to a cloud end; inputting the normalized data into a gas concentration prediction model on the cloud end to obtain a cloud-end gas concentration prediction value; and fusing the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value to obtain a real gas concentration. The present application collects relevant time sequence data of a to-be-detected gas through a sensor, calculates a gas concentration value first, then predicts the gas concentration at a subsequent moment according to the time sequence data collected by the sensor through a gas concentration model on the edge end, then re-predicts the gas concentration at the subsequent moment through a gas concentration model on the cloud end, and finally fuses the values of the three to obtain the real concentration of the gas. The model can be trained on the edge end and the cloud end at the same time, which reduces the training time. The three concentration values are fused, which considers more comprehensive factors and obtains more accurate results. BRIEF DESCRIPTION OF DRAWINGS
[0054] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative labor.
[0055] Figure 1 is a flow chart of the gas concentration calculation method provided by an embodiment of the present application;
[0056] Figure 2is an improved TCN model schematic diagram according to an embodiment of the present application;
[0057] Figure 3 is an edge computing architecture task division schematic diagram according to an embodiment of the present application;
[0058] Figure 4 is an NDIR sensor gas chamber entrance wind direction correction schematic diagram according to an embodiment of the present application;
[0059] Figure 5 is a gas concentration calculation device schematic diagram according to an embodiment of the present application. DETAILED DESCRIPTION
[0060] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the scope of the present application.
[0061] Reference Figure 1 , Figure 1 is a flow chart of a gas concentration calculation method according to an embodiment of the present application. As shown in Figure 1 , the method comprises the following steps:
[0062] S11: Collecting relevant time sequence data of a to-be-detected gas through a gas concentration sensor end, processing the time sequence data, and obtaining processed time sequence data.
[0063] In the embodiment, the gas concentration sensor is an NDIR sensor, which is specially used for detecting the concentration of a gas. The sensor has a gas chamber. After the gas enters the gas chamber, the sensor emits infrared light through the gas chamber. A narrow-band optical filter is installed at the outlet of the gas chamber, which is a target channel. A reference channel is also provided outside the target channel. The sensor calculates the concentration of the gas by detecting the absorbance of the infrared light by the gas. Meanwhile, the sensor is integrated with temperature, humidity, wind direction, wind speed and air pressure detection modules, which are respectively used for detecting time sequence data of corresponding indexes. The time sequence data is data at different times. Because the data of the gas-related indexes changes constantly with time, it is necessary to measure the time sequence data of these indexes.
[0064] Because the gas concentration sensor detects the gas concentration by emitting infrared light through the gas in the gas chamber of the sensor, and the near-infrared spectrum often contains some factors irrelevant to the properties of the gas to be detected, which will interfere with the detection result, it is necessary to preprocess the original spectrum and the collected data. The processed time series data is the time series data after the abnormal data interfering with the detection result is removed. The preprocessing process of the time series data includes outlier removal processing and data smoothing processing.
[0065] The time series data includes the time series data of absorbance, wind speed, wind direction, temperature, humidity and air pressure. The absorbance is the degree of absorption of infrared light by the gas, the wind speed is the flow rate of the gas at the inlet of the sensor gas chamber, the wind direction is the flow direction of the gas at the inlet of the sensor gas chamber, the temperature is the temperature of the surrounding environment, the humidity is the humidity of the surrounding environment, and the air pressure is the air pressure value in the sensor gas chamber.
[0066] For example, in a certain factory, the concentration of SO2 needs to be monitored in real time, so the gas concentration sensor is installed in the factory. When the SO2 gas passes through the gas chamber, the time series data of the absorbance of the gas is detected, and the time series data of the wind speed, wind direction, temperature, humidity and air pressure is detected by the integrated modules of the sensor. It can be preset to detect each index once every second, that is, the time series data of each index is obtained.
[0067] S12: Calculate the gas concentration according to the processed time series data to obtain the sensor-end gas concentration calculation value, and transmit the processed time series data to the edge end.
[0068] In this embodiment, the sensor end integrates a calculation module for processing the collected data and calculating the processed time series data. The gas concentration calculation value of the sensor end is transmitted to the edge end and the cloud end.
[0069] The gas concentration calculation method of the sensor end selects Beer-Lambert law, fits the absorbance-concentration curve to obtain a fitting function, and brings the processed time series data of absorbance into the fitting function to obtain the gas concentration value at the current time, that is, the gas concentration value of the sensor end. The gas concentration value is also transmitted to the cloud end.
[0070] In this embodiment, the fitting function is used to calculate the gas concentration at the sensor end to obtain the gas concentration value at the current time, which is used for the calculation of the gas concentration value at the subsequent time.
[0071] S13: Normalize the processed time series data through the edge end to obtain normalized data.
[0072] In this embodiment, the normalization of time series data is to transform and calculate the data so that each data is in the same order of magnitude. Because the multi-dimensional time series data collected by the sensor end, such as absorbance, wind speed, wind direction, temperature, humidity and air pressure, often have different dimensions and dimension units. Normalizing these time series data with different dimensions and dimension units so that each index is in the same order of magnitude can improve the convergence speed of data in the model training process and facilitate comprehensive comparison and evaluation.
[0073] The method of normalizing data can use min-max standardization, also known as deviation standardization, which is a linear transformation of the original data so that the result is mapped to 0-1. Z-score standardization method can also be used, which gives the mean and standard deviation of the original data to standardize the data. The processed data conforms to the standard normal distribution, that is, the mean is 0 and the standard deviation is 1.
[0074] In this embodiment, the time series parameters of environmental data such as absorbance, temperature, air pressure, etc. can be normalized using the above method, and for wind speed and wind direction, the method used for normalization is: the wind speed value at each time is projected according to the sine value and cosine value of different wind directions. Because at this time, if the sine value and cosine value are 0, it means that the wind blows from the opposite direction to the inlet, and the gas blown from the opposite direction cannot enter the gas chamber from the positive inlet. For the time when the sine value and cosine value after projection are less than 0, the sine value and cosine value at this time are replaced by 0 respectively. In this embodiment, the difference value of absorbance also needs to be calculated, that is, the difference value between each time series parameter of the normalized absorbance is calculated, and then the difference value is normalized. The normalized data is used to predict the gas concentration at the subsequent time after the edge prediction, and is also transmitted to the cloud to predict the gas concentration at the subsequent time.
[0075] In this embodiment, the time series data of temperature, humidity, absorbance, air pressure and other environmental parameters are uniformly normalized, the wind speed and wind direction are separately normalized, and the data is processed specifically, which is more conducive to subsequent calculation.
[0076] S14: input the normalized data into the gas concentration prediction model on the edge, to obtain the edge gas concentration prediction value, and transmit the normalized data to the cloud.
[0077] In this embodiment, a gas concentration prediction model is set up at the edge. The edge is close to the sensor and is specifically designed to process data transmitted from the sensor, resulting in faster processing speeds. The gas concentration prediction model on the sensor uses normalized data as input and the gas concentration at subsequent time points as output, achieving gas concentration prediction based on time-series absorbance and environmental parameters. The gas concentration prediction model at the edge focuses more on the impact of absorbance on gas concentration. The gas concentrations predicted at subsequent time points at the edge are transmitted to the cloud.
[0078] For example, the gas concentration prediction model at the edge can use an LSTM model. Training the LSTM model yields the gas concentration prediction model. During training, normalized time-series absorbance values (At) and temperature (T) are used as the basis for prediction. t ), humidity (H) t ), pressure (P) t ), wind direction (W) d ) and wind speed (W s The input is the gas concentration at a given time step, and the output is the gas concentration at subsequent time steps. For example, during training, a total of 28,000 time steps were input, with the training data accounting for 0.95% of the total data and the test set accounting for 0.05%. The network parameters for the edge gas concentration prediction network are set as follows: 128 hidden layer neurons, 2 stacked layers, and dropout of 0.2. The average test error is 0.333482, indicating a very high consistency between the predicted and actual values.
[0079] In this embodiment, a gas concentration prediction model is used at the edge to calculate the gas concentration at subsequent time points. This differs from calculating directly based on the collected data at the sensor end. The model predicts the gas concentration, providing important parameters for obtaining the actual gas concentration later.
[0080] S15: Input the normalized data into the gas concentration prediction model on the cloud to obtain the gas concentration prediction value on the cloud.
[0081] In this embodiment, the gas concentration prediction model on the cloud is an improved TCN model based on gas absorbance and environmental factors. Wind speed is a crucial parameter for gas concentration prediction. Existing Gaussian haze models show an inverse relationship between gas diffusion and wind speed. Based on this research, this embodiment adaptively adjusts the convolution kernel of the TCN model, meaning the kernel size at a given time is inversely proportional to the wind speed at that time. This modification of the convolution kernel achieves adaptive adjustment for gas concentration prediction. The model uses absorbance values (A... t ), temperature (T) t ), humidity (H) t ), pressure (P)t ), wind direction (W) d ) and wind speed (W s Using the gas concentration value at subsequent time points as input, and the gas concentration value at subsequent time points as output, the prediction of gas concentration at subsequent time points is realized.
[0082] This embodiment leverages the inverse relationship between gas diffusion and wind speed to dynamically adjust the convolution kernel size, thereby adjusting the window of the TCN model and correcting for gas concentration diffusion caused by wind speed differences. The specific relationship between the convolution kernel size k and the gas velocity is shown in the following equation:
[0083]
[0084] Where c is a manually set convolution kernel constant, v t Let v0 be the gas velocity at the inlet at time t, and v0 be the reference velocity at the inlet at the initial time, which is generally taken as 0.4 m / s.
[0085] For example, considering the gas flow velocity range of 0.4 m / s to 3.2 m / s in the data collected by this invention, the convolution kernel constant is selected as 6-12. When the wind speed changes, the convolution kernel size of the TCN model after the wind speed change can be calculated according to the proportion of the wind speed change.
[0086] like Figure 2 As shown, Figure 2 This is a schematic diagram of an improved TCN model proposed in an embodiment of the present invention, as shown below. Figure 2 The input feature is the absorbance value (A). t ), temperature (T) t ), humidity (H) t ), pressure (P) t ), wind direction (W) d ) and wind speed (W s After processing through two hidden layers, the gas concentrations at subsequent time steps, y0, ..., y0, are output. n The size of the convolution kernel is k, c is a manually set kernel constant, and v is the reference flow velocity at the inlet at the initial moment.
[0087] In this embodiment, an improved TCN model for environmental factors is used in the cloud as a gas concentration prediction model. Compared with the gas concentration prediction model at the edge, the gas concentration prediction model in the cloud has been specifically improved for environmental parameters, predicting the gas concentration value at subsequent times from another dimension, and providing important parameters for subsequent actual concentration prediction.
[0088] S16: The calculated gas concentration at the sensor end, the predicted gas concentration at the edge end, and the predicted gas concentration in the cloud are fused to obtain the real gas concentration.
[0089] In this embodiment, the gas concentration prediction model at the edge and the gas concentration prediction model in the cloud represent the impact of environmental factors on gas concentration calculation from different dimensions. By fusing the prediction results of the two models with the results calculated at the sensor end, a more accurate gas concentration calculation result can be obtained than the traditional concentration calculation method.
[0090] In this embodiment, a real gas concentration prediction model is used to calculate the real gas concentration. A convolutional layer is used to calculate the weight summation of the predicted values obtained from multiple learning models. The parameters of the convolutional kernel in the convolutional layer can take the prediction results of each learning model as inputs of different dimensions, and the real gas concentration at subsequent time points as the output. By training the weight matrix through multiple samples, the weight ratio of different concentration prediction models is calculated, so as to achieve effective fusion of edge concentration prediction model, cloud concentration prediction model and sensor concentration calculation value, thereby improving the calculation accuracy.
[0091] In this embodiment, as Figure 3 As shown, Figure 3 This is a schematic diagram of task partitioning in an edge computing architecture proposed in an embodiment of the present invention, as shown below. Figure 3 The present invention employs a three-layer edge computing architecture: sensor-edge-cloud. At the sensor end, a computing module is integrated to remove outliers and smooth the collected data. Based on the processed data and an absorbance-concentration fitting function, the gas concentration value is calculated. This processed data is then transmitted to the edge end, which, being closer to the sensor end, processes the data quickly, accelerating concentration calculation. At the edge end, data is normalized, with special normalization applied for wind speed and direction, further enhancing gas concentration prediction. A gas concentration prediction model is used to predict gas concentrations at subsequent times, focusing on the influence of absorbance. At the cloud end, an improved gas concentration prediction model, optimized for environmental factors, is used to predict gas concentrations at subsequent times. This model places greater emphasis on the impact of environmental factors on gas concentration. Finally, a real gas concentration prediction model is used, fusing the gas concentration calculation results from the sensor end, edge end, and cloud end. Feature stitching is performed on the predicted gas concentration values from different dimensions to obtain a more accurate gas concentration calculation result.
[0092] In another embodiment of the present invention, relevant time-series data of the gas to be detected are collected through a gas concentration sensor, and the time-series data is processed to obtain processed time-series data, including:
[0093] S21: Remove outliers from the time series data to eliminate abnormal data.
[0094] In this embodiment, the abnormal value removal is to eliminate the abnormal points in the collected time series data. The abnormal points in the data are often abnormal data generated by various factors, which interfere with the calculation, and therefore need to be removed.
[0095] For example, the method for removing abnormal points includes: identifying abnormal points according to the Cook distance between samples, identifying abnormal points according to the Mahalanobis distance between samples, and identifying abnormal samples according to the leverage value and studentized residual (the value obtained by dividing the residual by the standard deviation). This is not limited.
[0096] Taking the Cook distance as an example of the abnormal sample removal method, first, all sample data is used for modeling, then other sample data is calculated, and then higher or lower data in the time series data is found as abnormal data. After removing the abnormal data, the remaining sample data is used for modeling, and the model is used to calculate other sample data. If the calculation results before and after removing the abnormal data are significantly different, the probability of this sample being an abnormal sample is also larger. According to this theory, the Cook distance is calculated by the following formula:
[0097]
[0098] Wherein, wherein is the calculation value of the model for other samples after removing the ith sample for modeling, is the calculation value of the model for other samples when all samples are modeled, and C is a parameter set by a person. The Cook distance measures the change of the entire model caused by removing the sample, which can be judged by F test whether the change is significant, that is, whether the sample is an abnormal sample.
[0099] In this embodiment, by removing the abnormal points, the interference of environmental factors during data collection can be better excluded, and the accuracy of the subsequent calculation results can be ensured.
[0100] S22: performing data smoothing processing on the time series data to obtain the processed time series data.
[0101] In this embodiment, the data smoothing processing is a processing method for extracting the high frequency part of the signal by using the data smoothing algorithm, and the main purpose is to reduce the signal noise.
[0102] For example, the data smoothing algorithm can be the Savitzky-Golay smoothing algorithm and the moving window average algorithm. In this embodiment, the purpose is to measure the gas concentration. For gas diffusion, wind speed is an important factor affecting gas diffusion, and the diffusion is inversely proportional to the wind speed. Therefore, the moving window average method is better as the data smoothing algorithm. The moving window average method is to set a window, and extract the data in the window every time the window slides a certain distance. In this embodiment, the size of the moving window is inversely proportional to the wind speed.
[0103] In this embodiment, a data smoothing algorithm is used to reduce the noise of the collected time series data, ensuring the accuracy of subsequent calculations.
[0104] In another embodiment of the application, the gas concentration at the sensor end is calculated based on the processed time series data, including:
[0105] S31: Using the processed time series data in combination with the fitted absorbance-concentration curve, the sensor end gas concentration calculation value is obtained by using a fitting function.
[0106] In this embodiment, the sensor end gas concentration calculation value is the current gas concentration, which is received in the sensor's gas chamber. The specific expression for calculating the sensor end gas concentration calculation value using the fitting function is:
[0107]
[0108]
[0109] Where the infrared light absorbance detected by the detector at the target channel i is The infrared light intensity emitted by the light source is I0, and the infrared light intensity absorbed by the target channel after passing through the gas chamber is 1. The infrared light absorption coefficient of gas i is α i The concentration of gas i is C, and the light path length of infrared light in the gas chamber is L. The voltage of target channel i at time t is recorded as The voltage of the reference channel at time t is recorded as The voltage of gas i at the initial time of the target channel is recorded as The voltage of the reference channel at the initial time is recorded as
[0110] In another embodiment of the application, the processed time series data is normalized at the edge end to obtain normalized data, including:
[0111] S41: Using a conversion function to convert the time series data of absorbance, temperature, humidity, and pressure to data of the same order of magnitude.
[0112] In this embodiment, the time series data needs to be normalized at the edge end. First, the time series data of absorbance, temperature, humidity, and pressure is normalized, which means that the time series data of absorbance, temperature, humidity, and pressure is input into the conversion function, and the conversion function is as follows:
[0113]
[0114] Where x *denoted as the normalized sample value, x represents the collected sample data, max represents the maximum value of the sample data, and min represents the minimum value of the sample data.
[0115] S42: Correct the time-series data of wind speed and wind force, thereby achieving normalization processing of the time-series data of wind speed and wind direction.
[0116] like Figure 4 As shown, Figure 4 This is a schematic diagram illustrating wind direction correction at the inlet of the NDIR sensor chamber according to an embodiment of the present invention. Figure 4 As stated, when the wind direction is between 0° and 180°, gas will enter the NDIR sensor from the inlet. When the wind direction is between 180° and 360°, the sinusoidal component of the wind direction is less than 0, and gas will not flow into the NDIR sensor; therefore, the wind direction component at this moment is represented as 0. The product of the decomposed wind direction and the corresponding wind speed value is then used as the true gas inlet velocity at that moment. If the sinusoidal component of the wind direction is greater than 0, the product of the sinusoidal component and the wind speed is used as the gas velocity at the inlet at that moment. The expressions for the normalized wind speed and wind direction are:
[0117]
[0118] W cor =W s W d (5)
[0119] Among them, W d w represents the sinusoidal component of the wind direction after direction correction (dimensionless). d W represents the measured wind direction value. s W represents wind speed (m / s). cor This represents the sinusoidal component of the wind force after direction correction.
[0120] In this embodiment, the time-series data of absorbance, temperature, humidity, and air pressure were normalized, and the wind direction and wind speed were also uniformly processed. Different processing was performed on different data, which is more conducive to subsequent calculations and improves the accuracy of gas concentration prediction.
[0121] In another embodiment of the present invention, the training steps of the gas concentration prediction model include:
[0122] S51: Use the gas concentration sensor to collect gas of known concentration and obtain the processed time-series data corresponding to the gas.
[0123] In this embodiment, when training the gas concentration prediction model, first, a gas with a known concentration is collected using a gas concentration sensor, the concentration of the gas has been measured in the laboratory, and the gas concentration sensor processes the gas to obtain processed time series data, see the above embodiment for the processing steps.
[0124] S52: input the processed time series data into the gas concentration prediction model to obtain the predicted gas concentration.
[0125] S53: adjust the parameters of the gas concentration prediction model according to the difference between the predicted gas concentration and the concentration of the gas with a known concentration, to obtain a trained gas concentration prediction model.
[0126] In this embodiment, after the gas concentration prediction model receives the processed time series data, it outputs the predicted gas concentration at the next time, calculates the predicted gas concentration with the known concentration to obtain a difference, inputs the difference into the loss function of the model, adjusts the parameters of the model, and when the difference converges, it means that the parameters have been adjusted to the optimal, at this time, a trained gas concentration prediction model is obtained.
[0127] The gas concentration prediction models on the edge and in the cloud have different structures, but the training methods use the training method in the above steps.
[0128] In another embodiment of the present application, the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value are fused to obtain the real gas concentration, comprising:
[0129] S61: input the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value into the real gas concentration prediction model on the cloud.
[0130] S62: weight average the input values by the real gas concentration prediction model to obtain the real gas concentration.
[0131] In this embodiment, the real gas concentration prediction model is obtained by training, when training the model, the input of the model is the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value, and the output value is the real gas concentration, the concentration of the gas used for training is known, by comparing the real gas concentration predicted by the model with the known concentration, a difference is obtained, the parameters of the model are adjusted using the difference, until the model parameters are adjusted to the optimal, a trained real gas concentration prediction model is obtained. The real gas concentration is the gas concentration value closest to the actual gas concentration calculated by the model.
[0132] In this embodiment, the final gas concentration is calculated according to the weighted average method, and the weights of the gas concentration calculation and training models of different nodes are calculated by constructing a loss function. The expression is:
[0133] h θ (t)=θ T X
[0134]
[0135]
[0136] wherein θ is the weight vector of the gas concentration predicted by different models, X is the vector composed of the gas concentration calculated by different models, h θ (t) is the output value of the gas concentration after the gas concentration calculated and predicted by each model is fused. J(θ) is the loss function of the gas concentration fusion, y(t) is the actual gas concentration at t. Δθ i is the adjustment amount of the fusion weight, and the original weight θ is reduced by the weight adjustment amount Δθ i to realize the adjustment of the weight. The next round of model training is carried out with the adjusted weight, and η is the learning rate.
[0137] In this embodiment, the difference between the result after the fusion of the predicted gas concentration and the actual gas concentration is squared as the objective function, and through weight iteration, the weight of the gas concentration predicted by each model for the calculation result of the actual gas concentration is learned, so that the reasonable distribution of the weights of the gas concentration calculated and predicted by different models is realized. The fast and accurate calculation of the gas concentration based on environmental factors under the multi-model fusion is realized.
[0138] Based on the same inventive concept, an embodiment of the present application provides a gas concentration calculation device. Referring to Figure 5 , Figure 5 is a schematic diagram of a gas concentration calculation device 500 according to an embodiment of the present application. As shown in Figure 5 , the device comprises:
[0139] a time series data processing module 501 configured to collect relevant time series data of a to-be-detected gas through a gas concentration sensor end, process the time series data, and obtain processed time series data;
[0140] a sensor end calculation module 502 configured to calculate the gas concentration according to the processed time series data, obtain a sensor end gas concentration calculation value, and transmit the processed time series data to an edge end;
[0141] a normalization module 503 configured to perform normalization processing on the processed time series data through the edge end, and obtain normalized data;
[0142] an edge-end computing module 504, configured to input the normalized data into a gas concentration prediction model on the edge end to obtain an edge-end gas concentration prediction value, and transmit the normalized data to the cloud end;
[0143] a cloud-end computing module 505, configured to input the normalized data into a gas concentration prediction model on the cloud end to obtain a cloud-end gas concentration prediction value;
[0144] a real gas concentration calculation module 506, configured to fuse the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value to obtain a real gas concentration.
[0145] Optionally, the time-series data processing module comprises:
[0146] an outlier removal sub-module, configured to remove outliers from the time-series data to exclude abnormal data in the time-series data;
[0147] a smoothing processing sub-module, configured to perform data smoothing processing on the time-series data to obtain the processed time-series data.
[0148] Optionally, the time-series data comprises time-series data of absorbance, wind speed, wind direction, temperature, humidity and air pressure.
[0149] Optionally, the sensor-end computing module comprises:
[0150] a sensor-end computing sub-module, configured to use the processed time-series data to fit an absorbance-concentration curve, and use a fitting function to calculate the sensor-end gas concentration calculation value.
[0151] Optionally, the normalization module comprises:
[0152] a first data normalization sub-module, configured to use a conversion function to convert the time-series data of absorbance, temperature, humidity and air pressure into data of the same order of magnitude;
[0153] a second data normalization sub-module, configured to correct the time-series data of wind speed and wind direction, thereby realizing normalization processing on the time-series data of wind speed and wind direction.
[0154] Optionally, the device further comprises:
[0155] a sample collection module, configured to use the gas concentration sensor to collect a gas with a known concentration to obtain processed time-series data corresponding to the gas;
[0156] a model training module, configured to input the processed time-series data into the gas concentration prediction model to obtain a predicted gas concentration;
[0157] a parameter adjustment module, configured to adjust parameters of the gas concentration prediction model according to a difference between the predicted gas concentration and the known concentration of the gas, to obtain a trained gas concentration prediction model.
[0158] Optionally, the real gas concentration calculation module comprises:
[0159] a data input sub-module, configured to input the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value into a real gas concentration prediction model on the cloud;
[0160] a real gas concentration calculation sub-module, configured to perform weighted average on the input values by the real gas concentration prediction model to obtain the real gas concentration.
[0161] Based on the same inventive concept, another embodiment of the present application provides a readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the steps in the gas concentration calculation method according to any one of the above embodiments of the present application.
[0162] Based on the same inventive concept, another embodiment of the present application provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor being executed to implement the steps in the gas concentration calculation method according to any one of the above embodiments of the present application.
[0163] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts are described in the part of the method embodiment.
[0164] Each of the embodiments in the present specification is described in a progressive manner, and each embodiment mainly describes the difference from other embodiments. The same and similar parts between the embodiments can be referred to each other.
[0165] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device or a computer program product. Therefore, the embodiments of the present application can be in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0166] The embodiments of the present application are described with reference to the flowchart illustrations and / or block diagrams of the methods, terminal devices (systems) and computer program products according to the embodiments of the present application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal devices to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal devices, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.
[0167] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal devices to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.
[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal devices, such that a series of operational steps are performed on the computer or other programmable terminal devices to produce a computer implemented process so that the instructions executed on the computer or other programmable terminal devices provide steps for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.
[0169] Although preferred embodiments of the present application have been described, those skilled in the art will be able to make additional modifications and variations to the embodiments without departing from the scope of the present application. Accordingly, the appended claims are intended to encompass all such modifications and variations as falling within the scope of the embodiments of the present application.
[0170] Finally, it is to be understood that the phraseology or terminology such as "first" and "second" etc. used herein is merely intended to differentiate one entity or operation from another entity or operation, without necessarily requiring or implying any actual such relationship or order between such entities or operations. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0171] The gas concentration calculation method, device, equipment and storage medium provided by the present application are described in detail above, and the principles and implementation manners of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges will be changed, and the above description of the present application should not be understood as a limitation of the present application.
Claims
1. A gas concentration calculation method, the method comprising: collecting relevant time series data of a to-be-detected gas through a gas concentration sensor end, processing the time series data to obtain processed time series data, the time series data including time series data of absorbance, wind speed, wind direction, temperature, humidity, and air pressure, and the gas concentration sensor being arranged in a generation environment of the to-be-detected gas; performing gas concentration calculation according to the processed time series data to obtain a sensor-end gas concentration calculation value, and transmitting the processed time series data to an edge end; performing normalization processing on the processed time series data through the edge end to obtain normalized data, the edge end being arranged near the gas concentration sensor; inputting the normalized data into a gas concentration prediction model on the edge end to obtain an edge-end gas concentration prediction value, and transmitting the normalized data to a cloud end, the gas concentration prediction model on the edge end being an LSTM model; inputting the normalized data into a gas concentration prediction model on the cloud end to obtain a cloud-end gas concentration prediction value, the gas concentration prediction model on the cloud end being a TCN model improved according to a diffusion law of gas in space, a convolution kernel size of the TCN model being adaptively adjusted according to a wind speed in the generation environment of the to-be-detected gas, and the convolution kernel size at one moment being inversely proportional to the wind speed at the moment in the generation environment of the to-be-detected gas; performing fusion on the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value, and the cloud-end gas concentration prediction value according to weights of each concentration value obtained through training through a real gas concentration prediction model on the cloud end to obtain a real gas concentration, the weights representing weights of the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value, and the cloud-end gas concentration prediction value in the calculation of the real gas concentration.
2. The method of claim 1, wherein, collecting relevant time series data of a to-be-detected gas through a gas concentration sensor end, processing the time series data to obtain processed time series data, including: performing outlier removal on the time series data to exclude abnormal data in the time series data; performing data smoothing processing on the time series data to obtain the processed time series data.
3. The method of claim 1, wherein, performing gas concentration calculation according to the processed time series data to obtain a sensor-end gas concentration calculation value, including: combining the processed time series data with a fitted absorbance-concentration curve to calculate the sensor-end gas concentration calculation value by using a fitting function.
4. The method of claim 1, wherein, performing normalization processing on the processed time series data through the edge end to obtain normalized data, including: using a conversion function to convert the time series data of absorbance, temperature, humidity, and air pressure into data of the same order of magnitude; correcting the time series data of wind speed and wind direction to realize normalization processing on the time series data of wind speed and wind direction.
5. The method of claim 1, wherein, the training steps of the gas concentration prediction model include: collecting a gas with a known concentration by using the gas concentration sensor to obtain processed time series data corresponding to the gas; Input the processed time series data into the gas concentration prediction model to obtain a predicted gas concentration; Adjust parameters of the gas concentration prediction model according to a difference between the predicted gas concentration and the known concentration of the gas to obtain a trained gas concentration prediction model.
6. The method of claim 1, wherein, Fuse the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value to obtain a real gas concentration, including: Input the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value into a real gas concentration prediction model on the cloud to obtain a real gas concentration prediction model; Obtain the real gas concentration by weighted average of the input values through the real gas concentration prediction model.
7. A gas concentration calculating device characterized by comprising: The device comprises: a time series data processing module configured to collect relevant time series data of a to-be-detected gas through a gas concentration sensor end, process the time series data to obtain processed time series data, and the time series data comprises time series data of absorbance, wind speed, wind direction, temperature, humidity and air pressure, and the gas concentration sensor is arranged in a generation environment of the to-be-detected gas; a sensor-end calculation module configured to calculate a gas concentration according to the processed time series data to obtain a sensor-end gas concentration calculation value, and transmit the processed time series data to an edge end; a normalization module configured to perform normalization processing on the processed time series data through the edge end to obtain normalized data, and the edge end is arranged near the gas concentration sensor; an edge-end calculation module configured to input the normalized data into a gas concentration prediction model on the edge end to obtain an edge-end gas concentration prediction value, and transmit the normalized data to a cloud end, and the gas concentration prediction model on the edge end is an LSTM model; a cloud-end calculation module configured to input the normalized data into a gas concentration prediction model on the cloud end to obtain a cloud-end gas concentration prediction value, and the gas concentration prediction model on the cloud end is a TCN model improved according to a diffusion law of gas in space, a convolution kernel size of the TCN model is adaptively adjusted according to a wind speed in a generation environment of the to-be-detected gas, and the convolution kernel size at one moment is inversely proportional to the wind speed at the moment in the generation environment of the to-be-detected gas; a real gas concentration calculation module configured to fuse the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value according to weights of each concentration value obtained through training through a real gas concentration prediction model on the cloud end to obtain a real gas concentration, and the weights represent weights of the sensor-end gas concentration calculation value, the edge-end gas concentration prediction value and the cloud-end gas concentration prediction value for the real gas concentration calculation.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by a processor to implement steps in the method of any one of claims 1 to 6.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement steps of the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Mobile terminal, server and method for testing air quality
CN103607490A
Air pollutant detection device and detection method
CN108106998A
Multi-dimensional comprehensive online monitoring intelligent diagnosis system for transformer
CN112880750A
Industrial intelligent composite gas detector and detection method
CN113203772A
Concentration calculation device, concentration calculation system, and concentration calculation method
JP2018066336A