# Relational Positioning Method for 2D and 3D Ad Hoc Sensor Networks in Industry 4.0
## 3 Relational Positioning Method
### Two-Dimensional (2D) Localization  
For explanatory purposes, we first consider a planar scenario, and later the method is extended to a 3D scenario. A vertex in the lattice at cross point (\(j,k\)), with coordinates \((\mathbf{x}_{y_{j},k},\,\mathbf{y}_{y_{j},k})\), is denoted as \(\mathbf{v}_{j,k}\) and it is meant to be \(\delta_{i,(j,k)}\) Manhattan units apart from \(AN_{i}\) with coordinates \((x_{i},\,y_{i})\). The Manhattan distance between \(AN_{i}\) and vertex \(\mathbf{v}_{j,k}\) is defined as \(\delta_{i,(j,k)}=\frac{\mid\,x_{i}-\mathbf{v}_{j,k}\mid+\mid y_{i}-\mathbf{v} _{j,k}\mid}{L}\), where \(L\) is the Manhattan unit. Thus, the node of interest \(n_{0}\) is assumed to be at the unknown vertex \(\mathbf{v}_{j,k}\) in the discretized region, and it will have an associated set \(\{\delta_{i,(j,k)}\}\), \(i=1,\,2,\,3\), of Manhattan distances [18] to the corresponding \(AN_{i}\), (see Figure 1). This assumption is not necessarily true in real environments; however, the searching method perceives this as distance estimation noise and makes a search of the most likely vertex \(\mathbf{v}_{j,k}\) for location estimation of node \(n_{0}\). This process is explained in detail in this section, and it is further developed when the 3D localization method is explained. Figure 1: A 2D scenario for three ANs in a triangle. Actual Manhattan distances from ANs to \(\mathbf{n}_{0}\) at vertex \(\mathbf{v}_{j,k}\), may not be available. Although in an ad hoc network, they can be estimated by multiplying the mean length of a hop and the hop count in the shortest path linking the concerned node and the AN [16]. Estimated distances from \(AN_{i}\) to \(\mathbf{n}_{0}\), \(\Delta_{i,(j,k)}\), may depart from the corresponding Manhattan distances \(\delta_{i,\,(j,k)}\); this is \(\Delta_{i,(j,k)}=\delta_{i,(j,k)}+\varepsilon_{i,\,(j,k)}\), where the term \(\varepsilon_{i,(j,k)}\) accounts for an error associated with the estimation method, and it is often related to the node density and routing algorithm [16]. Note that the actual Manhattan distance between any pair of anchors \(AN_{i}\) (\(i=1\),\(2\),\(3\)) is determined from the known \(AN_{i}\) (\(i=1\), \(2\), \(3\)) coordinates, as stated above. In order to construct a location likelihood matrix \(\mathbf{\rho}=[\rho_{j,k}]\), we define an initial matrix \(\mathbf{W}=[w_{j,k}]\), where we assign an initial weight \(w_{j,k}=1\) to each vertex \(\mathbf{v}_{j,k}\) lying inside the convex hull containing the \(AN_{i}\), and otherwise, \(w_{j,k}=0\), meaning that each vertex can equally be a candidate for the node \(\mathbf{n}_{0}\) location. Weights \(w_{j,k}\) will iteratively be changed, allowing to correspondingly define a location likelihood matrix \(\mathbf{\rho}=[\rho_{j,k}]\), where \(\rho_{j,k}=\frac{w_{j,k}}{\sum_{j,k}w_{j,k}}\) is the probability (likelihood) of the node being at vertex \(\mathbf{v}_{j,k}\). Note that \(\sum_{j,k}\rho_{j,k}=1\). The weights \(w_{j,k}\) can further be modified, bearing in mind the relative distances to different \(AN\) nodes. For instance, let \(\Delta_{i,(j,k)}\) and \(\Delta_{m,(j,k)}\) be estimated distances from \(\mathbf{n}_{0}\) to \(AN_{i}\) and \(AN_{m}\), respectively. As many interference elements such as physical barriers, multipath phenomena, moving objects and measurement errors may impair distance estimates, our approach is based on the hop count criterion; that is, \(\Delta_{i,(j,k)}\) is proportionally approximated to the number of hops in the route connecting \(AN_{i}\) to node \(\mathbf{n}_{0}\) assumed to be at vertex \(\mathbf{v}_{j,k}\). Although we introduce some quantizing errors, making distance estimation dependent upon the hop count criterion leads to the proposed method becoming more robust to propagation impairments than the previously mentioned methods. We define an ANs pair (\(i\),\(m\)) proximity ratio as \(\zeta_{i,m}=\Delta_{i,(j,k)}/\Delta_{m,(j,k)}\), \(i,\,m=1,\,2,\,3,\,i\
eq m\).