#### Abstract

Sensor nodes in underwater wireless sensor networks (UWSNs) are in a three-dimensional space, and water fluidity continuously changes the positioning in water, the clock synchronization of underwater nodes is challenging, and ranging algorithms affected by water flow produce large errors. A three-dimensional UWSN positioning algorithm based on modified RSSI values is proposed to address the problem of UWSN positioning algorithms being susceptible to water influence and prone to unstable positioning and large positioning errors. An unlocated node screens the received anchor node signal strength and then makes a weighted correction to reduce the influence of the water environment and improve the ranging accuracy. A position estimation model is proposed and combined with a three-dimensional underwater model and least squares method to deduce the unlocated node’s position on the basis of the distance between the unlocated node and the anchor node. The proposed algorithm effectively reduces the influence of the water environment on the ranging algorithm’s accuracy and improves the performance of three-dimensional underwater positioning algorithms. Simulation results show that the proposed algorithm can effectively reduce the influence of the underwater environment on positioning algorithms.

#### 1. Introduction

Sensor node positioning is a key technology in wireless sensor networks. With the development of terrestrial wireless sensor network applications, underwater wireless sensor network applications have attracted increasing attention. However, the complex underwater environment hinders the location of underwater wireless sensor networks (UWSNs) [1]. It also necessitates the consideration of all factors affecting positioning performance. Sensors in water are usually deployed in areas that cannot be easily accessed by humans or those with few infrastructure; meanwhile, common sensor nodes are randomly arranged [2]. The factors affecting underwater signal transmission must be considered when estimating the positions of sensor nodes relative to anchor nodes by using received signal strength. The result identifies the factors affecting transmission in a real environment. UWSNs comprise unevenly distributed sensor nodes, sparse nodes, and nodes that are easily affected by water fluidity. Anchor nodes that assist positioning can improve the positioning accuracy of sensor networks [3–5]. Li et al. [6] proposed a weighted centroid ranging algorithm that is based on received signal strength indicators (RSSIs) and time difference of arrival (TDOA); this algorithm uses the distance parameter and signal strength between anchor nodes as a reference to correct the estimated distance between unlocated nodes and anchor nodes. It also reduces positioning errors relative to the traditional RSSI centroid. A positioning algorithm in [7] reduces positioning errors in an uneven node distribution by using RSSI values to optimize the single hop value in the DV-Hop algorithm. A three-sided RSSI centroid positioning algorithm was proposed in [8], and it is able to correct the path loss factor in an actual environment, reduce the ranging algorithm errors caused by the environment, and improve positioning algorithm accuracy. Zhang and Huang [9] aimed to correct RSSI values by dynamically acquiring path loss factors and reduce environment impact by combining three-sided centroid positioning algorithms. However, the positioning model needs to be adjusted regularly, and the error range of the acquired path loss factors affects positioning algorithms. Although existing algorithms show improved positioning accuracy, the accuracy of ranging algorithms requires improvement [10]; an enhanced design for positioning algorithms is also needed as nodes cannot be synchronized accurately in an underwater environment, and they tend to influence positioning algorithms.

In sum, underwater positioning algorithms in UWSNs are prone to large errors, and they are susceptible to water fluidity. Moreover, the nodes comprising UWSNs are difficult to synchronize. A received signal strength ranging algorithm is low cost and requires simple technology and minimal hardware. However, underwater sensor nodes are difficult to replace, they are susceptible to the underwater environment, their energy is limited, and their cost is relatively high. Therefore, a three-dimensional UWSN positioning algorithm based on modified RSSI values is proposed in this work. Weighted and modified RSSI values reduce ranging errors. Combined with a three-dimensional underwater positioning model, the proposed algorithm can estimate the unlocated node position in a three-dimensional space by using the least squares method. The proposed algorithm shows improved robustness, reduces the impact of underwater fluidity on ranging, and enhances the accuracy of network node positioning.

#### 2. Distance Conversion Model

##### 2.1. Received Signal Strength Algorithm

A ranging algorithm based on received signal strength can convert the signal strength received by an unlocated node and sent by an anchor node in a certain distance. Specifically, a mobile anchor node sends the signal. During the transmission process, certain loss occurs because of the influence of the external environment. The longer the transmission distance is, the greater the signal loss will be and the smaller the RSSI value received by the unlocated node. The loss during transmission can be converted into an RSSI value through the path loss model. In an actual ranging process, the loss model uses a log-normal distribution model. The parameters in the model can be calculated by the actual distance between anchor nodes and by the algorithm measurement distance [11].

In the current work, the signal transmission attenuation model uses a log-normal distribution model:

By simplifying formula (1) and taking the logarithm of each side, the following result is obtained:where is the received power between nodes, is the received strength path loss of unit distance, can be obtained by measuring the actual distance between nodes, is the channel attenuation index whose value depends on the application environment, generally ranges from 2 to 5, and refers to the Gaussian distribution noise and is often expressed by a normal distribution.

The distance between nodes can be deduced from formula (2):where is the communication distance between node and node . . The signal strength sent by the nodes in the UWSN decreases with an increase in transmission distance. Moreover, the signals from sensor nodes suffer from losses to a certain extent. The unlocated nodes obtain N RSSI values with anchor nodes, and the distance value between unlocated nodes and multiple anchor nodes can be obtained by formula (3).

##### 2.2. Weighted Correction of RSSI

The signal strength ranging algorithm is easily affected by the application environment, thereby resulting in ranging errors [12]. In practice, the temperature, salinity, obstacles, and density of the water environment cause signal losses and a decrease in signal strength. Water fluidity causes objects in water to move slightly [13]. Hence, the signal strength received by sensor nodes varies from time to time, eventually affecting distance estimation between nodes [14]. Thus, averaging and Gaussian filter methods are combined to weigh and modify RSSI values. A modified RSSI value improves ranging accuracy and positioning accuracy of UWSNs.

A mobile anchor node broadcasts signals regularly during its movement. Anchor nodes release signal *N* times at the same place to enhance the ranging accuracy. Each sensor node has a list of the ID numbers of mobile anchor nodes in different positions. After an unlocated node receives information from a mobile anchor node, the average Φ and variance *α* of the RSSI value of the same received ID can be calculated by the following formula:

According to formula (4), the same ID RSSI values received by the unlocated node are screened. The *M* RSSI values outside the (Φ − *α* and Φ + *α*) interval are cancelled, and the average value within the interval is recalculated. The weighted formula of the RSSI value within the interval is as follows:

According to formula (5), the weighted and modified RSSI values can be obtained. Then, the distance between the unlocated node and the anchor node can be calculated by substituting the obtained RSSI value into formula (3).

##### 2.3. Position Estimation Model

As the anchor node moves through the network and broadcasts signals to the surroundings, the ordinary node receives information from the anchor node and uses the distance conversion model to calculate the distance between nodes. In this section, a position estimation model is proposed to obtain the location information of unlocated nodes on the basis of the distance between nodes.

##### 2.4. Three-Dimensional Underwater Model

Wireless sensor networks on land generally require two-dimensional planar positioning, whereas UWSNs in special underwater environments require three-dimensional positioning [15–17]. Such requirements cannot be met by traditional positioning algorithms. Hence, research should consider how anchor and normal nodes send and receive signals in the three-dimensional underwater environment [18].

The positioning requirements of wireless sensor networks on land are generally two-dimensional planar positioning, while the special underwater environment requires UWSN to adopt a three-dimensional positioning. The traditional positioning algorithm cannot meet the requirement of underwater sensor nodes positioning. It is necessary to consider how the anchor node and normal node send and receive signals in the three-dimensional underwater environment.

As shown in Figure 1, signals in an UWSN diverge in a spherical shape when nodes communicate. Anchor nodes broadcast signals to unlocated nodes within the communication range. The signals are transmitted in a three-dimensional space, whose the coverage area is a sphere and the communication diameter is the radius.

In a three-dimensional underwater environment, unlocated nodes receive the information of *n* anchor nodes with the strongest signal. As shown in Figure 2, the sensor nodes in this model are equipped with pressure sensors to obtain their own depth information. Node depth can be directly converted into the *Z*-axis of node coordinates. The coordinates of unlocated nodes are (*x*, *y*, *z*), and the coordinates of three anchor nodes are *A* (*z*1, *y*1, *z*1), *B* (*z*2, *y*2, *z*2), *C* (*x*3, *y*3, *z*3), …, *N* (*xn*, *yn*, *zn*). On the basis of the distance between unlocated nodes and *n* anchor nodes, the following equations can be obtained:

Three sensor nodes form a plane. An unlocated node in underwater node positioning requires three anchor nodes, and four nodes form a polyhedron. Four nodes need to be projected to a horizontal plane to achieve relative positioning. Three anchor nodes are mapped to the same plane as that of the unlocated node. The coordinate *Z* of the unlocated node can be obtained by its own pressure sensor. The mapped formula is as follows:

From formulas (6) and (7), the coordinates of three anchor nodes on the same two-dimensional plane can be deduced as , , and .

##### 2.5. Least Squares Position Estimation

The coordinates of *N* anchor nodes around the unlocated node *D* are (*x*1, *y*1, *z*1), (*x*2, *y*2, *z*2), (*x*3, *y*3, *z*3), …, (*xn*, *yn*, *zn*). The distance from these anchor nodes to node *D* can be calculated by the distance conversion model as *d*1, *d*2, …, *dn*. The unlocated node *D* can obtain its own depth through its pressure sensor. The three-dimensional underwater positioning model can convert the obtained coordinates into two-dimensional coordinates. The converted coordinates are (*x*1, *y*1), (*x*2, *y*2), …, (*xn*, *yn*). Assuming that the two-dimensional coordinates of node *D* are (*x*, *y*), the following formula can be obtained as

Formula (9) is obtained by subtracting the last equation from the first equation of formula (8):

Formula (9) is converted into the linear equation , as shown in the following formula:

Finally, the estimated position coordinate of the unlocated sensor node *D* is determined as by using the least squares method.

##### 2.6. Three-Dimensional UWSN Positioning Algorithm Based on Modified RSSI Value

Differences exist between water and terrestrial environments [19]. Hence, in UWSN positioning, the algorithm adopted must consider underwater features [20], such as water fluidity, complex substances in water, actual signal losses varying with anchor nodes’ movement through different water areas, and signal strength changing with different obstacles in water [21]. Ranging algorithms based on signal strength produce large ranging error because of the instability of the underwater environment. An increase in ranging errors increases positioning errors accordingly. In this section, the weighted and corrected RSSI value is used to improve ranging algorithm accuracy. The value is combined with the three-dimensional underwater positioning method to improve the positioning accuracy of underwater nodes.

As shown in Figure 3, the three-dimensional positioning algorithm for the UWSN based on the revised RSSI value involves two stages: ranging (stage 1) and node positioning (stage 2). In stage 1, the mobile anchor node in the UWSN broadcasts information to the surrounding nodes through mobile communication. The unlocated node receives the RSSI value between itself and the anchor node. Moreover, the signal strength of each anchor node received by the unlocated node is converted into the distance between the unlocated node and each anchor node by the distance conversion model. In stage 2, the relative position of the unlocated node in the UWSN can be calculated with the distance between the sensor nodes in stage 1 by using the position estimation model. Then, the sensor node is located on the basis of the actual position of the anchor nodes.

The process of the proposed three-dimensional positioning algorithm is shown in Figure 4. The detailed steps are as follows: Step 1: the mobile anchor node traverses the network according to the planned route, reaches the specified location, broadcasts signals for *N* times, and sends its own information list containing the ID number and three-dimensional coordinates (*X*_{i}, *Y*_{i}, *Z*_{i}) of the location. Step 2: the unlocated node receives the information of the mobile anchor node and records the information list and signal strength on its own information list. The ID number of the same position corresponds to *N* signal strength. Step 3: the node processes the data in the obtained information list. A unique RSSI value is obtained by correcting the signal strength at the same position through the weighted modified RSSI value model. The information list is updated. An unknown ID corresponds to a signal strength. Step 4: according to the distance conversion model, only the input RSSI value gets the distance between nodes. Step 5: the unlocated nodes repeat Steps 2, 3, and 4 to obtain the corresponding distance of three position IDs and convert the three-dimensional space ID into a two-dimensional space ID by using the three-dimensional positioning model. Step 6: the maximum likelihood estimation method is used to calculate the two-dimensional coordinates of the positioning node. With the node’s own depth information, the three-dimensional reverse conversion is carried out, and two-dimensional coordinates are converted into three-dimensional network coordinates. The estimated position of the unlocated node is obtained, thereby completing the network positioning.

#### 3. Experimental Simulation

##### 3.1. Experimental Environment Setting and Evaluation Index

MATLAB 2016a simulation software is applied to test the proposed positioning algorithm. A total of 50 ordinary sensor nodes are randomly arranged; the proportion of anchor nodes is 20%, and the communication radius of ordinary nodes is 20 m. Ordinary sensor nodes cannot be removed after being randomly deployed. Each anchor node is aware of its own position information. The logarithmic attenuation model is used in the signal propagation attenuation model in the experiment. The proposed algorithm is compared with the traditional RSSI location algorithm, the median RSSI location algorithm, and the DV-Hop location algorithm based on RSSI value optimization [22–24]. The simulation area is a cube region measuring 100 m × 100 m × 100 m. The distribution of underwater wireless sensor nodes in the simulation experiment is shown in Figures 5 and 6.

The evaluation indexes of the positioning algorithm in this work are as follows.

Average measuring distance: represents the average measuring distance between the *i*^{th} unlocated node and the *j*^{th} anchor node. *D*_{ij} represents the measuring distance between the *i*^{th} unlocated node and the *j*^{th} anchor node. *m* represents the number of anchor nodes, and *n* represents the unlocated nodes that can measure distance. The average measuring distance between an anchor node and a positioning node can be obtained by the following formula:

Node average positioning error: the difference between the estimated position and the actual position of unlocated sensor node *i* is the node positioning error marked as error_{i}. *N* represents the total number of unlocated sensor nodes. The sum of the positioning errors of all nodes divided by the number of positioning nodes is the average positioning error of nodes.

The smaller the node average positioning error is, the higher the positioning accuracy is and the better the performance of the positioning algorithm will be, as shown in the followingformula:

Average maximum positioning error: in formula (14), Merro_{i} represents the *K*^{th} maximum positioning error of the node and *P*_{Meero} represents the average maximum positioning error of the node:

The experimental parameter settings are shown in Table 1.

##### 3.2. Experimental Results and Analysis

Given the 20 m communication radius of common nodes and the varying communication ranges of anchor nodes, the actual distance between nodes, traditional RSSI distance, median RSSI distance, and modified RSSI distance are compared in this work (Table 2). The actual distance is the real distance between the anchor node and the unlocated node. As the reference value for the ranging accuracy of the ranging algorithm, the absolute value of the difference between the measured distance based on the ranging algorithm and the real distance is the evaluation index for the accuracy of the ranging algorithm. The larger the difference is, the lower the accuracy of the ranging algorithm is, and vice versa. When the communication radius of the anchor node is the same, the absolute difference value between the distance obtained by the modified RSSI ranging algorithm and the actual distance is the smallest. Moreover, the absolute difference value between the distance obtained by the traditional RSSI ranging algorithm and the actual distance is the largest. As the communication radius of the anchor node increases, the absolute difference values of the three ranging algorithms decrease again, but the absolute value of the modified RSSI ranging algorithm remains the smallest. Hence, the modified RSSI ranging algorithm is more accurate than other ranging algorithms.

Given the 20 m communication range of ordinary nodes and the varying communication ranges of anchor nodes, this work compares the average node positioning errors of the traditional RSSI positioning algorithm, DV-Hop-based positioning algorithm, and three-dimensional UWSN positioning algorithm based on revised RSSI values. The comparison is illustrated in Figure 7. Given different communication ranges of anchor nodes, the average positioning error of the modified RSSI positioning algorithm is lower than those of the traditional RSSI algorithm and DV-Hop algorithm. Moreover, the average positioning error decreases steadily with the increase of the anchor nodes’ communication radius. Given a small radius, the DV-Hop algorithm produces a lower positioning error than the traditional RSSI algorithm; its error is close to that of the modified RSSI algorithm. The DV-Hop algorithm achieves positioning through multiple hops and thus achieves a higher positioning accuracy than the traditional RSSI algorithm in the network with sparse anchor nodes with a small communication radius. However, with an increase in the communication radius of anchor nodes, the information and calculation of nodes increase as well, thus leading to a continuous increase in errors. The revised RSSI algorithm does not need to carry out multiple data forwarding and data calculations and thus achieves reduced positioning errors. It also has high accuracy in the ranging phase and thus generates low positioning errors in the network.

Figure 8 presents a comparison diagram of the relationship between the average maximum positioning error and the anchor nodes’ communication radius on the basis of the traditional RSSI positioning algorithm, DV-Hop positioning algorithm, and three-dimensional UWSN positioning algorithm based on modified RSSI values. The average maximum positioning error of the modified RSSI algorithm is lower than that of the traditional RSSI algorithm and DV-Hop algorithm (Figure 8). When the anchor nodes’ communication radius is 25 m, the average positioning error of the DV-Hop algorithm is lower than that of the traditional RSSI algorithm and is close to that of the modified RSSI algorithm. However, its average maximum positioning error is higher than that of the traditional RSSI algorithm and modified RSSI algorithm. Moreover, its positioning stability is not high. With an increase in the anchor nodes’ communication radius, the average maximum positioning error of the revised RSSI positioning algorithm decreases steadily and remains lower than that of the traditional RSSI algorithm. The newly proposed algorithm achieves a stable improvement in positioning accuracy. As underwater network positioning is easily affected by water, a steady positioning algorithm is crucial.

#### 4. Conclusions

A three-dimensional UWSN positioning algorithm based on modified RSSI values is proposed to address the problem of UWSN positioning algorithms being susceptible to water influence and prone to unstable positioning and large positioning errors. The unlocated node screens the received signal strength of the anchor node and then performs weighted correction to reduce the influence of the water environment and improve ranging accuracy. Combined with a three-dimensional underwater environment, the accuracy and stability of the positioning algorithm are improved, and the error of the underwater positioning algorithm is reduced. The algorithm is simulated with other related positioning algorithms through experiments. The results show that the proposed three-dimensional UWSN positioning algorithm based on modified RSSI values remains stable, shows improved ranging accuracy, and reduces positioning error.

#### Data Availability

No data were used to support this study.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

This work was supported by Natural Science Foundation of Guangxi (2019GXNSFAA245053), Guangxi Science and Technology Major Project (AA19254016/2019AA06002), Beihai Science and Technology Planning Project (202082023), and Beihai Science and Technology Planning Project (202082033).