**3. Proposal of Multilayered Network Model for Mobile Network Infrastructure Disruption**

#### *3.1. Overview*

The proposed multilayered network model (MNM) is composed of three layers that accommodate three different types of wireless networks. The networks used in this multilayered concept are WSN, MANET, and DRONET. The main idea of this network model is to provide a backup network for destroying 5G and its infrastructure. In the case of MNM, WSN layer is supposed to provide IoT data collection functionality with the high number of static low energy wireless sensors. We assumed those data collected by the WSN network will be processed by cloud applications. Therefore, these data need to be transferred out of the WSN network to the Internet by gateways such as an Access Point (AP) of the Wi-Fi network. In the 5G network disruption scenario, we assumed that WSN gateways are unable to send data through AP since the fixed infrastructure is destroyed. In this case, data transfer to the part of the WSN network where Access Point is available could be very expensive in the term of energy consumption, data overload, delivery time, and so on. There is also a possibility that no functional Access Point exists in the WSN network.

Therefore, the ability to transfer critical data to the Internet could be handled by mobile inertial sensors in the MANET network [10]. Nodes of MANET network are not strictly energy-constrained and with mobility, higher radio ranges and data transfers are able to transfer data to the functional AP. There is also a possibility that the MANET network could fall apart into isolated sub-networks because of the mobility of nodes. This disadvantage is handled in MNM by UAVs of DRONET network. UAVs with appropriate communication technologies are able to communicate over long distances in the air without obstacles. DRONET network in MNM si playing the role of backbone network, which can transfer critical data from MANET sub-network without functional AP to the part of MANET network where the functional AP is presented. The structure of MNM is displayed in Figure 1.

Structure of MNM describes how this network model works. For example, WSN layer could be divided into three sub-WSN networks which all has its own connection to the Cloud on the Internet. The red area under WSN sub-network displayed at the left bottom expresses the part of fixed network

that is disrupted. Since the AP connection to the Cloud is not functional, the special type of WSN sensor, called WSN gateway, passes critical data to the nearest mobile sensor of the MANET network. However, the isolated MANET sub-network could also suffer from not functional AP, so the node pass obtained data from the WSN network to the nearest MANET gateway - the MANET node chosen by network to be a gateway to the DRONET layer. This gateway is directly connected to the UAV of DRONET network. UAV than looks for the best opportunity to deliver critical data to the MANET sub-network with functional AP. Therefore, the data are transferred through another UAV to MANET sub-network, where AP connection to the Cloud is operational. The whole path from source WSN node to Cloud is displayed by orange colour.

**Figure 1.** Structure of MNM.

Kazemzadeh et al. [11] presented a survey that addresses optimal multilayered network design identified by flow and design connectivity. Based on this survey, the MNM can be identified as a three-layer network model with one-to-one flow-connectivity design, where each layer is supporting or is supported by only one other layer. Urgent data from the WSN layer can be passed to the MANET layer and then to DRONET layer, while direct flow from WSN layer to DRONET layer does not exist. In MNM, the only urgent data in network disruption scenario can pass between layers, which is commodity of WSN layer. Therefore, MNM falls into multilayer single flow-type network, where only one layer has a commodity to route. When disruption scenario does not occur, the layers act independently and do not communicate.

In the following sections, the detailed functionality of all layers and interlayers interactivity will be described.

#### *3.2. WSN Layer*

The WSN layer in the MNM plays a role of the IoT network. It is composed of multiple low-energy wireless sensors that can be deployed in different environments. The biggest advantages of WSN networks are their localized and self-configuring capabilities, which can enable easier large-scale deployments even in inaccessible terrain. Market research suggests that WSN networks will be soon adopted by urban areas, mainly for public safety, localization, and environmental monitoring [4].

Sensors of WSN layer can communicate through different types of communication standards focused on low energy consumption and compatibility with a wireless interface of mobile devices. The most suitable standards for WSN layer are Bluetooth Low Energy (Bluetooth LE), Developers Alliance for Standards Harmonization of ISO 18000-7 (DASH7) and ZigBee IEEE 802.15.4 [12,13].

From the networking-layer point of view, the Bluetooth LE is designed for short ranges and higher data ranges. The main problem is energy consumption in the continuous data stream, where the energy consumption is almost similar with standard Bluetooth. Another problem is the supported star topology. Bluetooth LE operates primarily using ad hoc piconets, where the master device controls up to seven slaves per piconet. Slaves communicate only with the master and do not communicate with each other. However, a slave device may participate in one or more piconets [12]. This topology makes Bluetooth LE unsuitable for most of the WSN monitoring scenarios.

DASH7 is an open-source Wireless Sensor and Actuator Network protocol that provides multi-year battery life, long coverage range up to 2 km, and relatively low data rate down to 9.6 Kbps. The advantages are simple design and cheap chipset. However, its architecture is upload-centric, which means that it does not support mesh routing [13].

ZigBee [14] is one of the most suitable technologies for NMN. It able to communicate over distances from 10 to 50 m and with maximum transfer data rates of 250 Kbps. Newest embedded devices are able to communicate with lower transfer rates of 20 and 40 Kbit/s [15]. It is well analyzed and it is possible to adapt it to different deployment environments. With the combination with 6LoWPAN protocol [16], it provides powerful usability for WSN-Internet deployment. In the mesh network topology, 6LoWPAN protocol can enable connection of WSN sensors with the Internet by the edge router and it seamlessly combines IPv6 with standard IEEE 802.15.4 by performing header compression, fragmentation and reassembly. In addition, it supports the transition between IPv6 and IPv4. Another powerful specification for ZigBee is IPv6 Routing Protocol for Low-power and loss networks (RPL) [17]. RPL is basically an IPv6 multi-hop routing protocol that is suitable as a routing-layer protocol for ZigBee and is also enabled to connect WSN sensor nodes to the Internet. It adopts several techniques to tune routing for data collection optimization but requires a full-fledged IPv6 stack.

LoRa is a proprietary wireless data communication technology which specifies only a PHY layer. A popular MAC for use with LoRa is the open LoRaWAN specification. LoRa enables secure bi-directional, low cost and mobile communication for IoT, smart city, machine to machine (M2M) and industrial applications [18]. LoRa is a preferred technology for IoT embedded systems because of its long-range, high capacity of nodes in network, long battery life, bi-directional, secured and efficient network, interference immunity [18,19]. WSN makes use of Low-Power Wide-Area Networks (LPWANs), a wireless technology to transmit data over long distances with minimal power consumption. LoRaWAN is one of the most successful LPWAN technologies despite its low data rate and because of its low deployment and management costs. An experimental study on the range of LoRaWAN showed that it can achieve ranges up to 7.5 km using SF10 and packets with 10 bytes of payload [18]. The LoRaWAN technology transfer rates range between 0.3 kbps and 50 kbps. Since LoRa technology assures very large communication distances for an extremely low bandwidth, the standard is suitable for applications where a reduced amount of data is transferred and the information collected from the sensors does not change rapidly over time. In [19], the authors present multiple applications of LoRaWAN technology for WSN with IoT, such as water quality monitoring, agriculture, underground sensor networks or smart city. LoRaWAN is therefore another suitable technology for MNM.

Based on Zigbee, Bluetooth and WISA standards [20], several enhancements/related standards or products have been presented like the WirelessHART [21] and ISA 100.11a [22].

WirelessHART is an industrial control protocol that is extension of the Highway Addressable Remote Transducer (HART) communication protocol. It is designed to be reliable, easy to use, and interoperable protocol deployed in process control applications, alerting and monitoring systems. WirelessHART has low power consumption compared to ZigBee with higher security standards, and it can also establish large networks and can support different communication topologies [21]. However, while WirelessHART offers several features that complement its suitability in industry, it fails to offer appropriate solutions to facilitate interoperability. It is also not compatible with IP-based devices and the IoT [23].

ISA100.11a is a wireless network solution for IWSNs (Industrial WSN), developed by International Society of Automation (ISA). Like WirelessHART, it targets industrial applications in automation, process control and monitoring. It has the features of low power consumption, reliability, scalability, and security as well as high real-time data transfer [22]. It operates on 2.4 GHz frequency band, supports high data rates up to 250 kpbs [22]. The specification of an upper data link layer, network layer, UDP and TCP and application layer are defined. In addition, ISA100.11a is IP enabled and supports IPv6. Unlike WirelessHART, not all devices in ISA100.11a network must have routing capability. Without it, devices must be within one hop of a routing-capable device or the gateway. In larger networks, this disadvantage makes ISA100.11a unsuitable for MNM.

The best solution for MNM is ZigBee standard since it supports 6LoWPAN and RPL protocols to connect WSN nodes to the Internet. With appropriate routing protocols are also possible to establish the system of WSN gateways needed to provide interlayer communication. The role of WSN gateways will be further discussed in Section 3.5.

#### *3.3. MANET Layer*

The MANET network is usually composed of devices such as smartphones, tablets, laptops and so on. MANET layer in the MNM is composed of mobile smart sensors with communication based on IEEE 802.11 Wi-Fi using an Ad-Hoc mode. The advantages of the MANET network are the autonomous and self-organized network mobile nodes. Therefore, the establishment of the network is quick without needing fixed infrastructure, which enables MANET to be used in different scenarios and environments. The reason MANET is chosen as the second layer in MNM is due to the fact that MANET nodes are not strictly resource-constrained and offers longer radio ranges along with higher data rates. Standards like 802.11n offer data rate range from 54 Mbps to 600 Mbps with outdoor radio range up to 250 m [24]. With mobility, it is possible to send urgent data from the WSN layer through the MANET layer to the nearest functional AP.

The crucial part of MANET layer is communication without interference with other devices and with high spectrum efficiency in the highly congested 5G environment. One of the solutions to achieve higher spectral efficiency in 5G environment is D2D communication. Iqbal et al. [25] categorize D2D communication as Inband (licensed) and Outband (unlicenced) on the bases of spectrum in which D2D communication occurs. In Inband communication, D2D users share cellular resources, while in Outband communication is used to eliminate interference between D2D users and cellular users. It works in the unlicensed spectrum where Wi-Fi, Bluetooth and ZigBee operates. In terms of MANET networks, the solution to these problems is Cognitive Radio of Cognitive Radio Ad-Hoc Networks (CRAHN).

#### 3.3.1. Cognitive Radio in MANET Layer

In [26] we introduce the Adaptive Routing for CR-MANET (AR-CRM) based on Fuzzy logic. This routing method is based on functional blocks that can provide the functionalities of MANET nodes to sense spectrum, provide intelligent management of Wi-Fi channels and routing communication. In the MNM it is possible to implement methods for spectrum sensing and intelligent method for channel management, which can result in lower interference between MANET nodes that uses Wi-Fi communication interfaces. Spectrum sensing provides input data for Fuzzy logic based on SIR (Signal-to Interference Ratio) calculated from RSSI (Received Signal Strength Indicator) and Traffic. The output of precisely adjusted membership functions of Fuzzy logic provides the set of the best optimal channels for each device.

With this method the manage Wi-Fi channels according to the WSN channels is also possible. If the WSN layer uses the standard IEEE 802.15.4 ZigBee, the interference among MANET nodes can occur. The authors in [6] describes standard IEEE 802.11b/g/n/ax (Wi-Fi) channels from 1 to 13 in the range of 2401 MHz to 2495 MHz. The Zigbee standard IEEE 802.15.4 uses 16 frequency channels (from '11' to '26') each of 2 MHz. Wi-Fi and ZigBee channels depiction can be seen in Figure 2.

**Figure 2.** Frequency channels of Wi-Fi IEEE802.11 and ZigBee IEEE802.15.4 [6].

With the assumption of existing sensing methods for discovery of Zigbee channels, it is possible to arrange non-interfere MANET channels for each ZigBee channel based on the fuzzy logic model introduced with AR-CRM. Therefore, it would be possible to set MANET channels among MANET nodes according to nearby WSN channels to avoid interference. This paper does not describe the method of interference avoidance between the MANET and WSN nodes. The purpose of this section is to show the possible way to accomplish this problem. However, the AR-CRM is still possible to use as a protocol in the MNM MANET layer for interference avoidance among MANET nodes.

#### *3.4. DRONET Layer*

DRONET layer is composed of UAVs, also called drones. This layer in MNM is playing the role of back-up or backbone network. The reason is that MANET networks could split into subnetworks because of nodes mobility. Therefore, some MANET subnetworks could end-up without connectivity for functional AP. The main idea is to cover MANET subnetworks with UAVs of DRONET layer. With appropriate communication technologies of the DRONET layer it is possible to transfer urgent data over long distances from one MANET subnetwork to another with functional Access Point.

To perform such functionality, UAVs needs to support two protocol stacks. For DRONET communication, it is possible to use Wi-Fi standard IEEE 802.11 with appropriate MANET routing protocol to communicate with MANET nodes on the ground. For the communication between UAVs, it is possible to establish WiMAX IEEE 802.16 [27] communication with WiMAX routing protocol. This solution of two communication standards can overcome the interference of DRONET UAV's with MANET nodes. The WiMAX standard for the single-carrier modulation air interface, also known as WirelessMAN-SC [28], operates in the 10–66 GHz band with typical channel bandwidths of 25 MHz or 28 MHz. The raw data rates excesses 120 Mbps. In practice, the drone can carry the Raspberry Pi single-board computer with both Wi-Fi and WiMAX modules.

The assumption for the functionality of the DRONET network in MNM is the presence of a central point, which in this case will represent the so-called dock. Like MANET nodes, UAVs has also limited energy resources. Therefore, after some time it is necessary to replace used UAV by another UAV with a fully charged battery. The dock in MNM will serve as the headquarters for the DRONET network abilities to organize UAVs, replace fresh UAVs with drained UAVs and charge them or sends them to the required locations of the operation area.

Therefore, the dock will implement WiMAX communication technology. Beside UAVs organizing, the dock will also perform energy-intensive operations, such as clustering. Clustering will be required for the division of MANET nodes into clusters which will be covered by DRONES. This approach will be discussed in the followed section. An example of a such a dock for UAVs was presented in [5].

Sanches-Garcia et al. [29] show that the most prefered communication technology for DRONET network is Wi-Fi standard IEEE 802.11. It could be used for UAV to UAV communication technology as well as UAV to MANET nodes on the ground. However, for the communication between UAVs, it is possible to establish WiMAX IEEE 802.16 communication with WiMAX routing protocol [27]. This solution of two communication standards can overcome the interference of DRONET UAV's with MANET nodes, which can be useful with the large number of MANET nodes in the network. To perform such functionality, UAVs needs to support two protocol stacks. Therefore, it is possible to use Wi-Fi standard IEEE 802.11 with appropriate MANET routing protocol to communicate with MANET nodes on the ground, and WiMAX with an appropriate routing protocol to communicate among UAVs.

The WiMAX standard for the single-carrier modulation air interface, also known as WirelessMAN-SC [28], operates in the 10–66 GHz band with typical channel bandwidths of 25 MHz or 28 MHz. The raw data rates excesses 120 Mbps. In practice, the drone can carry the Raspberry Pi single-board computer with both Wi-Fi and WiMAX modules.

#### *3.5. Inter-Layer Communication*

In this section, the inter-layer communication will be described. We assume that all layers operate independently. The WSN network requires the existence of communication based on IPv6, which enables WSN nodes to reach the Access Point. The best solution to this is ZigBee with 6LoWPAN or RPL protocol mentioned in Section 3.2. The MNM approach is using a system of gateways, called WSN gateways. The WSN sensors are therefore divided into two types: WSN sensor node and WSN gateway sensors. In the network disruption scenario, WSN gateway sensors will serve as a gateway for urgent data to the higher layers. The ordinary WSN sensor nodes will use IEEE 802.15.4 ZigBee communication technology to communicate with other sensors or WSN gateway sensors. On the other hand, beside ZigBee standard, WSN gateway sensors will also use IEEE 802.11 Wi-Fi. Therefore, WSN gateway sensors need to implement a dual protocol stack that is depicted in Figure 3.

**Figure 3.** The example of dual protocol stack used in WSN gateway sensors.

Based on the dual protocol stack, WSN gateway senors will be able to communicate with WSN sensor nodes as well as MANET nodes. This scenario is depicted in Figure 4, where the source WSN sensor node is unable to send urgent data to AP\_1 because of the disrupted link. However, urgent data can be delivered through the another WSN gateway sensor and MANET layer nodes to the functional AP\_2.

**Figure 4.** The example of communication between WSN sensor nodes, WSN gateway sensors and MANET layer nodes.

At the Data Link OSI layer, WSN sensor nodes use ZigBee, while WSN gateway sensors use both ZigBee and Wi-Fi. On the Network layer, WSN sensor nodes will use IPv6 routing protocol such as 6LoWPAN.In this paper, higher layers are not considered, which is highlighted by dotted parts in Figure 3. However, in terms of energy consumption, light protocols should be used, such as the UDP transport protocol on the Transport layer. UDP protocol is lighter than TCP and is useful for energy-constrained WSN sensors and WSN gateway sensors. Examples of protocols used in higher layers include Constrained Application Protocol (CoAP) for constrained RESTful Environment running over UDP with lightweight Efficient XML Interchange (EXI) protocol which is a counterpart of XML. Since MANET nodes are not strict energy-constrained and MANET network is an independent network, it is possible to use the TCP transport protocol. However, if critical data are transported in disruption scenario, used protocol in the transport layer has to be UDP. Therefore, the Transport layer of MANET nodes has to be flexible.

To use the WSN gateway system and optimize energy consumption, the routing protocol used in WSN should be cluster-based or use sink-mobility, where elected cluster-head or sink node will act as a gateway to higher MNM layers. The appropriate routing protocols will be described closely in Section 4.1.

The only used communication technology in MANET layer of MNM will be IEEE 802.11 Wi-Fi standard. From the WSN layer point of view, only the WSN gateway sensors are able to send urgent data to the MANET layer. On the other hand, all MANET nodes are able to receive those data. To maintain the integrity of these two layers, it is recommended for the MANET network to use the routing protocol based on IPv6 addressing. This will ensure that the MANET node will be able to deliver critical data to the access point within the 5G network and will also not require reverse conversion between IPv4 and IPv6.

The third layer of the DRONET network uses IEEE 802.11 Wi-Fi standard to connect to nodes of the MANET layer. Based on Wi-Fi standard is possible for UAV of DRONET layer to search for MANET nodes from the air and establish communication. However, the MANET network can be quite large in terms of several nodes and spread over a large area. In order to cover the MANET network with the UAV, it is necessary to perform an area exploration and identify the network topology. Based on the size of the MANET network, using clustering algorithms, it is possible to divide MANET nodes into individual logical subnets in which one Cluster Head (CH) will be selected. This CH will serve as MANET gateway for other MANET nodes in the cluster when urgent data needs to be sent to the DRONET layer. The information about clustering and MANET gateway selection will be discussed in Section 5.1.

Besides the Wi-Fi standard, UAV uses the WiMAX IEEE 802.16 standard for communications among other UAVs and the dock. All UAVs needs to use dual protocol stack in the same way as WSN gateway sensors, which is depicted in Figure 5.

**Figure 5.** The example of dual protocol stack used in MANET node and UAV.

The first protocol stack implemented in UAV uses IEEE 802.11 Wi-Fi standard on the Data Link OSI layer and IPv6 MANET routing protocol on the Network layer. The second protocol stack used IEEE 802.16 WiMAX standard on the Data Link OSI layer and appropriate WiMAX routing protocol on the Network layer. Based on this approach, the UAV is able to communicate with MANET nodes and other UAV, which is depicted in Figure 6.

**Figure 6.** The example of communication between MANET nodes, MANET gateways and UAVs.

The scenario depicted in Figure 6 describes WSN source node that sends urgent data to AP\_1. Since the link is disrupted, urgent data are transferred to the MANET layer through the WSN gateway sensor. MANET node is also unable to deliver urgent data to the same AP\_1. Therefore, urgent data are transferred to DRONET layer through the MANET gateway in order to find another MANET subnet with functional AP\_2.

#### **4. Routing in MNM**

As described in previous sections, the MNM is composed of three layers that work independently, so the routing protocols on each layer also works independently. The network disruption scenario is the exceptional situation, in which routing protocols used by each layer need to provide required actions to recognize urgent data and deliver it to the Cloud through AP. Therefore, the content of this section will focus on the recommendations of appropriate routing techniques and algorithms for individual layers and also on their necessary modifications for proper functioning in MNM.

#### *4.1. Routing in WSN Layer*

The routing of urgent data begins in the WSN layer. The sensors of the WSN layer periodically measure data and routes them into cloud services on the Internet if the AP is available on the network. In Section 3.2. we provide technology recommendations for WSN layer. The best way to make WSN data propagation to the Internet is the implementation of the routing protocols based on IPv6 protocols.

The most suitable technology for MNM is IEEE 802.15.4 ZigBee with 6LoWPAN or RPL protocol. In the MNM, we assume that sensors in the WSN layer will be fixed without mobility and also will be able to communicate in a multihop manner. The authors in [30] provide a protocols survey based on 6LoWPAN technology. Protocols are classified based on multihop support, Network or Host-based mobility or presence of local entity among other specifications. The classification of routing protocols with multihop support can be seen in Figure 7.

The same authors also point out that proactive protocols are most suitable for WSN with 6LoWPAN, since, it helps to reduce the handover delay by reducing the configuration time and also to avoid the disconnection of nodes, which reduces the data loss rate. Therefore, it is useful to use protocols in the Proactive branch chart. Another important division is based on mobility. The authors described Micro and Macro mobility, where the "Micro mobility" refers to the node mobility within the same sensor network domain and "Macro mobility"refers to the node mobility between different sensor networks. Since sensors in MNM are fixed, the maximum allowed mobility of sensor node is Micro mobility. Since WSN layer in MNM uses the gateway system, the best suitable routing protocols based on presented assumptions are Based-Cluster [31] and RPL-Weight [32].

In the case of the Based-Cluster protocol, the main advantage is network architecture based on a clustering tree topology, which leads from the lowest layers of sensors to one leading sensor (Cluster Head), which in the case of MNM can be considered to be a WSN gateway sensor. RPL-Weight is a hierarchical protocol based on Directed Acyclic Graph (DAG), which defines a network topology and uses Destination Oriented DAG (DODAG) algorithm for routing. It supports sink node mobility, which reduces power consumption and to increase the network lifetime. This is also very useful for MNM, where the sink node can act as a gateway to the MANET Layer or AP. The clustering tree topology of Based-Cluster protocol and sink node mobility of the RPL-Weight protocol are shown in Figure 8.

**Figure 7.** WSN protocols based on 6LoWPAN with multi-hop support [30].

**Figure 8.** The example of Based-Cluster and RPL-Weight routing mechanisms.

However, both Based-Cluster and RPL-Weight protocols are not designed to support urgent data transmission through WSN gateway sensors to the MANET layer. Therefore, it is important to implement an exception mechanism for those or other deployed protocols. The algorithm responsible for the routing of urgent data in WSN layer of MNM is proposed in flowchart depicted in Figure 9.

**Figure 9.** The WSN Layer routing flowchart.

This algorithm needs to be implemented as an exception to the main routing algorithm. In the beginning, if AP is available in the network, all measured data are processed as usual by the main routing algorithm. If AP is not available, measured data needs to be evaluated based on Threshold. This threshold is set based on type or nature of measured data that evaluates them as urgent. Since the sink routing model is considered, it is possible to assume, those nodes near the sink node connected to MANET layer will be asked to forward packets more frequently as nodes that are far. This could affect

the energy consumption of those nodes and also cause traffic congestion. To address this problem and also lower the traffic load in the MANET layer, WSN sink node will forward only urgent data to MANET layer when AP is not accessible.

In order to lower processing on WSN gateway or sink node respectively, the process of urgent data evaluation is running on all nodes. When AP is not accessible and data are evaluated as non-urgent, nodes drop the data. Urgent data are transferred to the WSN gateway, which looks for an available MANET node. If the MANET node is accessible, data are transferred to the MANET layer, otherwise, data are processed by Data Backup algorithm described by Algorithm 1.


A data backup algorithm is used to prevent dropping of urgent data if the MANET node is not available at the specific time for WSN gateway. The main idea is to store urgent data for a specific time. The node then waits for the MANET node or AP availability. If the time for giving data runs out, urgent data are dropped.

We assume that input data can be identified by its origin node with a unique ID. Then the input data are associated with the node's ID and marked as *DataID*.

In the beginning, *DataID* is checked, if the gateway node has an entry for the same data in the repository. If not, the algorithm then checks, if the gateway has an entry for input data from the same node according to its ID. If yes, it means that the gateway node obtained fresher data from the same node. Therefore, older data identified by the same node are deleted. Then the gateway node tries to access AP and if this attempt is successful, the algorithm returns the "Successful" status of the main algorithm. If AP is not accessible, then *DataID* is stored to the repository and associated with *Timer ID*. This timer refers exactly to the stored *DataID*. Then the algorithm returns "Continue" status to the main algorithm.

If the gateway node has *DataID* stored in its repository, the algorithm checks if *Timer ID* is equal to zero. If yes, *DataID* is deleted and algorithm returns "Fail" status to the main algorithm. Otherwise, the gateway node attempts to access AP and the main algorithm returns "Successful" status to the main algorithm if AP is available. If AP is not accessible, *Timer ID* is decreased and "Continue" status is returned to the main algorithm.

#### *4.2. Routing in MANET Layer*

Routing in MANET layer of MNM is independent of routing in WSN layer when a local entity such as AP is available to all devices. When communication with AP is disrupted, sensors of WSN layer are unable to deliver its measured data to cloud services. Sensors, therefore, start to evaluate their data and produces only urgent data. Only those data are allowed to enter the MANET layer in order to enhance the delivery process. We assume that WSN gateway sensor is capable of using dual protocol stack with IEEE 802.11 WiFi connectivity. This allows the WSN gateway sensor to be seen by MANET nodes and vice versa. WSN gateway sensor is therefore allowed to send urgent data to any available MANET node.

Since WSN layer in MNM uses IPv6 protocol, it should be implemented in MANET layer as well. The routing protocol for MANET layer in MNM should be proactive, since topology maintained by proactive routing protocols is required for DRONET clustering algorithm. The example of MANET IPv6 protocols are IPv6 enabled DSR [33], AODV6 [34] or IPv6 OLSR [35]. Those routing protocols, however, do not support interference avoidance such as AR-CRM mentioned in Section 3.3.1. On the other hand, AR-CRM was not designed to support IPv6. This problem needs to be addressed by implementing interference avoidance mechanism of AR-CRM into mentioned routing protocols or implementing IPv6 into AR-CRM. It is also important to collect GPS positions since that information about topology could be used by DRONET layer to perform its clustering analyses. None of this is the scope of this paper and we assume that missing functionalities mentioned above are implemented.

Regardless of the selected routing protocol, the exception mechanism for urgent data delivery needs to be implemented to deployed routing protocol in order to work in MNM. The implemented exception helps main routing algorithm to recognize urgent data from WSN and provide necessary operations. This mechanism is described by flowchart depicted in Figure 10.

In the beginning, the MANET node that obtained urgent data needs to encapsulate IPv6 packet from WSN layer to recognize if obtained data are indeed urgent. If not, obtained data is recognized as not urgent and MANET node drops this data. If the obtained data are urgent, MANET node tries to access AP. If AP is available in the MANET network, data are sent to AP. If not, the MANET node is looking for MANET gateway.

If the MANET gateway is not recognized or is not available, the Data Backup algorithm described in Section 4.1 is called. If coming status from the Data Backup is Continue, algorithm check again for MANET gateway availability. If the status is Fail, the node drops the data. Otherwise, the status is Successful and it means the data was successfully delivered to AP and exception algorithm ends.

If MANET gateway node is available, urgent data is delivered to it. MANET gateway than check for UAV availability. If UAV is available, data are sent to DRONET layer and exception algorithm ends. If UAV is not available, gateway node calls Data Backup algorithm that stores data or tries to deliver it to AP. The urgent data are then dropped or the exception algorithm checks for UAV availability again according to the status obtained from Data Backup algorithm.

**Figure 10.** The MANET Layer routing flowchart.
