# A Cooja-Based Tool for Coverage and Lifetime Evaluation in an In-Building Sensor Network+
## 3 WSN-Maintain
\(\gamma(d)\) is the signal-to-noise ratio (SNR) at a distance \(d\) and is given by:  
\[\gamma(d)=P_{t}-PL(d)-P_{n} \tag{4}\]  
\(P_{n}\) is the noise floor, which is given by [10]:  
\[P_{n}=(F+1)kT_{0}B \tag{5}\]  
\(F\) is the noise figure, \(k\) the Boltzmann's constant, \(T_{0}\) the ambient temperature and \(B\) the equivalent noise bandwidth. The values for these parameters for Tmote Sky's CC2420 are given in Table 3[13]. One can change all of these parameters according to the type of hardware used. **Identify node on/off status based on coverage and connectivity**: To create a coverage map of the building, WSN-Maintain currently supports two types of coverage models, _i.e._, the binary detection \begin{table}
\begin{tabular}{c c c} \hline \hline
**Power Level** & **Output Power (dBm)** & **Current Consumption (mA)** \\ \hline
3 & \(-25\) & 8.5 \\
7 & \(-15\) & 9.9 \\
11 & \(-10\) & 11.2 \\
15 & \(-7\) & 12.5 \\
19 & \(-5\) & 13.9 \\
23 & \(-3\) & 15.2 \\
27 & \(-1\) & 16.5 \\
31 & 0 & 17.4 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Tmote Sky output power configuration for the CC2420 [7]. \begin{table}
\begin{tabular}{l l l} \hline \hline
**Parameters** & **LOS Value** & **NLOS Value** \\ \hline Reference distance (\(d_{0}\)) & 1.5 m & 10 m \\ Path loss at \(d_{0}(PL(d_{0}))\) & 40 dB & 83 dB \\ Path loss exponent (\(n\)) & 1.9 & 6.1 \\ Wall attenuation factor (WAF) & - & 3.1 dBm \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Tmote Sky signal propagation measurements [12]. model and [PERSON]'s model [14]. These models can be used to approximate, for example, passive infrared (PIR) sensors. While at the moment, only these two models are implemented in WSN-Maintain, one can add other models based on their own requirements. With the binary model, the probability \(p_{vi}\) that a sensor node \(i\) senses a point \(v\) in a floor plan is one if the distance \(d_{vi}\) between \(v\) and \(i\) is less than or equal to a threshold distance \(d_{t}\), _i.e._, the node's sensing range (Figure 2a). \[p_{vi}= \begin{cases}1&\text{if }d_{vi}\leq d_{t}\\ 0&\text{if }d_{vi}>d_{t}\end{cases}  \tag{6}\]  
In [PERSON]'s model, as depicted in Figure 2b, the probability that sensor \(i\) detects a target on grid point \(v\) is:  
\[p_{vi}= \begin{cases}1&\text{if }r-r_{e}\geq d_{vi}\\ e^{-\lambda a^{\beta}}&\text{if }r_{e}>|r-d_{vi}|\\ 0&\text{if }d_{vi}\geq r+r_{e}\end{cases}  \tag{7}\]  
where \(r\) is the sensing range, \(r_{e}\) (\(r_{e}<r\)) is a measure of uncertainty in sensor detection, \(\lambda\) and \(\beta\) are parameters that model different sensor characteristics and \(a=d_{vi}-r+r_{e}\). The parameters \(r\), \(r_{e}\), \(\lambda\) and \(\beta\) are adjusted according to the physical properties of the sensor. In particular, \(r\) and \(r_{e}\) affect the threshold distances of target detection. In [15], \(\lambda=0.2\), and \(\beta=0.6\). We approximate \(r_{e}=0.25\times r\) and set the probability threshold to 0.9, _i.e._, a point cannot be sensed if its probability is less than this threshold. In this work, we assume that sensor nodes cannot sense through walls and doors. We also assume that users may require different coverage degrees for special rooms, such as a server room and an electrical room. WSN-Maintain allows users to do this by clicking a point inside a room and specifying the coverage requirement. The total coverage percentage is calculated as the ratio of the total area satisfying the coverage requirements to the total interior area of the building. **Export topology file, export on/off binary file, read topology file and read node on/off status:** WSN-Maintain communicates with Cooja by exporting a topology file specifying network connectivity and a binary file specifying the on/off status of nodes. Note that with UDGM, the topology file specifies transmission range and interference range in meters, as well as the transmission success ratio and the receive success ratio in the range of [0, 1].