A Dynamic-Weighted Attenuation Memory Extended Kalman Filter Algorithm and Its Application in the Underwater Positioning

Extended Kalman ﬁlter (EKF) plays an important role in the acoustic signal processing of underwater positioning. However, accumulative errors and model inaccuracies lead to divergence. Then, attenuation memory EKF is created in response to this issue which needs to manually select all or part of the parameters. Thus, a dynamic-weighted attenuation memory EKF is proposed . Firstly, several underwater positioning simulations under diﬀerent conditions are carried out. Results show, with the change of parameter conditions in positioning, the ideal attenuation coeﬃcient changes between 0.5 and 1, but it is diﬃcult to express it in function formula or statistical form. Secondly, a dynamic selection method of attenuation factor is designed. In the later contrast simulation, the proposed method has improved the positioning performance compared with the existing attenuation memory ﬁlter algorithm. Finally, the results of physical model veriﬁcation experiment show that the dynamic-weighted attenuation memory EKF algorithm not only suppresses divergence better but also avoids the subjectivity of attenuation coeﬃcient selection to a certain extent.


Introduction
Unmanned or autonomous underwater vehicles are increasingly applied to underwater science data acquisition, such as underwater monitoring, exploration, disaster prevention, and rescue. Underwater acoustic methods play a significant role in the course of the positioning of underwater vehicles [1,2]. In many underwater acoustic positioning methods, there are inevitably various random errors [3], such as system disturbance, observation error [4], and non-line-ofsight error [5]. Although random errors conform to certain statistical laws in multiple positioning results, it is impossible to predict the size and direction of a single error. In order to reduce errors, digital filtering is an essential part for positioning algorithm. e commonly used filtering algorithms mainly include the least square method [6], Kalman filter [7,8], GDOP weighting [9,10], error classification [11], coordinate transformation [12], neural network [13,14], and other intelligent algorithms such as a genetic algorithm [15,16]. Among them, the Kalman filter makes noise suppression more effective, and positioning accuracy further improved because it does not impose too strict limits on error forms and its unique data fusion function.
However, the classical Kalman filter algorithm has an obvious defect. According to the principle of the Kalman filter algorithm, in the process of the prediction, the final predicted value at any time is jointly determined by the predicted state at the previous time and the present observed value [17,18]. It will cause cumulative errors, which will be more remarkable when the prediction model is inaccurate or changes. As a result, the positioning error increases rapidly with the increase of prediction time. erefore, it is necessary to artificially introduce the attenuation coefficient, reduce the restraining effect of old data, the previous predicted state, and increase the influence weight of new data, the present observed value in the forecasting. ere are two common methods to settle the value of the attenuation coefficient. e first method is to gain an empirical value according to the actual condition [19,20], and the other method is to use adaptive formulas to make the attenuation coefficient change in every step of prediction, which mainly consists of two different forms to determine the adaptive attenuation coefficient: one is the functional type [21], and the other is the probability type [22]. By setting a certain adaptive level, the attenuation coefficient is selected under a certain degree of confidence.
It is inevitable to select some coefficients artificially, which is subjective to some extent, whether it is to select a constant attenuation coefficient by experience or to select an attenuation coefficient by the function of self-adaptation. However, the method of self-adaptive selection of attenuation coefficient based on probability can only guarantee results at a certain confidence level. It has not discussed the specific selection method of attenuation coefficient. Besides, selecting the confidence level is still subjective. Moreover, if any attenuation coefficient cannot meet the selected confidence level, the positioning algorithm will fail and the stability will decrease.
In this paper, it is considered that the absolute value error between the final predicted value and the observed value should be taken as a direct evaluation index in the selection of attenuation coefficients, especially when the prediction model is inaccurate or changes, which indicates that certain control invasions are applied so that more state parameters are variables. e smaller the error, the more reasonable the coefficient selection. Based on this, a dynamic-weighted attenuation memory filtering algorithm is designed, which traverses all possible values of attenuation coefficient in a certain range and selects the optimal attenuation coefficient by comparing the absolute value of the error illustrated before. is type of selection of the attenuation coefficient can be used more effectively when the prediction model is inaccurate or in flux.

Underwater Acoustic Positioning Algorithm.
e lecture [23] provides the elementary principles of several underwater acoustic algorithms. Firstly, the basic principle of the Time of Arrival (TOA) underwater acoustic positioning algorithm is as follows. According to Figure 1, the time between anchor nodes A i and the positioning target P should be synchronized. e positioning target, as a signal source, sends a synchronous signal to each anchor node A 1 , A 2 , and A 3 . e anchor nodes record the length of time the signal arrives and calculate the distance between the positioning target and itself, respectively, by where c denotes the signal propagation speed, Δt represents the duration of signal's arrival, and r i denotes the distance.
As shown in Figure 1, the coordinates of A 1 , A 2 , and A 3 are (x 1 , y 1 ), (x 2 , y 2 ), and (x 3 , y 3 ), respectively. e coordinate of P is set to (x, y). According to the geometric relationship, the position coordinate of m can be calculated by Secondly, the basic principle of the Time Difference of Arrival (TDOA) underwater acoustic positioning algorithm is as follows. It needs to ensure that the time synchronization of each anchor node is only compared to the TOA. e target sends a signal to the measurement node. After selecting a reference anchor point, the time difference between the signal arriving at the other two anchor nodes and the reference anchor node is, respectively, recorded. According to the signal propagation speed, the distance difference can be obtained. en, calculate the position of the target by using a geometric relationship expressed in We used the TOA-TDOA fusion positioning algorithm refined by EKF to carry out the following various experiments.

Extend Kalman Filter
Algorithm. Based on the state transition relationship, the Kalman filter [7] combines various environmental observations to correct the predicted value so that it is closer to the real value. According to the state of the previous state and the state transition matrix, it predicts the state at the present state preliminarily. e preliminary prediction does not depend on any external observations, but only on the previous state and state transition matrix. As a result, it does not solve the noise of the prediction model and the state transition. Using various environmental observations can weaken the influence of noise to a certain extent. e role and weight of the observation value in the prediction process need to be determined by an important coefficient: the Kalman coefficient. e equations involved are as follows.
(i) Preliminary prediction of state: where F t denotes the state transition matrix, B t represents the control matrix, and u t stands for the control variable. (ii) Noise prediction of state: where P t denotes the preliminary prediction of state transition noise at the time t, P t−1 represents the prediction of state transition noise at the time t-1, and Q stands for the noise of the model itself. (iii) Dimension transformation of observation: where Z t denotes the observation matrix at time t, H stands for the dimension transformation matrix, and R represents the covariance matrix of observation noise. (iv) Filter correction of state: where K t denotes the Kalman coefficient. e calculation formula is as follows: (v) Filtering correction of noise: In the application of the Kalman filter algorithm, there may be nonlinear systems whose state transition equation or observation equation is not linear. For a nonlinear system, it is impossible to express the observation matrix and the state transition matrix directly in the matrix form. e EKF algorithm can solve its application in nonlinear systems [23]. e essence of the EKF is to expand the nonlinear expression by the Taylor formula, discard the quadratic term and other higher-order terms, and keep only the primary term. Clearly, EKF is an estimated treatment in the nonlinear treatment, which cannot be completely equal to nonlinear problems. When the observation system or state transition system cannot be represented by a matrix, it needs to be replaced by the Jacobian determinant. e process of calculating the Jacobian determinant is the process of expanding nonlinear function by Taylor formula and abandoning quadratic term and higher-order term.

Attenuation Memory Extended Kalman Filter Algorithm.
As stated in the introduction, it can be easily seen from formula (10) that, with the increase of the prediction step, the old data will restrain the prediction results more than the new data. Because of that, the update function of the new data to the predicted value is weakened to some extent: where X i is the state prediction matrix at the time i, K i denotes the Kalman coefficient at the time i, and Z i stands for the observation matrix at the time i.
In this case, if a certain control invasion is applied so that more state parameters are variables, the correction effect of new data in the prediction is even more important. erefore, it is necessary to artificially introduce the attenuation coefficient α, to reduce the restraining effect of old data and increase the influence weight of new data in the forecasting.
e specific implementation method is improved based on As stated in the introduction, the empirical value and the adaptive value are two kinds of the attenuation coefficient.
ere are two different forms to determine the adaptive attenuation coefficient: one is the functional type [21], such as the exponential function shown in formula (12), and the other is the probability type [22] shown in formula (13). By setting a certain adaptive level, the attenuation coefficient is selected under a certain degree of confidence: where α represents the attenuation coefficient, b is an empirical coefficient, and k denotes the prediction step number.
where α stands for the adaptive level, χ 2 m (k) denotes the variable with m chi-square variables, m represents the observation dimension, and k m denotes the probability density of χ 2 m . It is inevitable to select some coefficients artificially, which is subjective to some extent, whether it is to select a constant attenuation coefficient by experience or to select an attenuation coefficient by the function of self-adaptation. And, the method of self-adaptive selection of attenuation coefficient based on probability can only guarantee results at a certain confidence level. However, it has not discussed the specific selection method of attenuation coefficient. Besides, selecting the confidence level is still subjective. Moreover, if any attenuation coefficient cannot meet the selected confidence level, the positioning algorithm will fail and the stability will decrease.
Since then, through simulation results which will be elaborated in Section 3, the ideal attenuation coefficient will change under different experimental conditions, but it is difficult to get an exact functional expression or statistical form. is paper designs an attenuation memory filtering algorithm that traverses all possible values of the attenuation coefficient in a certain range and selects the best value among them. e basic idea is to traverse all possible values of attenuation coefficient in the interval 0.5-1 with certain step size, and the optimal attenuation factor is selected by comparing the residual values of each prediction step. is type of selection of the attenuation coefficient can be used more effectively when the prediction model is inaccurate or in flux, which will be verified in subsequent experiments. e pseudocode of the proposed algorithm is as follows, whose format is consistent with that specified in [24].
Pseudocode for optimal attenuation coefficient selection: While error < known error// e initial value of the known error is infinity (8) known error←error (9) x←predicted value (10) End While (11) End (12) Return x (13) End Fac

Simulational Results and Analysis
As shown in Figure 2, the simulation was carried out by the computer (CPU: i7-7500U 2.9 GHz, Memory:8 G), and three observation nodes A 1 , A 2 , and A 3 were arranged on the Xaxis along a straight line with an interval of 50 m. e initial position of the positioning target P was set at (20 m, 20 m). All kinds of errors involved in the system were random values that subjected to normal distribution, and the standard deviation of observation errors was 0.2 m. e standard deviation of the noise of the prediction model itself was 0.1 m.
To improve the maneuverability of the positioning target, the acceleration in X and Y directions was added, which makes the speed and position change. In addition to the basic simulation model size, the parameters that can be set artificially include acceleration, prediction time, and system noise. In the practical application of the algorithm, the basic variables involved are nothing more than these four kinds.
e forecast time varied from 30 s to 230 s and the acceleration varied from 1 m/s 2 to 21 m/s 2 . e reciprocals of the attenuation coefficient varied from 0.4 to 1. e random noise involved in the system obeyed Gaussian distribution. e standard deviation of predicted noise ranged from 0.01 m to 0.11 m, and the standard deviation of observed noise ranged from 0.02 m to 0.2 m. e ideal attenuation coefficients under different parameters were calculated through simulations. Results were shown in Table 1.
From the simulation results, it is found that the ideal attenuation coefficient will change under different parameter conditions and different predictions. And, it is stable between 0.5 and 1, although a few results reach 2.1 or even higher, and the higher value will cause the oscillation of data filtering, which will be proved in the later simulation.
To explore the relationship between the ideal attenuation coefficient and the variables involved, canonical correlation analysis, function fitting, and single sample nonparametric experiments were carried out in this paper. e results of various inspection and analysis are as follows.
Canonical correlation analysis is carried out on the above experiment data, and the results are as follows.
In Table 2, the value of two-tailed significant differences between the ideal attenuation coefficient and the forecast duration and the acceleration were both less than 0.001, which indicated that the difference was significant. On the contrary, the other two values of two-tailed significant differences were 0.974 and 0.895, respectively, which were both larger than 0.005 and indicates that its change has nothing to do with these two variables.
Similar results could be drawn out from Table 3 which contained the Pearson correlation coefficients, the correlation coefficients between the ideal attenuation coefficient and the forecast duration, and the acceleration −0.524 and 0.1, which were higher than the other two-0.001 and 0.002, though they were both lower 0.7-the limitation that proves that there is a strong correlation between two variables.
To explore whether the ideal attenuation coefficient can be expressed by the above two variables and whether there is an exact functional relationship, the experimental data were fitted by various functions, and the significance was shown in Table 4: In Table 4, the goodness of fitting, R 2 , was small, indicated the maximum of them was 0.008 which were much less than 1, and the fitting effect cannot meet the requirements. It showed that it is difficult to express the ideal attenuation coefficient with an exact functional expression. And, its significant two-tailed asymptotic characterization values are all less than 0.05, which shows that it is also difficult to express it in statistical form.
Besides, Figure 3 denotes the distribution of the ideal attenuation coefficient when the forecast duration and acceleration were taken by independent variables, which showed less irregularity and dispersion. It accorded with the results of the multivariate function fitting, and the goodness of fitting is 0.2846 which is much less than 1. Figure 4 denotes the result of multivariate function fitting, it was difficult to find a binary function image that contains most of the scattered points, and it was difficult to express the ideal attenuation coefficient in a binary function expression.
Since then, this paper preliminarily concludes that the ideal attenuation coefficient will change under different experimental conditions, but it is difficult to get an exact functional expression or statistical form. Given the above analysis, this paper designs an attenuation memory filtering algorithm that traverses all possible values of the attenuation coefficient in a certain range and selects the best value among them. e basic idea is to traverse all possible values of attenuation coefficient in the interval 0.5-1 with certain step   size, and the optimal attenuation factor is selected by comparing the residual values of each prediction step.

Comparison and Discussion
To verify the filtering performance of the dynamic weighted attenuation memory filtering algorithm. Under the same parameter conditions, we conducted the comparison simulations between it and the filtering algorithm with a fixed value selection attenuation memory coefficient. e specific stimulation parameters are set as follows. e noise involved in the experiment obeys Gaussian distribution, the standard deviation of observation noise is 0.1 m, and the model noise is 0.2 m. To ensure high maneuverability, the initial acceleration is set to 200 m/s 2 , and the TOA and TDOA fusion positioning algorithm based on EKF is still taken as an example, and 100 s is calculated continuously. e residual error and the maximum divergence value of the positioning process are recorded, respectively.
From the positioning result diagram in Figure 5, the actual state curve in Figure 5(b) was consistent with the predicted state curve, but there were significant differences between the true state curve and the predicted state curve in Figure 5(a). e root means square error (RMSE) of the classical EKF is 1767664.099 m which is higher than the dynamic weighted attenuation memory EKF's, 184234.382 m. It showed that the dynamic weighted attenuation memory filtering algorithm involved in this paper was superior to the classical EKF in positioning accuracy.   From Table 5, the maximum divergence value using the proposed method, which was 2198.10 m, was smaller than other types. is result preliminarily confirms that the algorithm designed in this article can better suppress divergence to a certain extent than classic attenuation memory algorithms.
Although according to Table 5, the maximum divergence value decreased with the decrease of fixed attenuation coefficient and artificial trial calculation and experiments are subjective. And, attenuation coefficient which is too small will lead to the oscillation and divergence of filtering when the prediction time is long. For example, the prediction time in the experimental parameters is increased from the 30 s to 200 s, and the attenuation coefficient is set to 0.33. As shown in Figure 6, the filtering algorithm had a divergence phenomenon, which indicated that the residual showed an upward trend in the forecasting process and the rising speed was accelerating.
In the practical application of the filtering algorithm, taking underwater positioning as an example, various related parameters are unknown and changing, such as prediction time, motion state, and environmental variables. e adaptability of the filtering algorithm, which selects attenuation coefficients according to empirical values, will be greatly reduced in this unknown and changing environment.
Although the selection method of adaptive function weighting changes the attenuation coefficient according to a certain rule in every step of the prediction process, the experimental data indicate that it is difficult to express the attenuation coefficient in the functional form or statistical form. Besides, this kind of method still needs to set some parameters and adaptive form artificially. e proposed method not only reduces the subjectivity of parameter selection but also limits its maximum value according to the actual condition and needs. It can restrain the oscillation and divergence of data filtering to a certain extent.

Physical Model Verification
To verify the reliability of the simulation results, the physical model is established, and the verification experiment is carried out. Figure 7, the experiment device is mainly composed of an unmanned ship, a target node (drag body) towed by the unmanned ship, a simulated dam, and measurement nodes (hydrophones) arranged along the simulated dam. e relative position of the measurement node relative to the simulated dam was known. rough the acoustic signal interaction between the target node and the measurement node, the relative position coordinates of the target node during the detection process were determined. e unmanned ship carrier used the Stm32 microcontroller to control the movement of the hull. e target node was mounted on the hull and is towed by the hull. e ultrasonic sensor on it transmitted acoustic signals to interact with the acoustic waves to obtain the original data required for positioning. e attenuation memory EKF positioning algorithm processed the original data to obtain the final position data. e classic attenuation memory filtering positioning algorithm and the dynamic-weighted attenuation designed in this paper were used, respectively.

Experimental Verification.
Since the real positioning data of the target was not able to be obtained during the entire verification experiment, this paper adopted the residual by comparing the predicted state and the default state to compare the positioning performance of various algorithms. If the motion state reflected by the positioning data is in better agreement with the default motion state, the algorithm application performance is better.
e experiment was carried out in the transparent water tank (length: 150 cm, width: 100 cm, and depth: 50 cm), as shown in Figure 8. Establish three coordinate axes along the bottom edge of the simulated dam and the two boundary lines of the water tank. e measurement nodes were arranged in a straight line along the bottom edge of the simulated dam. e target node starts from the origin o, and the unmanned ship was controlled to drag the target node. e unmanned ship was controlled artificially so that the target node towed by it is at a constant depth, and the initial velocity was 0.25 m/s. To simulate the change of exercise state, the acceleration was 0 m/s 2 initially, which was increased to 1 m/s 2 , starting from the 50 s, and the movement direction is the direction of the bisector of the x-axis and yaxis angle. Compare it with the movement state reflected by the positioning data processed by different attenuation memory filtering positioning algorithms to analyze the actual performance of different algorithms. ree different weighting methods were involved: the classical EKF, selecting the attenuation factor with the fixed value,0.813, which is the optimal attenuation factor [25], and the dynamic weighted EKF.

Experimental Results.
e experimental results are recorded every second. Partial positioning residuals of the experiment were listed in Table 6. To be more specific, the sum of the RMSE processed by the dynamic-weighted attenuation memory EKF designed in this paper was 1.217 cm, which was lower than classical EKF's, 38.574 cm, and fixed value-weighted attenuation memory EKF's, 2.051 cm. To more intuitively see the difference between the positioning performance of the two algorithms, the positioning data results were shown in Figure 9.
As shown in Figure 9, there was a significant increase from the 50 s which was the moment when acceleration was increased to 1 m/s 2 in the data scatters of the classical EKF and the fixed value-weighted EKF, but not found in the dynamic weighted EKFs. In the underwater positioning verification experiment, the data could be processed better with it.   Mathematical Problems in Engineering

Conclusion
During the application of the EKF, the attenuation memory factor's selection method plays an important role in effectively suppressing errors caused by the changing and inaccurate models and the accumulative errors. is paper selects four variables, prediction error, observation error, forecast duration, and acceleration, and conducts a large number of simulations to explore the change law of the ideal attenuation coefficient. e experiment results showed that the reciprocal value of the ideal attenuation coefficient will change between 0.5 and 1 under different parameter conditions, but it is difficult to get an exact functional expression or statistical form. Accordingly, a dynamic-weighted attenuation memory EKF algorithm is designed and compared with the classic algorithm. e attenuation coefficient selection method proposed uses positioning residual between the predicted value and the observed value as a direct comparison index, which can avoid the subjectivity of classic algorithms in the selection of attenuation factors to a certain extent. is type of selection of the attenuation coefficient can be used more effectively when the prediction model is inaccurate or in flux. And, in the underwater acoustic positioning simulation, the attenuation factor selection method proposed showed better accuracy and smaller divergence than the classic selection method.
e results of the simulation were further confirmed in the subsequent physical model verification experiment. e dynamic-weighted attenuation memory EKF algorithm not only improves the performance of accuracy and suppression of divergence but also avoids the subjectivity of attenuation coefficient selection to a certain extent.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest. Duration (s) Figure 9: Positioning result map.