## 4 Fire and Firefighter Monitoring
### Firefighter Monitoring
#### 4.2.1 Training-Based RSSI Localization  
A high number of RSSI-based localization methods have been developed in WSN. Range-based methods, such as multilateration [20], least squares solution [21] or maximum likelihood [22], use RSSI measurements to estimate distance to anchor nodes. Range-based methods operate well in outdoors. In indoors RSSI is highly affected by radio reflections and other interactions resulting in poor localization performance. Range-free methods, such as ROC-RSSI [23] or APIT [24], overcome these drawbacks relying on geometric considerations. Although more robust to variations in the radio channel, their localization errors are usually higher than in range-based methods. Also, some methods, such as fingerprinting [25], compare RSSI measurements with a previously computed RSSI map. These techniques often provide good results even in indoors environments but require detailed previously-computed RSSI maps of the environment and thus cannot be applied in our rapid-deployment scheme. RSSI-Range Model Training  
The RSSI-range model has been extensively studied in the literature [26,27]. It can be modeled as a linear relationship between the RSSI and the logarithm of the distance \(D\):  
\[RSSI(D)=a\log D+b \tag{1}\]  
where \(a\) and \(b\) are the model parameters. Assuming a set of measurements {\(RSSI_{k}\), \(\log D_{k}\)} the model can be fitted by performing a simple linear regression:  
\[a=\frac{\sum_{k}RSSI_{k}\log D_{k}-\overline{RSSI}\sum_{k}\log D_{k}}{\sum_{k} (\log D_{k})^{2}-\log D\sum_{k}\log D_{k}} \tag{2}\]  
\[b=\overline{RSSI}-(a\overline{\log D}) \tag{3}\]  
where \(\overline{RSSI}\) and \(\overline{\log D}\) stand for the mean of \(RSSI_{k}\) and \(\log D_{k}\), respectively. The training stage is as follows. Once deployed, any static node \(i\) starts periodically broadcasting _RegrRequest_ packages. If static node \(j\) receives this package, in response it transmits a _RegrResp_ packet containing its ID and its location \(L_{j}\). Node \(i\) receives the _RegrResp_ packet and measures its RSSI, \(RSSI_{ij}\). It also extracts \(L_{j}\) and computes \(\log\|L_{i}-L_{j}\|\). Recall that each node knows its own location. Hence, node \(i\) obtains a measurement (\(RSSI_{ij}\), \(\log D_{ij}\)). If node \(i\) has sufficient measurements, it can fit its RSSI-range model \(RSSI_{i}(D)\) using Equations (2) and (3). Only the \(K\) most recent measurements are used in order to allow model adaption to changing conditions. As node \(i\) gathers more measurements it periodically recalculates \(RSSI_{i}(D)\). RSSI measurements contain significant noise level that can affect the model training. Regression can cope with Gaussian noise but performs badly with non-Gaussian occasional highly noisy measurements. The proposed method adopts the RANSAC (RANdom SAmple Consensus) algorithm [28] to filter out highly noisy measurements--outliers. RANSAC is an efficient method to estimate parameters of a mathematical model from a set of measurements that can contains outliers. It requires a set of measurements {\(RSSI_{k}\), \(\log D_{k}\)} and the parameterized model in Equation (1). RANSAC iterates by selecting a random subset of the measurements as hypothetical inliers. At each iteration the model is fitted to the hypothetical inliers using Equations (2) and (3). Then, the rest of the measurements are tested against the fitted model: if an observation fits well to the estimated model, it is also considered as a hypothetical inlier. If a sufficient number of measurements have been classified as hypothetical inliers, the estimated model is considered good and the model is re-estimated using all hypothetical inliers. Finally, the model is evaluated by estimating the error of the inliers relative to the model. This procedure is repeated a number of times, each time producing either a rejected model when too few measurements are classified as inliers or a refined model together with its error measure. After the iterations, the model with lower error is selected.