# Relational Positioning Method for 2D and 3D Ad Hoc Sensor Networks in Industry 4.0
## 4 Simulations and Results
### The 3D Evaluation  
Let us consider a 3D scenario defined by a regular tetrahedron, as illustrated in Figure 5a, having four ANs with coordinates \(AN_{1}\)(0,0,0), \(AN_{2}\)(d,0,0), \(AN_{3}\)(\(d\)\(\cos\frac{\pi}{3}\), \(d\)\(\sin\frac{\pi}{3}\),0), and \(AN_{4}\)(\(\frac{d}{2}\), \(\frac{d}{2}\)\(\tan\frac{\pi}{6}\),\(d\)). Routes from ANs to node \(n_{0}\) are obtained according to [PERSON]'s routing algorithm [PERSON] (1984). As stated before, the estimated distance between \(AN_{i}\) and node \(n_{0}\), \(\Delta_{i,\,(j,k,l)}\) is approximated by the number of hops in the route connecting them. In addition, the maximum coverage radius is initially set to \(r_{0}\) = 2 m, and the number of nodes in the network is set as follows: for the 2D scenario, we randomly deploy 70 to 90 nodes in a _dxd_ square meter area, and as the working area is a triangle defined by ANs coordinates, the proportional number of nodes within the triangle is \(n\) = 30 to 40 nodes. For the 3D scenario, 300 to 400 nodes are also randomly deployed in a _dxdxd_ cube meter volume, and as the working space is a tetrahedron defined by ANs coordinates, the proportional number of nodes in such tetrahedron is \(n\) = 43 to 57. For the 3D assessment, we extended the variety of scenarios analyzed, varying more network conditions (ANs locations, coverage radius \(r_{0}\), and the number of nodes) and under different values of the space discretization unit \(L\). Note that \(L\) defines the vertices \(\mathbf{v}_{j,k,l}\) on the discretized space and thus the searching points related to distances \(\delta_{i,(j,k,l)}\), in Equation (2). Figure 7 shows the performance of the relational searching method for a 3D scenario, as shown in Figure 5a, with \(AN_{1}\)(0,0,0), \(AN_{2}\)(d,0,0), \(AN_{3}\)(\(d\)\(\cos\frac{\pi}{3}\), \(d\)\(\sin\frac{\pi}{3}\),0) and \(AN_{4}\)(\(\frac{d}{2}\), \(\frac{d}{2}\)\(\tan\frac{\pi}{6}\),\(d\)), where \(d\) = 10 m. In this figure, we analyzed the performance of the method under different coverage ranges, \(r_{0}\), and the number of nodes \(n\) in the working space. In this analysis, we can observe that as \(r_{0}\) increases, the normalized error \(\varepsilon/d\) increases; however, the Euclidean quadratic error \(\varepsilon\) shows stability, as it remains close to 2 m. In this figure, we can also observe that by increasing the number of nodes in the space, we can achieve a significant improvement for \(r_{0}\) = 2 m. This is because better routes can be found if more nodes are in the network, and this is more significant when \(r_{0}\) is small. Even that the transmission range \(r_{0}\) is selected in the range \(r_{0}\) = [2 m 5 m] for the following evaluations, it can be larger than 5 m; however, the normalized localization error is very close to that obtained for \(r_{0}\) = 5 m. Simulations were performed for \(r_{0}\) = 6 m, 7 m, 8 m and \(n\) = 43 nodes, obtaining \(\varepsilon/d\) = 0.2236, 0.2235 and 0.2526, showing error saturation, which is a desirable behavior. In Figure 8, results from a different perspective are shown; on the \(x\)-axis, the average Euclidean quadratic distance error \(\varepsilon\) (m) is presented, and on the \(y\)-axis, the values of the cumulative distribution function describing the percentage of cases when \(\varepsilon\) is under a given distance are presented. \begin{table}
\begin{tabular}{c c c c c} \hline \(r_{0}\)(m) & **2** & **2.5** & **3.333** & **5** \\ \hline \(x_{3}=d\)\(\sin\frac{\pi}{3}\) & 0.1606 & 0.1410 & 0.1553 & 0.209 \\ \(x_{3}=d\)\(\sin\frac{\pi}{3}\pm 1\) & 0.1380 & 0.1308 & 0.1520 & 0.2025 \\ \(x_{3}=d\)\(\sin\frac{\pi}{3}\pm 2\) & 0.1415 & 0.1328 & 0.1448 & 0.2034 \\ \(x_{3}=d\)\(\sin\frac{\pi}{3}\pm 3\) & 0.1406 & 0.1106 & 0.1301 & 0.1810 \\ \(x_{3}=d\)\(\sin\frac{\pi}{3}\pm 4\) & 0.1396 & 0.1220 & 0.1518 & 0.1860 \\ \(x_{3}=d\)\(\sin\frac{\pi}{3}\pm 5\) & 0.1390 & 0.1163 & 0.1545 & 0.2005 \\ \hline \end{tabular}
\end{table} 
Table 2: Error (\(\varepsilon/d\)) analysis for different triangle shapes (“\(x\)” coordinate of \(AN_{3}\)).