# Three-Dimensional Localization of Underwater Nodes Using Airborne Visible Light Beams
## 4 The 3D-LUNA Localization Framework
### Handling Unknown Depth  
When a node receives a single transmission, Figure 3 represents the possible location of the node where the node can be located anywhere on the surface of a 3D shape. Therefore, to determine the node's position, multiple transmissions should be received, and the corresponding 3D contours are correlated. In essence, we need to find the intersection of at least three contours to determine the x, y, and z coordinates of the underwater node. Later in this section, we will discuss the scenarios in which fewer transmissions are received. Figure 4 illustrates the fundamental principle behind the multilateration process used in 3D-LUNA when the underwater node's depth is unknown. Each VLC transmission produces a 3D contour of potential positions (as shown previously in Figure 3), and these are discretized into circular slices at various depths. If a node receives three or more transmissions, in an ideal scenario, all the resultant contours will overlap with each other, and based on the granulation of the discretized depth, they will either yield a single point  
that indicates the location of the underwater node or provide the depth at which the circle will have the least amount of overlap. Let us assume that the underwater node receives \(N\) transmissions. So, there will be \(N\) contours, and each \(j\) (\(j=1,2,\ldots,N\)) is centered at \(\left(x_{j},y_{j}\right)\) in the \(x\)-\(y\) plane. Since each contour can be discretized into circles in the \(x\)-\(y\) plane, let us assume each circle has a radius \(r_{j}(z_{i})\) at each depth \(z_{i}\). The height of each 3D contour \(i\) is \(z_{i}\in\left[z_{i}^{min},z_{i}^{max}\right]\). For \(N\) circles to intersect at a single point \(\left(x,y,z\right)\) in 3D space, the distance from this point to each circle's center in the \(x\)-\(y\) plane must be equal to the radius of the circle at that depth. \[r_{j}(z_{i})=\sqrt{\left(x-x_{j}\right)^{2}+\left(y-y_{j}\right)^{2}} \tag{7}\]  
where \(r_{j}(z_{i})\) is the radius of contours \(j\) at depth \(z_{i}\). For \(N\) circles, this results in a system of equations for the common point \(\left(x,y,z\right)\):  
\[r_{k}(z_{i})=\sqrt{\left(x-x_{k}\right)^{2}+\left(y-y_{k}\right)^{2}},\ \ k=1,2,\ldots,N \tag{8}\]  
If we square and rearrange Equation (7), we obtain the following:  
\[x^{2}+y^{2}-2 xx_{j}-2 yy_{j}=r_{j}(z_{i})^{2}-x_{j}^{2}-y_{j}^{2} \tag{9}\]  
Let \(D_{j}(z_{i})=r_{j}(z_{i})^{2}-x_{j}^{2}-y_{j}^{2}\). The equation simplifies to:  
\[x^{2}+y^{2}-2 xx_{j}-2 yy_{j}=D_{j}(z_{i}) \tag{10}\]  
For \(N\) circles, we obtain a system of \(N\) equations:  
\[x^{2}+y^{2}-2 xx_{k}-2 yy_{k}=D_{N}(z_{i}),\ \ k=1,2,\ldots,N \tag{11}\]  
If we subtract the equation for circle \(j\) from the equation for circle \(j+1\), we obtain the following equation:  
\[-2x\left(x_{j}-x_{j+1}\right)-2x\left(y_{j}-y_{j+1}\right)=D_{j}(z_{i})-D_{j+ 1}(z_{i}) \tag{12}\]  
After forming a linear equation with x and y, we obtain  
\[A_{k}x+B_{k}y=C_{k}(z_{i}),\ \ k=1,2,\ldots,N-1 \tag{13}\]  
Figure 4: The scenario of receiving three transmissions. (**a**) Bottom view; (**b**) top view. where  
\[A_{N-1}x+B_{N-1}y=C_{N-1}(z_{i}) \tag{14}\]  
\[B_{j}=-2\big{(}y_{j}-y_{j+1}\big{)} \tag{15}\]  
\[r_{k}(z_{i})=\sqrt{\left(x-x_{k}\right)^{2}+\left(y-y_{k}\right)^{2}},\ \ k=1,2,\ldots,N \tag{8}\]0  
By solving this system of linear equations for \(x\) and \(y\) and all depths \(z_{i}\), we can find the exact intersection point. If an exact solution is not available for any depth, 3D-LUNA formulates an optimization that opts to find the position corresponding to the smallest error. We consider the depth range where all the circles intersect with each other, and among that range, we will consider the depth at which there is the least overlap among all circles. For all \(N\) circles to have a common intersection, the following conditions must be met:  
* The distance between the centers of any two circles must be less than or equal to the sum of their radii.