A Fuzzy-Logic Based Adaptive Data Rate Scheme for Energy-Efficient LoRaWAN Communication

: Long Range Wide Area Network (LoRaWAN) technology is rapidly expanding as a technology with long distance connectivity, low power consumption, low data rates and a large number of end devices (EDs) that connect to the Internet of Things (IoT) network. Due to the heterogeneity of several applications with varying Quality of Service (QoS) requirements, energy is expended as the EDs communicate with applications. The LoRaWAN Adaptive Data Rate (ADR) manages the resource allocation to optimize energy efﬁciency. The performance of the ADR algorithm gradually deteriorates in dense networks and efforts have been made in various studies to improve the algorithm’s performance. In this paper, we propose a fuzzy-logic based adaptive data rate (FL-ADR) scheme for energy efﬁcient LoRaWAN communication. The scheme is implemented on the network server (NS), which receives sensor data from the EDs via the gateway (GW) node and computes network parameters (such as the spreading factor and transmission power) to optimize the energy consumption of the EDs in the network. The performance of the algorithm is evaluated in ns-3 using a multi-gateway LoRa network with EDs sending data packets at various intervals. Our simulation results are analyzed and compared to the traditional ADR and the ns-3 ADR. The proposed FL-ADR outperforms the traditional ADR algorithm and the ns-3 ADR minimizing the interference rate and energy consumption.


Introduction
LoRaWAN is a proprietary trademark synonymous with LoRa and a member of the Low Power Wide Area Networks (LPWANs) technology on the Internet of Things (IoTs).It connects numerous end devices (EDs) with low-cost, low-data-rate, long-range, and longlasting batteries suitable for various IoT applications with varying QoS in various industries such as smart agriculture, smart metering, smart cities and smart healthcare [1][2][3][4].Unlike NB-IoT [5] and Sigfox [6], which are proprietary, LoRaWAN operates in the industrial, scientific and medical (ISM) band.LoRa employs a physical (PHY) layer chirp spread spectrum (CSS) modulation technology which provides the highest receiver sensitivity while consuming the least power in comparison with other LPWAN technologies [7].The CSS enables the demodulation of data packets with low signal-to-noise ratio (SNR) at lower data rates.EDs sense the environment and communicate with the network server (NS) via the gateway (GW).Depending on the distance from the gateway and the propagation conditions, transmission parameters are set, namely, spreading factor (SF), transmission power (TP), bandwidth (BW) and coding rate (CR).These transmission parameters have an impact on energy consumption.LoRaWAN employs the Adaptive Data Rate scheme, an essential element which regulates these transmission parameters, to optimize resource allocation.The key objective of the ADR scheme is network optimization for maximum capacity, ensuring that EDs always transmit with optimal transmission parameters.Since the lifespan of the ED's battery is limited, charging or replacing batteries may be impossible in some harsh environments; thus, energy efficiency is considered to avoid network lifetime degradation in a LoRaWAN network.Numerous works on ADR either optimize the spreading factor to improve packet success ratio using a channel-adaptive SF recovery algorithm [8], packet reception probability (PRP) under average energy consumption constraint [9] using a distributed genetic algorithm, maximize the throughput of the EDs using the matching theory [10], or optimize the transmission power to maximize utility [11].Other approaches use optimization of the ADR mechanism's convergence time [12], which is hampered by a high spreading factor and does not correlate to efficient energy consumption.
In this paper, a fuzzy-logic based adaptive data rate algorithm is proposed to improve energy consumption in a LoRaWAN network.The proposed scheme makes use of the Mamdani fuzzy inference system (FIS) to create an inference system for selecting network parameters to achieve high network efficiency for various IoT scenarios using LoRa networks.The proposed scheme aids in the decision-making process by selecting optimal SF and TP parameters based on channel estimates derived from the signal-to-noise-ratio (SNR) of the four most recently received data packets, which reduces computational costs when compared to traditional ADR, which considers 20 data packets.
To the best of our knowledge, no research has considered improving ADR by optimizing the SF and TP using fuzzy logic.Adapting fuzzy logic to changing ADR requirements will improve energy efficiency.The main challenge is how to implement the FL-ADR algorithm to configure the transmission parameters to provide reliable communication while using as little energy as possible.Our proposed scheme makes use of the LoRaWAN module developed in [13], which is built under the ns-3 simulation module.The ns-3 is an open-source discrete event simulator written in C++ and Python that simulates simple and complex network systems.The LoRaWAN module complies with the class A LoRaWAN 1.0 specifications [14].This paper makes the following contribution: 1.
We improved Semtech's traditional ADR to obtain SNR margin allocation by calculating the SNR average of four (4) packets rather than the traditional ADR's twenty (20) packets, which reduce the computational cost of searching for the SNR margin in every frame transmitted.

2.
We developed a fuzzy-logic based algorithm to calculate the optimal SF and TP values using the obtained SNR margin for the EDs to select an efficient data rate to be transmitted.

3.
We evaluated the performance of the system through extensive simulations.We used six metrics to compare the results obtained with the traditional ADR and the ns-3 ADR scheme, namely, Total Energy Consumption (E T ), Confirmed Packet Success Rate (CPSR), Uplink Packet Delivery Ratio (UL-PDR), Interference/Collision Rate (I PR ), Lost-Because-Busy Rate (L PR )) and Energy Efficiency.
The remainder of the paper is organized as follows: Section 2 presents the related work; Section 3 provides a technological overview of the LoRaWAN ADR as well as the fuzzy logic system.Section 4 presents the proposed FL-ADR scheme while Section 5 describes the simulation of the proposed FL-ADR algorithm under ns-3 and Section 6 discusses and analyses the results.Section 7 concludes the paper.

Related Work
LoRaWAN networks have been implemented in numerous deployments and are rapidly growing due to the rising demand of smart applications in IoTs.The most ubiquitous challenges that exist regarding these deployments is energy efficiency.The early ADR algorithms [15][16][17][18] sought to solve the challenge of scalability, congestion, throughput and packet delivery ratio without focusing on the schemes' impact on energy consumption.The authors in [19] propositioned two ADR methods of cumulative complexity: EXPLoRa-SF and EXPLoRa-AT to decrease collisions, enhance data extraction rate, and therefore im-prove network throughput.They, however, did not consider the effect of the algorithm on energy efficiency.
In Ref. [20], dynamic LoRa (DyLoRa) was proposed, a scheme that uses a symbol error rate model to determine an energy efficient SF and TP allocation.Optimizing convergence time of the ADR mechanism is used in [12], channel allocation conditions in [21], frequency estimation in [22] and link level performance in [11], to formulate the problems that the ADR algorithms attempt to address.In Ref. [23], the authors developed EARN, an enhanced greedy ADR mechanism with code rate modification to exploit adaptive SNR margin to mitigate the dynamic link changes.A spreading factor assignment strategy was introduced in [24] to evaluate capacity vs. coverage tradeoff in LoRaWAN.They define and compare the performance of nine assignment strategies using vector assignment.They provide evaluation results related to the proposed work.
The adaptation of fuzzy logic in IoT to improve the efficiency of smart applications has gained attention [25,26].The fuzzy logic approach was used in [27] to predict efficient LoRa communication.They develop a fuzzy logic model to predict a high network efficiency under different environment scenarios.This work considers only spreading factors of 7 and 9. Our proposed work builds on this previous research in [18,27] to adapt fuzzy logic to the ADR scheme by optimizing SF and TP to provide an efficient energy usage that improves LoRaWAN communication.In contrast to the traditional ADR scheme, the ADR+ scheme developed in [18] outperforms the traditional ADR scheme with the use of the 20 measured packets' average SNR instead of the traditional maximum SNR value.This resulted in improved energy efficiency.We propose a modification of the number of measured packets, the use of the packets' average SNR, and the development of a fuzzy logic-based algorithm to optimise the spreading factor and transmission power.This results in a reduction in energy consumption, hence prolonging the battery lifetime of the EDs.The key research papers discussed in this section are summarized in Table 1.The table highlights the shared characteristics in the cited papers.

Technological Overview
Out of the OSI layer protocol, LoRaWAN utilizes three layers of the protocol stack, namely, PHY layer, MAC layer and Application layer.The PHY layer is represented by LoRa, a patented technology advanced by Semtech [28].LoRa works in different frequency bandwidths depending on the regional parameters as prescribed in [29].The characteristics of LoRa, for instance, topology, data transmission, error correction, modulation and data range, are described in [30].The MAC layer is represented by LoRaWAN, an open-source protocol managed by the LoRa Alliance.It is the interface between LoRa and the gateway by providing channel access, ADR control and security services.LoRaWAN is derived from pure ALOHA medium access, meaning that EDs do not check for channel availability prior to transmitting data packets, opening up to the possibility of packet collision.The LoRaWAN standard defines three device classes that support bidirectional communication, trading off performance for power consumption.
Dependent on the application framework, LoRaWAN EDs could be modelled into three distinctive classes: Class A EDs are required to avail one or two receive windows after every UL transmission to permit the NS to distribute a prospective data packet to the ED.When an ED receives a DL transmitted in the initial window, it is exempted from unlocking the second window; otherwise, it should unlock the second window.Class B EDs are an extension of Class A behaviour with the addition of slotted receive windows for DL transmissions.Synchronization of the receive window is done by means of a beacon packet transmission using the GWs.Class C EDs are also an extension of Class A behaviour by maintaining the receive window open at all times except during UL transmission.This provides Class C EDs with low latency DL transmission, which entails greater energy utilization.This study only considers Class A EDs because ns-3 currently only implements Class A devices and Class A behaviour results in the least energy utilization.

LoRaWAN Adaptive Data Rate
The standard LoRaWAN ADR (which we will call Semtech-ADR to distinguish it from other ADR schemes used in this work) algorithm dynamically modifies the transmission parameters in order to extend the battery life and maximize throughput.The data rates and transmission power for every ED in the LoRaWAN network are adjusted to achieve this.The ADR algorithm is applicable on the ED side and the NS side.Data rate selection is determined the transmission parameters and past performance of each ED.Battery lifetime is extended, and the global network capacity is increased by optimizing data rates, time on air (ToA), and energy depletion, thereby enhancing the lifecycle of the end devices.Following the LoRaWAN Regional Parameters and Specifications [29,30], EDs are required to accommodate specified data rates, further complicating the power constraint problem since SNR figures must range across specific thresholds and power levels.Given that the EDs should respond to the network's channel conditions, it is necessary that they have the capability to adjust the data rates and TP appropriately.A review of the LoRaWAN ADR framework is provided in [31].
To obtain optimal data rates, EDs must follow specific procedures [30].Firstly, the end node selects the ADR bit in a UL message header requesting that the NS manage data rate adaptation.Subsequently, the NS sends LinkADRReq MAC instruction to the ED, which specifies the modification of its SF and TP, which results in a change in data rate.The ED uses the LinkADRAns MAC command settings to confirm the required settings to the NS.If the ED is unable to receive a DL message within the ADR_ACK_LIMIT while the current data rate is greater than the nominal data rate, all subsequent uplinks will be transmitted with the ADRACKReq bit set.If the ED is unable to receive a DL message within the ADR_ACK_DELAY from the NS, in the subsequent uplinks, the ED attempts to re-establish communication by changing to the next lower data rate which delivers an extended communication range.As a result, the ED reduces the data rate by a step each instance that the ADR_ACK_DELAY is attained.When the ED receives a DL message from the NS, it uses its internal counter ADR_ACK_CNT which is reset.Figure 1 details the ADR system flow effected at the ED.
On the network server side, the NS monitors the uplink quality and commands the EDs to adjust the SF and TP.The UL quality of each packet transmitted by the ED is recorded in the network server's history and compared to the minimum required SNR threshold.If the SNR of recent packets is found to be better, the NS commands the EDs to reduce SF and TP and vice versa.The main difference between the Semtech-ADR model and the ns-3-ADR implementation is that ns-3 does not use the 10 dB deviceMargin in its implementation.Another differentiating factor is that TP is adjusted in steps of 2 instead of 3 as implemented in the Semtech-ADR.The LoRaWAN network does not operate in stable network conditions due to varying weather conditions, radio interference, moving obstacles, and so on.These factors result in a constant change in received signal strength indicator.It is imperative that there is no overestimation of the link.We therefore cannot have a crisp value for the target SNR margin , necessitating the use of fuzzy logic to optimize transmission parameter resource management.The SNR margin is used to estimate how much we can adjust the data rate by optimizing SF and TP, which will result in minimized energy consumption.
instance that the ADR_ACK_DELAY is attained.When the ED receives a DL message from the NS, it uses its internal counter ADR_ACK_CNT which is reset.Figure 1 details the ADR system flow effected at the ED.
On the network server side, the NS monitors the uplink quality and commands the EDs to adjust the SF and TP.The UL quality of each packet transmitted by the ED is recorded in the network server's history and compared to the minimum required SNR threshold.If the SNR of recent packets is found to be better, the NS commands the EDs to reduce SF and TP and vice versa.The main difference between the Semtech-ADR model and the ns-3-ADR implementation is that ns-3 does not use the 10 dB deviceMargin in its implementation.Another differentiating factor is that TP is adjusted in steps of 2 instead of 3 as implemented in the Semtech-ADR.The LoRaWAN network does not operate in stable network conditions due to varying weather conditions, radio interference, moving obstacles, and so on.These factors result in a constant change in received signal strength indicator.It is imperative that there is no overestimation of the link.We therefore cannot have a crisp value for the target  , necessitating the use of fuzzy logic to optimize transmission parameter resource management.The  is used to estimate how much we can adjust the data rate by optimizing SF and TP, which will result in minimized energy consumption.

Fuzzy Logic System
We can define fuzzy logic systems (FLS) as universal approximators of nonlinear systems that perform the nonlinear mapping of an input data set to a scalar output data [33,34].We use FLS for decision-making based on "uncertain, imprecise environments" [35].Fuzzy Logic Control based systems do not process assumptions on the basis of the probability distribution framework.Because they can estimate any real continuous function to a compact set, FLS is specifically applicable to dynamic systems and can

Fuzzy Logic System
We can define fuzzy logic systems (FLS) as universal approximators of nonlinear systems that perform the nonlinear mapping of an input data set to a scalar output data [33,34].We use FLS for decision-making based on "uncertain, imprecise environments" [35].Fuzzy Logic Control based systems do not process assumptions on the basis of the probability distribution framework.Because they can estimate any real continuous function to a compact set, FLS is specifically applicable to dynamic systems and can approximate these dynamic systems to any level of precision.A FLS consists of four core elements: the fuzzifier, the rules, the inference engine, and the defuzzifier [36].The fuzzification state transforms the crisp values of the system inputs into fuzzy values.This stage consists of computing the fuzzy values of the linguistic variables given their respective system inputs.The appropriate fuzzy rules are activated by utilizing the fuzzy input values in the inference step, which then produce the commensurate fuzzy output values.In the final stage, the fuzzy output values are converted into crisp values at the defuzzification stage.
The fuzzy controller derives its output from the fuzzification of both inputs and outputs with the use of associated membership functions.Based on the value of the crisp input, the fuzzy controller will convert it to a range of inputs (members) of the associated membership functions.A membership function is a curve that expresses how every element in the input range maps to a degree of membership ranging from 0 and 1.The general types of membership functions are triangular, trapezoidal and Gaussian.The fuzzy inference process uses three methods that are proposed in literature, namely Mamdani, Sugeno and Tsukamoto.The fuzzy logic algorithm is a problem-solving algorithm that uses the basic IF-THEN rule structure.

The Proposed Algorithm
We propose the use of fuzzy logic for our ADR algorithm to predict the values of SF and TP on the NS side of the network.The algorithm generates new transmission parameters (SF and TP) according to channel approximations derived from the SNR of the four most recently received data packets (ReceivedPacketList).This reduces computational costs compared to the traditional ADR, which uses 20 data packets to estimate the link quality.For the implementation of the proposed FL-ADR Algorithm, we applied average SNR margin as the input variable consisting of three membership functions with linguistic variables LOW, IDEAL and HIGH.Triangular membership functions were used in this algorithm.The pattern is determined by the "historyRange" from the ReceivedPacketList.Furthermore, we used two output variables TP-New and SF-New, both consisting of three membership functions with linguistic variables LOW, MEDIUM and HIGH.The SNR margin is implemented to modify appropriate SF and TP parameters.The single input multiple output Mamdani fuzzy control system [37] is employed to control the output for optimum adjustment of the SF and TP using Fuzzylite libraries [38].We designed our membership functions using some of the standards used in [39] using the triangle membership function.

The System Model
To achieve energy efficiency in the network, LoRaWAN must satisfy the SNR, data rate and power requirements.In our network, we optimize SF and TP at the ED in order to minimize energy utilization.We consider a LoRa network that uses modulation with a fixed BW of 125 kHz and a fixed payload.The simulation tool mimics the SX1301 digital baseband chip used for GW capabilities and SX1272 for the ED transceiver [40,41].The EDs and GWs are static, randomly distributed and their number does not change in the network.Ten simulations were run with different seeds of random number generator in order to get the statistical confidence of the performance metrics.The network has enabled confirmed traffic.GWs are placed in a hexagonal grid layout where a GW is placed at the center of each hexagon.We assume that a single GW has the default three receivers working in parallel.When a data packet is transmitted through a specific LoRa channel and receive paths listening at that channel are unavailable, the data packet is lost.The path loss model between the EDs and the GWs is based on the Log Distance Propagation Model [42].The effects of signal propagation on signal strength are estimated by a link measurement model at the GW and takes into consideration factors like TP and antenna gains both at the transmitter and receiver.The received signal power at the GW is given by (1): where P tx is the transmit power at the i th ED, G a is the antenna gain, L p is the path loss.We express the power in dB as shown in (2): The path loss propagation is given by (3): where d i is the distance between the i th ED and the gateway, α is the pathloss exponent (3.76), and f c is the carrier frequency (868.1 MHz).We assume a simple energy consumption model comprising of four states, namely, transmit, idle, receive and sleep.The energy model links each of the aforementioned states with a different voltage and current utilization as shown in Table 1.We monitor the energy usage of each node throughout the simulation period in order to determine the energy consumption of the network.The model calculates the device energy consumption and estimates the ED's battery life.The total energy consumption for each ED is given by ( 4): where E tx is the energy consumed when the ED is transmitting a packet, E rx is the energy consumed when the ED is receiving an incoming packet, E i is the energy consumed when listening for incoming packets, E s is the energy consumed when the ED is sleep mode.
In our model, we optimize the SF and TP by minimizing the SNR requirements of the link.The LoRaWAN specification stipulates the required SNR thresholds that enable signals to be demodulated at the GW according to the current data rate the ED is implementing.LoRa can demodulate signals that are −7.5 dB to −20 dB below the noise floor [30].We set the range of SNR margin from −25 to 25 [43].Fuzzy logic is introduced on the NS side to determine how SF and TP can be optimally allocated.The FL-ADR algorithm determines the average SNR over four most recent transmissions, determines the minimum required SNR using the current parameters and then calculates the margin.Using this margin, we implement the fuzzy logic to optimize SF and TP.Furthermore, we set the fuzzy rules and use the Mamdani FLS to complete the operation.SNR margin is calculated as follows: where SNR avg is the average SNR of the packets in the ReceivedPacketList, SNR required is the minimum SNR threshold, D margin is the device margin.
When the SNR margin is high, the data rate can be increased, which implies reducing the SF and TP values.When the SNR margin value is low, it implies that the current data rate the ED is using is high and must be reduced by increasing the SF and TP.On the NS side, our proposed FL-ADR algorithm allocates the lowest possible SF above the GW sensitivity and the corresponding TP to the ED.The solution for the optimal transmission parameters for the EDs is obtained using the following procedure: • the linguistic variable and terms are defined; • the membership functions are constructed; • the fuzzy values are created from the crisp input data; • the rule base evaluates the rules; • each rule's outcomes are aggregated, and the non-fuzzy values are generated from the output data.

The Input Variable-SNR margin
The linguistic variable SNR margin is decomposed into a set of linguistic terms: The crisp input values are mapped to fuzzy linguistic terms by the membership functions and are defined by ( 6)-( 8) below.Figure 2 shows the membership function of the input variable SNR margin .

•
the rule base evaluates the rules; • each rule's outcomes are aggregated, and the non-fuzzy values are generated from the output data.

The Input Variable-𝑆𝑁𝑅
The linguistic variable  is decomposed into a set of linguistic terms:  = {LOW, IDEAL, HIGH}.
The crisp input values are mapped to fuzzy linguistic terms by the membership functions and are defined by ( 6)-( 8) below.Figure 2 shows the membership function of the input variable  .The following are the three triangular membership functions used to represent the range of input variable  :

The Fuzzy Rules
In order to regulate the output variable, an FLS constructs a rule base.The fuzzy rules are simple IF-THEN rules with a condition and a conclusion.The rules are set using the knowledge of the LoRaWAN specifications in terms of SNR range, spreading factors and transmission power.The following are the three rules defined in our Fuzzy-Logic based ADR algorithm: is LOW then TPnew is MEDIUM and SFnew is MEDIUM."

The Output Variable-TPnew
The linguistic variable for transmission power is decomposed into a set of linguistic terms: The following are the three triangular membership functions used to represent the range of input variable SNR margin :

The Fuzzy Rules
In order to regulate the output variable, an FLS constructs a rule base.The fuzzy rules are simple IF-THEN rules with a condition and a conclusion.The rules are set using the knowledge of the LoRaWAN specifications in terms of SNR range, spreading factors and transmission power.The following are the three rules defined in our Fuzzy-Logic based ADR algorithm: 1.
"if SNR margin is HIGH then TPnew is MEDIUM and SFnew is MEDIUM;" 2.
"if SNR margin is IDEAL then TPnew is LOW and SFnew is LOW;" 3.
"if SNR margin is LOW then TPnew is MEDIUM and SFnew is MEDIUM."

The Output Variable-TPnew
The linguistic variable for transmission power is decomposed into a set of linguistic terms: TPnew = {LOW, MEDIUM, HIGH}.
The membership functions are defined by ( 9)-( 11) below.Figure 3 shows the membership functions for transmission power.

The Output Variable-SFnew
The linguistic variable for spreading factor is decomposed into a set of linguistic terms: SFnew = {LOW, MEDIUM, HIGH}.
The membership functions for spreading factor estimation are defined by ( 12)-( 14) below and shown in Figure 4.The following are the three Triangle membership functions used to represent the range of output variable TPnew: µ MEDIUM (x) = x − 5 5 , 5 ≤ x ≤ 10 15 − x 5 , 10 < x ≤ 15 ( 10)

The Output Variable-SFnew
The linguistic variable for spreading factor is decomposed into a set of linguistic terms: SFnew = {LOW, MEDIUM, HIGH}.
The membership functions for spreading factor estimation are defined by ( 12)-( 14) below and shown in Figure 4.
The membership functions are defined by ( 9)-( 11) below.Figure 3 shows the membership functions for transmission power.

The Output Variable-SFnew
The linguistic variable for spreading factor is decomposed into a set of linguistic terms: SFnew = {LOW, MEDIUM, HIGH}.
The membership functions for spreading factor estimation are defined by ( 12)-( 14) below and shown in Figure 4.The following are the three Triangle membership functions used to represent the range of output variable SF-New: µ MEDIUM (x) = x − 8 1.5 , 8 ≤ x ≤ 9.5 11 − x 1.5 , 9.5 < x ≤ 11 ( 13) Below is the Algorithm 1 for the proposed FL-ADR scheme
For our simulations, we used up to seven GW nodes, one NS node and between 100 and 300 ED nodes in a 10 km × 10 km network, sending data packets at different time intervals.Tables 2 and 3 show the parameters used in the LoRaWAN simulation.We coded our algorithms inside the ADR component code of the ns-3 LoRaWAN module.We analyzed the system performance of different ADR models, namely, the standard ADR model, which we term Semtech-ADR, the ADR model implemented in the ns-3 LoRaWAN module, which we term ns-3-ADR and our proposed fuzzy logic-based ADR known as FL-ADR.We performed two different evaluations and analyses.In the first evaluation, we used 100 EDs and changed the Application Data Packet Rate to transmit 1 packet per 300 s, 600 s, 900 s, 1200 s and 1500 s.In the second evaluation, we kept the application data rate constant at 1 packet per 600 s and varied the number of EDs to 100, 150, 200, 250 and 300 and analyzed the performance.The simulation was configured to simulate for 3.3 h.

The Parameters of the Simulation
Tables 2 and 3 show some of the important parameters that we used while evaluating the performance of the typical LoRaWAN network.Table 2 below shows the energy model parameters used by ED nodes of ns-3 LoRaWAN simulation.

Results and Discussion
This section includes a performance analysis of our proposed scheme as well as the numerical output of our simulations.Using two additional schemes as benchmarks, we evaluated the performance of our proposed algorithm.Table 4 shows some characteristics of the three ADR schemes being compared.In this analysis, we used six metrics (Total Energy Consumption (E T ), Confirmed Packet Success Rate (CPSR), Uplink Packet Delivery Ratio (UL-PDR), Interference/Collision Rate (I PR ), Lost-Because-Busy Rate (L PR )) and Energy Efficiency in the evaluation of the LoRaWAN network performance.The charts below show the comparison in performance between Semtech-ADR, ns-3-ADR and our proposed FL-ADR scheme, indicating network performance using these metrics.We use the six metrics we are considering for performance analysis.E T ) comprises the energy utilized by all the EDs. Figure 5a considers application data intervals.The FL-ADR showed superior performance with respect to the total energy consumed.This is attributed to the ideal SNR margin obtained from the FIS, ensuring effective assignment of SF values at minimal transmission power.As the data packet interval increases, less energy is expended because the probability of packet collision and retransmission is reduced.According to the simulation results, the global network performance shows that, every time the interval is increased by 300 s, the overall network energy consumption reduces at every step by approximately 46%, 22%, 18% and 6%, respectively, across the three algorithms.This aligns with the fact that a low duty cycle is ideal for LoRaWAN as per specifications.Figure 5b provides a comparison of energy consumption against different numbers of node density at a constant application data interval of 600 s.As more nodes are added onto the network, it is expected that the total energy consumption will increase.The simulation results show that the proposed FL-ADR algorithm conserves over 43% of the battery energy compared to Semtech-ADR and 14% saving compared to ns-3-ADR, respectively.

Maximum SNR
Minimum SNR Average SNR  (Equation ( 5))  calculation excludes   (Equation ( 5)) No steps required Uses 3 dB steps to adjust TP Uses 2 dB steps to adjust TP Uses fuzzy logic

Performance in Terms of Total Energy Consumption
Figure 5a,b show the performance of the three different LoRaWAN ADR implementations in terms of total energy consumption.The total energy consumption (ET) comprises the energy utilized by all the EDs. Figure 5a considers application data intervals.The FL-ADR showed superior performance with respect to the total energy consumed.This is attributed to the ideal SNR margin obtained from the FIS, ensuring effective assignment of SF values at minimal transmission power.As the data packet interval increases, less energy is expended because the probability of packet collision and retransmission is reduced.According to the simulation results, the global network performance shows that, every time the interval is increased by 300 s, the overall network energy consumption reduces at every step by approximately 46%, 22%, 18% and 6%, respectively, across the three algorithms.This aligns with the fact that a low duty cycle is ideal for LoRaWAN as per specifications.Figure 5b provides a comparison of energy consumption against different numbers of node density at a constant application data interval of 600 s.As more nodes are added onto the network, it is expected that the total energy consumption will increase.The simulation results show that the proposed FL-ADR algorithm conserves over 43% of the battery energy compared to Semtech-ADR and 14% saving compared to ns-3-ADR, respectively.

Performance in Terms of Confirmed Packet Success Rate
Figure 6a,b show the performance of the three ADR implementations of LoRaWAN in terms of confirmed packet success rate.This is the probability that the transmitted uplink packets and their corresponding downlink packets are appropriately received by the network server and the ED, respectively, in at least one of the transmission attempts available.Our proposed algorithm FL-ADR is outperformed by the other Semtech-ADR and

Performance in Terms of Confirmed Packet Success Rate
Figure 6a,b show the performance of the three ADR implementations of LoRaWAN in terms of confirmed packet success rate.This is the probability that the transmitted uplink packets and their corresponding downlink packets are appropriately received by the network server and the ED, respectively, in at least one of the transmission attempts available.Our proposed algorithm FL-ADR is outperformed by the other Semtech-ADR and ns-3-ADR algorithms.The effect of the gateway density makes the CPSR close to one for the better performing algorithms while FL-ADR ranges between 0.7 and 0.8 [51].The results show that CPSR tends to increase as the application data interval increases.This is because longer intervals between transmissions reduce congestion and therefore reduce the probability of interference or packet collision.As the node density increases, the CPSR decreases as a result of an increase in the probability of interference or collision.An increase in network size results in more attempts to transmit packets and a drop in the ratio of successfully received packets.For example, when the node density is 150, the value of FL-ADR CPSR is 0.754, while that of ns-3-ADR is 0.991.The CPSR decreases when the node density increases to 300 nodes to 0.721 for FL-ADR and 0.945 for ns-3-ADR, respectively.the probability of interference or packet collision.As the node density increases, the CPSR decreases as a result of an increase in the probability of interference or collision.An increase in network size results in more attempts to transmit packets and a drop in the ratio of successfully received packets.For example, when the node density is 150, the value of FL-ADR CPSR is 0.754, while that of ns-3-ADR is 0.991.The CPSR decreases when the node density increases to 300 nodes to 0.721 for FL-ADR and 0.945 for ns-3-ADR, respectively.

Performance in Terms of Uplink Packet Delivery
The probability that an uplink packet ( ) is correctly received (whether or not the ACK is requested) is defined as Uplink Packet Delivery Ratio (UL-PDR).We measure the ratio of uplink packets successfully delivered to the GW over those generated at the EDs.In Figure 7, the FL-ADR shows poorer performance in terms of UL-PDR compared to the other two algorithms.More differences in performance are apparent in the two unique metrics considered below even though there is a difference when comparing the UL-PDR and CPSR performance, especially between Semtech-ADR and ns-3-ADR.

Performance in Terms of Uplink Packet Delivery Ratio
The probability that an uplink packet (UL s ) is correctly received (whether or not the ACK is requested) is defined as Uplink Packet Delivery Ratio (UL-PDR).We measure the ratio of uplink packets successfully delivered to the GW over those generated at the EDs.In Figure 7, the FL-ADR shows poorer performance in terms of UL-PDR compared to the other two algorithms.More differences in performance are apparent in the two unique metrics considered below even though there is a difference when comparing the UL-PDR and CPSR performance, especially between Semtech-ADR and ns-3-ADR.

Performance in Terms of Interference/Collision Rate
Figure 8a,b shows the performance of the three different ADR schemes considering the interference/collision rate.It is the rate of packet loss when the packet is correctly locked-on by the GW, but due to interference from overlapping packets, the GW fails to receive the packet.The performance of FL-ADR performs slightly better than the ns-3-ADR, while the Semtech-ADR is marginally underperforming.The slight increase in interference rate at a 1200 s interval is peculiar.Interference is minimal in this network attributed to the effect of multiple gateways.As the node density increases, the network becomes more prone to interference/collisions. Typically, as the application data interval increases, the probability of interference/collision decreases.It is the rate of packet loss when the packet is correctly locked-on by the GW, but due to interference from overlapping packets, the GW fails to receive the packet.The performance of FL-ADR performs slightly better than the ns-3-ADR, while the Semtech-ADR is marginally underperforming.The slight increase in interference rate at a 1200 s interval is peculiar.Interference is minimal in this network attributed to the effect of multiple gateways.As the node density increases, the network becomes more prone to interference/collisions. Typically, as the application data interval increases, the probability of interference/collision decreases.
Figure 8a,b shows the performance of the three different ADR schemes considering the interference/collision rate.It is the rate of packet loss when the packet is correctly locked-on by the GW, but due to interference from overlapping packets, the GW fails to receive the packet.The performance of FL-ADR performs slightly better than the ns-3-ADR, while the Semtech-ADR is marginally underperforming.The slight increase in interference rate at a 1200 s interval is peculiar.Interference is minimal in this network attributed to the effect of multiple gateways.As the node density increases, the network becomes more prone to interference/collisions. Typically, as the application data interval increases, the probability of interference/collision decreases.This occurs when packets are lost due to GW transmission, the disruption of packet reception due to the broadcast of a downlink packet from the GW.Typically, the ratio decreases as the application data interval increases because there is less traffic to the GWs to receive UL and transmit DL messages.Where ED density is increasing, this ratio tends to increase because the GWs are flooded with transmissions.This metric provides more detail in the behavior of the algorithms where FL-ADR performs marginally better than its two counterparts as shown in Figure 9.The LoRa standard recommends the first DL receive window (RX1) to be unlocked on a similar channel used in the uplink, while the second window (RX2) is unlocked in the reserved downlink channel.While the GW is transmitting a DL message, no UL messages are transmitted.Therefore, as the node density increases, the number of UL and DL packets increase causing delays.
packet reception due to the broadcast of a downlink packet from the GW.Typically, the ratio decreases as the application data interval increases because there is less traffic to the GWs to receive UL and transmit DL messages.Where ED density is increasing, this ratio tends to increase because the GWs are flooded with transmissions.This metric provides more detail in the behavior of the algorithms where FL-ADR performs marginally better than its two counterparts as shown in Figure 9.The LoRa standard recommends the first DL receive window (RX1) to be unlocked on a similar channel used in the uplink, while the second window (RX2) is unlocked in the reserved downlink channel.While the GW is transmitting a DL message, no UL messages are transmitted.Therefore, as the node density increases, the number of UL and DL packets increase causing delays.

Energy Efficiency in Terms of Correctly Received Packets
The ratio of the total number of packets received at the gateway to the total amount of energy used by the network to send those packets is known as energy efficiency.Figure 10 below shows the energy consumed per packet calculated for the three algorithms under consideration.For these results, the application data interval was 600 s, implying that 20

Energy Efficiency in Terms of Correctly Received Packets
The ratio of the total number of packets received at the gateway to the total amount of energy used by the network to send those packets is known as energy efficiency.Figure 10 below shows the energy consumed per packet calculated for the three algorithms under consideration.For these results, the application data interval was 600 s, implying that 20 packets were sent per ED during the simulation period.Packets sent a range from 2000 to 6000 depending on the number of EDs.The FL-ADR is more energy efficient compared to the Semtech-ADR and the ns-3-ADR, showing that the proposed ADR is efficiently adjusting SF and TP despite a trade-off with CPSR and UL_PDR.From the results presented in the above sections, we observe that the two unique metrics  and  were able to showcase the intricate differences in performance better than CPSR and UL-PDR, which did not provide that much differentiation between the models, particularly under ideal network conditions.Where multiple gateways are implemented, CPSR and UL-PDR may have a value almost equal to one (100%) such that it is difficult to distinguish the performance of the models only by using CPSR and UL-PDR.In terms of energy consumption, FL-ADR provided the best performance, saving up to 14% of energy per ED node in this 3.3 h simulation scenario compared to the ns-3-ADR and 43% compared to Semtech-ADR.Although the FL-ADR is more energy efficient, this is achieved with a drop in performance in terms of CPSR and UL-PDR.This algorithm could be used in applications where energy consumption is of utmost priority in the QoS requirements.

Conclusions
In this work, we proposed a fuzzy-logic based adaptive data rate scheme for energyefficient LoRaWAN communication (FL-ADR) and evaluated its performance through extensive simulations.The proposed fuzzy logic-based model provided a reduction in energy consumption compared to Semtech-ADR and ns-3-ADR schemes achieving a better performance albeit with a decrease of CPSR and UL-PDR for this multi-gateway network.Using the two unique metrics for analysis,  and  , we were able to obtain more details on the CPSR and UL-PDR performance.The metrics  and  provide more insight on network performance on the physical layer.Future work involves investigating how to improve the CSPR and UL-PDR without compromising the energy efficiency that is accomplished by the proposed algorithm.It would be interesting to find the impact of combining the Fuzzy Logic System with other techniques such as deep learning on the network performance.From the results presented in the above sections, we observe that the two unique metrics I pR and L pR were able to showcase the intricate differences in performance better than CPSR and UL-PDR, which did not provide that much differentiation between the models, particularly under ideal network conditions.Where multiple gateways are implemented, CPSR and UL-PDR may have a value almost equal to one (100%) such that it is difficult to distinguish the performance of the models only by using CPSR and UL-PDR.In terms of energy consumption, FL-ADR provided the best performance, saving up to 14% of energy per ED node in this 3.3 h simulation scenario compared to the ns-3-ADR and 43% compared to Semtech-ADR.Although the FL-ADR is more energy efficient, this is achieved with a drop in performance in terms of CPSR and UL-PDR.This algorithm could be used in applications where energy consumption is of utmost priority in the QoS requirements.

Conclusions
In this work, we proposed a fuzzy-logic based adaptive data rate scheme for energyefficient LoRaWAN communication (FL-ADR) and evaluated its performance through extensive simulations.The proposed fuzzy logic-based model provided a reduction in energy consumption compared to Semtech-ADR and ns-3-ADR schemes achieving a better performance albeit with a decrease of CPSR and UL-PDR for this multi-gateway network.Using the two unique metrics for analysis, I PR and L PR , we were able to obtain more details on the CPSR and UL-PDR performance.The metrics I PR and L PR provide more insight on network performance on the physical layer.Future work involves investigating how to improve the CSPR and UL-PDR without compromising the energy efficiency that is accomplished by the proposed algorithm.It would be interesting to find the impact of combining the Fuzzy Logic System with other techniques such as deep learning on the network performance.

Figure 3 .
Figure 3. TPnew membership function.The following are the three Triangle membership functions used to represent the range of output variable TPnew:

Figure 4 .
Figure 4. SFnew membership function.The following are the three Triangle membership functions used to represent the range of output variable SF-New:

Figure 3 .
Figure 3. TPnew membership function.The following are the three Triangle membership functions used to represent the range of output variable TPnew:

Figure 4 .
Figure 4. SFnew membership function.The following are the three Triangle membership functions used to represent the range of output variable SF-New:

Figure 5a ,
Figure5a,b show the performance of the three different LoRaWAN ADR implementations in terms of total energy consumption.The total energy consumption (E T ) comprises the energy utilized by all the EDs.Figure5aconsiders application data intervals.The FL-ADR showed superior performance with respect to the total energy consumed.This is attributed to the ideal SNR margin obtained from the FIS, ensuring effective assignment of SF values at minimal transmission power.As the data packet interval increases, less energy is expended because the probability of packet collision and retransmission is reduced.According to the simulation results, the global network performance shows that, every time the interval is increased by 300 s, the overall network energy consumption reduces at every step by approximately 46%, 22%, 18% and 6%, respectively, across the three algorithms.This aligns with the fact that a low duty cycle is ideal for LoRaWAN as per specifications.Figure5bprovides a comparison of energy consumption against different numbers of node density at a constant application data interval of 600 s.As more nodes are added onto the network, it is expected that the total energy consumption will increase.The simulation results show that the proposed FL-ADR algorithm conserves over 43% of the battery energy compared to Semtech-ADR and 14% saving compared to ns-3-ADR, respectively.

Figure 5 .
Figure 5.The total energy consumption: (a) data interval vs. total consumed energy; (b) no.EDs vs. total consumed energy.

Figure 5 .
Figure 5.The total energy consumption: (a) data interval vs. total consumed energy; (b) no.EDs vs. total consumed energy.

6. 4 .
Figure8a,b shows the performance of the three different ADR schemes considering the interference/collision rate.It is the rate of packet loss when the packet is correctly locked-on by the GW, but due to interference from overlapping packets, the GW fails to receive the packet.The performance of FL-ADR performs slightly better than the ns-3-ADR, while the Semtech-ADR is marginally underperforming.The slight increase in interference rate at a 1200 s interval is peculiar.Interference is minimal in this network attributed to the effect of multiple gateways.As the node density increases, the network becomes more

Figure 8 .
Figure 8. Interference/collision rate: (a) data interval vs. interference/collision rate; (b) no.EDs vs. interference/collision rate.6.5.Performance in Terms of Lost-Because-Busy RateFigure 9a,b show the three different ADR performances in terms of Lost-Because-Busy rate.This occurs when packets are lost due to GW transmission, the disruption of

Figure 8 .
Figure 8. Interference/collision rate: (a) data interval vs. interference/collision rate; (b) no.EDs vs. interference/collision rate.6.5.Performance in Terms of Lost-Because-Busy Rate Figure 9a,b show the three different ADR performances in terms of Lost-Because-Busy rate.This occurs when packets are lost due to GW transmission, the disruption of packet reception due to the broadcast of a downlink packet from the GW.Typically, the ratio decreases as the application data interval increases because there is less traffic to the GWs to receive UL and transmit DL messages.Where ED density is increasing, this ratio tends to increase because the GWs are flooded with transmissions.This metric provides more detail in the behavior of the algorithms where FL-ADR performs marginally better than its two counterparts as shown in Figure9.The LoRa standard recommends the first DL receive window (RX1) to be unlocked on a similar channel used in the uplink, while the second window (RX2) is unlocked in the reserved downlink channel.While the GW is transmitting a DL message, no UL messages are transmitted.Therefore, as the node density increases, the number of UL and DL packets increase causing delays.

J 18 Figure 10 .
Figure 10.Energy Efficiency in terms of correctly received packets.

Author Contributions:
Conceptualization, R.K. and A.A.-M; Methodology, R.K.; Writing-original draft preparation, R.K.; writing-review and editing, G.H. and A.A.-M.e.All authors have read and agreed to the published version of the manuscript.

Figure 10 .
Figure 10.Energy Efficiency in terms of correctly received packets.

Table 1 .
Summary of related work.

Table 2 .
Energy model parameters.

Table 4 .
Features of the three ADR algorithms under consideration.