A high-precision capacitance measurement method based on BP neural network
The BP neural network-based method improves electric capacity measurement precision by processing and training data to achieve accurate, real-time capacitance predictions.
Patent Information
- Application Number
- CN202210108623.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2042-01-28
AI Technical Summary
The existing capacitance measurement methods have insufficient accuracy and applicability, especially when online real-time measurement and wide-band operation, the measurement error is large, making it difficult to meet the requirements of high accuracy and real-time.
Using a high-precision capacitance measurement method based on BP neural network, the voltage data at both ends of the capacitor is obtained through the data acquisition circuit, and after cleaning and denoising, a sample set is constructed, and the BP neural network is trained to establish a test model, and finally high-precision measurement of the capacitor is realized.
It achieves 97% measurement accuracy, with a measurement range of 1-470pF, and a single measurement time of only 0.5s, which is suitable for real-time online capacitive sensor application systems.
Smart Images

Figure CN114441859B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of capacitance measurement, and more specifically, it relates to a high-precision capacitance measurement method based on a BP neural network. Background Art
[0002] Currently, the commonly used capacitance measurement methods include the capacitance meter method, the three-meter method, the bridge method, and the resonance method. The capacitance method uses a capacitance measuring instrument to measure the target capacitance value. Its measurement accuracy depends on the measuring instrument used and requires manual operation, which is not suitable for application scenarios that require on-line real-time measurement. The three-meter method is a method used in early circuit design. It uses an AC voltmeter, an AC ammeter, and a power meter to obtain electrical parameters such as the voltage, current, and power across the component under test, and then calculates the required parameter values through calculation. This method has complicated operations, and the measurement error is affected by the three measuring instruments and is difficult to improve. It is generally only used for experimental verification. In the bridge method and the resonance method, the capacitance to be measured is respectively connected to the bridge circuit and the resonance circuit, and then the output voltage of the bridge and the resonance frequency of the resonance circuit are measured, and the capacitance value of the component under test is calculated using the output voltage and the resonance frequency. Although this method can be applied to real-time systems, it is limited by the non-linearity of the circuit when operating in a wide frequency band. When the change range of the target capacitance is large, the measurement error is relatively large. Summary of the Invention
[0003] The technical problem to be solved by the present invention is aimed at the above-mentioned deficiencies of the prior art. The purpose of the present invention is to provide a high-precision capacitance measurement method based on a BP neural network that can improve the measurement accuracy.
[0004] The technical solution of the present invention is: A high-precision capacitance measurement method based on a BP neural network, including:
[0005] Obtaining voltage data across the sample capacitance through a data acquisition circuit to construct an original sample set;
[0006] Performing cleaning processing and denoising processing on the original sample set to obtain a preprocessed sample set;
[0007] Performing feature selection on the preprocessed sample set;
[0008] After performing normalization processing on the preprocessed sample set, inputting it into a BP neural network for training to obtain a test model;
[0009] Using the test model to measure the actual capacitance to be measured.
[0010] As a further improvement, the data acquisition circuit includes a main control board, a signal generator, an amplifier, a sampler, a resistor, and a sample capacitor. The main control board is connected in series with one end of the signal generator, the amplifier, the resistor, and the sample capacitor in sequence. One end of the sample capacitor is connected to the main control board through the sampler, and the other end of the sample capacitor is grounded.
[0011] Further, the process of obtaining the voltage data at both ends of the sample capacitor is as follows:
[0012] The main control board starts the signal generator to linearly output a sine test signal with a frequency range of 1 MHz - 8 MHz, with a step of 100 kHz, a total of 71 frequency points, and a signal maintenance time of 500 ms for each frequency point;
[0013] The amplifier performs amplitude-limiting amplification on the sine test signal and outputs it, so that the signal output amplitude of all frequency points remains unchanged at 1 V;
[0014] The sampler performs effective value detection and analog-to-digital conversion on the voltage amplitude at both ends of the sample capacitor, and the obtained signal amplitude is saved as the characteristic value of the data sample.
[0015] Further, the cleaning process is as follows: The voltages of 50 sample capacitors are measured 6 times respectively, with an interval of 24 hours each time. For the same sample capacitor, if the voltage amplitude of a certain measurement is less than half of the average value of the other five measurements, or greater than 1.5 times the average value of the other five measurements, it is considered an abnormal data point, and the abnormal data point is replaced with the average value of the other five measurements;
[0016] The denoising process uses the median filter method;
[0017] After removing the abnormal data points and filtering, the average value of the 6 measurements is taken as the new characteristic value of the sample.
[0018] Further, when performing feature selection, the voltage amplitudes of 71 signals with a frequency value greater than 1 MHz are taken as the features of the sample.
[0019] Further, the BP neural network is a 5-layer network structure of 71×16×32×16×1.
[0020] Further, the performance of the test model is evaluated through two indicators: the mean square error MSE and the coefficient of determination R 2 These two indicators.
[0021] Furthermore, the training parameters of the BP neural network include: the dataset division ratio is train:validation:test = 70:15:15, the training function is Levenberg-Marquardt, the evaluation function is MSE, the maximum number of iterations Epoch is 1000, the learning target is 1.0e-7, the learning rate is 0.001, the minimum number of validation failures ValidationChecks is 6, the hidden layer function is tansig, and the output layer function is purelin.
[0022] Advantageous Effects
[0023] Compared with the prior art, the advantages of the present invention are as follows:
[0024] The capacitance measurement accuracy of the present invention reaches 97%, the measurement range is 1 - 470 pF, the single measurement time is only 0.5 s, and it has good generalization ability and can be applied to real-time online capacitance sensor application systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is the flowchart of the present invention;
[0026] Figure 2 is the circuit diagram for data acquisition in the present invention;
[0027] Figure 3 is the structure diagram of the BP neural network in the present invention;
[0028] Figure 4 is the training convergence curve diagram of the BP neural network in the present invention;
[0029] Figure 5 is the regression fitting curve diagram of the training set in the present invention;
[0030] Figure 6 is the comparison diagram between the predicted result and the original value in the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0031] The following further describes the present invention with reference to specific embodiments in the drawings.
[0032] Refer to Figures 1 - 6 , a high-precision capacitance measurement method based on a BP neural network, includes:
[0033] Obtain the voltage data at both ends of the sample capacitor C through a data acquisition circuit to construct an original sample set;
[0034] Perform cleaning and denoising processing on the original sample set to obtain a preprocessed sample set;
[0035] Perform feature selection on the preprocessed sample set;
[0036] After normalizing the preprocessed sample set, it is input into a BP neural network for training to obtain a test model;
[0037] Use the test model to measure the actual capacitor to be measured.
[0038] In this embodiment, the data acquisition circuit includes a main control board DSP, a signal generator DDS, an amplifier AGC, a sampler ADC, a resistor R, and a sample capacitor C. One end of the main control board DSP is sequentially connected in series with the signal generator DDS, the amplifier AGC, the resistor R, and one end of the sample capacitor C. One end of the sample capacitor C is connected to the main control board DSP through the sampler ADC, and the other end of the sample capacitor C is grounded, as Figure 2 shown.
[0039] The main control board DSP uses the 32-bit C2000 series high-performance real-time microcontroller TMS320F28379D produced by TI (Texas Instruments) company; its operation rate reaches 800 MIPS, and the flash memory capacity is 1 MB, which can meet the requirements of real-time performance and accuracy of the measurement system. The signal generator DDS uses the direct digital frequency synthesizer AD9910 produced by AD (Analog Devices) company. After being configured and started by the DSP controller, it linearly outputs a sine wave sweep signal with a frequency range of 1 MHz - 8 MHz and a total of 71 frequency points. The amplifier AGC is the AD8367 amplifier of AD company, and the AD8367 amplifier can make the amplitude of the sweep signal remain 1 V throughout the frequency range. The sampler ADC is composed of an effective value detector and an AD converter. Among them, the effective value detection is realized by the effective value measurement chip AD637 produced by AD company, and its working frequency range is 0 - 8 MHz, and the voltage measurement range is -45 dBm - +30 dBm; the AD converter uses the 16-bit ADC built in the DSP.
[0040] The process of obtaining the voltage data at both ends of the sample capacitor C is as follows:
[0041] The main control board DSP starts the signal generator DDS to linearly output a sine test signal with a frequency range of 1 MHz - 8 MHz, a step of 100 kHz, a total of 71 frequency points, and a signal maintenance time of 500 ms for each frequency point;
[0042] The amplifier AGC performs amplitude-limiting amplification on the sine test signal and outputs it, so that the signal output amplitude of all frequency points remains unchanged at 1 V;
[0043] The effective value detection and analog-to-digital conversion of the voltage amplitude at both ends of the sample capacitor C are performed through the sampler ADC, and the obtained signal amplitude is saved as the characteristic value of the data sample.
[0044] The cleaning process is as follows: The voltages of 50 sample capacitors C were measured 6 times, with a 24-hour interval between each measurement. For the same sample capacitor C, if the voltage amplitude of a certain measurement is less than half of the average value of the other five measurements, or greater than 1.5 times the average value of the other five measurements, it is considered an abnormal data point, and the abnormal data point is replaced with the average value of the other five measurements;
[0045] The denoising process uses the median filter method. The median filter method is an efficient non-linear filtering method, which can effectively filter out random noises such as white noise in the analog discrete signal. In the discrete-time domain standard median (SM) filtering algorithm, the window slides on the signal sequence X, and the median of the samples in the window is used as the output at each position. The median filtering operation can be expressed as:
[0046] Y=Med*X1,X2,…,X N}
[0047] In the formula, Y is the filtered output value; X is the discrete analog signal sequence; N is the size of the filtering window; X1,X2,…,X N are the samples within the filter window;
[0048] After removing the abnormal data points and filtering, the average value of the 6 measurements is taken as the new eigenvalue of the sample.
[0049] At low frequencies (<1MHz), the capacitor is equivalent to an open circuit. At this time, the amplitudes of the voltages at both ends of the capacitor are equal to the amplitude of the input signal, and there is no discrimination for all samples. Therefore, when selecting features, the amplitudes of 71 signal voltages with a frequency value greater than 1MHz are taken as the features of the samples.
[0050] The BP neural network is a 5-layer network structure of 71×16×32×16×1. As Figure 3 shown, the number of nodes in the input layer is equal to the number of features of the sample, which is 71; the number of nodes in the output layer is 1; the number of nodes in the three hidden layers are 16, 32, and 16 respectively.
[0051] For the preprocessed sample set, the minmax normalization method is used to convert the data to the [0,1] interval. The conversion formula is as follows:
[0052]
[0053] In the formula, x i is the initial data, min(x i ) and max(x i ) are the maximum and minimum values of the initial data, and x i ′ is the output data after normalization.
[0054] Through the mean square error MSE and the coefficient of determination R 2These two metrics evaluate the performance of the test model.
[0055] MSE is the mean of the squares of the differences between the predicted values and the true values, and its formula is as follows:
[0056]
[0057] In the formula, n is the number of samples; y i and are the true value and the predicted value of the sample respectively. MSE is the magnification of the square of the error, and compared with other methods, it focuses more on magnifying the errors with larger deviations. Therefore, it can be used to evaluate the overall stability of the model. The smaller the MSE value, the better the model performance, and vice versa.
[0058] R 2 represents the proportion of the variance explained in the designed model, and it is a comparison dimension of the model relative to the mean model. Its calculation formula is as follows:
[0059]
[0060]
[0061]
[0062] Among them, SSE (Sum of due to errors) is the sum of the squares of the errors; SST (Total sum of squares) is the sum of the squares of the samples deviating from the mean. When R 2 = 1, SSE = 0, indicating that the predicted value is exactly the same as the true value, and the designed model perfectly explains the change of the dependent variable. When R 2 = 0, SSE = SST, indicating that the prediction performance is the same as that of the mean model, and the model has no further explanatory ability relative to the mean model and is not available. Therefore, R 2 in the interval [0, 1] can be used to evaluate the performance of the model. The closer it is to 1, the better the model performance.
[0063] The training parameters of the BP neural network include: the dataset division ratio is train:validation:test = 70:15:15, the training function is Levenberg-Marquardt, the evaluation function is MSE, the maximum number of iterations Epoch is 1000, the learning target is 1.0e-7, the learning rate is 0.001, the minimum number of validation failures Validation Checks is 6, the hidden layer function is tansig, and the output layer function is purelin. As shown in Table 1.
[0064] Table 1: Training Parameters of the Neural Network Model
[0065] Parameter Name Set Value Dataset Partition Ratio (train:validation:test) 70:15:15 Training Function Levenberg - Marquardt Evaluation Function MSE Maximum Number of Iterations (Epoch) 1000 Learning Objective <![CDATA[1.0e -7 > Learning Rate 0.001 Minimum Number of Validation Failures (Validation Checks) 6 Hidden Layer Function tansig Output Layer Function purelin
[0066] Figure 4 This is the training convergence curve of the BP neural network. As can be seen from Figure 4 , the MSE performance curve rapidly decreases as the number of iterations increases, and the MSE value of the training set reaches the set learning target value (1.0e -7 ) at the 10th iteration, ending the training, while the MSE values of the validation set and the test set tend to be stable after the 3rd iteration. Figure 5 This is the regression fitting curve of the BP neural network on the training set. The coefficient of determination R 2 values on the training, validation, and test data are 1, 0.99747, and 0.99876 respectively, and it also reaches 0.99709 on the entire training set, indicating that the BP network model proposed in this paper has high prediction accuracy.
[0067] To evaluate the prediction ability of the model for new data, the trained model is used to predict the test set, and the prediction results are shown in Table 2 below.
[0068] Table 2 Test Results of the Test Set
[0069]
[0070]
[0071] As can be seen from Table 2, the minimum error of the model prediction is only 0.417%, the maximum error is 10.1073%, the average error is about 2.6291%, and there is a relatively large prediction error when the capacitance is less than 10 pF. The comparison of the prediction results with the original values is as Figure 6 shown. As can be seen from the figure, the prediction results of the model are in good agreement with the original values, and the coefficient of determination R 2 on the test set also reaches 0.99914, indicating that the model has good generalization ability.
[0072] A high-precision capacitance measurement method based on a BP neural network according to the present invention. By using an acquisition circuit to collect the voltage division amplitudes of 50 standard capacitances at 71 different frequency points, after data cleaning and median filtering for denoising preprocessing, a 50×71 C-U data set is constructed; then this data set is used to train a BP neural network model with a hidden layer structure of 16×32×16 to obtain a capacitance prediction model. The test results show that the average relative error between the predicted value and the true value of the model is only 2.6291%, and it also has good generalization ability.
[0073] The above are only the preferred embodiments of the present invention. It should be noted that for those skilled in the art, without departing from the structure of the present invention, several modifications and improvements can be made, and these will not affect the implementation effect of the present invention and the practicability of the patent.
Claims
1. A high-precision capacitance measurement method based on a BP neural network, characterized in that Including: Obtain the voltage data across the sample capacitor (C) through a data acquisition circuit, and construct an original sample set; Perform cleaning processing and denoising processing on the original sample set to obtain a preprocessed sample set; Perform feature selection on the preprocessed sample set; After normalizing the preprocessed sample set, input it into a BP neural network for training to obtain a test model; Use the test model to measure the actual capacitor to be measured; The data acquisition circuit includes a main control board (DSP), a signal generator (DDS), an amplifier (AGC), a sampler (ADC), a resistor (R), and a sample capacitor (C). The main control board (DSP) is serially connected to one end of the signal generator (DDS), the amplifier (AGC), the resistor (R), and the sample capacitor (C) in sequence. One end of the sample capacitor (C) is connected to the main control board (DSP) through the sampler (ADC), and the other end of the sample capacitor (C) is grounded; The process of obtaining the voltage data across the sample capacitor (C) is as follows: The main control board (DSP) starts the signal generator (DDS) to linearly output a sine test signal with a frequency range of 1 MHz - 8 MHz at a step of 100 kHz, a total of 71 frequency points, and a signal maintenance time of 500 ms for each frequency point; The amplifier (AGC) performs limited amplitude amplification on the sine test signal and outputs it, so that the signal output amplitude of all frequency points remains 1 V unchanged; The sampler (ADC) performs effective value detection and analog-to-digital conversion on the voltage amplitude across the sample capacitor (C), and the obtained signal amplitude is saved as the characteristic value of the data sample; The cleaning process is as follows: The voltages of 50 sample capacitors (C) are measured 6 times respectively, with a measurement interval of 24 hours each time. For the same sample capacitor (C), if the voltage amplitude of a certain measurement is less than half of the average value of the other five measurements, or greater than 1.5 times the average value of the other five measurements, it is considered an abnormal data point, and the abnormal data point is replaced with the average value of the other five measurements; The denoising process uses the median filter method; After removing abnormal data points and filtering, take the average value of the 6 measurements as the new characteristic value of the sample; The training parameters of the BP neural network include: the dataset division ratio is train:validation:test = 70:15:15, the training function is Levenberg-Marquardt, the evaluation function is MSE, the maximum number of iterations Epoch is 1000, the learning target is 1.0e-7, the learning rate is 0.001, the minimum number of validation failures Validation Checks is 6, the hidden layer function is tansig, and the output layer function is purelin.
2. The high-precision capacitance measurement method based on a BP neural network according to claim 1, characterized in that, When performing feature selection, take the voltage amplitudes of 71 signals with a frequency value greater than 1 MHz as the features of the sample.
3. A high-precision capacitance measurement method based on a BP neural network according to claim 1, characterized in that, The BP neural network is a five-layer network structure.
4. A high-precision capacitance measurement method based on a BP neural network according to claim 1, characterized in that Evaluate the performance of the test model through two metrics: the mean squared error (MSE) and the coefficient of determination
Citation Information
Patent Citations
Equipment defect time prediction method based on capacitive equipment defect data
CN111259953A
Model training method based on reinforcement learning and related device
CN111985640A