## 6 Method Description  
This section describes the method that analyses the quality of the links between nodes in a Wireless Sensor Network (WSN) in the presence of other coexisting networks. In Section 4 we introduced some metrics that can be used to characterize and determine the quality of the available frequency channels. In Section 5 we described different frequency hopping techniques which select a subset of channels and define a hopping sequence, avoiding channels with lower quality metrics to a greater or a lesser extent depending on the hopping technique. These quality metrics and hopping techniques are interlaced and compared to find the best subset of channels and hopping sequence that result in a minimum number of interferences, improving network throughput, reliability and resilience against security attacks. The proposed method can be divided in the following steps:  
1. Evaluation of the interfering environment. 2. Frequency channel selection. 3. Packet Error Rate (PER) calculation. 4. Determination of the topology. In the first step, the interfering environment is evaluated by determining the noise coming from coexisting networks. The interfering noise is evaluated at every point of interest, that is, at every location of the nodes of the WSN under study. Over a specified observation time, the RSSI values are measured for each of the centre frequencies of the available channels in the WSN of interest. From this RSSI values, all the quality metrics of Section 4 are calculated. Figure 2 showed an example of RSSI measurements for an observation time of 1 s and for the 16 channels available in a IEEE 802.15.4 network, from which the statistical properties of Figure 4 were calculated. In the next step, frequency channel selection, the optimal subset of channels is calculated for each of the available quality metrics of Section 4 and hopping techniques of Section 5. The quality metrics are normalized according to Equations (3) and (4) to obtain a normalized channel gain, \(H\), that can be used for every hopping technique of Section 5. The result will be a _nxm_ matrix containing a subset of channels for each combination of quality metric and hopping technique, \(n\) being the number of employed quality metrics and \(m\) the number of employed hopping techniques. Along with the subset of channels, the hopping sequence is also calculated, that is, the frequency to be used every time the system hops from one channel to another. The obtained hopping sequence will be used by the WSN of interest for a specified operation time. Figure 13 shows the observation time during which the interfering environment is evaluated and the operation time during which the WSN of interest operates. An example of channel occupancy for WLAN, LR-WPAN and Bluetooth networks is also represented. WLAN and LR-WPAN networks stay in static channels with 22 MHz and 3 MHz  
Figure 12: Comparison of channel usage between different frequency hopping techniques: (**a**) WRFH; (**b**) UBAFH with \(\alpha=10\); (**c**) UBAFH with \(\alpha=100\); (**d**) SAFH with \(c=10\); (**e**) SAFH with \(c=100\). bandwidth respectively. In order to simplify the example, the Bluetooth network hops over only three channels with 1 MHz bandwidth. Once the interfering environment is evaluated and the best frequency sequence is determined, the Packet Error Rate (PER) is calculated for every possible bidirectional connection between nodes of the WSN of interest. For an error to occur in the communication between two nodes, the signal of interest and the interfering noise must coexist in time and frequency, and the Signal to Noise Ratio (SNR) must be higher than the receiving sensitivity. The propagation of the signal of interest is modelled according to the free-space path loss model:  
\[P_{d}=P_{0}\cdot\left(\frac{4\pi df}{c}\right) \tag{26}\]  
where \(P_{o}\) is the transmission power, \(f\) the signal frequency, \(c\) the speed of light and \(P_{d}\) the received power at distance \(d\).