# Enabling Heterogeneous IoT Networks over 5G Networks with Ultra-Dense Deployment--Using MEC/SDN
## 4 Energy-Aware and Latency-Aware Offloading Scheme
### Energy-Aware and Latency-Aware Offloading Algorithm for Cellular Network
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Task** & **Task (1)** & **Task (2)** & **Task (3)** & **Task (4)** & **Task (5)** \\ \hline \(Z\) (KB) & 1.0 & 1.1 & 1.2 & 1.3 & 1.4 \\ \(T_{\text{QoS1}}\) (ms) & 1.1 & 1.1 & 1.2 & 1.2 & 1.3 \\ \(T_{\text{QoS2}}\) (ms) & 1.3 & 1.4 & 1.5 & 1.6 & 1.7 \\ \(T_{\text{QoS3}}\) (ms) & 2.0 & 2.2 & 2.4 & 2.6 & 2.8 \\ \hline
**Task** & **Task (6)** & **Task (7)** & **Task (8)** & **Task (9)** & **Task (10)** \\ \hline \(K\) (MB) & 1.5 & 1.7 & 1.9 & 2.1 & 2.3 \\ \(T_{\text{QoS1}}\) (ms) & 1.4 & 1.4 & 1.5 & 1.5 & 1.6 \\ \(T_{\text{QoS2}}\) (ms) & 1.8 & 1.8 & 1.9 & 1.9 & 2.0 \\ \(T_{\text{QoS3}}\) (ms) & 3.0 & 3.1 & 3.2 & 3.3 & 3.4 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Task specifications of low-level devices (LL). \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Task** & **Task (1)** & **Task (2)** & **Task (3)** & **Task (4)** & **Task (5)** \\ \hline \(Z\) (KB) & 2.0 & 2.2 & 2.4 & 2.6 & 2.8 \\ \(T_{\text{QoS1}}\) (ms) & 1.0 & 1.1 & 1.2 & 1.3 & 1.4 \\ \(T_{\text{QoS2}}\) (ms) & 1.4 & 1.5 & 1.6 & 1.7 & 1.8 \\ \(T_{\text{QoS3}}\) (ms) & 2.2 & 2.4 & 2.6 & 2.8 & 3.0 \\ \hline
**Task** & **Task (6)** & **Task (7)** & **Task (8)** & **Task (9)** & **Task (10)** \\ \hline \(K\) (MB) & 3.0 & 3.1 & 3.2 & 3.3 & 3.4 \\ \(T_{\text{QoS1}}\) (ms) & 1.5 & 1.6 & 1.6 & 1.7 & 1.7 \\ \(T_{\text{QoS2}}\) (ms) & 1.9 & 2.0 & 2.1 & 2.2 & 2.3 \\ \(T_{\text{QoS3}}\) (ms) & 3.2 & 3.4 & 3.6 & 3.8 & 4.0 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Task specifications of gateway devices (GW). \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Task** & **Task (1)** & **Task (2)** & **Task (3)** & **Task (4)** & **Task (5)** \\ \hline \(Z\) (KB) & 3.2 & 3.4 & 3.6 & 3.8 & 4.0 \\ \(T_{\text{QoS1}}\) (ms) & 1.1 & 1.2 & 1.3 & 1.4 & 1.5 \\ \(T_{\text{QoS2}}\) (ms) & 1.7 & 1.8 & 1.9 & 2.0 & 2.1 \\ \(T_{\text{QoS3}}\) (ms) & 2.2 & 2.5 & 2.9 & 3.3 & 3.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Task specifications of high-level devices (HL). considered LL devices. In the last system, system D, C-MEC server is removed, and all devices are considered to be LL devices. ### Simulation Results and Discussion

The results of the first scenario are introduced in Figures 8-13. Figure 8 presents the time required to handle tasks for IoT devices. Each device is assumed to have one task from tasks indicated in Table 5. These tasks are handled either locally, i.e., at IoT device, or offloaded to edge servers, I-MEC and C-MEC. The average time required to handle each task is presented in Figure 8 for the three considered cases. As the QoS latency increases, i.e., moving from case 1 to case 2 and then case 3, the probability of offloading increases. This is to save the IoT devices' energy and prolong the lifetime of devices. Using the proposed structure, with MEC and SDN, all tasks are handled without any blocking, even with the existence of QoS latency constraints. Figure 8: _Cont._

Figure 8: Average latency of handling IoT tasks for the three considered cases of the first scenario. (**a**) Average latency for case (1), (**b**) Average latency for case (2), and (**C**) Average latency for case (3). Figure 9: _Cont._

Figure 10: Average latency of handling GW devices’ tasks for the three considered cases of the first scenario. Figure 9: Average latency of handling LL devices’ tasks for the three considered cases of the first scenario. (**a**) Average latency for case (1), (**b**) Average latency for case (2), and (**C**) Average latency for case (3). Figure 9 provides the average latency for handling tasks of LL devices. Each LL device is assumed to have a computing task with the workload indicated in Table 6. A part of these tasks is executed locally at LL devices, while the rest of these tasks are offloaded to nearby GW and HL devices. The offloaded tasks are due to either energy constraints or

Figure 11: Average latency of handling HL devices’ tasks for the three considered cases of the first scenario.