A data fusion method for measuring sand content using capacitive sensors
By using Sage-Husa adaptive Kalman filtering and LSTM neural network data fusion methods in capacitive sensors, the problem of capacitive sensors being affected by environmental factors when measuring the sand content of rivers is solved, and the accuracy and stability of measurement are improved.
Patent Information
- Application Number
- CN202211225016.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-09
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-10-09
AI Technical Summary
Existing capacitive sensors are susceptible to environmental factors when measuring river sand content, resulting in unstable measurement values and low accuracy.
The data fusion method based on Sage-Husa adaptive Kalman filtering-LSTM is adopted to collect data through capacitance sensors, temperature sensors and conductivity testers, and the LSTM neural network is used to fuse environmental information such as capacitance value, temperature and conductivity with sand content information to eliminate interference from environmental factors.
The accuracy of the results of capacitive sensor measurement sand content is improved, the impact of environmental factors on the measured values is reduced, and real-time and accurate measurement of sludge and sand content is achieved.
Smart Images

Figure CN115563579B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a data fusion method for measuring sediment content by a capacitive sensor, in particular to a data fusion method for measuring sediment content by a capacitive sensor based on Sage-Husa adaptive Kalman filter-LSTM, and belongs to the technical field of river sediment content measurement. Background Art
[0002] Runoff sediment is one of the important parameters for measuring soil erosion. It can provide basic data for the simulation and research of soil erosion dynamic processes, the establishment of soil erosion prediction models, and provide a scientific basis for the monitoring and prevention of soil and water loss. At present, the common methods for measuring river sediment content can be divided into direct measurement methods and indirect measurement methods. Direct measurement methods include: drying weighing method and replacement method. Indirect measurement methods include: optical method, acoustic method, vibration method, capacitance method, isotope method, etc. The above sediment content measurement methods have various shortcomings:
[0003] 1) The drying weighing method has a long measurement cycle and a complicated process;
[0004] 2) The optical method is greatly affected by the color and particle size of the medium, has a narrow measurement range, and is costly;
[0005] 3) The acoustic method is expensive and has a small measurement range;
[0006] 4) The vibration method is greatly affected by water velocity. When the water velocity is lower than 0.5 m / s, the vibration tube will be blocked.
[0007] 5) The isotope method cannot be widely used due to radiation problems caused by radioactive sources.
[0008] The capacitance method has a simple structure, low cost, safe use and fast response speed, but the capacitance measurement value is easily affected by the environment. Therefore, how to reduce the interference of environmental factors on the capacitance measurement value is a key issue in the study of capacitance sand measurement. Summary of the invention
[0009] The present invention provides a data fusion method for measuring sediment content by a capacitive sensor, which is used to eliminate the influence of environmental factors such as temperature on the measurement value of the capacitive sensor. The environmental information such as capacitance value, temperature and conductivity is fused with the sediment content information through an LSTM neural network, so as to achieve the effect of eliminating the influence of environmental factors on the sediment content measurement, and improve the accuracy of the sediment content measurement result of the capacitive sensor.
[0010] The technical solution of the present invention is: a data fusion method for measuring sand content using a capacitive sensor, the specific steps of the method are as follows:
[0011] Step 1: Multi-sensor measurement data signal acquisition, through the capacitance sensor, temperature sensor, conductivity tester with a sampling frequency of F respectively collect the capacitance value C at the tth moment t 、Water temperature T t , conductivity σ t , the sand content information of the measuring point is determined by drying weighing method as the actual sand content CS t , where t∈{1, 2, …, N}, forming a first data set; specifically, the capacitive sensor collects the capacitance value information of the water body at the measuring point, the temperature sensor collects the current water temperature information of the measured water body, the conductivity tester collects the conductivity information of the water body at the measuring point, and the drying weighing method is used to determine the sand content information of the measuring point as the evaluation standard of the actual sand content.
[0012] Step 2, using the Laida criterion to identify and remove outliers in the first data set, and then using piecewise linear interpolation to calculate estimated values as a supplement to the outliers to ensure the integrity of the data, forming a second data set;
[0013] The step 2 comprises the following steps:
[0014] Step 2.1: Change the capacitance value C in the first data set to t 、Water temperature T t and conductivity σ t The Laida criterion is used to identify outliers. The outlier judgment method is as follows: When x t Normal values are retained. When x t is an outlier, and the outlier is removed, where x t is the sample value at time t, is the arithmetic mean of the current sample, σ is the standard deviation, and the calculation formula of σ is: In the formula, σ is the standard deviation, n is the number of sampling;
[0015] Step 2.2: Remove outliers and use linear interpolation to supplement missing data. Outliers are divided into single-point outliers and regional outliers. For the single-point outlier x at the mth moment m , using linear interpolation to calculate new estimates in is a single point outlier x m The estimated value of x m-1 is a single point outlier x m The normal value at the previous moment, x m+1 is a single point outlier x m The normal value at the next moment, for the regional abnormal value x at the pth moment p ∈(x t ,xt+1 ,x t+2 ,…,x t+n ), that is, all sample values from time t to time t+n are outliers, and the new estimated value is calculated by linear interpolation. For regional outliers, the outlier region is [t, t+n], p∈[t, t+n], where is the regional outlier x p The estimated value of x t-1 is the first abnormal value x in the abnormal area t The normal value at the previous moment, x t+n+1 is the last abnormal value x of the abnormal area t+n The normal value at the next moment.
[0016] Step 3, denoising the data after outlier processing: using Sage-Husa adaptive Kalman filter to perform optimal estimation on the second data set from which gross errors have been removed to form a third data set;
[0017] The step 3 comprises the following steps:
[0018] Step 3.1: Use Sage-Husa adaptive Kalman filter to filter the capacitance values C in the second data set. t 、Water temperature T t and conductivity σ t Kalman filtering is used to perform optimal estimation, reduce noise interference, and calculate the prior estimate at the kth moment. In the formula is the prior estimate at the kth moment, A is the state matrix of the state equation, is the posterior estimate at the k-1th moment, is the system noise at the k-1th moment;
[0019] Step 3.2: Calculate the prediction covariance matrix Where P(k / k-1) is the prediction covariance matrix at the kth moment, A is the state matrix of the state equation, and A T is the transposed matrix of A, P(k-1 / k-1) is the error covariance matrix at the k-1th moment, is the covariance matrix of the system noise at the k-1th moment;
[0020] Step 3.3: Calculate the new information sequence: Where ε(k) is the residual at the kth moment, Y(k) is the observed value at the kth moment, H is the observation matrix, is the prior estimate at the kth moment, is the observation noise at the k-1th moment;
[0021] Step 3.4: Calculate weights: where d k is the weight at the k-th moment, and b is the forgetting factor; the value range is 0 < b < 1, and usually the value is 0.9 - 0.99;
[0022] Step 3.5: Calculate the Kalman gain where K(k) is the Kalman gain at the k-th moment, P(k / k - 1) is the predicted covariance matrix at the k-th moment, H is the observation matrix, H T is the transpose matrix of H, is the covariance matrix of the observation noise;
[0023] Step 3.6: Calculate the updated state estimate where is the posterior estimate at the k-th moment, is the prior estimate at the k-th moment, K(k) is the Kalman gain at the k-th moment, and ε(k) is the residual at the k-th moment;
[0024] Step 3.7: Calculate the updated error covariance matrix P(k / k) = [I - K(k)H]P(k / k - 1), where P(k / k) is the error covariance matrix at the k-th moment, I is the identity matrix, K(k) is the Kalman gain at the k-th moment, H is the observation matrix, and P(k / k - 1) is the predicted covariance matrix at the k-th moment;
[0025] Step 3.8: Update the system noise and the covariance matrix of the system noise using the time-varying noise estimator:
[0026] where is the system noise at the k-th moment, d k is the weight at the k-th moment, is the system noise at the (k - 1)-th moment, is the posterior estimate at the k-th moment, A is the state matrix of the state equation, is the posterior estimate at the (k - 1)-th moment;
[0027] where is the covariance matrix of the system noise at the k-th moment, d k is the weight at the k-th moment, is the covariance matrix of the system noise at the (k - 1)-th moment, K(k) is the Kalman gain at the k-th moment, ε(k) is the residual at the k-th moment, ε(k) T is the transpose matrix of ε(k), K(k) T is the transpose matrix of K(k), P(k / k) is the error covariance matrix at the k-th moment, A is the state matrix of the state equation, P(k - 1 / k - 1) is the error covariance matrix at the (k - 1)-th moment, A Tis the transposed matrix of A;
[0028] Step 3.9: Update the observation noise and the covariance matrix of the observation noise using the time-varying noise estimator:
[0029] In the formula is the observation noise at the kth moment, d k is the weight at the kth moment, is the observation noise at the k-1th moment, Y(k) is the observation value at the kth moment, H is the observation matrix, is the prior estimate at the kth moment;
[0030] In the formula is the covariance matrix of the observation noise at the kth moment, d k is the weight at the kth moment, is the covariance matrix of the observed noise at the k-1th moment, ε(k) is the residual at the kth moment, ε(k) T is the transposed matrix of ε(k), H is the observation matrix, H T is the transposed matrix of H, and P(k / k-1) is the predicted covariance matrix at the kth moment.
[0031] Step 4: Build an LSTM neural network, use the capacitance value, water temperature, and conductivity information in the third data set as the input of the LSTM neural network, and use the sand content as the output of the LSTM neural network to perform data fusion on the environmental information and sand content information.
[0032] The step 4 comprises the following steps:
[0033] Step 4.1: Build an LSTM neural network model and transform the capacitance value C in the third data set t 、Water temperature T t , conductivity σ t and sand content CS t After normalization, the first 90% of the data is used as training samples and sent to the LSTM neural network for training until the training sample error meets the requirements;
[0034] Step 4.2: Change the capacitor value C t 、Water temperature T t and conductivity σ t As a three-dimensional input, the sand content CS t As a one-dimensional output;
[0035] Step 4.3: Output h of layer t-1 t-1 With the sequence data x of layer t t Through a "forget gate layer" with trainable parameters and a Sigmoid activation function, the forget gate output f is obtainedt =σ(W f ·[h t-1 , x t ]+b f ), where f t is the output of the forget gate of layer t, f t Indicates the degree to which the cell state of the previous layer is forgotten, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W f is the forget gate weight with trainable parameters, represented by h t-1 The forget gate weight and x t The forget gate weight is composed of σ, σ is the Sigmoid activation function, b f is the bias of the forget gate;
[0036] Step 4.4: Input h of layer t-1 t-1 With the sequence data x of layer t t Through an "input gate layer" with trainable parameters and a Sigmoid activation function, the output i of the input gate is obtained t =σ(W i ·[h t-1 ,x t ]+b i ), where i t is the output of the input gate of layer t, i t Indicates the degree to which the intermediate output information of this layer is retained, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W i is the input gate weight with trainable parameters, represented by h t-1 The input gate weight and x t The input gate weight is composed of σ, σ is the Sigmoid activation function, b i is the bias of the input gate;
[0037] Step 4.5: Input h of layer t-1 t-1 With the sequence data x of layer t t Through an "intermediate output gate layer" with trainable parameters and the Tanh activation function, the intermediate output of the neurons in this layer is obtained. in is the intermediate output information of the t-layer neurons, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W C is the intermediate output weight with trainable parameters, represented by h t-1 The intermediate output weights and x tThe intermediate output weights are composed of, Tanh is the Tanh activation function, b C is the bias of the intermediate output;
[0038] Step 4.6: Set the previous cell state C t-1 Multiply the degree to which the cell state in the previous layer is forgotten by f t , plus the intermediate output of the neurons in this layer Multiply by the degree to which the intermediate output information of this layer is retained i t A new cell state can be obtained Among them C t is the memory cell of layer t, f t is the output of the forget gate of layer t, C t-1 is the memory cell of layer t-1, i t is the output of the input gate of layer t, is the intermediate output information of the t-layer neurons;
[0039] Step 4.7: Input h of layer t-1 t-1 With the sequence data x of layer t t Through an "output gate layer" with trainable parameters and a Sigmoid activation function, the threshold output o of the output gate is obtained t =σ(W o ·[h t-1 ,x t ]+b o ), where o t is the threshold output of the output gate of layer t, o t Determine which part of the neuron state in this layer needs to be output, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W o is the output gate threshold weight with trainable parameters, represented by h t-1 The output gate threshold weight and x t The output gate threshold weight is composed of σ, σ is the Sigmoid activation function, b o is the bias of the output gate threshold;
[0040] Step 4.8: Set the neuron state C of this layer t The output o after the Tanh activation function and multiplication by the Sigmoid threshold t , get the output h of the output gate t =o t *Tanh(C t ), where h t is the output of the output gate of layer t, h t Will be used as the input of the neurons in layer t+1, o t is the threshold output of the output gate of layer t, C tis the memory cell of layer t, Tanh is the Tanh activation function;
[0041] Step 4.9: The last 10% of the data is used as test samples and sent to the LSTM neural network for testing.
[0042] The expression of the Sigmoid activation function in the above formula is: The value range is (0, 1), and the expression of the Tanh activation function is: The value range is (-1, 1), W f , b f , W i , b i , W C , b C , W o , b o All of them are adjustable parameters. The LSTM neural network continuously adjusts the adjustable parameters through a large number of training samples to achieve the best training result fit and the minimum training error.
[0043] The beneficial effects of the present invention are:
[0044] 1. The present invention adopts the Laida criterion to identify abnormal values of capacitance data, water temperature data and conductivity data, and adopts linear interpolation method to estimate the abnormal values, and corrects the abnormal values with new estimated values, thereby improving the stability and reliability of the data.
[0045] 2. The present invention adopts Sage-Husa adaptive Kalman filtering to optimally estimate capacitance data, water temperature data and conductivity data, thereby reducing noise interference caused by the measurement error of the sensor itself and improving the accuracy of the data.
[0046] 3. The present invention uses LSTM neural network to perform data fusion processing on environmental information such as temperature and sediment content information, eliminating the interference of environmental factors on sediment content measurement and improving the accuracy of sediment content measurement results by capacitive sensors. Compared with other sediment content measurement methods, the capacitance method has a simple structure, low cost, safe use and fast response speed, and can achieve real-time measurement of sediment content. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a structural block diagram of a system for measuring sediment content using a capacitive sensor in an embodiment of the present invention;
[0048] Figure 2 A flowchart of outlier identification and correction of outliers by linear interpolation method in an embodiment of the present invention;
[0049] Figure 3 Schematic diagram of the recursive formula of the Sage-Husa adaptive Kalman filter in an embodiment of the present invention;
[0050] Figure 4 Schematic diagram of the structure of LSTM in an embodiment of the present invention;
[0051] Figure 5 Schematic diagram of the forget gate of LSTM in an embodiment of the present invention;
[0052] Figure 6 Schematic diagram of the input gate of the LSTM in an embodiment of the present invention;
[0053] Figure 7 Schematic diagram of the output gate of LSTM in an embodiment of the present invention;
[0054] Figure 8 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0055] Example 1: Figure 1-Figure 8 As shown, a data fusion method for measuring sand content using a capacitive sensor comprises the following steps:
[0056] Step 1: Use the capacitance sensor, temperature sensor, and conductivity tester to collect the capacitance value C at the tth moment at a sampling frequency of F. t 、Water temperature T t and conductivity σ t , where t∈{1, 2, ..., N}, the sand content information of the measuring point is determined by the drying weighing method as the actual sand content CS t , forming the first data set [C1, T1, σ1, CS t ];
[0057] Step 2: Use the Laida criterion to identify and remove outliers in the first data set, and then use the interpolation method to calculate the estimated value as a supplement to the outliers to ensure the integrity of the data, forming the second data set [C2, T2, σ2, CS t ];
[0058] Step 3: The second data set with gross errors removed is optimally estimated by Sage-Husa adaptive Kalman filtering to form the third data set [C3, T3, σ3, CS t ];
[0059] Step 4: Construct an LSTM neural network and normalize the capacitance value information C3, water temperature T3 and conductivity σ3 in the third data set as the input X of the LSTM neural network. t As the output Y of the LSTM neural network, the sediment content information and environmental information are fused.
[0060] Step 2 uses a data preprocessing algorithm to identify and correct outliers in the original data. The flowchart of outlier identification and linear interpolation correction is as follows: Figure 2 As shown:
[0061] The step 2 comprises the following steps:
[0062] Step 2.1: Change the capacitance value C in the first data set to t 、Water temperature T t and conductivity σ t The Laida criterion is used to identify outliers. The outlier judgment method is as follows: When x t Normal values are retained. When x t is an outlier, and the outlier is removed, where x t is the sample value at time t, is the arithmetic mean of the current sample, σ is the standard deviation, and the calculation formula of σ is: In the formula, σ is the standard deviation, n is the number of sampling;
[0063] Step 2.2: Remove outliers and use linear interpolation to supplement missing data. Outliers are divided into single-point outliers and regional outliers. For the single-point outlier x at the mth moment m , using linear interpolation to calculate new estimates in is a single point outlier x m The estimated value of x m-1 is a single point outlier x m The normal value at the previous moment, x m+1 is a single point outlier x m The normal value at the next moment, for the regional abnormal value x at the pth moment p ∈(x t ,x t+1 ,x t+2 ,…,x t+n ), that is, all sample values from time t to time t+n are outliers, and the new estimated value is calculated by linear interpolation. For regional outliers, the outlier region is [t, t+n], p∈[t, t+n], where is the regional outlier x p The estimated value of x t-1 is the first abnormal value x in the abnormal area t The normal value at the previous moment, x t+n+1 is the last abnormal value x of the abnormal area t+n The normal value at the next moment.
[0064] Step 3: Perform Sage-Husa adaptive Kalman filtering on the data in the second dataset to achieve the purpose of denoising. The schematic diagram of the recurrence formula of Sage-Husa adaptive Kalman filtering is as shown in Figure 3 as follows:
[0065] Step 3.1: Calculate the prior estimate at the k-th moment where is the prior estimate at the k-th moment, A is the state matrix of the state equation, is the posterior estimate at the (k - 1)-th moment, is the system noise at the (k - 1)-th moment;
[0066] Step 3.2: Calculate the predicted covariance matrix where P(k / k - 1) is the predicted covariance matrix at the k-th moment, A is the state matrix of the state equation, A T is the transpose matrix of A, P(k - 1 / k - 1) is the error covariance matrix at the (k - 1)-th moment, is the covariance matrix of the system noise at the (k - 1)-th moment;
[0067] Step 3.3: Calculate the innovation sequence: where ε(k) is the residual at the k-th moment, Y(k) is the observed value at the k-th moment, H is the observation matrix, is the prior estimate at the k-th moment, is the observation noise at the (k - 1)-th moment;
[0068] Step 3.4: Calculate the weight: where d k is the weight at the k-th moment, b is the forgetting factor; the value range is 0 < b < 1, and usually the value is 0.9 - 0.99;
[0069] Step 3.5: Calculate the Kalman gain where K(k) is the Kalman gain at the k-th moment, P(k / k - 1) is the predicted covariance matrix at the k-th moment, H is the observation matrix, H T is the transpose matrix of H, is the covariance matrix of the observation noise;
[0070] Step 3.6: Calculate the updated state estimate where is the posterior estimate at the k-th moment, is the prior estimate at the k-th moment, K(k) is the Kalman gain at the k-th moment, ε(k) is the residual at the k-th moment;
[0071] Step 3.7: Calculate the updated error covariance matrix P(k / k)=[IK(k)H]P(k / k-1), where P(k / k) is the error covariance matrix at the kth moment, I is the identity matrix, K(k) is the Kalman gain at the kth moment, H is the observation matrix, and P(k / k-1) is the prediction covariance matrix at the kth moment;
[0072] Step 3.8: Update the system noise and the covariance matrix of the system noise using the time-varying noise estimator:
[0073] In the formula is the system noise at the kth moment, d k is the weight at the kth moment, is the system noise at the k-1th moment, is the posterior estimate at the kth moment, A is the state matrix of the state equation, is the posterior estimate at the k-1th moment;
[0074] In the formula is the covariance matrix of the system noise at the kth moment, d k is the weight at the kth moment, is the covariance matrix of the system noise at the k-1th moment, K(k) is the Kalman gain at the kth moment, ε(k) is the residual at the kth moment, and ε(k) T is the transposed matrix of ε(k), K(k) T is the transposed matrix of K(k), P(k / k) is the error covariance matrix at the kth moment, A is the state matrix of the state equation, P(k-1 / k-1) is the error covariance matrix at the k-1th moment, A T is the transposed matrix of A;
[0075] Step 3.9: Update the observation noise and the covariance matrix of the observation noise using the time-varying noise estimator:
[0076] In the formula is the observation noise at the kth moment, d k is the weight at the kth moment, is the observation noise at the k-1th moment, Y(k) is the observation value at the kth moment, H is the observation matrix, is the prior estimate at the kth moment;
[0077] In the formula is the covariance matrix of the observation noise at the kth moment, d k is the weight at the kth moment, is the covariance matrix of the observed noise at the k-1th moment, ε(k) is the residual at the kth moment, ε(k)T is the transposed matrix of ε(k), H is the observation matrix, H T is the transposed matrix of H, and P(k / k-1) is the predicted covariance matrix at the kth moment.
[0078] Step 4: Construct an LSTM neural network, use the capacitance value, water temperature and conductivity information in the third data set as the input of the LSTM neural network, and use the sediment content as the output of the LSTM neural network to fuse the environmental information and sediment content information. Construct an LSTM neural network, train and save the model, and the LSTM structure diagram is as follows: Figure 4 As shown:
[0079] Step 4.1: Build an LSTM neural network model and transform the capacitance value C in the third data set t 、Water temperature T t , conductivity σ t and sand content CS t After normalization, the first 90% of the data is used as training samples and sent to the LSTM neural network for training until the training sample error meets the requirements;
[0080] Step 4.2: Change the capacitor value C t 、Water temperature T t and conductivity σ t As a three-dimensional input, the sand content CS t As a one-dimensional output;
[0081] The schematic diagram of the forget gate of LSTM is as follows Figure 5 As shown:
[0082] Step 4.3: Output h of layer t-1 t-1 With the sequence data x of layer t t Through a "forget gate layer" with trainable parameters and a Sigmoid activation function, the forget gate output f is obtained t =σ(W f ·[h t-1 , x t ]+b f ), where f t is the output of the forget gate of layer t, f t Indicates the degree to which the cell state of the previous layer is forgotten, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W f is the forget gate weight with trainable parameters, represented by h t-1 The forget gate weight and x t The forget gate weight is composed of σ, σ is the Sigmoid activation function, b f is the bias of the forget gate;
[0083] The input gate diagram of LSTM is as follows Figure 6 As shown:
[0084] Step 4.4: Input h of layer t-1 t-1 With the sequence data x of layer t t Through an "input gate layer" with trainable parameters and a Sigmoid activation function, the output i of the input gate is obtained t =σ(W i ·[h t-1 ,x t ]+b i ), where i t is the output of the input gate of layer t, i t Indicates the degree to which the intermediate output information of this layer is retained, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W i is the input gate weight with trainable parameters, represented by h t-1 The input gate weight and x t The input gate weight is composed of σ, σ is the Sigmoid activation function, b i is the bias of the input gate;
[0085] Step 4.5: Input h of layer t-1 t-1 With the sequence data x of layer t t Through an "intermediate output gate layer" with trainable parameters and the Tanh activation function, the intermediate output of the neurons in this layer is obtained. in is the intermediate output information of the t-layer neurons, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W C is the intermediate output weight with trainable parameters, represented by h t-1 The intermediate output weights and x t The intermediate output weights are composed of, Tanh is the Tanh activation function, b C is the bias of the intermediate output;
[0086] Step 4.6: Set the previous cell state C t-1 Multiply the degree to which the cell state in the previous layer is forgotten by f t , plus the intermediate output of the neurons in this layer Multiply by the degree to which the intermediate output information of this layer is retained i t A new cell state can be obtained Among them C t is the memory cell of layer t, f t is the output of the forget gate of layer t, C t-1is the memory cell of layer t-1, i t is the output of the input gate of layer t, is the intermediate output information of the t-layer neurons;
[0087] The output gate diagram of LSTM is as follows Figure 7 As shown:
[0088] Step 4.7: Input h of layer t-1 t-1 With the sequence data x of layer t t Through an "output gate layer" with trainable parameters and a Sigmoid activation function, the threshold output o of the output gate is obtained t =σ(W o ·[h t-1 ,x t ]+b o ), where o t is the threshold output of the output gate of layer t, o t Determine which part of the neuron state in this layer needs to be output, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W o is the output gate threshold weight with trainable parameters, represented by h t-1 The output gate threshold weight and x t The output gate threshold weight is composed of σ, σ is the Sigmoid activation function, b o is the bias of the output gate threshold;
[0089] Step 4.8: Set the neuron state C of this layer t The output o after the Tanh activation function and multiplication by the Sigmoid threshold t , get the output h of the output gate t =o t *Tanh(C t ), where h t is the output of the output gate of layer t, h t Will be used as the input of the neurons in layer t+1, o t is the threshold output of the output gate of layer t, C t is the memory cell of layer t, Tanh is the Tanh activation function;
[0090] Step 4.9: The last 10% of the data is used as test samples and sent to the LSTM neural network for testing.
[0091] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.
Claims
1. A data fusion method for measuring sediment content using a capacitive sensor, characterized in that: The specific steps of the data fusion method for measuring sand content using a capacitive sensor are as follows: Step 1: Use the capacitance sensor, temperature sensor, and conductivity tester to collect the capacitance value C at the tth moment at a sampling frequency of F. t 、Water temperature T t , conductivity σ t , the sand content information of the measuring point is determined by the drying weighing method as the actual sand content CS t , where t∈{1, 2, …, N}, forming a first data set; Step 2: Use the Laida criterion to identify and remove outliers in the first data set, and then use the piecewise linear interpolation method to calculate estimated values as a supplement to the outliers to ensure the integrity of the data and form the second data set; Step 3: Use Sage-Husa adaptive Kalman filter to perform optimal estimation on the second data set from which gross errors have been removed to form a third data set; Step 4: Construct an LSTM neural network, use the capacitance value, water temperature, and conductivity information in the third data set as the input of the LSTM neural network, and use the sediment content as the output of the LSTM neural network to perform data fusion on the environmental information and sediment content information.
2. The data fusion method for measuring sediment content using a capacitive sensor according to claim 1, characterized in that: The step 2 comprises the following steps: Step 2.1: Change the capacitance value C in the first data set to t 、Water temperature T t and conductivity σ t The Laida criterion is used to identify outliers. The outlier judgment method is as follows: When x t Normal values are retained. When x t is an outlier, and the outlier is removed, where x t is the sample value at time t, is the arithmetic mean of the current sample, σ is the standard deviation, and the calculation formula of σ is: In the formula, σ is the standard deviation, n is the number of sampling; Step 2.2: Remove outliers and use linear interpolation to supplement missing data. Outliers are divided into single-point outliers and regional outliers. For the single-point outlier x at the mth moment m , use linear interpolation to calculate new estimates in is a single point outlier x m The estimated value of x m-1 is a single point outlier x m The normal value at the previous moment, x m+1 is a single point outlier x m The normal value at the next moment, for the regional abnormal value x at the pth moment p ∈(x t , x t+1 , x t+2 , …, x t+n ), that is, all sample values from time t to time t+n are outliers, and the new estimated value is calculated by linear interpolation. p∈[t, t+n], where is the regional outlier x p The estimated value of x t-1 is the first abnormal value x in the abnormal area t The normal value at the previous moment, x t+n+1 is the last abnormal value x of the abnormal area t+n The normal value at the next moment.
3. The data fusion method for measuring sand content by a capacitive sensor according to claim 1 is characterized in that: The step 3 comprises the following steps: Step 3.1: Change the capacitance value C in the second data set to t 、Water temperature T t and conductivity σ t Use Kalman filtering to perform optimal estimation and calculate the prior estimate at the kth moment In the formula is the prior estimate at the kth moment, A is the state matrix of the state equation, is the posterior estimate at the k-1th moment, is the system noise at the k-1th moment; Step 3.2: Calculate the prediction covariance matrix Where p(k / k-1) is the prediction covariance matrix at the kth moment, A is the state matrix of the state equation, and A T is the transposed matrix of A, P(k-1 / k-1) is the error covariance matrix at the k-1th moment, is the covariance matrix of the system noise at the k-1th moment; Step 3.3: Calculate the new information sequence Where ε(k) is the residual at the kth moment, Y(k) is the observation value at the kth moment, H is the observation matrix, is the prior estimate at the kth moment, is the observation noise at the k-1th moment; Step 3.4: Calculate weights Where d k is the weight at the kth moment, and b is the forgetting factor; Step 3.5: Calculate Kalman gain Where K(k) is the Kalman gain at the kth moment, P(k / k-1) is the prediction covariance matrix at the kth moment, H is the observation matrix, and H T is the transposed matrix of H, is the covariance matrix of the observation noise; Step 3.6: Calculate the updated state In the formula is the posterior estimate at the kth moment, is the prior estimate at the kth moment, K(k) is the Kalman gain at the kth moment, and ε(k) is the residual at the kth moment; Step 3.7: Calculate the updated error covariance matrix P(k / k)=[IK(k)H]P(k / k-1), where P(k / k) is the error covariance matrix at the kth moment, I is the identity matrix, K(k) is the Kalman gain at the kth moment, H is the observation matrix, and P(k / k-1) is the prediction covariance matrix at the kth moment; Step 3.8: Update the system noise and the covariance matrix of the system noise using the time-varying noise estimator: In the formula is the system noise at the kth moment, d k is the weight at the kth moment, is the system noise at the k-1th moment, is the posterior estimate at the kth moment, A is the state matrix of the state equation, is the posterior estimate at the k-1th moment; In the formula, is the covariance matrix of the system noise at the kth moment, d k is the weight at the kth moment, is the covariance matrix of the system noise at the k-1th moment, K(k) is the Kalman gain at the kth moment, ε(k) is the residual at the kth moment, and ε(k) T is the transposed matrix of ε(k), K(k) T is the transposed matrix of K(k), P(k / k) is the error covariance matrix at the kth moment, A is the state matrix of the state equation, P(k-1 / k-1) is the error covariance matrix at the k-1th moment, A T is the transposed matrix of A; Step 3.9: Update the observation noise and the covariance matrix of the observation noise using the time-varying noise estimator: In the formula is the observation noise at the kth moment, d k is the weight at the kth moment, is the observation noise at the k-1th moment, Y(k) is the observation value at the kth moment, H is the observation matrix, is the prior estimate at the kth moment; In the formula is the covariance matrix of the observation noise at the kth moment, d k is the weight at the kth moment, is the covariance matrix of the observed noise at the k-1th moment, ε(k) is the residual at the kth moment, ε(k) T is the transposed matrix of ε(k), H is the observation matrix, H T is the transposed matrix of H, and P(k / k-1) is the predicted covariance matrix at the kth moment.
4. The data fusion method for measuring sediment content by a capacitive sensor according to claim 1 is characterized in that: The step 4 comprises the following steps: Step 4.1: Build an LSTM neural network model and transform the capacitance value C in the third data set t 、Water temperature T t , conductivity σ t , sand content CS t After normalization, the first 90% of the data is used as training samples and sent to the LSTM neural network for training until the training sample error meets the requirements; Step 4.2: Change the capacitor value C t 、Water temperature T t , conductivity σ t As a three-dimensional input, the sand content CS t As a one-dimensional output; Step 4.3: Calculate the forget gate output f t =σ(W f ·[h t-1 , x t ]+b f ), where f t is the output of the forget gate of layer t, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W f is the forget gate weight with trainable parameters, represented by h t-1 The forget gate weight and x t The forget gate weight is composed of σ, σ is the Sigmoid activation function, b f is the bias of the forget gate; Step 4.4: Calculate the input gate output i t =σ(W i ·[h t-1 , x t ]+b i ), where i t is the output of the input gate of layer t, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W i is the input gate weight with trainable parameters, represented by h t-1 The input gate weight and x t The input gate weight is composed of σ, σ is the Sigmoid activation function, b i is the bias of the input gate; Step 4.5: Calculate the intermediate output information of neurons in this layer in is the intermediate output information of the t-layer neurons, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W C is the intermediate output weight with trainable parameters, represented by h t-1 The intermediate output weights and x t The intermediate output weights are composed of, Tanh is the Tanh activation function, b C is the bias of the intermediate output; Step 4.6: Calculate the updated memory cells of this layer Among them C t is the memory cell of layer t, f t is the output of the forget gate of layer t, C t-1 is the memory cell of layer t-1, i t is the output of the input gate of layer t, is the intermediate output information of the t-layer neurons; Step 4.7: Calculate the threshold output o of the output gate t =σ(W o ·[h t-1 , x t ]+b o ), where o t is the threshold output of the output gate of layer t, h t-1 is the output of layer t-1, x t is the sequence input of layer t, W o is the output gate threshold weight with trainable parameters, represented by h t-1 The output gate threshold weight and x t The output gate threshold weight is composed of σ, σ is the Sigmoid activation function, b o is the bias of the output gate threshold; Step 4.8: Calculate the output gate output h t =o t *Tanh(C t ), where h t is the output of the output gate of layer t, o t is the threshold output of the output gate of layer t, C t is the memory cell of layer t, Tanh is the Tanh activation function; Step 4.9: The last 10% of the data is used as test samples and sent to the LSTM neural network for testing.