Stream-Function Based 3D Obstacle Avoidance Mechanism for Mobile AUVs in the Internet of Underwater Things

The mobility manager in the Internet of Underwater Things (IoUT) plays a major role in data acquisition. In this paper, one novel obstacle avoidance method based on fluid mechanics is discussed for autonomous underwater vehicle (AUV) in 3D IoUT. The proposed method utilizes ocean current characteristics simplified as stream-function to design an optimal 3D trajectory with an obstacle avoidance function. 3D stream-function is constructed for spherical and cylindrical obstructions in details. Theoretical analysis of 3D stream-function proves that traditional 2D stream-function can be extended to 3D IoUT space under specific conditions. One path deformation method based on virtual obstacle methodology is proposed to overcome the inherent hysteresis problem of the traditional stream-function based obstacle avoidance design. Moreover, we introduce an energy consumption model for AUV to prove that our obstacle avoidance algorithm can improve energy efficiency if actual ocean currents exist. Extensive simulation results verify that the proposed obstacle avoidance method has the characteristics of curve continuity and smoothness, enhanced obstacle avoidance effects, and high energy efficiency. Therefore, the proposed method meets the actual requirements of multi-obstacle avoidance path planning for AUV in IoUT.


I. INTRODUCTION
The Internet of Underwater Things (IoUT), such as underwater sensor networks, which is defined as the network of smart interconnected underwater objects, have played an important role in many underwater applications [1], e.g., seabed exploration, underwater resource exploitation, maritime rescue, and military strategic exercises. One of the challenges of IoUT is to collect sensory information from underwater nodes, with the features of low cost, long term, long range, voyage routing, and real-time communications computationally. IoUT aided with autonomous underwater The associate editor coordinating the review of this manuscript and approving it for publication was Jiajia Jiang . vehicles (AUVs) has emerged as a promising solution for underwater tasks, as shown in Figure 1. Harsh underwater environments with long propagation distance, low transmission rate, and limited bandwidth make it challenging to design a useful packet transmission protocol. Recent research has proven that mobile data collection by using AUVs is an effective approach, such that mobile AUVs have been one of the primary technologies for various categories of IoUT. Many studies have been conducted on AUVs in the aspects of path planning, formation control, and obstacle avoidance [2], [3]. Among them, effective path planning with obstacle avoidance is one important topic for AUVs in IoUT to perform the underwater exploration task successfully [4]. The objective of obstacle avoidance path planning VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ is to design an optimized trajectory while avoiding potential obstacles. However, underwater obstacle avoidance remains a challenging task for AUVs in IoUT due to harsh deep-sea environment, such as turbulent and changeable ocean currents and randomly distributed obstacles. Most obstacle avoidance algorithms have strict requirements on experimental environments [5]. Considering the special characteristics of ocean currents, this study applies 3D stream-function to design an obstacle avoidance path for AUVs in IoUT, which is able to avoid multiple obstacles with good performance in the aspects of real-time response, smooth path, and decreased energy consumption [6]. In recent years, increasing research has been performed on obstacle avoidance-based path-planning algorithms [7], such as artificial potential field (APF) [8], rapid-exploration random tree (RRT) [9], virtual force field (VFF) [10], grid-based control method (GM) [11], vector field histogram (VFH) [12], dynamic window approach (DWA) [13], and artificial neural network (ANN) [14]. The APF-based obstacle avoidance algorithm is of simple structure and convenient for real-time low-level control, such that it is widely used in real-time obstacle avoidance-based smooth path design. Nevertheless, the mobile robot may fall into a dead zone and cannot move because of the local minimum problem. The RRT-based obstacle avoidance method designs a motion path rapidly for the moving robot in the case of scattered obstacles. However, the planned trajectory is not necessarily the optimal solution because it is influenced by the special distribution of multiple obstacles. The basic principle of the VFF-based obstacle avoidance method is to construct a virtual artificial force field composed of the gravitational field of the target orientation and the repulsion field around the obstacle. The collision-free path is decided by searching the descent direction of a potential function, which consists of virtual repulsion force and virtual gravity. The GM-based obstacle avoidance algorithm has no local minimum problem, but the resolution of the GM algorithm depends on grid size. As a result, a contradiction exists between environmental resolution and information storage. The VFH-based obstacle avoidance method is a robot navigation algorithm enhanced from APF. It calculates the travel cost represented intuitively by a histogram in each direction; the more obstacles in this direction are, the higher the cost will be. Moreover, the influence of obstacles with different distances in a certain direction will accumulate calculated values. Mobile robots use the balance function to balance the travel cost and target direction. In the end, a relatively most suitable direction is chosen to be optimal. The VFH-based obstacle avoidance algorithm has high calculation complexity and is unsuitable for longdistance obstacle avoidance applications. The DWA algorithm has the ability to calculate the optimal collision-free velocity of mobile robots, which converts Cartesian targets into speed commands for the mobile robots. The DWA-based obstacle avoidance method is not computationally complicated, but it is only suitable for small scenes. As a two-stage back propagation network, ANN simulates the functional relationship between the left and right wheel speeds of an intelligent robot. The obstacle avoidance control for multiple obstacles is realized by adjusting the size of ellipse axis. The ANN-based obstacle avoidance algorithm has good adaptability, self-organization, strong learning capability, and fault tolerance capacity. Nonetheless, the tedious training process and large amount of data calculation limit the application of the ANN algorithm.
Most of the above mentioned obstacle avoidance algorithms only consider the obstacle avoidance mechanism and do not plan the obstacle avoidance path effectively. The stream-function is a scalar function related to the continuity equation in fluid mechanics [15]. The vector field obtained through the Galileo transformation of the complex potential of a uniform flow is tangent to the obstacle boundary [16], which ensures that the streamline calculated using the stream-function will not intersect with the obstacle to realize dynamic obstacle avoidance. In addition, given that the stream-function satisfies Laplace's equation in the incompressible field, no local optimal problem exists in APF [17]. Stream-function based obstacle avoidance algorithms have been introduced in the field of path planning. For example, Cao et al. [18] proposed how to design an obstacle avoidance-based flight path for UAVs by using the stream-function in a complex environment. Yongqiang et al. [19] proved that the stream-function is appropriate for formation control and path planning in multi-agent systems. Wang et al. [20] proposed to apply the stream-function to wireless sensor networks to improve the network coverage. To et al. [21] proposed a local motion plan for underwater vehicles by using stream-function to improve the maneuverability of the vehicles. Nan et al. [22] studied the path identification algorithm with the stream-function.
Compared with other obstacle avoidance algorithms, stream-function based obstacle avoidance algorithms utilize the characteristics of ocean current. Consequently, the derived continuous and smooth trajectory has better obstacle avoidance capability, higher energy efficiency, and lower computational complexity. However, on the one hand, hysteresis problem of the traditional stream-function based obstacle avoidance method [23] exists; i.e., the mobile AUV will stagnate in a special position sometimes. On the other hand, distinct obstacles and flow field information of the stream-function algorithm are needed, which induces great requirements for system environmental perception capability [24]. Moreover, many studies on the stream-function consider only a 2D region. 3D extension of the stream-function in IoUT has not been found in the literature.
With respect to the above mentioned issues, this paper proposes one novel obstacle avoidance-based path-planning algorithm for mobile AUVs in the 3D IoUT region. The proposed algorithm utilizes 3D extension stream-function to avoid multiple obstacles. Theoretical analysis of 3D stream-function proves that traditional 2D stream-function can be extended to 3D space under specific conditions. In addition, we propose one novel virtual obstacle-based path deformation method to overcome the hysteresis problem of classic stream-function. To compare energy efficiency, a power consumption model for stream-function based obstacle avoidance, which jointly considers buoyancy, gravity, and pushing force, is investigated. Extensive simulation results verify that the proposed obstacle avoidance method based on stream-function has good performance in the presence of spherical and cylindrical obstructions in a 3DIoUT region.
The main contributions of this paper are summarized as follows: (1) Traditional 2D stream-function based obstacle avoidance algorithms are extended to 3D obstacle avoidance path design for IoUT in the presence of multiple spherical and cylindrical obstructions; (2) The virtual obstacle-based path deformation method is discussed to overcome the hysteresis problem of traditional stream-function based path design method; (3) One novel energy consumption model for mobile AUV is proposed to verify the energy consumption efficiency of the proposed algorithm.
The rest of this paper is organized as follows. In Section 2, a 3D obstacle avoidance model and the basic principle of stream-function are presented. We also propose one new power consumption model to compare the energy consumption efficiency. The proposed 3D obstacle avoidance method based on stream-function is elucidated in Section 3. The effectiveness of the proposed approach is verified with MATLAB software in Section 4 via a set of simulation results. Lastly, Section 5 concludes this article.

II. OBSTACLE AVOIDANCE MODEL AND PRINCIPLE OF STREAM-FUNCTION A. 3D OBSTACLE AVOIDANCE FRAMEWORK
The investigated 3D obstacle avoidance framework for underwater vehicles is illustrated in Figure 2. Fixed convex polygon obstacles are deployed in 3D IoUT (L × W × H ) randomly. The mobile AUV located at a specified position will cruise from one position to another along an obstacle avoidance trajectory. The mobile AUV is assumed to have the ability to understand the overall IoUT environments and obstacle environments with certain underwater detectors, such as high-power sonar radar. Therefore, the global obstacle distribution model and obstacle avoidance path can be calculated in advance. To simplify the investigated model, the collision region of a convex polygon obstacle is simplified to sphere or cylinder obstructions. In fact, as shown in Figure 3, the practical obstacles existing in underwater networks can almost be modeled as spheres and cylinders. For the sake of safety, a lot of safety margin is generally left to ensure that there is no collision. Therefore, typical sphere and cylinder with larger size can achieve full coverage of underwater obstacles. If any points in the designed trajectory touch any boundary of a certain obstacle, then such a designed trajectory is regarded as a collision path because it will approach a certain dangerous area. In conclusion, the optimization objective of the 3D obstacle avoidance mechanism for AUVs is to find an optimized path on the basis of virtual streamlines. Considering that the stream-function coming from fluid dynamics is suitable in the field of path planning, we apply it in our 3D obstacle avoidance through some 3D expansions.

B. STREAM-FUNCTION PRELIMINARIES AND 3D EXTENSION
The stream-function discussed in this paper is the basis of the inviscid, incompressible ideal fluid [25]. If the equation generating APF is a harmonic function, then no local extrema exist in the potential field [26].
Harmonic Function [27]. If a complex valued function and a second-order continuous differentiable function ξ satisfy the following Laplace equation, then ξ is a harmonic function on , where is a nonempty subset of R n×n , and x i denotes the independent variable of i dimension.
Liouville's Theorem [28]. If a harmonic function has a maximum or minimum value on , then ξ is a continuous real valued function on bounded , and ξ has no local extrema on .
In 2D space, if the incompressible, inviscid, and irrotational ideal fluid is no swirling at a certain source point, then the fluid is also no swirling around the source point [29]. That is, the vortex vector ω 0 in the fluid is always zero; i.e., ω 0 = ∇ × v s = 0. v s is the velocity, ∇ is the Hamiltonian factor, and ∇ is the Laplace operator. For any scalar function φ, ∇ × ∇φ = 0 to satisfy the irrotational condition. Given that ω 0 = ∇ × v s = 0 and ∇ × ∇φ = 0, v s = ∇φ = 0, where φ is called velocity potential. Under these circumstances, the irrotational flow is named potential flow. The velocity can be expressed as v s = ∇φ = i u + j v. The mass conservation equation should be satisfied in the 2D incompressible flow field [25].
The velocity potential [29] is expressed as follows: where u, v are the velocity components of x-axis and y-axis in a rectangular coordinate system. For ideal fluids, the continuity equation is described as ∇ · v s = 0. Given that v s = ∇φ, the equation ∇ 2 φ = 0 can be deduced from Equation (1); i.e., the velocity potential satisfies Laplace's equation. In accordance with Equation (2) of the 2D incompressible field, the contour of the potential function can be obtained as, Hence, the following equation is obtained: dy dx = − u(x,y) v(x,y) . That is, the contour lines' tangent of the velocity potential is perpendicular to the velocity vector.
Under the condition of Equation (2), the stream-function [25] ϕ is defined as, For an ideal fluid, we can obtain the following results from Equation (2) by substituting Equation (5): From the definition of a harmonic function, the condition in Equation (6) satisfies Laplace's equation. Therefore, the stream-function is a harmonic function in fact. In accordance with Equation (2) and (5), we can calculate the contour lines of the stream-function from the differential equation of the stream-function as, . As a result, the contour lines' tangent of the stream-function, named streamlines, is parallel to the velocity component. In other words, the stream-function on the same streamline is a constant value, and the difference among different streamlines is the flow rate in the flow field. In the 2D incompressible, inviscid, irrotational field, stream-function and velocity potential exist. If a series of streamlines and equipotential lines is illustrated in the same flow field, they must make up an orthogonal flow net [30], as shown in Figure 4. The direction of the equipotential line generated using the potential function is perpendicular to the velocity direction, and the tangent line of the streamlines generated using stream-function is the velocity direction. Thus, the streamline direction can represent the fluid direction in the flow field. From Equation (4) and (7), the contour lines of the stream-function can represent the obstacle avoidance trajectory of a moving object directly rather than the velocity potential. Therefore, this study applies the stream-function to realize path planning with obstacle avoidance capability in IoUT.
Uniform flow [31] is a kind of fluid whose streamlines are parallel to one another in constant flow, and the velocity of different points on the same streamline is equal. Several reasons are considered to choose uniform flow as our streamfunction. Firstly, most ocean currents are regular along a certain direction with a relatively stable velocity, which have high similarity to uniform flow. Secondly, compared with other types of ocean currents, uniform flow has more suitable horizontal flow characteristics for a 3D flow field model of the stream-function. Lastly, the streamline designed using uniform flow model is suitable for AUV. In sum, traditional uniform flow is applied to our obstacle avoidance-based path design method in this paper.
The existence condition of a 3D stream-function is as follows [32]: multiple obstacles are fixed and axisymmetric in the incompressible irrotational flow field, and uniform flow exists across along the symmetric axis of obstacles. In this case, the projection of the 3D stream-function on its flow direction is a 2D stream-function satisfying Laplace's equation. Hence, the 3D obstacle avoidance streamlines of the stream-function can be constructed by superimposing streamlines on different flow surfaces. In the following, we will discuss 2D and 3D complex potential in details.
2D Complex Potential [33]: The complex potential d 2 of fluid flow in a 2D irrotational field is expressed as follows: where p 2 = i x + j y denotes the 2D space position vector. In a 2D incompressible inviscid uniform fluid, if a circle with center coordinates (O x , O y ) and radius r is introduced into the fluid space, then the distance between the singular point and the circle center is much greater than the radius. In this case, the complex potential of 2D space is denoted as [34], 3D Complex Potential. Under the condition of 3Daxisymmetric flow, the complex potential d 3 without swirling flow is defined as, where p 3 denotes the 3D space position vector, φ denotes the velocity potential, ϕ denotes the stream-function, and σ denotes the force function generated by the buoyancy and gravity of the moving body on Z -stream surface. The movement trend of the moving object in the flow field under the action of buoyancy and gravity is defined as force potential in this paper.

VOLUME 9, 2021
The buoyancy equation is F = ρgE [35], where ρ denotes the fluid density of the flow field, g denotes the constant of the gravity field, and E denotes the volume of the AUV. In the 3D flow field, the mobile AUV has the ability to change its movement trend by controlling its own volume of drainage, thus obtaining different buoyancy, named force potential. In the ideal case, given that the gravity of the moving object is fixed, the change trend of the force potential is a constant value. The following equation can be deduced from Equation (3) and (5): Complex Velocity [33]. The complex velocity is obtained with the differential equation of complex potential d 3 of the 3D irrotational flow. On the basis of Equation (11), the complex velocity ψ is expressed as, The flow direction of fluid can be expressed using the 3D complex velocity, where u, v, w represent the velocity components in three mutually perpendicular directions in the 3D axisymmetric flow field.
For example, a spherical obstacle exists in the flow field with its center coordinates O x , O y , O z and radius r. In O z stream layer, the fluid complex potential d 3 ( p 3 ) in 3D space is expressed as, In other words, the complex potential generated by uniform flow makes the mobile AUV move parallel to the x-axis. That flow layer when the force potential is zero. As a sphere obstacle, the radius is r 0 (s z ) = r 2 − (s z − O z ) 2 , in which the sphere generates the complex potential in s z stream layer. Similarly, the complex velocity in different flow layers is obtained through the derivation of d 3 ( p 3 )|s z as, The force potential is ∂σ ∂z = 0 if the buoyancy of a moving body in stream s z equals to gravity. Hence, the complex velocity in (x, y, s z ) plane is If a cylindrical obstacle with coordinates of upper surface circle (x t , y t , z t ), lower surface circle (x b , y b , z b ), height hc, and radius r c is deployed in the IoUT space, it can be divided into two cases: if the cylindrical obstacle is placed vertically, then r 0 is a constant value r c ; if the cylindrical obstacle is  On the contrary, the force potential is a nonzero constant given any difference between buoyancy and gravity in stream s z . Thus, the complex velocity in (x, y, s z ) plane is: In the 3D rectangular coordinates, u, v, w denotes the velocity component along the x-axis, y-axis and z-axis, respectively. The streamlines in different flow layers are calculated and superimposed on the z-axis to finish the obstacle avoidance task by using streamlines in 3D space. For example, an ideal fluid with uniform flow is assumed to exist in 3D space, and its velocity is 2 units. In this 3D space, a spherical obstacle with a radius of 2 units exists. The simulation diagram of a stream-function around the obstacle is shown in Figure 5. With different sizes of obstacles, obstacle avoidance paths in different flow layers are calculated and demonstrated.
Following the above Equation (15) and (16), calculating the motion state of AUV at each coordinate point only needs to substitute obstacle's size and relative distance between AUV and obstacle. Therefore, the time complexity of the proposed algorithm for each coordinate point is O (1). It is assumed that the robot needs to go through N coordinate points to complete the obstacle avoidance process to the destination. Therefore, the time complexity of the whole obstacle avoidance process is O(N ).

C. POWER CONSUMPTION MODEL BASED ON STREAM-FUNCTION OBSTACLE AVIODANCE
The stream-function-based obstacle avoidance in IoUT not only has the characteristics of high obstacle avoidance efficiency and low computational complexity but also has low energy consumption during motion. In this subsection, we establish a power consumption model for AUVs in IoUT.
The moving AUV moves on the seafloor under the impact force of current, resistance of ocean current, and driving force of the AUV itself. In Figure 6, the position coordinates and velocity vectors of the AUV at locations A and B are  A(x a , y a , z a ), V A (u a , v a , w a ) and B(x b , y b , z b ), V B (u b , v b , w b ), respectively. The current is assumed to be uniform, the velocity v s is constant, the drag coefficient of the current is c, and the angle between the current and moving direction of the AUV is α in the X -Y plane. The quality of the AUV is m, and the contact surface area is S. For simplicity, the movement of the AUV from point A to point B is regarded as uniformly accelerated linear motion. Under the above hypothesis, the resultant force of the AUV in the x-axis is: where F px denotes the component of driving force of the AUV engine in the x-axis, f denotes the current resistance suffered by the AUV, and a denotes the acceleration under the action of resultant force. The resistance of the AUV [34] for underwater motion is described as, where v a denotes the actual velocity of the AUV, c is drag coefficient of current. The relationship among the engine power of the AUV, driving force, and speed provided for the AUV is expressed as follows, (19) where P x denotes the power provided by the AUV in the x-axis, and v px denotes the velocity of the AUV under P x power. When the AUV moves in a straight line with uniform acceleration, the relationship among velocity, acceleration, and path is expressed as follows: where v 1 and v 0 denote the starting speed and terminal speed, respectively; L denotes the length of the middle path during the cruising process.
In accordance with the momentum equation, the relationship between the impact force and velocity of ocean current is denoted as follows: where ρ denotes the current density, and t denotes the step interval.
Equations (20), (21), (22), and (22) are substituted into (19), and the expression of the resultant force F x of the AUV VOLUME 9, 2021 in the x-axis can be obtained as, In accordance with (21) and (24), we can obtain the following results: Given the velocity components of the AUV at location A/B and the velocity v s of ocean current, v px can be expressed as, Hence, P x can be expressed as, P y is the same; i.e., Given that the ocean current has no velocity component in the z-axis, P z is defined as, In conclusion, given that the power is scalar, the total power of the AUV engine is described as,

III. 3D STREAM-FUNCTION-BASED OBSTACLE AVOIDANCE MECHANISM A. 3D STREAM-FUNCTION FOR DIFFERENT OBSCTACLES
This subsection focuses on the detailed implementation of the stream-function method to complete the obstacle avoidance task in 3D IoUT space. Before discussing the streamfunction-based obstacle avoidance streamline for multiple obstacles in 3D space, we first discuss the obstacle avoidance process with a single obstacle. In the following sub-subsections, streamlines with spherical and cylindrical obstacles are established in details.

1) 3D STREAM-FUNCTION FOR SPHERICAL OBSTACLES
Given that a sphere is a complete axisymmetric solid, a spherical obstacle meets the requirement of a 3D stream-function. A stereo streamline model in a 3D flow field with a spherical obstacle is illustrated in Figure 7. The detailed generation process is as follows. Firstly, we use the projection method to map the sphere into a 2D plane to reduce the number of dimensions. Secondly, different streamlines are solved in accordance with the complex potential generated by the cross section of a circle with different radius in different flow layers. Lastly, a 3D obstacle avoidance streamline is calculated by combining the streamlines of different flow layers, and the 3D streamline diagram is obtained using such a superposition method. For example, we set the center of the spherical obstacle at the origin of the 3D coordinate system, and the radius of the spherical obstacle is 2 units. Figure 8(a) shows that in the 3D uniform flow field, the stream-function works well to realize obstacle avoidance function if one spherical obstacle exists. Figure 8(b) is the left view of Figure 8(a), which shows that the 3D streamline is smooth around the obstacle surface. The top view in Figure 8(c) shows that the 3D spherical streamlines are actually composed of a 2D obstacle avoidance streamline by using the superposition method. The front view in Figure 8(d) displays that the final trajectory can achieve an obstacle avoidance function around the flow in the vertical direction.  If the buoyancy force of the AUV is greater than its own gravity in the process of obstacle avoidance, then the force potential is generated in the vertical direction; i.e., w = ∂σ ∂z = C = 0. In the case of fixed buoyancy velocity, a floating offset is added to the vertical direction of the 2D streamline to obtain 3D streamlines with vector sum theorem [35]. For example, a spherical obstacle with a radius of 2 units and a spherical center exist at the origin in the 3D flow field. The simulation results with the above set up are demonstrated in Figure 9 from different views. Figure 9(a) describes the obstacle avoidance process of 3D stream-function with buoyancy perpendicular to the horizontal plane, where the AUV will cruise with an oblique angle along 3D streamlines. Figure 9(b) shows the left view in this case. The 3D streamlines are smooth around the obstacle's surface. The top  view in Figure 9(c) shows that streamlines will not collide with obstacles. Figure 9(d) is a front view of this case, which shows that the fluid moves obliquely in the 3D IoUT region.

2) 3D STREAM-FUNCTION FOR CYLINDRICAL OBSTACLES
If the obstacle shape is similar to a cylinder, it can be divided into two cases to discuss. In Case-1, as shown in Figure 10(a), the symmetry axis of the cylinder is perpendicular to the flow direction. In this case, the traditional stream-function does not exist. However, if the current is uniform, along the direction of the symmetry axis of the cylindrical obstacle, the mapping image of the obstacle in each flow layer is circular. Therefore, the obstacle avoidance streamline in each flow layer is calculated in accordance with Equation (15).
The current is assumed to move horizontally, and the symmetry axis of the cylinder is perpendicular to the horizontal plane. The upper and lower surface circles of the cylindrical obstacle are set to (2, 2, 0) and (2,2,4), respectively. The radius is set to 1 unit. Three different flow layers with different Z-coordinates are described in Figure 11. Figure 11(a) verifies that the three streamlines can bypass cylindrical obstacles and complete the obstacle avoidance capability. The left view in Figure 11(b) shows that the fluid will not affect others and cruise in different flow layers. The top view in Figure 11(c) shows that the 3D streamline is actually an expansion of a 2D streamline in practice. The front view in Figure 11(d) proves that the process of cylindrical obstacle avoidance is completed by superimposing streamlines in each flow layer. In Case-2, as depicted in Figure 10(b), the symmetry axis of the cylinder is parallel to ocean current. The flow direction of current is supposed to be parallel to the symmetry axis of the cylindrical obstacle in 3D IoUT space, such that it satisfies the existence condition of a 3D stream-function. Therefore, we use the coordinate projection method to project the cylindrical obstacle to a 2D plane and then calculate the complex potential of the projected rectangle in the 2D plane. The streamlines of 3D space consist of complex velocities of different planes. If the cylindrical obstacle's upper and lower surface circles are set to (−1, 0, 3) and (1, 0, 3), respectively, with a radius of 1 unit in 3D space, the superposition results of streamlines generated using stream-function is shown in Figure 12. The figure exhibits the obstacle avoidance process of an AUV with horizontal cylindrical obstacles by using the proposed superposition method. The left view in Figure 12(b) shows that the 3D complex potential generated using a cylindrical obstacle will guide the mobile AUV to escape forward obstacles and complete the obstacle avoidance task. The top view in Figure 12(c) shows that when the AUV moves in the 2D plane with rectangular obstacles, it can complete the obstacle avoidance task with a streamline. The front view in Figure 12(d) shows that the obstacle avoidance trajectory planned using the stream-function-based obstacle avoidance method is smooth relatively, which satisfies the requirements for AUVs in actual motion control.

B. PATH DEFORMATION METHOD TO OVERCOME THE HYSTERESIS PROBLEM
Although no local extremum problem with a stream-function based path will occur, the hysteresis problem exists in some cases. The hysteresis problem means that the AUV moves along the direction that will pass through the obstacle's center. This situation has no solution because the mobile AUV will stop at the obstacle's edge. In this subsection, one virtual obstacle-based path deformation method is proposed to solve the hysteresis problem. The AUV is assumed to move in a uniform flow with constant intensity in 3D space, as illustrated in Figure 13. A spherical obstacle with radius of r 1 exists in the flow field. If the center of the obstacle and the AUV are on the same horizontal line, the moving AUV will stop at the edge of the spherical obstacle with the above 3D stream-function method. As a result, the expected obstacle avoidance mission will fail with a high probability. To overcome this problem, we construct one virtual obstacle with radius r 2 = k × r 1 whose bottom is tangent to the original obstacle to replace the original obstacle. Therefore, the moving direction of the AUV and the virtual obstacle are not on the same horizontal line. The above-mentioned 3D stream-function obstacle avoidance method will be recalculated by substituting the attributes of the virtual obstacle into Equation (15). The recalculated streamline will not have a stagnation point, as shown via a blue line in Figure 13. The AUV can keep away from obstacles along one specific streamline. In summary, a simple virtual obstacle method is introduced to change the original stagnant path to a distorted path, such that the traditional hysteresis problem can be solved perfectly. Similarly, for cylindrical obstacles, the hysteresis problem can be solved using the virtual obstacle-based path deformation method. Moreover, the defined extension factor k denotes certain distortion degree of obstacle avoidance curve. If the parameter k is larger, the hysteresis problem will be avoided better, but the obstacle avoidance path will be longer than original path.
The simulation result of virtual obstacle-based path deformation is shown in Figure 14. The cruising AUV will stagnate at the obstacle's edge with the traditional stream-function based obstacle avoidance strategy, as shown via a red line in Figure 14. On the contrary, with the proposed virtual obstacle-based path deformation method, the AUV will complete the obstacle avoidance process along a continuous and smooth streamline, as shown via a blue line in Figure 14. The simulation result shows that our proposed path deformation method can cope well with conditions, regardless of whether a spherical obstacle or cylindrical obstacle exists.

C. MULTI-OBSTACLES AVOIDANCE METHOD AND ALGORITHM IMPLEMENTATION OF A 3D STREAM-FUNCTION
The above subsections explain the streamline superposition method to design a smooth and effective obstacle avoidance route for the AUV when a single obstacle exists in 3D IoUT. If many obstacles exist in a 3D watershed, Laplace's equations with multiple boundary conditions should be solved to calculate the complex potential. However, most of these equations are unsolvable. The experimental results prove that a minimal influence is exerted when the complex potential is generated using a certain distance among obstacles in the flow field [24]. Therefore, we use the common trellis partition method to divide the flow field space into several sub regions in accordance with the location and size of obstacles and calculate the complex velocity of each region. As a result, as long as multiple obstacles are disjointed, each obstacle is treated separately by the traditional stream-function based obstacle avoidance method. To ensure the continuity of the 3D obstacle avoidance streamline, it is merged in accordance with the position of the start and end planes of each sub region. The detailed process of our proposed algorithm is divided into three main parts. First, before the stream-function is used to avoid obstacles, the size of the region of interest (RoI) (length, width, and height), the current velocity (U s ), and the position (p), number (N ), and shape (t) of obstacles in the RoI are input to the proposed algorithm. In accordance with the area occupied by the largest obstacle, the proposed algorithm divides the watershed into several sub regions. Second, in accordance with the position and shape of random obstacles, the streamline of the subarea is calculated using Equation (15). If the AUV needs to float upward, the streamlines of the region are calculated using Equation (16). If a stagnation point exists in the streamlines, the proposed virtual obstacle-based path deformation method is applied to recalculate this streamline. Lastly, all sub VOLUME 9, 2021  regions are superimposed and merged to one total streamline. In accordance with the starting position (x s , y s , z s ) of the AUV, a certain obstacle avoidance streamline is controlled by the AUV's center control system. In short, the 3D obstacle avoidance task is completed easily by moving along a certain streamline. The pseudo code of our proposed algorithm is provided in details.

IV. SIMULATION RESULTS
In this section, extensive simulation results are provided to verify the effectiveness of our proposed algorithm. We assume that several spherical and cylindrical obstacles are distributed randomly in the3D IoUT region. The detailed parameters of the simulation scene are listed in TABLE 2. The proposed 3D stream-function obstacle avoidance method and virtual obstacle-based path deformation method are used to avoid multiple obstacles with a planned trajectory on various occasions. Hence, we will discuss several simulation cases in the following.

A. OBSTACLE AVOIDACNE RESULTS
The shape, size, and location of different obstacles are described in TABLE 3. The position of the spherical obstacle is represented by the center of the spherical obstacle, and the positions of cylindrical obstacles are defined by the center of the upper and lower surfaces.
The obstacle avoidance trajectory results are illustrated in Figure 15, which prove that one smooth and reasonable trajectory can be obtained using the proposed stream-function method to complete obstacle avoidance path-planning tasks. Figure 15(a) shows that the AUV can avoid all obstacles and realize path planning as long as it runs along the route designed using the proposed stream-function. Figure 15(b)   FIGURE 15. The 3D streamline of stream-function for AUV to avoid multiple obstacles in Scene 1.
and Figure 15(c) illustrate the obstacle avoidance trajectory based on 3D streamlines from the perspectives of aerial view and side view, respectively.
Moreover, the smoothness feature of the designed trajectory is verified in this study. The above obstacle avoidance path and its derivation curve are illustrated in Figure 16. Figure 16(a) and Figure 16(b) are the projection results of the obstacle avoidance path in Figure 15 into X -Y and X -Z planes, respectively. Figure 16(c) and Figure 16(d) are the derivation of the curves of Figure 16(a) and Figure 16(b), respectively. These results show that the designed trajectory has good continuity and smoothness in both projected planes. As a result, the AUV's trajectory can avoid obstacles  efficiently and does not induce excessively high requirements for the AUV's maneuverability.

B. HYSTERESIS AVOIDANCE RESULTS
As we know, the streamline passing through obstacle's center needs a large turning angle to bypass the certain obstacle, so as to lead 'stagnation' at the edge of obstacle.  shows some important parameters of obstacles in simulation Scene 2. In this case, the hysteresis problem will occur with traditional stream-function based obstacle avoidance method. This section is devoting to verify the efficiency of virtual obstacle based path deformation method. Simulation results are compared in Figure 15 with extension factor k = 1.1. VOLUME 9, 2021 For example, the hysteresis phenomenon will happen while moving along the streamline pass through the center of Spherical obstacle (S1), which causes the AUV to stop at the edge of S1, as shown via a magenta line in Figure 17 The proposed virtual obstacle method is used to guide the AUV to avoid this obstacle with a small turning angle, as depicted via a blue dotted line in Figure 17. The AUV will move along the streamline designed using stream-function to complete the obstacle avoidance task of the AUV at the stagnation state, as shown via a blue solid line in Figure 17. The simulation results verify that the stream-function combined with the virtual obstacle method can solve the hysteresis problem of the traditional stream-function effectively to complete multi-obstacles avoidance smoothly in 3D IoUT space.

C. ENERGY CONSUMPTION RESULTS
In this subsection, the energy model of an AUV along different ocean current directions is analyzed. The obstacle avoidance path of the AUV is assumed to be the same as that presented in Figure 15. Some important simulation parameters are listed in TABLE 5 in details. The energy consumption of the AUV at each position is calculated using Equation (24), (25), (26), and (27). Figure 16 shows that the greater the angle between the current flow direction and the AUV's moving direction is, the more energy will be needed to complete the obstacle avoidance mission. When the directions of the AUV and ocean current are the same, the impact of ocean current will provide total power for the AUV's motion. If an angle exists between the directions of the AUV and ocean current, the impact of ocean current will provide a part of power for the AUV's motion. Even if the AUV moves against the ocean current, it will still have side effects on the movement direction of the AUV. Figure 18 depicts that the AUV at positions P1 and P2 needs to move around Cylindrical Obstacles1 (C1) and Obstacles2 (C2). Meanwhile, the AUV is required to provide driving force in the y-axis to complete the cruising mission. Therefore, the AUV is only required to provide power at these points. The AUV's trajectory deflects under the action of potential field generated by Cylindrical Obstacle4 (C4) and Spherical Obstacle2 (S2) at position P5. Hence, the AUV is also only required to provide a small amount of power to complete this process. Given that the AUV needs to complete the floating obstacle avoidance task at position P4, the AUV has to provide additional power. At position P5, the AUV does not need to execute an obstacle avoidance mission. Consequently, the designed trajectory does not change, and the AUV can move following the ocean current. Furthermore, given an angle between the directions of the AUV and ocean current, the ocean current will provide a small amount of power in the y-axis. As a result, the AUV has to slow down when it travels around positions P6 and P7. In sum, the proposed obstacle avoidance mechanism utilizes the driving force from ocean current to reduce the energy consumption greatly.

D. LAKE TEST VERIFICATION
In order to verify the performance of proposed 3D streamfunction based obstacle avoidance algorithm. As shown in Figure 19, the underwater robot needs to complete the fixed-point cruise task in a large range of pool. The robot is not only equipped with multi degree of freedom thrusters, but also has high mobility and can complete the basic underwater actions. Moreover, it is equipped with high-precision GPS equipment, which is used to record the movement trajectory. We set two obstacles on its cruise route, which requires the robot to complete the cruise task without collision.
The key snaps in collision trajectory are show in Figure 20. Without the obstacle avoidance algorithm, there is no doubt that it will collide with the obstacles when the robot moves following preset cruise path. Therefore, it is very important to apply efficient obstacle avoidance algorithm for underwater robot.
On the contrary, the collision will be avoided with the proposed three-dimensional flow function obstacle avoidance method. When the underwater robot approaches the area of  obstacles, the proposed stream-function obstacle avoidance algorithm is applied to calculate a streamline that bypasses this spherical obstacle. The underwater robot controls the steering thrusters to move along the streamline to complete the obstacle avoidance task and return to the cruise route without collision. Figure 21 illustrates the movement process of the robot moving along the streamline to avoid the spherical obstacle. Figure 22 is the derived completed trajectory of Figure 21. The underwater robot starts from the starting point and cruises along cruise point1, 2, 3, 4. Approaching to the cruise point 4, it encounters the first obstacle. The underwater robot moves along the path designed by stream-function obstacle avoidance algorithm, successfully avoided the obstacle. The blue line denotes ideal route for obstacle avoidance, and the red dots denote the actual movement points. The above results verify that 3D stream-function obstacle avoidance algorithm proposed in this paper can finish obstacle avoidance task perfectly.

V. CONCLUSION
This study investigates 3D stream-function based obstacle avoidance for AUVs in IoUT. The ocean current characteristics, simplified as stream-function, are utilized to design an optimized trajectory with obstacle avoidance capacity.
Theoretical analysis and simulation results prove that the obstacle avoidance path designed using the proposed algorithm has the characteristics of curve continuity, good smoothness, and effective obstacle avoidance. In our future works, we will focus on the practical applications of the proposed method in IoUT.
SHUAISHUAI LV received the B.E. and Ph.D. degrees from the School of Automation, Northwestern Polytechnical University, in 2011 and 2016, respectively. Since 2016, he has been a Lecturer with the College of Electronics and Information, Hangzhou Dianzi University. His research interests include iterative learning control, fractional order control, finite time control of linear and nonlinear systems, network control systems, and the consensus of distributed multi-agent system and its applications.