The current sensor-based temperature compensation methods are mainly divided into two methods: analog hardware design and digital signal processing. Analog hardware usually uses technologies such as PTAT and CTAT to design the readout circuit. Digital signal processing methods usually include linear fitting, least square polynomial fitting, BP neural network, Kalman filter, support vector machine and other algorithms. Based on these algorithms, this paper proposes a double exponential function model temperature compensation algorithm, which has the following advantages:
(1) The exponential function has an infinite-order Taylor expansion, so the double exponential function can achieve high accuracy in fitting nonlinear curves such as the temperature coefficient curve of the sensor.
(2) This paper proposes an alternate iteration method with high-precision initial values, namely the separation coefficient method. First, use 4 sets of data points and simultaneous equations to find the initial values ​​of the nonlinear coefficients, and then use the alternating iteration method to calculate the optimized linear and nonlinear coefficients. The whole algorithm solves the problems of non-convergence, low accuracy, and many iterations caused by the direct use of the alternate iteration method.
(3) In sensor temperature compensation, since there are only 4 double exponential function coefficients, the CORDIC algorithm can be used to design a hardware compensation circuit to integrate into the sensor. The coefficients can be stored in ROM, so it has good engineering practical value.
1 Alternating iteration method to fit double exponential functionThe double exponential function model based on sensor temperature compensation is equation (1).
(5) Repeat steps (2), (3) and (4) to alternately calculate linear coefficients and nonlinear coefficients until the mean square error Δ satisfies the given range.
The alternate iteration method only uses nonlinear coefficients as initial values, which reduces the difficulty of initial value selection to a certain extent, but still has dependence on nonlinear coefficients. Therefore, in the fitting process, the selection of initial values ​​of nonlinear coefficients plays a role. Crucial role.
2 The separation coefficient method calculates the initial value of the nonlinear coefficientThis section uses the separation coefficient method [9] to calculate the nonlinear initial value. The specific algorithm is as follows:
(1) Select 4 sets of data points {(Vtempi, Vouti)} in the data points, i=1, 2, 3, 4. Among them, Vtemp1 "Vtemp2" Vtemp3 "Vtemp4, and VouTI has the same number.
(2) Bring point 1 and point 2 into the double exponential function formula (1) to obtain formula (4) and formula (5):
(4) Incorporating points 2 and 3 into equation (1) can obtain an equation similar to equation (6). Together, the linear parameter α2 can be eliminated to obtain equation (8), where T2 is given by equation (7) Add 1 to get.
(5) Taking the logarithms on both sides of equation (8) and then approximately bringing them into the midpoint differentiation to eliminate the logarithms, equation (9) can be obtained, where the intermediate variables A1, B1, C1, and D1 are expressed by equation (10):
(6) Reusing points 2, 3 and 4 can also derive an equation similar to equation (9), such as equation (11). The coefficient is the subscript of formula (10) plus one.
(7) Simultaneous equations (9) and (11), eliminate one nonlinear coefficient β2, solve a one-variable quadratic equation group to obtain two solutions of another nonlinear coefficient β1, and then obtain β2 from equation (9) .
The separation coefficient method uses the data points to separate the coefficients, and finally converts the transcendental function equation into a quadratic equation in one variable. When using this method, four different points can be tried multiple times to compare the fitting results. Generally speaking, when the observation points are relatively dense and uniform, the error is relatively small. After obtaining the high-precision initial value of the nonlinear coefficient, use the alternate iteration method introduced in the first section to calculate the linear coefficient and optimize the result from the calculated initial value. The double exponential function equation with high fitting accuracy can be obtained, which is the temperature Compensation provides a more accurate function model.
3 Simulation experiment and analysis3.1 Double exponential function fitting
The two sets of data (x1, y1) and (x2, y2) are tested experimentally. The specific data are shown in Table 1.
Use matlabR2013 software to fit the data (x1, y1) and (x2, y2). The fitting results are shown in Figure 1 and Figure 2. Figure 1(a) and Figure 2(a) use the algorithm proposed in this article to first calculate the high-precision initial values ​​of nonlinear coefficients, which are β1=17.614 6, β2=1.314 7 and β1=-0.092 9, β2=7.568 5 , Figure 1 and Figure 2(b), Figure 2(c) use different linear initial values ​​for comparison. Table 2 and Table 3 are the quantitative analysis of the three fitting effects in Figure 1 and Figure 2, respectively, using root mean square error (RMSE) and coefficient of determination (R_square) as evaluation indicators.
It can be seen from the results in the table that the algorithm proposed in this paper improves the accuracy of the initial value, reduces the mean square error, improves the coefficient of determination, and has a better fitting effect.
3.2 Based on sensor temperature compensation
In this section, in order to verify the effectiveness of the algorithm and model of this article in sensor temperature compensation, a MEMS accelerometer is used to perform a zero temperature cycle experiment in a thermostat. Preprocess the collected data, the specific steps are as follows:
(1) The experimental data is imported into MATLAB for data processing. Take the full temperature experiment section in the temperature cycle experiment, that is, Vtemp from 0.4 V to 0.67 V (the actual temperature is equivalent to -40 ℃ to 60 ℃).
(2) Perform wavelet denoising and eliminate singular values ​​on the data.
(3) Use the moving average method for smoothing and sample 50 data points at equal intervals as the data to be fitted. The results are shown in Figure 3 (a), Figure 3 (b), Figure 3 (c), and Figure 3 (d).
Figure 4 (a) and Figure 4 (b) are the fitting result graph and the final compensation result graph. The fitting result RMSE=4.874 2&TImes;10-5, R_square=0.994 3. After compensating the original output of the MEMS accelerometer, the maximum error (peak-to-peak value) dropped from 1.851 3&TImes;10-5 to 1.735 0&TImes;10-5. Reduced by an order of magnitude.
4 ConclusionBased on the existing temperature compensation algorithm, this paper first proposes a temperature compensation method with a double exponential function model. Secondly, taking into account the problems of non-convergence, low accuracy, and large number of iterations caused by improper initial value selection in the traditional alternate iteration method for double exponential function fitting, a separation coefficient method is proposed. It can effectively calculate the high-precision initial value, thereby obtaining high-precision fitting results. Finally, the algorithm is applied to the sensor temperature compensation. The compensation result shows that the maximum error of the temperature coefficient curve is reduced by an order of magnitude. Has a certain practical value. In the next step, the CORDIC algorithm can be used to implement the double exponential function model in hardware, the coefficients are stored in ROM, and a digital compensation circuit is designed to integrate into the sensor chip. Only 4 coefficients need to be changed to replace the single-chip microcomputer to realize automatic temperature compensation.
Spiral Rotor Flowmeter,marine helical rotor flowmeter,lzx type marine helical rotor flowmeter
Taizhou Jiabo Instrument Technology Co., Ltd. , https://www.taizhoujbcbyq.com