## 4 Fire and Firefighter Monitoring
### Firefighter Monitoring
#### 4.2.1 Training-Based RSSI Localization
Figure 3 shows the model obtained with and without using RANSAC in an experimental test. It shows 200 RSSI measurements taken by one static node from 5 surrounding nodes. Although the RSSI measurements from each node showed low variability, the model fitting error is significant if all the measurements are considered. The RANSAC algorithm was applied. Most of the measurements fitted well to the resulting model (inliers, represented with dots), but there were some with high fitting errors  
(outliers, represented with asterisks). The model obtained without RANSAC, using all measurements, was \(a=-9.51\) and \(b=-5.34\), see Figure 3 in dashed line. The mean fitting error was 2.23 dBm. The model obtained with RANSAC, using only inliers measurements, yielded \(a=-10.302\) and \(b=-1.678\), with a mean fitting error of 0.49 dBm, see Figure 3 in solid line. Despite the low differences between the model parameters, the differences between the models and their impact on localization errors are significant, as will be presented in Section 6. Notice that each static node needs measurements from only two static nodes to compute its RSSI-range model. Of course, the model trained with few measurements could have poor accuracy, but it will be improved as the number of measurements increases. Section 6 evaluates the impact of model training in localization errors as the number of measurements increases. Model training is executed by each static node. Equations (2) and (3) can be efficiently computed in off-the-shelf WSN nodes. Keeping on with the example in Figure 3, Figure 4 shows the mean fitting error assuming different numbers of RANSAC iterations. Four iterations are enough to obtain a good fitting and no significant improvement is obtained with more. The proposed model fitting assumes 5 RANSAC iterations. It was implemented in NesC under TinyOs and its execution requires less than 170 ms in TelosB nodes. Figure 4: Mean model fitting error assuming different numbers of RANSAC iterations. Figure 3: Experimental RSSI-range models obtained with and without RANSAC. Localization Algorithm  
Localization uses the RSSI-range models computed in the training stage. When a mobile node \(i\) wants to measure its location, it broadcasts a _LocRequest_ packet. Any static node \(j\) that receives the packet measures its RSSI and, using its RSSI-range model, estimates \(D_{ij}\), its distance to the mobile node \(i\). Then, node \(j\) sends to node \(i\) a _LocResp_ packet containing \(D_{ij}\) and its location, \(L_{j}\). Static nodes responding to node \(i\) are considered anchor nodes for localization. Therefore, the mobile node receives a set of measurements {(\(L_{j}\), \(D_{ij}\))} from nearby anchor nodes. With these measurements it can compute its location \(L_{i}\) applying a localization method. Various methods such as multilateration [20] or least squares [21] can be used to provide an optimal mathematical solution to over-determined linear systems. These methods give good results when RSSI measurements have low noise levels. Low noise in RSSI measurements can cause high differences between the estimated and the actual distances. The Weighted Centroid Localization method (WCL) [29] exhibits high robustness against noise. [29] demonstrated that although Least Squares (LS) is optimal with noiseless RSSI measurements, the performance of WCL is better than LS with realistic levels of noise. We confirmed experimentally the results and adopted the WCL method. The mobile node \(i\) computes its location using the expression:  
\[L_{i}=\frac{\sum_{j=1}^{n}(\omega_{ij}L_{j})}{\sum_{j=1}^{n}\omega_{ij}} \tag{4}\]  
where \(n\) is the size of the data set and \(\omega_{ij}\) are weighting factors that depend on the distance:  
\[\omega_{ij}=\frac{1}{(D_{ij})^{p}} \tag{5}\]  
where \(p\) is an exponent to modify the influence of distance in the weights. Higher \(p\) gives more relevance to measurements from nearby static anchor nodes. RSSI-range models become flat--_i.e._, insensitive to range--as range increases.