# Enabling Heterogeneous IoT Networks over 5G Networks with Ultra-Dense Deployment--Using MEC/SDN
## 3 IoT/5G System Structure
### Radio Access Network (RAN)
#### 3.1.2 D2D Enabled Network  
Heterogeneous sensors and other wireless devices may be deployed over 5G cellular networks. One way to enable these devices is to introduce an appropriate radio communication interface, besides the existing cellular interface, to unload the cellular networks. Furthermore, some of these devices, i.e., sensors and actuators, may not support the cellular interface, and thus, the need for another radio interface becomes a must. D2D is one of the best solutions to provide coverage for the distributed sensors and wireless devices [18]. This enables the dense deployment scenario required for 5G systems. Figure 3 illustrates the main structure of the D2D enabled networks. Distributed sensors and wireless devices that support D2D communications use the nearby devices that support cellular interface to forward their data to the cellular base station with the connected edge server.  
Figure 3: Device-to-Device communication (D2D) based network.  
Devices deployed in the proposed D2D networks are categorized into three main levels based on the device capabilities, e.g., processing and storage, and the radio communication interfaces supported by the device. The first level represents devices that support only D2D communication and does not support the cellular interface. These devices are referred to as low-level devices (LL). LL devices have limited resources, including energy, processing and storage. These devices include sensors and actuators. The second level represents devices that support either D2D communication interfaces only or both cellular and D2D interfaces. These devices are wireless devices with acceptable computing resources that are higher than that of LL devices. These devices are referred to as gateway devices (GW). GW devices can handle some computing tasks to the nearby LL devices based on the currently available resources and the current level of energy of GW devices. Furthermore, if the available resources are not enough to handle the offloaded tasks, GW devices act as a relay and forward the received tasks from LL to the higher level.  
The last level of devices is the high-level devices (HL), which represents devices with powerful computing resources and energy resources. These devices must support both cellular and D2D interfaces. Such examples of these devices include smartphones, tablets and notebooks. HL devices receive offloading requests from the distributed GW devices and nearby LL devices and provide the appropriate response upon the available resources. If the currently available resources of the HL device are enough to handle the received offloading requests, the HL device accepts the offloading request and handles the computing task for GW or LL device. When the current resources of the HL device are not enough to handle the offloading request, the HL device sends the request to the MEC server connected to the cellular base station. The previously developed network setup algorithm presented in [19], is used for the proposed D2D-based networks. The required offloading algorithm for managing task offloading between devices in D2D-based networks is presented in Section 4.2. The algorithm is energy and latency-aware to achieve a required QoS latency for computing tasks and to achieve high-energy efficiency.