# Wireless Sensor Network Aided Assembly Line Monitoring According to Expectations of Industry 4.0
## 2 Materials and Methods
### Localization Algorithms  
To be able to successfully determine the location of the mobile node using fingerprint localization, a localization algorithm is to be used. The choice and application of the localization algorithm depends on the required information and has the biggest influence on the result [29]. Some algorithms are based on simple searching for similarities by comparing the measured RSSI data with the data from the data sample database. Usually, the successfully implemented algorithms are those used for classification purposes. In the proposed control model, two algorithms are used, Artificial Neural Networks (ANN) [30] and the weighted \(k\)-nearest neighbor algorithm (WkNN) [31].  
The proposed ANN to be used in the control model is a multilayer one, which consists of the input and output layers and the internal layer as well [26; 28]. At the output layer, the linear activation function is used, while at the internal layer, the hyperbolic tangent activation function is used. The proposed model uses the \"Levenberg-Marquardt\" training method.  
The inputs to the ANN are the measured RSSI values for every anchor [31]. The number of the inputs to the ANN is determined by the number of anchors. At the output from the ANN, the required data form is the position coordinate of the mobile node. The training of the ANN was done by using the RSSI values measured in off-line mode and stored in the database. The stored data is organized in a matrix form \(S_{ji}\), where the \(s_{ji}\) elements of the matrix determine the RSSI value for the \(j\)-th measured position and \(i\)-th anchor.  
For the implementation the WkNN algorithm, the RSSI values measured in off-line mode are used. The RSSI values measured in on-line mode at a certain moment of time \(m\) are organized in a matrix form \(S_{mi}\), where the \(s_{mi}\) elements of the matrix determine the RSSI value for the \(i\)-th anchor.  
Based on the measured \(S_{mi}\), the similarity with one of the positions from \(S_{ji}\) is determined by calculating the Euclidean distance \(p_{j}\), where \(n\) is the number of anchors:  
\[p_{j}=\sqrt{\sum_{i=1}^{n}(s_{mi}-s_{ji})^{2}} \tag{1}\]  
The mostly similar position, i.e., referent point, is the point that has the minimal value for \(p_{j}\). The WkNN method takes into consideration more than one point that is  
Figure 5: Online phase of the fingerprint localization.  
closest to the analyzed point (neighboring points). The number of neighboring points is \(k\), which is the most important parameter to be used with this method and has to be defined at the beginning of the localization. The resulting coordinates of the mobile node are determined as:  
\[xy=\sum_{i=1}^{k}w_{i}xy_{i}, \tag{2}\]  
where \(w_{i}\) is a weight parameter, which is used to evaluate the potential neighboring points, while \(xy_{i}\) are the coordinates of the potential points. The weight parameters are determined as:  
\[w_{j}=\frac{\frac{1}{p_{j}^{2}}}{\sum_{i=1}^{k}\frac{1}{p_{i}^{2}}} \tag{3}\]  
The testing results of the presented localization techniques can be found in paper [28], where indoor localization has been implemented in laboratory conditions based on RSSI. Here, the algorithms are applied in industrial environment.