sensors

Article A Method for Dynamically Selecting the Best Frequency Hopping Technique in Industrial Wireless Sensor Network Applications

Erlantz Fernández de Gorostiza 1,*, Jorge Berzosa 1 ID , Jon Mabe 1 and Roberto Cortiñas 2 ID

1 Electronics and Communications Unit, IK4-Tekniker, Calle Iñaki Goenaga 5, 20600 Eibar, Spain; [email protected] (J.B.); [email protected] (J.M.) 2 Computer Science Faculty, University of the Basque Country UPV/EHU, Paseo M. Lardizábal 1, 20018 Donostia-San Sebastián, Spain; [email protected] * Correspondence: [email protected]; Tel.: +34-943-20-6744

Received: 29 December 2017; Accepted: 20 February 2018; Published: 23 February 2018

Abstract: Industrial wireless applications often share the communication channel with other wireless technologies and communication protocols. This coexistence produces interferences and transmission errors which require appropriate mechanisms to manage retransmissions. Nevertheless, these mechanisms increase the network latency and overhead due to the retransmissions. Thus, the loss of data packets and the measures to handle them produce an undesirable drop in the QoS and hinder the overall robustness and energy efficiency of the network. Interference avoidance mechanisms, such as frequency hopping techniques, reduce the need for retransmissions due to interferences but they are often tailored to specific scenarios and are not easily adapted to other use cases. On the other hand, the total absence of interference avoidance mechanisms introduces a security risk because the communication channel may be intentionally attacked and interfered with to hinder or totally block it. In this paper we propose a method for supporting the design of communication solutions under dynamic channel interference conditions and we implement dynamic management policies for frequency hopping technique and channel selection at runtime. The method considers several standard frequency hopping techniques and quality metrics, and the quality and status of the available frequency channels to propose the best combined solution to minimize the side effects of interferences. A simulation tool has been developed and used in this work to validate the method.

Keywords: wireless sensor networks; robustness; coexistence mechanisms; interference avoidance; security; frequency hopping; channel characterization

1. Introduction Wireless Sensor Networks (WSN) are one of the industrial applications that benefit the most from the license-free nature of the Industrial, Scientific and Medical (ISM) band. Nevertheless, the ISM band has to be shared with other devices and systems using standard communication protocols such as Wireless Local Area Network (WLAN) or [1]. This situation leads to interferences in the communication channel and, as a result, produces (pseudo-) random transmission errors. Re-transmitting interfered packets might eventually succeed, but at the expense of increased latency and energy consumption of the devices. Lost packets and increased latency directly affect the QoS of the network, first by the direct loss of arbitrary packets and second by the side effects of the missed packets such as breaking a multi message or state-full process that has to be started from the beginning (i.e., pairing, network establishment, discovery, etc.) [2].

Sensors 2018, 18, 657; doi:10.3390/s18020657 www.mdpi.com/journal/sensors Sensors 2018, 18, 657 2 of 34 Sensors 2017, 17, x FOR PEER REVIEW 2 of 33

Additionally, notnot all all interferences interferences are unintentionallyare unintentionally produced produced by coexisting by coexisting networks. networks. External Externalattackers attackers may try to may block try theto block communication the communication channel in channel order to in perform order to aperform Denial ofa Denial Service of (DoS) Service [3] (DoS)attack. [3] DoS attack. security DoS security attacks areattacks specifically are specifical designedly designed for interfering for interfering with thewith communication the communication link, link,either either hindering hindering or totally or totally blocking blocking the communication the communication channel. channel. Thus, Thus, communication communication protocols protocols that thatdo not do appropriately not appropriately manage manage the communication the communica channeltion channel may not may be able not to be provide able to a satisfactoryprovide a satisfactorysecurity level. security level. All in all, all, interference interference avoidance avoidance mechanisms that reduce the need need for for retransmissions retransmissions are highly highly desired in WSN domains in order order to minimize minimize ener energygy consumption, consumption, reduce reduce unnecessary degradation of QoS and reliability as well as to raise security. In this paper we present a methodmethod for supportingsupporting the design of communicationcommunication solutions for saturated and dynamic environments from the point of view ofof channelchannel interference.interference. This method characterizes frequency hopping techniques based on the the quality quality of of the the available available frequency frequency channels. channels. Frequency hopping techniques relay on the use of multiple frequency channels over time as opposed to statically allocating and using a single frequency channel. The main idea is that, in case of channel interference, frequency hopping helps in minimizing the side side effects effects by by avoiding avoiding (at (at least least temporally) temporally) the interfered frequency. Figure 11 shows shows aa frequencyfrequency hoppinghopping scheduleschedule exampleexample inin whichwhich multiplemultiple frequency channels are selected at different timetime instants.instants.

Figure 1. Example of a Frequency Hopping schedule.

The core of the method is based on several standard frequency hopping techniques as well as The core of the method is based on several standard frequency hopping techniques as well quality metrics for the characterization of available and valid frequency channels. The proposed as quality metrics for the characterization of available and valid frequency channels. The proposed method homogenizes the notation used to describe the different techniques and normalizes the method homogenizes the notation used to describe the different techniques and normalizes the different different quality metrics based on the statistical properties of the RSSI values. Thanks to the quality metrics based on the statistical properties of the RSSI values. Thanks to the homogenization homogenization and normalization, the different techniques can be fairly compared based on quality and normalization, the different techniques can be fairly compared based on quality and performance and performance indicators. Additionally, the method is flexible enough to accommodate new indicators. Additionally, the method is flexible enough to accommodate new frequency hopping frequency hopping techniques, quality metrics and performance indicator approaches. Thus, it is techniques, quality metrics and performance indicator approaches. Thus, it is scalable and extensible scalable and extensible with new additions. with new additions. All the techniques and metrics are combined into a two-dimensional matrix. Each technique and All the techniques and metrics are combined into a two-dimensional matrix. Each technique and metric pair represents a possible solution which provides a subset of selected or preferred channels metric pair represents a possible solution which provides a subset of selected or preferred channels and the sequence in which the channels are used. For some techniques, this sequence is purely and the sequence in which the channels are used. For some techniques, this sequence is purely random random while for others the sequence will change based on specific parameters. For instance, in while for others the sequence will change based on specific parameters. For instance, in techniques techniques based on probabilistic channel usage, there are channels within the subset which are used based on probabilistic channel usage, there are channels within the subset which are used more often more often because they are considered to be of “better” quality. On the other hand, and regarding because they are considered to be of “better” quality. On the other hand, and regarding quality metrics, quality metrics, some metrics are better suited for characterizing static interferences while others are better used for dynamic interferences that hop between channels.

Sensors 2018, 18, 657 3 of 34 some metrics are better suited for characterizing static interferences while others are better used for dynamic interferences that hop between channels. All the solutions from the matrix are compared to determine the best one: the solution that results in the fewer number of interferences for the given interference range, either produced by coexisting networks or by external factors (such as malicious attacks). The proposed method can be used in two complementary scenarios: (a) as a deployment planning supporting tool in order to decide on the best frequency channels, channel quality metrics and frequency hopping techniques and (b) as a runtime management component for the dynamic allocation of communication frequency channel. In the former case, a network topology can be planned based on the frequency channel subset, channel hop sequence and the number of hops of each node to the gateway. In the latter case, the management component can be implemented into a device which will monitor the quality of the environment using the selected quality metric and dynamically adapt to the environment conditions by switching to the most suitable frequency hopping technique. Additionally, the method can also take into account the characteristics of constrained systems (either computationally or energetically) in order to select the most suitable solution. To the best knowledge of the authors, this is the first attempt to define a method that homogenizes, combines and compares several frequency-hopping techniques for network deployment and real-time adaptation. As will be shown in Section3, current approaches compare either different frequency hopping techniques or characterization metrics, but no common comparison is made to specify the best solution taking into account frequency channel quality behaviour and its evolution over time. No technique found in the SoTA adapts the frequency hopping technique dynamically to the environment conditions. Several frequency hopping techniques are analysed, but their use is not modified at run time (nor the quality metric) if the interferences pattern (and frequency channel quality) changes in the medium-long term. This paper only considers the theoretic validation of the proposed method in simulated scenarios. The method has been implemented as a Matlab tool, which has been used in this work for testing and validation purposes. The validation considers realistic network coexistence and interference scenarios and applies the method to compute the best solution for the given scenario, evaluating frequency channel interference in terms of Packet Error Rate (PER). Thus, the Matlab tool is used as a deployment planning supporting tool and its efficiency is evaluated. The paper is structured as follows: Section2 presents a summary of the current interference avoidance mechanisms used in standard communication protocols, followed by Section3 which includes the related work for this paper. Section4 summarizes the metrics used by the method to characterize and determine the quality of the available frequency channels. Section5 introduces the different frequency hopping techniques considered by the method. Section6 describes the core of the method and Section7 presents the evaluation. Finally, Section8 summarizes and concludes the paper pointing out future steps.

2. Interference Avoidance in Standard Protocols Within the 2.4 GHz ISM band, different standards have been developed to enable interoperability between devices. Each of these standards uses a different mechanism for interference avoidance. The well-known and widely used Wireless Local Area Network (WLAN), for instance, adopts the IEEE 802.11 standard [4] which makes use of Direct Sequence (DSSS) [5]. In DSSS the message signal is modulated with a bit sequence known as Pseudo (PN) that consists of pulses of a much shorter duration (larger bandwidth) than the pulse duration of the message signal. The same PN code is used by the receiver to reconstruct the message signal. The of the signal makes the resulting signal noisier and, thus, more immune to unintentional or intentional interference. WLAN divides the 2.4 GHz ISM band into 11 channels with 22 MHz bandwidth each. Thus, only three channels can be used at the same time avoiding overlapping of the frequency bands. DSSS is not suitable to low-power systems due to the high data rates involved. Sensors 2018, 18, 657 4 of 34

The IEEE 802.15 standard [6] is the base for Wireless Personal Area Networks (WPAN). Here, the range is smaller than for the WLAN, but the energy consumption is considerably reduced. The first sub-standard IEEE 802.15.1 is known as Bluetooth [7], which uses Frequency Hopping Spread Spectrum (FHSS) [5]. In FHSS the message signal is transmitted by rapidly switching among many frequency channels, using a pseudorandom sequence known to both transmitter and receiver. FHSS divides the available frequency band into sub-bands or channels, and hops among them in a predetermined order. Bluetooth divides the 2.4 GHz ISM band into 79 channels with 1MHz bandwidth each, and hops from channel to channel up to 1600 times per second. Even if Bluetooth is more energetically efficient than WLAN, it is not suitable for some applications where autonomous operation of battery-powered devices is desirable. The sub-standard for Low-Rate Wireless Personal Area Networks (LR-WPAN) is IEEE 802.15.4 [8], which divides the spectrum into 16 non-overlapping channels (starting from channel 11 to channel 26) with a channel width of 3 MHz. The manifold benefits of wireless technologies, specially the absence of cables, make Wireless Sensor Networks (WSN) attractive for industrial applications as well. However, the adoption of wireless technologies in industry poses extra challenges, mainly because factory environments are typically harsh in terms of interferences, noise and physical obstacles. Several industrial organizations, such as ZigBee [9], HART [10] and ISA [11] have been promoting the use the IEEE 802.15.4 standard to introduce wireless technologies in industrial applications. While ZigBee only utilizes DSSS provided by the IEEE 802.15.4 physical layer, WirelessHART [10] and ISA100 [12] adopt channel hopping and channel blacklisting to improve the data transmission reliability [13]. In ZigBee, all the transmissions stay on the same channel unless the entire network decides to hop to another channel. WirelessHART uses only 15 of the 16 channels defined by the IEEE 802.15.4: channels 11 to 25. Channel 26 is not included as the corresponding frequency is not allowed in some countries [14]. Communication among network devices is arbitrated using Time Division Multiple Access (TDMA) [15], which allows for the scheduling of link activity. To enhance reliability, TDMA is combined with channel hopping mechanisms. WirelessHART employs non-adaptive frequency hopping where each link in the network switches randomly between the 15 available channels. Moreover, channels subject to interference may be eliminated due to blacklisting, and so, the number of available channels may be less than 15. Transmissions are synchronized in 10 ms timeslots and during each timeslot all available channels can be used simultaneously by the various nodes in the network. This allows 15 packets to be propagated through the network at the same time while minimizing the risk of collisions. Like WirelessHART, ISA100 uses TDMA along with collision avoidance mechanisms, such as Carrier Sense Multiple Access with Collision Avoidance (CSMA-CA) and Clear Channel Assessment (CCA) [16], resulting in increased data transmission reliability. Before packets are transmitted, the transmitter listens on the channel on which it intends to transmit in order to assess if the channel is clear. If the channel is not clear, the transmitter backs off for a random amount of time, after which it attempts to retransmit the packet. Devices communicate according to various channel hopping techniques, with each subsequent transmission utilizing the next channel defined in the hopping sequence. Different devices use different offsets in the hopping sequence, resulting in interleaved hopping of devices operating in a wireless subnet. Every data packet needs to be acknowledged by the receiving device, and unacknowledged packets are retransmitted on a different channel over a different frequency. Hopping techniques include channel blacklisting and adaptive hopping. Channel blacklisting is a centralized decision made by the system manager, while adaptive hopping is a localized decision based on statistics of wireless parameters collected by each device. Adaptive hopping allows wireless devices to adapt their hopping sequences based on the quality of communication with specific neighbours.

3. Related Work There is a significant amount of literature that contains studies of the performance and coexistence of the different IEEE standards. The authors in [17], for instance, examine the reliability of a point to Sensors 2018, 18, 657 5 of 34 point communication with a real IEEE 802.15.4 hardware by measuring the Packet Error Rate (PER) and the Received Signal Strength Indicator (RSSI), both in indoor and outdoor RF environments. The obtained results are used to calibrate the error model in the ns-2 network simulator in order to produce a more real simulation environment and evaluate the IEEE 802.15.4 network performance in a more reliable way. Furthermore, the coexistence between IEEE 802.15.4 and IEEE 802.11 networks is addressed, measuring the impact these two wireless technologies have on each other when operating concurrently and in range. It is concluded that the IEEE 802.15.4 network operation has practically no negative influence on a concurrent IEEE 802.11 communication, but if no care is taken about the operational channels of the two technologies, the IEEE 802.11 network will have a negative effect on the performance of the IEEE 802.15.4 network. From the performed measurements, there should be at least 7 MHz offset between the operational frequencies for a satisfactory performance of the IEEE 802.15.4 network. In [1], the coexistence between IEEE 802.11, IEEE 802.15.1 and IEEE 802.15.4 is examined through mathematical analysis. For different combinations of affected and interfering networks, the PER caused by cross-technology interference is calculated. This PER is calculated from the Signal to Noise Ratio (SNR) at the affected wireless network receiver, and it is evaluated in terms of distance between interfering and affected networks, packet interval and channel separation. When varying the interferer distance from the receiver or the packet interval, the transmitter and interferer channels are chosen as follows: IEEE 802.11 on channel 1 (2412 MHz), IEEE 802.15.1 on channel 3 (2410 MHz) and IEEE 802.15.4 on channel 12 (2410 MHz), thus constituting co-channel interference. When varying the channel separation, the interferer channel separation from the transmitter is varied from −15 to 15 MHz, thus constituting adjacent channel interference. It is concluded that the IEEE 802.15.1 is more affected by IEEE 802.15.4 interference than vice versa. On the other hand, the IEEE 802.15.1 results to be more resistant than IEEE 802.15.4 against IEEE 802.11 interference. Nevertheless, these studies do not deepen in interference avoidance mechanisms such as frequency hopping. Some other work can be found in the literature related to models and simulators of frequency hopping systems [18–20]. The authors in 18 modelled a frequency hopping wireless communication system based on the Signal Processing Worksystem (SPW) developed by CoWare (acquired by Synosys in 2010) [21]. The designed system is tested in terms of its Bit Error Rate (BER) performance under broadband and partial-band noise. The interfering noise is generated and modelled as the sum of a broadband Additive White Gaussian Noise (AWGN) and a multi-tone interference noise, where the jammer spreads some interference signals on a number of discrete frequency points. The system defines 32 frequency channels, and the frequency hopping pattern is generated according to a certain pseudo-random algorithm. In [19], a simulator is designed to simulate and evaluate a frequency hopping spread spectrum communication systems using VisSim Comm software [22], which is mainly designed to simulate and analyse communication systems. The presented simulator is capable of simulating a complete system (transmitter, receiver and medium) operating under a noisy environment. The carrier frequencies for the FHSS system are varied in a pseudorandom manner within a wideband channel. The performance of the communication system is evaluated in terms of BER, and it is concluded that the FHSS significantly reduces the probability of error of a system operating under narrow band jamming conditions. In [20], mathematical modelling is used to simulate and analyse the performance improvement using frequency hopping spread spectrum with popular modulation techniques using Matlab-Simulink. The baseband signal is combined with a randomly generated carrier frequency. The carrier frequency is controlled by a Pseudorandom Noise (PN) sequence generator and the signal is transmitted over AWGN. The received data is demodulated using the same PN code, and compared to the original input data to calculate the BER. Theses simulators deal only with frequency hopping systems with pseudorandom frequency sequences, and do not consider adaptive frequency hopping techniques, where the selected Sensors 2018, 18, 657 6 of 34 frequency channels are adapted to the conditions and characteristics of the environment interferences. The method presented here takes into consideration different hopping techniques and channel quality metrics found in the literature. These hopping techniques and metrics are interlaced to analyse different possible solutions and obtain the best subset of channels as well as a predetermined hopping sequence for a given scenario where the network under study has to coexist with unwanted interfering networks.

4. Channel Characterization Metrics This section describes the different channel characterization metrics taken into consideration in the analysis.Sensors Different2017, 17, x FOR quality PEER REVIEW metrics can be used in order to classify frequency channels6 of 33 based on interferencepredetermined level. Regardless hopping sequence of the metricfor a given used, scenario the methodwhere the must network classify under study lowly has interfered to coexist channels as “good”with and unwanted highly interfering interfered networks. channels as “bad”. The Received Signal Strength Indicator (RSSI), for instance, measures the RF power level received by an antenna. The channel is characterized by 4. Channel Characterization Metrics its centre frequency and bandwidth. The higher the RSSI signal, the worse the channel, as it is highly interfered byThis unwanted section describes coexisting the different systems. channel RSSI characterization is usually measured metrics taken in dBm into units,consideration that is, in the power the analysis. Different quality metrics can be used in order to classify frequency channels based on ratio (P) in decibels (dB) referred to one milliwatt (mW): interference level. Regardless of the metric used, the method must classify lowly interfered channels as “good” and highly interfered channels as “bad”. The Received Signal Strength Indicator (RSSI), P(mW) for instance, measures the RF power level received by an antenna. The channel is characterized by its P(dBm) = 10· log10 (1) centre frequency and bandwidth. The higher the RSSI signal,1 mW the worse the channel, as it is highly interfered by unwanted coexisting systems. RSSI is usually measured in dBm units, that is, the power The RF power level of a radio signal ranges between 0 dBm and −120 dBm. The closer this value ratio (P) in decibels (dB) referred to one milliwatt (mW): is to −120 dBm, the better, because that means there is little(mW) to no interference. Typical lowly interfered (dBm) =10·log (1) environments range between −100 dBm and −80 dBm. 1mW Alternatively,The RF frequencypower level channelsof a radio signal can be ranges classified between using 0 dBm Packet and −120 Error dBm. Rate The (PER),closer this which value represents is to −120 dBm, the better, because that means there is little to no interference. Typical lowly interfered the rate of non-received to sent frames. A channel is classified as bad if its PER exceeds the system environments range between −100 dBm and −80 dBm. defined threshold.Alternatively, Bit Error frequency Rate (BER)channels can can be be used clas insified a similar using Packet way. Error Rate (PER), which In therepresents following the rate sections of non-received we will to sent focus frames. on A thechannel RSSI is classified as a channel as bad if qualityits PER exceeds indicator, the as the measurementssystem defined and calculations threshold. Bit involved Error Rate with(BER) RSSIcan be areused less in a complicated,similar way. and RSSI values are easily available fromIn thethe chipsets.following However,sections we thewillwork focus presentedon the RSSI here as a is channel equally quality applicable indicator, to otheras the indicators measurements and calculations involved with RSSI are less complicated, and RSSI values are easily (such as PER)available with from little the or chipsets. no modification. However, the RSSI work values presented must behere measured is equally over applicable a specified to other observation time for allindicators the available (such as PER) channel with little frequencies. or no modification. Figure 2RSSI shows values an must illustrative be measured example over a specified of RSSI signals over an observationobservation time time for of all 1 the s for available the 16 channel channels freque availablencies. Figure in an 2 shows 802.15.4 an illustrative network. example On purpose, of some channelsRSSI are signals affected over only an observation by white time noise, of 1 while s for the others 16 channels are interfered available in to an a 802.15.4 greater network. or lesser On extent by purpose, some channels are affected only by , while others are interfered to a greater or some coexisting systems. lesser extent by some coexisting systems.

Figure 2.FigureExample 2. Example of Received of Received Signal Signal Strength Strength IndicatorIndicator (RSSI) (RSSI) signal signal over over 1 second 1 sfor for anan IEEE 802.15.4 network802.15.4 with 16 network channels. with 16 The channels. RSSI valuesThe RSSI lie values within lie within−120 − dBm120 dBm and and 0 dBm.0 dBm. Higher RSSI RSSI values values indicate channels interfered to a greater extent, while lower RSSI values indicate channels indicate channelsinterfered to interfered a lesser extent. to a greater extent, while lower RSSI values indicate channels interfered to a lesser extent.

Sensors 2018, 18, 657 7 of 34

From RSSI values, different statistical properties can be obtained for channel characterization [23]. These statistical properties are calculated over a specified observation time for every available frequency channel.

• Mean value (mean): A low mean value of the RSSI signal over the observation time indicates low RF power in the channel and, thus, a lowly interfered channel. The lower the mean value, the better the channel. • Standard deviation (std): A high standard deviation indicates a highly interfered channel because of the high variability of the RF power. The lower the standard deviation, the better the channel. • Skewness (skew): The skewness indicates the asymmetry of the RSSI distribution. A symmetric distribution, which means skewness of around zero, is expected when the RSSI signal is only affected by white noise and no interfering radio transmissions. When multiple RSSI peaks occur due to radio transmissions, the distribution of the RSSI signal extends to higher values and, thus, a higher value of skewness is expected. The skewness of a signal, x, is calculated by Equation (2), where n is the number of RSSI samples, mean(x) the mean value and std(x) the standard deviation of x. 3 1 ∑n (x − mean(x)) skew(x) = i=1 i (2) n std(x)3

• x% quantile (quan): The x% quantile of a set of samples describes the cut value which divides the statistical distribution so that x% of the samples are below the cut value. A simple way to calculate the quantile is to sort the RSSI values and find the entry with the index corresponding to the x% of the vector length. The lower this value, the less peaks occur in the RSSI signal and the lower interference from other radio systems is expected. • Number of samples over threshold (soth): It is the number of RSSI samples over a specified power level threshold. The lower this value, the less peaks occur in the RSSI signal.

All mentioned properties have in common that lower values indicate less interference and thus better channels. These properties must be transformed into a channel gain metric, H, that is directly proportional to the channel quality, so that it can be directly introduced in the equations presented in Section5. To do this, a simple linear adjustment is performed:

H = α·x + β (3) where x is an arbitrary statistical property of the RSSI signal and α and β are parameters to be adjusted. Furthermore, the H metric is normalized between [0, 1], so that the α and β parameters are derived in the following way: [min(x), max(x)] → [1, 0] ) ( 1 1 = α·min(x) + β α = − (4) → min(x) max(x) 0 = α·max(x) + β = − max(x) β min(x)−max(x) Figure3 shows an illustrative example of this linear projection from the mean value of the RSSI signal (that ranges from −120 dBm to 0 dBm) to a normalized quality metric. The power metric presented in Equation (5), Q = |H|2, is also represented. For the RSSI values in Figure2, the calculated statistical properties are represented in Figure4. The derived channel gains are represented in Figure5. Sensors 2018, 18, 657 8 of 34 Sensors 2017, 17, x FOR PEER REVIEW 8 of 33

Sensors 2017, 17, x FOR PEER REVIEW 8 of 33

FigureFigure 3. 3.Example Example ofof linearlinear projectionprojection from from the the mean mean valu valuee of of the the RSSI RSSI signal signal (blue) (blue) to a to normalized a normalized

channelchannel gain,gain, H (red).(red). The The dashed dashed red line red represents line represents the power the metric, power Q metric,, derivedQ ,from derived the channel from the Figure 3. Example of linear projection from the mean value of the RSSI signal (blue) to a normalized channelgain. gain. channel gain, H (red). The dashed red line represents the power metric, Q, derived from the channel gain.

FigureFigure 4. Different 4. Different statistical statistical properties properties obtained obtained from from the the RSSI RSSI valuesvalues in Figure 2:2: ( (aa)) Mean Mean value; value; (b ()b ) Figure 4. Different statistical properties obtained from the RSSI values in Figure2:( a) Mean value; StandardStandard deviation; deviation; (c) (Skewness;c) Skewness; (d ()d 50%) 50% quantile; quantile; ( e(e) )SOTH SOTH withwith −−70 dBm threshold.threshold. (b) Standard deviation; (c) Skewness; (d) 50% quantile; (e) SOTH with −70 dBm threshold.

Sensors 20172018, 1718, x 657 FOR PEER REVIEW 99 of of 33 34

Gain

FigureFigure 5. 5. NormalizedNormalized channel channel gains gains from from RSSI RSSI st statisticalatistical properties of Figure 44..

It can be observed that most of the statistical properties result in similar channel gains for the It can be observed that most of the statistical properties result in similar channel gains for the considered RSSI signal. This does not stand for the skewness metric, which suggests that channels 2, considered RSSI signal. This does not stand for the skewness metric, which suggests that channels 2, 6, 10 and 14 are worse than channels 4, 8 and 12, for instance. Even if channels 2, 6, 10 and 14 have 6, 10 and 14 are worse than channels 4, 8 and 12, for instance. Even if channels 2, 6, 10 and 14 have higher interfering power peaks, they also have more continued traffic, resulting in a more symmetric higher interfering power peaks, they also have more continued traffic, resulting in a more symmetric skewness function and, thus, lower skew values. Therefore, the skewness metric would be a better skewness function and, thus, lower skew values. Therefore, the skewness metric would be a better indicator of channel quality when dealing with dynamic interferences that vary a lot in time, while indicator of channel quality when dealing with dynamic interferences that vary a lot in time, while the the others would be better when dealing with static interferences that hold in time. others would be better when dealing with static interferences that hold in time. So, one of the open questions will be to find the most appropriate metric for a reliable channel So, one of the open questions will be to find the most appropriate metric for a reliable channel quality indicator. Even more, for some metrics, some parameters will have to be adapted for each quality indicator. Even more, for some metrics, some parameters will have to be adapted for each specific application (the cut value and the power threshold for the x% quantile and SOTH specific application (the cut value and the power threshold for the x% quantile and SOTH respectively). respectively). One of the main objectives of the proposed method is to automatically decide the best One of the main objectives of the proposed method is to automatically decide the best RSSI property RSSI property for each specific scenario. for each specific scenario. 5. Frequency Hopping Techniques 5. Frequency Hopping Techniques This section describes the different frequency hopping techniques taken into consideration in This section describes the different frequency hopping techniques taken into consideration the analysis. Hopping techniques determine not only the subset of channels, but also the way these in the analysis. Hopping techniques determine not only the subset of channels, but also the channels are scheduled. Frequency hopping techniques can be classified as either channel-ignorant way these channels are scheduled. Frequency hopping techniques can be classified as either or channel-aware [24]. With channel-ignorant frequency hopping techniques, the hopping pattern is channel-ignorant or channel-aware [24]. With channel-ignorant frequency hopping techniques, selected regardless of the channel characteristics, whereas with channel-aware frequency hopping the hopping pattern is selected regardless of the channel characteristics, whereas with channel-aware techniques, the hopping pattern is selected after determining the channel characteristics. Channel- frequency hopping techniques, the hopping pattern is selected after determining the channel aware hopping techniques can be further classified as reduced-hop-set and probabilistic-channel- characteristics. Channel-aware hopping techniques can be further classified as reduced-hop-set and usage techniques [24–26]. Algorithms based on reduced hop sets totally avoid bad channels. On the probabilistic-channel-usage techniques [24–26]. Algorithms based on reduced hop sets totally avoid other hand, algorithms based on probabilistic channel usage use all channels, although bad channels bad channels. On the other hand, algorithms based on probabilistic channel usage use all channels, are assigned a smaller usage probability that depends on environmental conditions. Figure 6 although bad channels are assigned a smaller usage probability that depends on environmental summarizes the frequency hopping technique types. These techniques are explained in more detail conditions. Figure6 summarizes the frequency hopping technique types. These techniques are in the following subsections. explained in more detail in the following subsections.

Sensors 2018, 18, 657 10 of 34 Sensors 2017, 17, x FOR PEER REVIEW 10 of 33

Figure 6. Classification of frequency hopping techniques. Figure 6. Classification of frequency hopping techniques.

5.1. Channel-Ignorant Techniques 5.1. Channel-Ignorant Techniques

RandomRandom FrequencyFrequency Hopping Hopping InIn Random Random Frequency Frequency Hopping Hopping (RFH) (RFH) [27 ],[27], the availablethe available frequency frequency band isband divided is divided into K narrow into sub-bands,narrow sub-bands, and transmission and transmission is carried is outcarried by transmitting out by transmitting short bursts short of bursts data onof onedata sub-band on one sub- at aband time, at hopping a time, hopping from sub-band from sub-band to sub-band to sub-band in a pseudo-random in a pseudo-random way. way. WithWith channelchannel ignorant ignorant techniques techniques such such as asRFH, RFH, over over a sufficiently a sufficiently large largeamount amount of time, of all time, sub- allbands sub-bands will be will used be a used roughly a roughly equal equal number number of time of times,s, and and so, so,transmission transmission over over bad bad sub-bands sub-bands is isinevitable. inevitable. This This will will cause cause system system performance performance degra degradationdation resulting resulting in high in high packet packet error error rates. rates. To Tosolve solve this this problem, problem, channel-aware channel-aware frequency frequency hoppi hoppingng techniques techniques are are proposed, where thethe hoppinghopping patternpattern is is selected selected after after determining determining the channel the channe characteristics.l characteristics. Channel-aware Channel-aware or adaptive or frequency adaptive hoppingfrequency algorithms hopping algorithms are able to are provide able to better provide throughput better throughput against static against interferences, static interferences, dynamic interferencesdynamic interferences or both static or both and dynamicstatic and interferences, dynamic interferences, but they might but bethey more might vulnerable be more to vulnerable jamming attacksto jamming as they attacks decrease as they the dec frequencyrease the diversity. frequency diversity.

5.2.5.2. Channel-Aware,Channel-Aware, Reduced-Hop-Set Reduced-Hop-Set Techniques Techniques

FrequencyFrequency hopping hopping techniques techniques based based on on reduced reduced hop hop sets sets select selectM channels channels from from the the available availableK channels, channels, and and hop hop among among them them in a in pseudo-random a pseudo-random manner. manner. 5.2.1. Highest Gain Frequency Hopping 5.2.1. Highest Gain Frequency Hopping The most obvious example of the reduced-hop-set techniques is the Highest Gain Frequency The most obvious example of the reduced-hop-set techniques is the Highest Gain Frequency Hopping (HGFH), where the selected M channels are the ones with highest gain. Hopping (HGFH), where the selected channels are the ones with highest gain. 5.2.2. Matched Frequency Hopping 5.2.2. Matched Frequency Hopping Channels with high gains tend to be adjacent to each other, and so, it might be easier for a jammer Channels with high gains tend to be adjacent to each other, and so, it might be easier for a jammer to jam adjacent frequency channels. The Matched Frequency Hopping (MFH) not only selects channels to jam adjacent frequency channels. The Matched Frequency Hopping (MFH) not only selects with high gains, but also tries to select channels with dispersed frequencies [28]. In this technique, channels with high gains, but also tries to select channels with dispersed frequencies [28]. In this the main parameter used to select the M channels is the set of channel gains, Hk, from which the power technique, the main parameter used to select the channels is the set of channel gains, , from metrics, Qk, are calculated: which the power metrics, , are calculated: 2 Qk = |Hk| (5) = || (5) To select channels with high gains and reasonably well-spaced frequencies, a normalized power

metric, , and a cumulative metric, , are defined:

Sensors 2018, 18, 657 11 of 34

To select channels with high gains and reasonably well-spaced frequencies, a normalized power metric, Bk, and a cumulative metric, Ck, are defined:

Q = k ∈ { } Bk K k 1, 2, . . . , K (6) ∑i=1 Qi

Sensors 2017, 17, x FOR PEER REVIEW k 11 of 33 Ck = ∑ Bi (7) i=1 = ∈1,2, … , (6) The cumulative metric will always∑ be a monotonically increasing function of k. This metric is used with the M equally spaced values over [0,= 1) given by (7) The cumulative metric will always1  be a monotonically1  increasing function of . This metric is ym = m − m ∈ {1, 2, . . . , M} (8) used with the equally spaced valuesM over [0,2 1) given by = − ∈1,2, … , (8) to determine the indices of the selected channels. The index of the mth channel is given by the value of to determine the indices of the selected channels. The index of the mth channel is given by the value k such that of such that Ck−1 ≤ ym < Ck (9) ≤ < (9) Figure7 illustrates how M = 10 channels are selected among K = 100 available channels using Figure 7 illustrates how =10 channels are selected among = 100 available channels this method. For the considered metric, using the highest gain technique would result in selecting the using this method. For the considered metric, using the highest gain technique would result in first five and last five channels, while only attending to channel separation would result in equally selecting the first five and last five channels, while only attending to channel separation would result spacedin channels.equally spaced The MFH channels. algorithm The MFH tends algorithm to select channelstends to select with highchannels gains with while high avoiding gains while selecting clustersavoiding of adjacent selecting channels. clusters of adjacent channels.

Figure 7. Channel selection for Matched Frequency Hopping (MFH) technique. The red line Figure 7. Channel selection for Matched Frequency Hopping (MFH) technique. The red line represents represents the channel gain and the blue line represents the cumulative sum of the power metric. The the channel gain and the blue line represents the cumulative sum of the power metric. The selected selected channels are represented as vertical black lines. The best channels are selected from the channelsintersections are represented between asthevertical cumulative black metric lines. and The thebest equally channels spaced arehorizontal selected lines. from the intersections between the cumulative metric and the equally spaced horizontal lines. 5.2.3. Clipped Matched Frequency Hopping 5.2.3. ClippedThe Clipped Matched Matched Frequency Frequency Hopping Hopping (CMFH) is an evolution of the MFH technique [29]. TheThe Clippedchannel gains Matched are first Frequency clipped at Hopping a certain (CMFH)threshold, is proportional an evolution to ofthe the maximum MFH technique gain, and [29]. The channelthen, the gains clipped are channel first clipped gains atare a decreased certain threshold, by this threshold. proportional That tomeans themaximum any channel gain, gain and less then, than or equal to the threshold, max( | |), is set to zero. The power metrics, , are redefined so the clipped channel gains are decreased by this threshold. That means any channel gain less than or that 2 equal to the threshold, ξmax(|H |), is set to zero. The power metrics,Q , are redefined so that |k| −max(|| ), || >max(|| ) k = (10) ( 0, || ≤max(|| ) 2 2 2 2 The MFH technique is then applied|Hk| −to ξthemax new(|H clippedk| ), power|Hk| >metrics,ξmax instead(|Hk| ) of using directly || Qk = 2 2 (10) as it is done in the MFH technique.0, The CMFH technique|Hk| will≤ ξ resultmax( |inH ka| hopping) set with more concentrated channels than in the MFH technique, but with higher gains.

Sensors 2018, 18, 657 12 of 34

The MFH technique is then applied to the new clipped power metrics, instead of using directly 2 |Hk| as it is done in the MFH technique. The CMFH technique will result in a hopping set with more concentrated channels than in the MFH technique, but with higher gains.

5.2.4. Advanced Frequency Hopping The Advanced Frequency Hopping (AFH) technique further improves the performance of the

SensorsMFH 2017 technique, 17, x FOR by PEER selecting REVIEW more channels with higher gains [30]. The modified power metrics12 of are 33 given by 2 5.2.4. Advanced Frequency Hopping |Hk| Qk =   (11) ( + ) | |2 − | |2 The Advanced Frequency Hopping 1(AFH)α max techniquHk e furtherHk improves the performance of the MFHwhere techniqueα is a small by scaling selecting factor more that channels can be adjusted with higher to obtain gains different [30]. The responses. modified Thepower MFH metrics technique are givenis then by applied to the new power metric. | | Figure8 illustrates the channel selection for the HGFH, MFH, CMFH and AFH techniques. In all = (11) the cases M = 10 channels have been(1+ selected.) It(| can| be) − seen|| how the MFH technique selects more wheredispersed is channels a small comparedscaling factor to the that HGFH. can be The adju CMFHsted to and obtain AFH different techniques responses. modify The the powerMFH techniquemetric to clusteris then applied the channel to the selection new power around metric. the highest gain channels but still preserving certain channelFigure separation. 8 illustrates the channel selection for the HGFH, MFH, CMFH and AFH techniques. In =10 all theFigures cases 9 and 10 channelsillustrate thehave evolution been selected. of the channelIt can be selection seen how in the the MFH CMFH technique and AFH selects techniques more dispersedwhen varying channels the ξ comparedand α parameters. to the HGFH. When Th increasinge CMFH theand threshold AFH techniques in the CMFH modify technique, the power the metricselected to channelscluster the tend channel to concentrate selection around around the the highest highest gain gain channels channels, but as still more preserving bad channels certain are channeldiscarded. separation. The same happens when decreasing the α parameter in the AFH technique.

HGFH 1

0.5 Channel gain Selected channels 0 0 102030405060708090100 Channel index (a) MFH 1

0.5 Power metric Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (b) CMFH ( = 0.1) 1

0.5 Power metric Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (c) AFH ( = 0.1) 1 Figure 8. Cont.

0.5 Power metric Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (d)

Figure 8. Comparison of channel selection between different frequency hopping techniques: (a) Highest Gain Frequency Hopping (HGFH); (b) Matched Frequency Hopping (MFH); (c) Clipped Matched Frequency Hopping (CMFH) with =0.1; (d) Advanced Frequency Hopping (AFH) with =0.1. The selected channels are represented as vertical black lines. HGFH directly uses the channel gain (red) to select the best channels, while MFH, CMFH and AFH use the cumulative metrics (blue) obtained from the power metrics (green) and their intersections with the equally spaced horizontal lines.

Sensors 2017, 17, x FOR PEER REVIEW 12 of 33

5.2.4. Advanced Frequency Hopping The Advanced Frequency Hopping (AFH) technique further improves the performance of the MFH technique by selecting more channels with higher gains [30]. The modified power metrics are given by || = (11) (1+)(|| ) − || where is a small scaling factor that can be adjusted to obtain different responses. The MFH technique is then applied to the new power metric. Figure 8 illustrates the channel selection for the HGFH, MFH, CMFH and AFH techniques. In all the cases =10 channels have been selected. It can be seen how the MFH technique selects more dispersed channels compared to the HGFH. The CMFH and AFH techniques modify the power metric to cluster the channel selection around the highest gain channels but still preserving certain channel separation.

HGFH 1

0.5 Channel gain Selected channels 0 0 102030405060708090100 Channel index (a) MFH 1

0.5 Power metric Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (b) CMFH ( = 0.1) 1

0.5 Power metric Cummulative metric Selected channels 0 Sensors 2018, 18,0 657 10203040506070809010013 of 34 Channel index (c) AFH ( = 0.1) 1

0.5 Power metric Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (d)

FigureFigure 8. ComparisonComparison of of channel channel selection selection between between different different frequency frequency hopping ho techniques:pping techniques: (a) Highest (a) SensorsHighestGain 2017 Frequency, 17 Gain, x FOR Frequency PEER Hopping REVIEW Hopping (HGFH); (HGFH); (b) Matched (b) Matched Frequency Frequency Hopping Hopping (MFH); (c(MFH);) Clipped (c) MatchedClipped13 of 33 MatchedFrequency Frequency Hopping Hopping (CMFH) (CMFH) with ξ = with 0.1; (=0.1d) Advanced; (d) Advanced Frequency Frequency Hopping Hopping (AFH) with(AFH)α =with 0.1. =0.1TheFigure selected. The9 and selected channels Figure channels are 10 represented illustrate are represented asthe vertical evolution as black vertic of lines.al the black HGFHchannel lines. directly HGFH selection uses directly thein channelthe uses CMFH the gain channel and (red) AFH techniquesgainto select (red) when the to bestselect varying channels, the best the channels, while and MFH, while CMFHparameters. MFH, and CMFH AFH When and use AFH theincreasing cumulative use the cumulativethe metrics threshold (blue) metrics in obtained the(blue) CMFH technique,obtainedfrom the the powerfrom selected the metrics power channels (green) metrics andtend (green) their to concentr intersectionsand theirate intersections around with the the equally with highest the spaced eq gainually horizontal channels,spaced lines.horizontal as more bad channelslines. are discarded. The same happens when decreasing the parameter in the AFH technique.

CMFH ( = 0.1) 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (a) CMFH ( = 0.3) 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (b) CMFH ( = 0.5) 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (c)

FigureFigure 9.9. Channel selection evolution inin the Clipped Matched Frequency HoppingHopping (CMFH)(CMFH) techniquetechnique whenwhen varyingvarying thethe thresholdthreshold parameter:parameter: ((aa))ξ =0.1= 0.1; (;b ()bξ) = 0.3; = 0.3 (c); ξ(c=) 0.5.=0.5.

Sensors 2018, 18, 657 14 of 34 Sensors 2017, 17, x FOR PEER REVIEW 14 of 33

AFH ( = 1) 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (a) AFH ( = 0.1) 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (b) AFH ( = 0.01) 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (c)

FigureFigure 10. Channel10. Channel selection selection evolution evolution inin thethe Advanced Frequency Frequency Hopping Hopping (AFH) (AFH) technique technique when when =1 =0.1 = 0.01 varyingvarying the αtheparameter: α parameter: (a )(aα) = 1; (b; )(bα) = 0.1; (c;) (cα) = 0.01. .

5.3. Channel Aware, Probabilistic-Channel-Usage Techniques 5.3. Channel Aware, Probabilistic-Channel-Usage Techniques Unlike the reduced-hop-set techniques, probabilistic-channel-usage techniques use all the availableUnlike thechannels, reduced-hop-set but channels marked techniques, as good probabilistic-channel-usage are used with higher probability. techniques use all the available channels, but channels marked as good are used with higher probability. 5.3.1. Weighted Random Frequency Hopping 5.3.1. Weighted Random Frequency Hopping In the Weighted Random Frequency Hopping (WRFH) technique, the hopping set contains all ofIn the the Weighted channels, just Random like with Frequency the standard Hopping RFH, but (WRFH) when deciding technique, the hopping the hopping sequence, set a non- contains all ofuniform the K channels,probability justdistribution like with is theused standard so that channels RFH, but with when higher deciding gains are the more hopping likely to sequence, be selected [24]. The probability, , of selecting channel is given by a non-uniform probability distribution is used so that channels with higher gains are more likely to be || selected [24]. The probability, P , of = selecting channel ∈k1,2,is given … , by (12) k ∑| |

where is the same channel gain introduced in Equation (5). This equation is analogous to the |H |2 normalized power metric in theP MFH= techniquek (Equk ∈ation{1, 2, (6)). . . . ,ForK} each hop, the selection of the (12) k K 2 channel is carried out by a cumulative∑ metric,i=1|H i|, as it is done with the MFH technique: = (13) where Hk is the same channel gain introduced in Equation (5). This equation is analogous to the normalizedThe index power of the metricnth channel in the is given MFH by technique the value of (Equation such that (6)). For each hop, the selection of the channel is carried out by a cumulative metric, Ck, as it is done with the MFH technique:

k Ck = ∑ Pi (13) i=1 Sensors 2018, 18, 657 15 of 34

The index of the nth channel is given by the value of k such that

Sensors 2017, 17, x FOR PEER REVIEW 15 of 33 Ck−1 ≤ yn < Ck n ∈ {1, 2, . . . , K} (14)

≤ < ∈1,2, … , (14) where yn is a pseudo-random number over [0,1). This is the main difference with the MFH technique, as thewhere corresponding is a pseudo-randomym numbers innumber the MFH over were[0,1). MThisequally is the spacedmain difference values over with [0,1). the MFH So, in the WRFHtechnique, technique, as the all corresponding the channels can numbers be selected in the with MFH more were or less equally probability, spaced values while over in [0,1). the MFH technique,So, in the there WRFH were technique, only M selected all the channels channels can that be wouldselected be with used more with or equalless probability, probability. while in Figurethe MFH 11 technique, illustrates there the differenceswere only between selected the channels RFH, MFHthat would and WRFH be used techniques. with equal probability. As an example, 20 frequencyFigure hops 11 haveillustrates been the considered differences for between the three the hopping RFH, MFH techniques. and WRFH In thetechniques. case ofthe As randoman example, 20 frequency hops have been considered for the three hopping techniques. In the case of the and weighted random techniques, this results in 20 different channels, whereas in the MFH technique, random and weighted random techniques, this results in 20 different channels, whereas in the MFH some or all of the selected 10 best channels have to be repeated. Because of its random behaviour, the technique, some or all of the selected 10 best channels have to be repeated. Because of its random RFHbehaviour, technique the selects RFH sometechnique channels selects withsome achannels very low with gain. a very This low is gain. partially This avoidedis partially by avoided the WRFH as theby cumulative the WRFH as metric the cumulative around the me lowesttric around gain the channels lowest gain is hardly channels increased is hardly and increased is less likelyand is to be interceptedless likely by to the be horizontalintercepted by lines the representinghorizontal lines the representingyn random the values. random However, values. as However, the number as of channelthe number hops approaches of channel hops infinite, approaches it would infinite, be inevitable it would tobe hopinevitable over theto hop channels over the with channels the leastwith gain, whichthe does least not gain, happen which withdoes not the happen MFH technique. with the MFH technique.

RFH 1

0.8

0.6

0.4

0.2 Channel gain Selected channels 0 0 102030405060708090100 Channel index (a) MFH 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (b) WRFH 1

0.8

0.6

0.4 Power metric 0.2 Cummulative metric Selected channels 0 0 102030405060708090100 Channel index (c)

FigureFigure 11. 11.Comparison Comparison ofof channel selection selection between between different different frequency frequency hopping hopping techniques: techniques: (a) (a) RandomRandom Frequency Frequency HoppingHopping (RFH); (b (b) )Matched Matched Frequency Frequency Hopping Hopping (MFH); (MFH); (c) Weighted (c) Weighted Random Random Frequency Hopping (WRFH). In the RFH and MFH cases, horizontal lines are equally spaced while Frequency Hopping (WRFH). In the RFH and MFH cases, horizontal lines are equally spaced while in in the WRFH case, horizontal lines are randomly spaced. the WRFH case, horizontal lines are randomly spaced. 5.3.2. Utility Based Adaptive Frequency Hopping

Sensors 2018, 18, 657 16 of 34

5.3.2. Utility Based Adaptive Frequency Hopping The Utility Based Adaptive Frequency Hopping (UBAFH) technique extends the performance of the WRFH by introducing a parameter, α, which is called temperature [31]:

Qα P = k (15) k K α ∑i=1 Qi

The parameter α can be adjusted to achieve different behaviours. Low temperatures will result in almost even channel usage, while for high temperature values, only the best channels will be used. When α = 1, the probability distribution happens to be the same as for the WRFH technique. Additionally, lower and upper bounds on the usage probability can be introduced so that

Pmin ≤ Pk ≤ Pmin (16)

Pmin is introduced to ensure a minimum degree of frequency diversity, while Pmax prevents the algorithm from converging to scenarios where only a few channels are used.

5.3.3. Smooth Adaptive Frequency Hopping Smooth Adaptive Frequency Hopping (SAFH) assigns usage probabilities to all channels based on an exponential smoothing filter for the quality metric to estimate and predict the channel conditions [32]. The algorithm uses exponential smoothing to predict the quality metric of the next time step. 0 The predicted power metrics are referred as Qk, while the measured power metric is referred to as Qk. The predicted power metric at time (t + 1) is calculated by using the predicted metric at time t plus an adjustment for the error that occurred in the last forecast (measured power metric minus predicted power metric): 0 0 0  Qk(t + 1) = Qk(t) + α· Qk(t) − Qk(t) (17) ( 0 0 Qk(t + 1) = α·Qk(t) + (1 − α)·Qk(t) 0 (18) Qk(1) = Qk(0) → (initial condition) The balance between new and old data is controlled by the smoothing factor α in the range between [0,1]. When α approaches 1, the filter gives more weight to recent data and has less of a smoothing effect. When α approaches 0, the effect of current observation is ignored and only the smoothed past is retained. By recurrent substitution,

"t−1 # 0 j t Qk(t + 1) = α· ∑(1 − α) ·Qk(t − j) + (1 − α) ·Qk(0) (19) j=0

In exponential smoothing, all previous measurements contribute to the smoothed value, but their contribution is suppressed by increasing powers of the parameter α. The mapping from the metric, Q, to the probability function, P, is subject to two conditions:

1. The probability assigned to a channel is an increasing function of its quality metric:

0 0 Qi(t + 1) ≤ Qj(t + 1) → Pi(t + 1) ≤ Pj(t + 1) (20)

This condition results in good channels being used more often than bad channels. 0 2. The target average metric, Q (t + 1), must be above a certain threshold ξ:

K 0 ∑ Pi(t + 1)·Qi(t + 1) ≥ ξ (21) i=1 Sensors 2018, 18, 657 17 of 34

This condition results in robustness of the link between the nodes. The following mapping function fulfils the above conditions: ( P = (β + c·d )/δ i f d ≥ 0 k k k (22) Pk = (β + s·dk)/δ i f dk ≤ 0

where the term dk is the difference between the predicted metric and the threshold ξ:

0 dk = Qk − ξ (23)

A positive dk value indicates a good channel and a negative value indicates a bad channel. The term c determines how good channels are rewarded, while the term s determines how bad channels are punished. The larger the c parameter, the more often good channels are used, and the larger the s parameter, the less often bad channels are used. The term δ is a normalizing factor that ensures ∑ Pi = 1: Kg Kb δ = ∑(β + c·di) + ∑(β + s·di) (24) i=1 i=1

where Kg and Kb are the number of good and bad channels respectively. The term β is chosen K 0 so that the condition ∑i=1 Pi(t + 1)·Qk(t + 1) = ξ is fulfilled. The case when c = s = 1 and β = ξ results in Q0 Q0 P = k = k (25) k δ K 0 ∑i=1 Qi which represents the WRFH probability function.

As an illustrative example, let us consider a four-channel problem with Q: {0.84, 0.8, 0.82, 0.86}. Table1 shows the channel usage probabilities for the WRFH, UBAFH and SAFH techniques for the specified parameter values. Same results are represented in Figure 12. It can be observed how increasing the temperature parameter in the UBAFH technique penalizes the usage of the worst channels in favour of the best ones. The same happens when increasing the c parameter in the SAFH technique.

Table 1. Comparison of channel usage for Weighted Random Frequency Hopping (WRFH), Utility Based Adaptive Frequency Hopping (UBAFH) and Smooth Adaptive Frequency Hopping (SAFH) techniques.

WRFH UBAFH SAFH

ff Qk Pk = K ff ξ = 0.85 ξ = 0.85 ∑i=1 Qi P = Qk α = 1 α = 1 k K Q ∑i=1 i c = 10 c = 100 ff = 10 ff = 100 s = 1 s = 1

Q1 0.84 P1 0.253 0.273 0.086 0.197 0.100 Q2 0.8 P2 0.241 0.168 0.001 0.027 0.075 Q3 0.82 P3 0.247 0.214 0.008 0.111 0.088 Q4 0.86 P4 0.259 0.345 0.906 0.665 0.737 Sensors 2017, 17, x FOR PEER REVIEW 17 of 33

the larger the parameter, the less often bad channels are used. The term is a normalizing

factor that ensures ∑ =1: = (+·) + (+·) (24) where and are the number of good and bad channels respectively. The term is chosen so that the condition ∑ (+1) · (+1) = is fulfilled. The case when ==1 and = results in = = (25) ∑ which represents the WRFH probability function. As an illustrative example, let us consider a four-channel problem with : 0.84, 0.8, 0.82, 0.86. Table 1 shows the channel usage probabilities for the WRFH, UBAFH and SAFH techniques for the specified parameter values. Same results are represented in Figure 12. It can be observed how increasing the temperature parameter in the UBAFH technique penalizes the usage of the worst channels in favour of the best ones. The same happens when increasing the parameter in the SAFH technique.

Table 1. Comparison of channel usage for Weighted Random Frequency Hopping (WRFH), Utility Based Adaptive Frequency Hopping (UBAFH) and Smooth Adaptive Frequency Hopping (SAFH) techniques.

WRFH UBAFH SAFH = . = . = = = ∑ = ∑ = = = = = = 0.84 0.253 0.273 0.086 0.197 0.100 0.8 0.241 0.168 0.001 0.027 0.075 Sensors 2018 , 18, 6570.82 0.247 0.214 0.008 0.111 0.088 18 of 34 0.86 0.259 0.345 0.906 0.665 0.737

Figure 12. Comparison of channel usage between different frequency hopping techniques: (a) WRFH; Figure 12. Comparison of channel usage between different frequency hopping techniques: (a) WRFH; =10 = 100 =10 = 100 (b) UBAFH with α = 10;; ((cc)) UBAFHUBAFH with withα = 100; (;d ()d SAFH) SAFH with withc = 10; (e; )(e SAFH) SAFH with withc = 100. .

6. Method Description 6. Method Description This section describes the method that analyses the quality of the links between nodes in a This section describes the method that analyses the quality of the links between nodes in a Wireless Wireless Sensor Network (WSN) in the presence of other coexisting networks. In Section 4 we Sensor Network (WSN) in the presence of other coexisting networks. In Section4 we introduced introduced some metrics that can be used to characterize and determine the quality of the available some metrics that can be used to characterize and determine the quality of the available frequency frequency channels. In Section 5 we described different frequency hopping techniques which select channels. In Section5 we described different frequency hopping techniques which select a subset of a subset of channels and define a hopping sequence, avoiding channels with lower quality metrics to channels and define a hopping sequence, avoiding channels with lower quality metrics to a greater or a greater or a lesser extent depending on the hopping technique. These quality metrics and hopping 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 Section4 are calculated. Figure2 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 Figure4 were calculated. In the next step, frequency channel selection, the optimal subset of channels is calculated for each of the available quality metrics of Section4 and hopping techniques of Section5. 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 Section5. 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 Sensors 2017, 17, x FOR PEER REVIEW 18 of 33 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 Sensors 2018, 18, 657 19 of 34 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 bandwidthbandwidth respectively. respectively. In Inorder order to simplify to simplify the the exam example,ple, the the Bluetooth Bluetooth network network hops hops over over only only three three channelschannels with with 1 MHz 1 MHz bandwidth. bandwidth.

FigureFigure 13. 13.RepresentationRepresentation of observation of observation (blue) (blue) and and oper operationation (purple) (purple) times times and and example example of channel of channel occupancyoccupancy with with two two static static networks networks (WLAN (WLAN and and LR-WPAN) LR-WPAN) and and a dynamic a dynamic network network (Bluetooth) (Bluetooth) that that hopshops over over three three frequency frequency channels channels.. The The coexisting coexisting networks networks will will be analysed be analysed during during the theobservation observation timetime to determine to determine the the operation operation of the of the netw networkork of interest of interest during during the the operation operation time. time.

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:

 4πd f  P = P · (26) d 0 c

where Po is the transmission power, f the signal frequency, c the speed of light and Pd the received power at distance d. The overlapping of the signal of interest and the interference noise can be seen in Figure 14. The signal of interest (between two specific nodes) is represented in green, starting after the observation time and hopping from channel to channel within the operation time. All the contributions from different coexisting networks to the interference noise are represented in red, and the overlaps between signal and noise are represented in black. Sensors 2017, 17, x FOR PEER REVIEW 19 of 33

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: 4 = · (26) where is the transmission power, the signal frequency, the speed of light and the received power at distance . The overlapping of the signal of interest and the interference noise can be seen in Figure 14. The signal of interest (between two specific nodes) is represented in green, starting after the observation time and hopping from channel to channel within the operation time. All the contributions from Sensors 2018different, 18, 657 coexisting networks to the interference noise are represented in red, and the overlaps20 of 34 between signal and noise are represented in black.

Figure 14. Signal (green) and noise (red) overlapping. There are different sources that contribute to Figure 14. Signal (green) and noise (red) overlapping. There are different sources that contribute noise: static networks and dynamic networks that hop over different frequencies. The noise is to noise: static networks and dynamic networks that hop over different frequencies. The noise is analysed during the observation time (blue) to determine the hopping sequence of the signal of analysed during the observation time (blue) to determine the hopping sequence of the signal of interest. interest. The signal of interest is only transmitted during the operation time (purple). The overlapping The signalof signal of interest and noise isonly is represented transmitted in black. during This the overlap operation only timeimplies (purple). time and The frequency overlapping coexistence; of signal and noisefor an is representederror to occur, in the black. SNR This must overlap be higher only than implies the receiving time and sensitivity frequency of the coexistence; nodes too. for an error to occur, the SNR must be higher than the receiving sensitivity of the nodes too. In the last step, determination of the topology, the topology of the WSN can be determined Intaking the last into step, consideration determination the distances of the topology,between node thes topology and the resulting of the WSN overall can PER. be determinedFigure 15 shows taking two types of topologies where each node communicates directly to the gateway (single-hop topology) into consideration the distances between nodes and the resulting overall PER. Figure 15 shows two or through other nodes (multi-hop topology). When a node communicates to the gateway through types ofother topologies nodes, the where PERs eachof all nodethe transmissions communicates are multiplied directly to to theobtain gateway the overall (single-hop PER. topology) or through otherIn terms nodes of (multi-hopenergy consumption, topology). it Whenmight be a node preferable communicates to hop among to the different gateway nodes, through so that other nodes,the the communication PERs of all the distances transmissions are reduced are multiplied and the transmission to obtain power the overall of the PER. nodes can be lowered. InIn terms return, of this energy may involve consumption, increasing it the might overall be preferablePER. On the tocontrary, hop among to minimize different the overall nodes, PER, so that the communicationit is most likely distances that each arenode reduced has to communica and the transmissionte directly to power the gateway, of the nodesbut in canexchange be lowered. for In return,increasing this may the involve transmission increasing distances the overalland the PER. consequent On the power contrary, consumption. to minimize Assigning the overall different PER, it is most likelyweights that to each the nodeoverall has PER to communicateand the maximum directly transmission to the gateway, distance but inmay exchange result in for different increasing the transmissiontopologies, distancesand will help and to the choose consequent the topology power with consumption. the best equilibrium Assigning between different overall weights PER and to the energy consumption. overall PER and the maximum transmission distance may result in different topologies, and will help to choose the topology with the best equilibrium between overall PER and energy consumption. Sensors 2017, 17, x FOR PEER REVIEW 20 of 33

Figure 15. Different network topologies: (a) Single-hop: each node (black dots) communicates directly Figure 15.toDifferent the gateway network (red dot); topologies: (b) Multi-hop: (a) the Single-hop: nodes communicate each node to the (black gateway dots) hopping communicates through directly to the gatewayother nodes. (red dot); (b) Multi-hop: the nodes communicate to the gateway hopping through other nodes. 7. Evaluation The evaluation of the presented method is performed beginning with a simulated interfering environment. It has been done so to have an illustrative interfering noise, coming from both static and dynamic (frequency changing) networks, and with significant RSSI values. Even though the same analysis could have been done starting from real RSSI measurements of any specific scenario. To help in the evaluation of the method, a simulation tool has been developed using Matlab. The developed tool allows to define the interfering environment, deploy the network under study and graphically visualize the results of the calculations. Figure 16 shows the main window of the developed simulation tool.

Figure 16. Main interface of the simulation tool. The left panels contain buttons to configure the analysis parameters and select the different plotting options. The right panel is reserved for the graphical representation of the results. The different type of results are represented in their corresponding tab within the graph panel.

Sensors 2017, 17, x FOR PEER REVIEW 20 of 33

Figure 15. Different network topologies: (a) Single-hop: each node (black dots) communicates directly Sensors 2018, 18, 657 21 of 34 to the gateway (red dot); (b) Multi-hop: the nodes communicate to the gateway hopping through other nodes. 7. Evaluation 7. Evaluation The evaluation of the presented method is performed beginning with a simulated interfering The evaluation of the presented method is performed beginning with a simulated interfering environment. It has been done so to have an illustrative interfering noise, coming from both static and environment. It has been done so to have an illustrative interfering noise, coming from both static dynamic (frequency changing) networks, and with significant RSSI values. Even though the same and dynamic (frequency changing) networks, and with significant RSSI values. Even though the same analysis could have been done starting from real RSSI measurements of any specific scenario. analysis could have been done starting from real RSSI measurements of any specific scenario. To help in the evaluation of the method, a simulation tool has been developed using Matlab. To help in the evaluation of the method, a simulation tool has been developed using Matlab. The The developed tool allows to define the interfering environment, deploy the network under study developed tool allows to define the interfering environment, deploy the network under study and and graphically visualize the results of the calculations. Figure 16 shows the main window of the graphically visualize the results of the calculations. Figure 16 shows the main window of the developed simulation tool. developed simulation tool.

Figure 16. Main interface of the simulation tool. The left panels contain buttons to configure the Figureanalysis 16. parametersMain interface and of select the simulation the different tool. plotti The leftng panelsoptions. contain The right buttons panel to configure is reserved the analysisfor the parametersgraphical representation and select the of different the results. plotting The options. different The type right of panel results is reservedare represented for the graphicalin their representationcorresponding oftab the within results. the Thegraph different panel. type of results are represented in their corresponding tab within the graph panel.

The interfering environment is simulated by placing potential coexisting networks close to the network of interest. The simulation tool allows to choose between different standards: IEEE 802.11, IEEE 802.15.1 and IEEE 802.15.4. As an illustrative example, let us consider the deployment of an IEEE 802.15.4 network as represented in Figure 17, consisting of four sensor nodes (black dots) that have to communicate with a gateway (G). The network has to coexist with one IEEE 802.11 (WLAN), two IEEE 802.15.4 (LR-WPAN A and LR-WPAN B) and one IEEE 802.15.1 (Bluetooth) networks (coloured markers) located close to the gateway. Our IEEE 802.15.4 network has the ability to hop among the available 16 channels. Sensors 2017, 17, x FOR PEER REVIEW 21 of 33

The interfering environment is simulated by placing potential coexisting networks close to the network of interest. The simulation tool allows to choose between different standards: IEEE 802.11, IEEE 802.15.1 and IEEE 802.15.4. As an illustrative example, let us consider the deployment of an IEEE 802.15.4 network as represented in Figure 17, consisting of four sensor nodes (black dots) that have to communicate with a gateway (G). The network has to coexist with one IEEE 802.11 (WLAN), two IEEE 802.15.4 (LR-WPAN A and LR-WPAN B) and one IEEE 802.15.1 (Bluetooth) networks (colouredSensors 2018 ,markers)18, 657 located close to the gateway. Our IEEE 802.15.4 network has the ability to22 hop of 34 among the available 16 channels.

FigureFigure 17. 17. ExampleExample of of an an 802.15.4 802.15.4 network network deployment deployment wi withth four four nodes nodes (black (black dots) dots) and and a a gateway gateway (G).(G). The The gateway gateway is is surrounded surrounded by by four four interfering interfering networks networks (coloured (coloured markers). markers).

FromFrom the the transmission transmission power power of of ea eachch interfering interfering network, network, the the interference interference noise noise is is calculated calculated at at everyevery location location of of the the nodes nodes of of the the network network under under study. study. The The signal signal propagation propagation is is modelled modelled according according toto the the free-space free-space path path loss loss (Equation (Equation (26)). (26)). The The tr transmissionansmission powers powers of of the the interfering interfering networks networks are are shownshown in in Table Table 2,2, along along with with the the transmission transmission power power and and the the receiving receiving sensitivity sensitivity of ofthe the network network of interest.of interest.

TableTable 2. 2. TransmissionTransmission powers powers and and receiving receiving sensitivities sensitivities for for the the interfering interfering networks networks and and the the wireless wireless sensorsensor network network under under study. study.

INTERFERENCE WSN INTERFERENCE WSN WLAN Bluetooth LR-WPAN A LR-WPAN B 802.15.4 TRANSMISSION POWER WLAN 100 mW Bluetooth 2.5 mW LR-WPAN 1 mW A LR-WPAN 1 mW B 802.15.4 1 mW TRANSMISSIONRECEIVING SENSITIVITY POWER 100 mW - 2.5 mW - 1 mW - 1 mW - − 190 mW dBm − RECEIVING SENSITIVITY ---- 90 dBm

The developed tool allows to configure the observation and operation times, as well as the hopping time and the slot times of each network. For the reduced hop set techniques, the number of channels to employ must be defined as well. Table3 summarizes the time parameters employed

in the evaluation example. The interference noise is observed for 0.1 s and, then, the connections of the network of interest are evaluated for an operation time of 0.9 s. Therefore, the total analysis time results in 1 s, with a time resolution (time step) of 1 ms. The slot and wait times of all the networks are set to the same values: 3 ms and 2 ms respectively. For the WSN of interest and the interfering Bluetooth network, the hop times are set to 5 ms, meaning that every 5 ms these networks hop from one frequency channel to another. Sensors 2017, 17, x FOR PEER REVIEW 22 of 33

The developed tool allows to configure the observation and operation times, as well as the hopping time and the slot times of each network. For the reduced hop set techniques, the number of channels to employ must be defined as well. Table 3 summarizes the time parameters employed in the evaluation example. The interference noise is observed for 0.1 s and, then, the connections of the network of interest are evaluated for an operation time of 0.9 s. Therefore, the total analysis time Sensorsresults2018 in ,118 s,, 657with a time resolution (time step) of 1 ms. The slot and wait times of all the networks23 of 34 are set to the same values: 3 ms and 2 ms respectively. For the WSN of interest and the interfering Bluetooth network, the hopTable times 3. areTime set parameters to 5 ms, meaning employed that in the every analysis. 5 ms these networks hop from one frequency channel to another. OBSERVATION 0.1 s TIME Table 3. Time parameters employed in the analysis. OPERATION 0.9 s OBSERVATIONTIME TIME 0.1 s ANALYSIS OPERATION TIME 1 s 0.9 s ANALYSISTIME TIME 1 s TIME STEP 1 ms TIME STEP 1 ms INTERFERENCEINTERFERENCE WSN WSN WLANWLAN Bluetooth Bluetooth LR_WPAN LR_WPAN A ALR_WPAN LR_WPAN B B 802.15.4802.15.4 SLOTSLOT TIME TIME 3 ms3 ms 3 ms 3 ms 3 ms 3 ms 3 ms 3 ms 3 3 ms ms WAITWAIT TIME TIME 2 ms2 ms 2 ms 2 ms 2 ms 2 ms 2 ms 2 ms 2 2 ms ms HOP TIME - 5 ms - - 5 ms HOP TIME - 5 ms - - 5 ms

The IEEE 802.11 (WLAN) and the interfering IEEE 802.15.4 (LR-WPAN A and LR-WPAN B) networks transmittransmit in in static static frequency frequency channels, channels, while while the the IEEE IEEE 802.15.1 802.15.1 (Bluetooth) (Bluetooth) network network hops fromhops frequencyfrom frequency to frequency to frequency in a random in a random way. Forway. simplicity, For simplicity, a reduced a reduced set of set seven of seven channels channels have beenhave selectedbeen selected from thefrom available the available 79 of the 79 Bluetoothof the Bluet network.ooth network. Figure 18Figure shows 18 the shows occupancy the occupancy of the 2.4 of GHz the bandwidth2.4 GHz bandwidth over time over and time the amplitudeand the amplitude of the interference of the interference noise as noise received as received by the gateway. by the gateway.

Figure 18. Interference noise at the gateway location: (a) Frequency pattern. The WLAN network Figure 18. Interference noise at the gateway location: (a) Frequency pattern. The WLAN network transmits in the 6th channel of the 802.11 standard, centred at 2437 MHz with a bandwidth of 22 MHz transmits in the 6th channel of the 802.11 standard, centred at 2437 MHz with a bandwidth of 22 MHz (red). The LR-WPAN A network transmits in the 4th channel of the 802.15.4 standard, centred at 2420 (red). The LR-WPAN A network transmits in the 4th channel of the 802.15.4 standard, centred at MHz with a bandwidth of 3 MHz (yellow). The LR-WPAN B network transmits in the 13th channel, 2420 MHz with a bandwidth of 3 MHz (yellow). The LR-WPAN B network transmits in the 13th channel,centred at centred 2465 MHz at 2465 (green). MHz (green).The Bluetooth The Bluetooth network network transmits transmits over seven over frequency seven frequency channels channels with a withbandwidth a bandwidth of 1 MHz of 1 MHzeach, each,hopping hopping from from channel channel to channel to channel in ina arandom random way way (blue); (blue); ( (bb)) Signal strength. TheThe signal signal strength strength of eachof each interfering interferin networkg network at the gatewayat the gateway position isposition calculated is calculated according toaccording the free-space to the free-space path loss model.path loss The model. four interferingThe four interfering networks networks are at the are same at distancethe same fromdistance the gateway,from the butgateway, have differentbut have signaldifferent strengths signal asstreng theyths have as they different have transmission different transmission powers. powers.

Figure 19 represents the channel selection for different metrics and hopping techniques. In order to simplify the visualization, only four hopping techniques (HGFH, WRFH, AFH and SAFH) and two metrics (mean value and standard deviation of RSSI) have been represented, but the analysis has been done for all the eight hopping techniques in Section5 and all the five metrics in Section4, as will be summarized at the end of this section. The configuration parameters of some of the metrics and hopping techniques (when needed), are presented in Table4. Sensors 2018, 18, 657 24 of 34

For the reduced-hop-set techniques (HGFH and AFH), M = 10 channels have been selected. The HGFH technique selects the 10 best channels directly from the channel gain, while the AFH technique selects the 10 best channels from the cumulative sum of the modified power metric (Equation (11)). With HGFH, both the mean and standard deviation metrics result in the same subset of channels, whereas with AFH, the resulting subset of channels are slightly different. The WRFH and the SAFH use all the available channels, but the best channels are used more often than the worst ones. The channel quality is determined from the cumulative metric: the higher the slope of the cumulative metric, the higher the probability for the corresponding channel to be selected. The resulting hopping sequence is represented in Figure 20. The interference noise from all the interfering networks is represented in red and the signal of interest is represented in green. The overlapping of the interference noise and signal is represented in black, but as we have mentioned before, aside from the overlapping, the signal to noise ratio has to be higher than the receiving sensitivity for the communications to fail. The bad channel avoidance is best observed here. The HGFH, for instance, totally avoids the 22 MHz band of the WLAN network. However, it does not manage to avoid the 3 MHz bands of the LR-WPAN A (channel 4) and LR_WPAN B (channel 13) networks when choosing 10 channels. The AFH tries to avoid the occupied channels while maintaining certain level of frequency dispersion and, thus, the WLAN is not always avoided. WRFH and SAFH do not avoid any of the occupied channels, but channels within the 22 MHz band of the WLAN network are used less often than good channels.

Table 4. Configuration parameters for quality metrics and hopping techniques.

QUALITY METRIC PARAMETERS QUANTILE SOTH 95% th = −60 dBm HOPPING TECHNIQUE PARAMETERS CMFH AFH UBAFH SAFH ξ = 0.85 α = 1 ξ = 0.1 α = 0.5 α = 2 c = 10 s = 1

The amplitude gains of the signal of interest and noise are represented in Figure 21 for the specific connection between the first node and the gateway. The noise corresponds to the signal strength of all the contributing interference networks received at the gateway position, and the signal of interest corresponds to the signal strength received at the gateway coming only from the first node. For the considered transmission powers, if signal and noise overlap in time and frequency, the communication will fail as the strength of the signal of interest is lower than the noise at the gateway. The frequency pattern of Figure 20 will be the same for all the nodes in the network, but the amplitude of the different signals will depend on the distance between the nodes and between the nodes and the interfering networks. Sensors 20172018,, 1718,, x 657 FOR PEER REVIEW 2425 of of 33 34

FigureFigure 19. ChannelChannel selection. selection. HGFH HGFH technique technique directly directly uses uses the the channel channel gain gain (red) (red) to to select select the the 10 best channels. WRFH, WRFH, AFH AFH and and SAFH SAFH techn techniquesiques use use the the cumulativecumulative metric (blue)(blue) derivedderived fromfrom the the power power metric metric (green) (green) to to select select the the best best channels. channels. In allIn theall the case, case, the the selected selected channels chann areels representedare represented as vertical as vertical black black lines. lines.

Sensors 2018, 18, 657 26 of 34 Sensors 2017, 17, x FOR PEER REVIEW 25 of 33

Figure 20.20. Frequency pattern of signalsignal andand noisenoise forfor differentdifferent hoppinghopping techniquestechniques andand qualityquality metrics.metrics. The interfering noise is representedrepresented in red andand thethe signalsignal ofof interestinterest inin green.green. TheThe samesame noisenoise patternpattern isis considered forfor allall the hopping techniques andand allall the quality metrics. Different hoppinghopping techniques and different quality metrics resultresult inin differentdifferent frequencyfrequency patternspatterns forfor thethe signalsignal ofof interest.interest. TheThe overlappingoverlapping ofof thethe noisenoise andand signalsignal ofof interestinterest is is represented represented in in black. black.

Sensors 2018, 18, 657 27 of 34 Sensors 2017, 17, x FOR PEER REVIEW 26 of 33

FigureFigure 21.21. StrengthStrength ofof signalsignal andand noisenoise forfor differentdifferent hoppinghopping techniquestechniques andand qualityquality metrics.metrics. TheThe interferinginterfering noisenoise isis representedrepresented inin redred andand thethe signalsignal ofof interestinterest inin green.green. TheThe noisenoise isis the the sum sum of of all all the the interfering interfering networks networks as as received received at theat the gateway. gateway. The The signal signal of interest of interest is the is signalthe signal strength strength received received at the at gateway the gateway coming coming from thefrom first the node. first node.

Sensors 2018, 18, 657 28 of 34

Sensors 2017, 17, x FOR PEER REVIEW 27 of 33 For each possible bidirectional connection between nodes of the network under study, the PER is For each possible bidirectional connection between nodes of the network under study, the PER calculated from the number of interferences during the operation time. The result will be a matrix for is calculated from the number of interferences during the operation time. The result will be a matrix eachfor quality each quality metric metric and hopping and hopping technique technique as represented as represented in in Figure Figure 22 22..

Figure 22. Packet Error Rate for all possible node connections for different quality metrics and Figure 22. Packet Error Rate for all possible node connections for different quality metrics and hopping hopping techniques. Each element contains the Packet Error Rate (PER) value (percentage) for the techniques.specified Each connection. element 1> contains, for instance, the Packet indicates Error the Rate connect (PER)ion from value node (percentage) 1 to the gateway. for the specified connection. 1 > G, for instance, indicates the connection from node 1 to the gateway. From the PER of each connection, the topology of the network can be determined in terms of overallFrom thepacket PER error of each rate connection, and transmission the topology distances. of theFigure network 23–Figure can be25 determinedshow the resulting in terms of topologies when assigning different weights to the transmission distances and the resulting PER. overall packet error rate and transmission distances. Figures 23–25 show the resulting topologies when Only attending to the overall PER results in direct connections between the nodes and the gateway assigning different weights to the transmission distances and the resulting PER. Only attending to (Figure 23), while minimizing the transmission distances results in multi hop transmissions (Figure the overall24). In both PER cases, results the insame direct topologies connections result fo betweenr all the quality the nodes metrics and and the hopping gateway techniques. (Figure When 23), while minimizingassigning the equal transmission weights to the distances transmission results distances in multi and hop the transmissionsoverall PER, different (Figure topologies 24). In bothresult cases, the samefor different topologies quality result metrics for all and the hopping quality metricstechniqu andes (Figure hopping 25). techniques.With the HGFH, When for assigning instance, equal weightshopping to the from transmission node to node distances in order andto minimize the overall the transmission PER, different distances topologies does not result penalize for differentthe qualityoverall metrics PER andat all, hopping while with techniques the other hopping (Figure 25techniques,). With the the HGFH, overall PER for instance, is considerably hopping increased from node to nodeas the in transmission order to minimize distances the are transmission reduced. distances does not penalize the overall PER at all, while with theTable other 5 hopping summarizes techniques, the overall the PER overall results PER for all is the considerably quality metrics increased in Section as the4 and transmission all the hopping techniques in Section 5 for equal weights of overall PER and transmission distances. For distances are reduced. most of the considered metrics, the RFH results to be the worst hopping technique as we could expect. Table5 summarizes the overall PER results for all the quality metrics in Section4 and all the The WRFH technique significantly improves the performance of the RFH, but is still far from the hoppingperformance techniques level in of Section the other5 for hopping equal weightstechniques of. overallAmong PERthe other and transmissionhopping techniques, distances. it cannot For most of thebe consideredsaid that a specific metrics, technique the RFH is much results better to th bean the the worstothers, hoppingand the same technique happens aswith we the could quality expect. The WRFHmetrics. techniqueFor the considered significantly scenario, improves the combination the performance of UBAFH technique of the RFH, and but95% isquantile still far metric from the performanceresults to levelbe the of best the solution other hopping with a 9% techniques. of overall PER, Among but different the other interfering hopping scenarios techniques, might it result cannot be said thatin other a specific quality metrics technique and ishopping much bettertechniques than being the others,the best. and Conf theiguration same happensparameters with other the than quality metrics.the ones For thepresented considered in Table scenario, 4 could thealso combination yield a different of UBAFHsolution. techniqueNevertheless, and the 95% main quantile objective metric resultsof tothe be method the best here solution presented with is not a 9% to ofdetermine overall PER,a quality but metric different and interferinga hopping technique scenarios that might best result fits most of the possible scenarios, but to automatically find the best solution for any specific scenario in other quality metrics and hopping techniques being the best. Configuration parameters other than after analysing all the possible solutions. the ones presented in Table4 could also yield a different solution. Nevertheless, the main objective of the method here presented is not to determine a quality metric and a hopping technique that best fits most of the possible scenarios, but to automatically find the best solution for any specific scenario after analysing all the possible solutions. Sensors 20182017,, 1817,, 657x FOR PEER REVIEW 2928 of 3433

Figure 23.23. InferredInferred topologiestopologies withwith wPER =1= 1 and wDIST =0= 0. .Minimizing Minimizing the the overall overall PER PER results results in in direct direct connections connections between between nodes nodes and and gateway gateway for all thethe hopping techniques and quality metrics.metrics.

Sensors 2018, 18, 657 30 of 34 Sensors 2017, 17, x FOR PEER REVIEW 29 of 33

Figure 24. Inferred topologies with =0 and =1. Minimizing the transmission distances results in multi-hop connections for all the hopping techniques Figure 24. Inferred topologies with wPER = 0 and wDIST = 1. Minimizing the transmission distances results in multi-hop connections for all the hopping techniques andand qualityquality metrics.metrics. TheThe overalloverall PERPER isis considerablyconsiderably increased,increased, exceptexcept forfor thethe HGFHHGFH technique,technique, whichwhich remainsremains thethe samesame asaswith withsingle-hop single-hoptopology. topology.

Sensors 2018, 18, 657 31 of 34 Sensors 2017, 17, x FOR PEER REVIEW 30 of 33

=0.5 =0.5 FigureFigure 25. 25.Inferred Inferred topologies topologies with withw PER= 0.5 and andw DIST= 0.5..Different Different hopping hopping techniques techniques and and different different quality quality metrics metrics result result in in different different topologies. topologies.

Sensors 2018, 18, 657 32 of 34

Table 5. Overall PER with wPER = 0.5 and wDIST = 0.5.

HOPPING TECHNIQUES HGFH RFH WRFH MFH CMFH AFH UBAFH SAFH mean 14% 51% 36% 22% 19% 20% 17% 27% std 18% 52% 42% 48% 49% 23% 24% 29% quality skewness 19% 50% 45% 57% 43% 53% 41% 15% metrics 95% quantile 18% 42% 19% 23% 19% 19% 9% 24% soth (−60 dBm) 22% 49% 31% 35% 18% 20% 21% 33%

8. Conclusions In this paper, we presented a method for selecting the best frequency hopping strategy. The proposed method leverages a set of standard frequency hopping techniques and quality metrics in order to homogenize and normalize them, so they can be fairly compared based on quality and performance indicators. The main objective of the method is to provide an interference avoidance mechanism to reduce the need for retransmissions, minimize energy consumption, avoid the unnecessary degradation of QoS and reliability as well as protect against interference based security attacks. The method has the advantage of dynamically selecting the best channel quality metric and the best hopping technique taking into account the communication channel quality and environment interference conditions. As opposed to static and standalone solutions found in the state of the art, in case of channel interference, the method supports the selection of the best frequency hopping strategy to minimize the side effects of an interfered frequency and is able to dynamically adapt to changing conditions. The final result is a subset of frequency channels, as well as a hopping sequence, that minimizes the interference with coexisting networks and the effects of interference based security attacks. The method is designed to be used in two complementary scenarios: (a) as a deployment planning supporting tool for the selection of the best frequency channels, channel quality metrics and frequency hopping techniques given a known interference scenario and (b) as the base for the implementation of a runtime management component for the dynamic selection of communication frequency channels under changing interference conditions. The method is extensible and easily accommodates additional frequency hopping techniques, quality metrics and performance indicator approaches. Additionally, the method can also be extended to take into account other characteristics and restrictions of constrained systems (such as processing power or energy consumption) in order to select the most suitable solution. A simulation tool has been developed to assist in the validation and implementation of the method. The simulation tool allows for the definition and simulation of the interfering environment, but the whole analysis is perfectly applicable to real environments. That is, the received signal strength indicator (or some other channel quality indicator) in a real environment could be measured and used as input for the method implementation, and the channel selection and the hopping sequence would be obtained from the tool. It is left for future work to test the implementation of a runtime channel selection component based on the proposed method and its verification against the simulation tool. For that, a real deployment would have to be analysed in terms of received signal strength indicator for the interfering nodes and packet error rate for node connections in the wireless sensor network under study, and then compared with the same simulated scenario. It is also left for future research the inclusion of additional input parameters to the method to take into account other restrictions of the environment or the system, such as characteristics of constrained systems.

Acknowledgments: Research partially supported by the European Union’s Seventh Framework Programme for research, technological development and demonstration under Grant Agreement Number FP7-SEC-2013-1/607292 ZONeSEC—Towards a EU framework for the security of Widezones, in the scope of the activities related to Sensors 2018, 18, 657 33 of 34 develop technologies that foster the Plug, Play&Forget paradigm. Also partially supported by the Department of Education, Universities and Research of the Basque Government under Grant IT980-16 and the Spanish Research Council, under grant TIN2016-79897-P. Author Contributions: The authors have contributed equally to the work reported. Conflicts of Interest: The authors declare no conflict of interest.

References

1. Natarajan, R.; Zand, P.; Nabi, M. Analysis of Coexistence between IEEE 802.15.4, BLE and IEEE 802.11 in the 2.4 GHz ISM Band. In Proceedings of the 42nd Annual Conference of the IEEE Industrial Electronics Society (IECON), Florence, Italy, 23–26 October 2016. 2. Chen, D.; Varshney, P.K. QoS Support in Wireless Sensor Networks: A Survey. In Proceedings of the International Conference on Wireless Networks (ICWN), Las Vegas, NV, USA, 21–24 June 2004. 3. Singh, R.S.; Prasad, A.; Moven, R.M.; Sarma, H.K.D. Denial of Service Attack in Wireless Data Netwok: A Survey. In Proceedings of the Devices for Integrated Circuit (DevIC), Kalyani, India, 23–24 March 2017. 4. IEEE. Sdt 802.11-2012-IEEE Standard for Information Technology—Telecommunications and Information Exchange between Systems—Local and Metropolitan Area Networks—Specific Requirements Part 11: Wireless LAN Medium Access Control (MAC) and Physical (PHY) Specifications; IEEE: San Francisco, CA, USA, 2012. 5. Dixon, R. Spread Spectrum Techniques; John Wiley & Sons: New York, NY, USA, 1977. 6. Pahlavan, K.; Krishnamurthy, P. IEEE 802.15 Wireless Personal-Area Network. In Networking Fundamentals: Wide, Local and Personal Area Communications; John Wiley & Sons: New York, NY, USA, 2009. 7. Bluetooth SIG. Bluetooth Specification Version 4.2; Core Version 4.2; Bluetooth SIG: Kirkland, WA, USA, 2014. 8. IEEE. IEEE Std 802.15.4-2011-IEEE Standard for Local and Metropolitan Area Networks—Part 15.4: Low-Rate Wireless Personal Area Networks (LR-WPANs); IEEE: San Francisco, CA, USA, 2011. 9. ZigBee Alliance. Available online: http://www.zigbee.org (accessed on 21 February 2018). 10. HART Communication. Available online: https://fieldcommgroup.org/technologies/hart (accessed on 21 February 2018). 11. ISA. Available online: https://www.isa.org (accessed on 21 February 2018). 12. ISA 100 Wireless Compliance Institute. Available online: https://isa100wci.org (accessed on 21 February 2018). 13. Eskola, M.; Hikkilä, T. Classification of Radio Channel Disturbances for Industrial Wireless Sensor Networks. Ad Hoc Netw. 2016, 42, 19–33. [CrossRef] 14. Petersen, S.; Carlsen, S. Performance Evaluation of WirelessHART for Factory Automation. In Proceedings of the IEEE Conference on Emerging Technologies & Factory Automation (ETFA 2009), Mallorca, Spain, 22–25 September 2009. 15. Pal, S.K.; Chatterjee, P. A Survey on TDMA-based MAC Protocols for Wireless Sensor Network. Int. J. Emerg. Technol. Adv. Eng. 2014, 4, 219–230. 16. Wong, C.M.; Hsu, W.P. An additional clear channel assessment for IEEE 802.15.4 slotted CSMA/CA networks. In Proceedings of the IEEE International Conference on Communications Systems, Singapore, 17–19 November 2010; pp. 62–66. 17. Petrova, M.; Riihijärvi, J.; Mähönen, P.; Labella, S. Performance Study of IEEE 802.15.4 Using Measurements and Simulations. In Proceedings of the IEEE Wireless Communications and Networking Conference (WCNC), Las Vegas, NV, USA, 3–6 April 2006. 18. Li, Y. Model and Simulation of Slow Frequency Hopping System Using Signal Progressing Worksystem. In International Conference on Information Computing and Applications (ICICA): Communications in Computer and Information Science; Springer-Verlag: Berlin/Heidelberg, Germany, 2010; Volume 105. 19. Alqaysi, H.J.A. Simulation of Frequency Hopping Spread Spectrum and Jamming in Wireless Communication Systems. J. Adv. Sci. Eng. Res. 2013, 3, 400–407. 20. Badiger, R.; Nagaraja, M.; Kurian, M.Z.; Rasheed, I. Analysis, Design and Testing of Frequency Hopping Spread Spectrum Transceiver Model Using Matlab-Simulink. Int. J. Adv. Res. Electr. Electron. Instrum. Eng. 2014, 3, 7432–7438. 21. SPW Signal Processing Systems. Available online: https://www.synopsys.com/verification/virtual- prototyping/algorithm-design-analysis/spw.html (accessed on 21 February 2018). Sensors 2018, 18, 657 34 of 34

22. VisSim Comm Signal Processing and Communication System Design. Available online: http://www. adeptscience.co.uk/products/mathsim/vissim/vissim-comm.html (accessed on 21 February 2018). 23. Berger, A.; Pichler, M.; Ciccarello, D.; Priller, P.; Springer, A. Characterization and Adaptive Selection of Radio Channels for Reliable and Energy-Efficient WSN. In Proceedings of the IEEE Wireless Communications and Networking Conference (WCNC), Doha, Qatar, 3–6 April 2016. 24. Saad, W.M.; Marsland, I. Weighted Random Frequency Hopping in the Presence of Narrowband Interference. In Proceedings of the 10th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI-CON), Krabi, Thailand, 15–17 May 2013. 25. Sughasiny, M.; Dhanapal, R. Interference Avoidance Mechanisms in Bluetooth—A Comparative Study. Int. J. Comput. Appl. 2013, 75, 37–42. 26. D’mello, S.; Aalam, Z. AFH Techniques—Survey Based on Probabilistic Channel Usage. Int. J. Res. Comput. Eng. Electron. 2014, 3, 1–5. 27. Putzke, M.; Wietfeld, C. Self-organizing OFDMA Systems by Random Frequency Hopping. In Proceedings of the 4th IFIP Wireless Days, Niagara Falls, ON, Canada, 10–12 October 2011. 28. El-Khamy, S.E. Matched Frequency Hopping (MFH) Signals for Slowly Fading Dispersive Channels. IEEE Trans. Veh. Technol. 1998, 47, 365–369. [CrossRef] 29. El-Khamy, S.E.; Abdalla, F.; Al-Hourani, A. An Improved Channel Aware Clipped Matched Frequency Hopping (CMFH) Signaling Technique in Slowly Fading Dispersive Channels. In Proceedings of the Twenty-Second National Radio Science Conference (NRSC 2005), Cairo, Egypt, 15–17 March 2005. 30. El-Khamy, S.E.; Saad, W.M. New Technique for Enhancing the Signaling in Slowly Fading Dispersive Channels. In Proceedings of the 5th International Conference on Wireless Communications, Networking and Mobile Computing (WiCom), Beijing, China, 24–26 September 2009. 31. Stabellini, L.; Shi, L.; Al Rifai, A.; Espino, J.; Magoula, V. A New Probabilistic Approach for Adaptive Frequency Hopping. In Proceedings of the 2009 IEEE 20th International Symposium on Personal, Indoor and Mobile Radio Communications, Tokyo, Japan, 13–16 September 2009. 32. Cheikh, S.B.; Esemann, T.; Hellbrück, H. SAFH—Smooth Adaptive Frequency Hopping. In Proceedings of the 2011 Third International Workshop on Cross Layer Design (IWCLD), Rennes, France, 30 November–1 December 2011.

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).