# Energy Efficient Load-Balancing Mechanism in Integrated IoT-Fog-Cloud Environment
## 3 Methodology
Transmission Model  
Data transmission rate from IoT to fog nodes as per [PERSON]'s equation [31] can be described as:  
\[C_{ij}(t)=Blog_{2}\bigg{(}1+\frac{P_{i}^{c}(t)G_{ij}(t)}{WN_{0}}\bigg{)} \tag{1}\]  
where \(G_{ij}(t)\) is the channel gain, \(P_{i}^{c}\) represents the transmission power, B is the bandwidth, N0 represents the noise, and \(C_{ij}(t)\) represents the data transmission at time t from I to j. Using the M/M/1 [18], the uplink latency (transmission time and queuing) and average delay can be computed using Equation (2) [32]  
\[\tau_{D}=\frac{1}{\frac{C_{ij}(t)}{\omega_{i}(t)P_{i}(t)}-\omega_{i}(t)\varphi_ {i}(t)} \tag{2}\]  
where \(\tau_{D}\) represents the transmission delay, \(\omega_{i}\) denotes the offloading ratio, and \(P_{i}\) signifies the packet magnitude of \(i\)th task. Note that the fixed-size data are transmitted and utilized to find the transmission rate. Consequently, it is not essential to take into account each packet's length since it does not affect the optimal decision and subsequently the optimal solution. Figure 2: Flow chart of the methodology. * Fog device computational delay Considering the \(k\)th fog device with the rate of traffic \(t_{k}\) and \(s_{i}\) service rate [33], the computation latency which includes service time and waiting time \(CD_{k}^{fog}\) is \[CD_{k}^{fog}=\frac{1}{s_{i}-t_{k}}\] (3)
* IoT-Fog System Energy Consumption Model Overall energy usage [34] in IoT-fog can be expressed as \[Q_{iot-fog}=\sum_{j=1}^{K}Q_{j}(t)+\sum_{i=1}^{N}Q_{i,j}^{c}\ (t)+\sum_{i=1}^{N}(1-\omega_{i}(t))Q_{i}\ (t)\] (4) where \(Q_{j}(t)\) represents the energy used by the \(j\)th fog node that can be computed as \(Q_{j}(t)=CD_{k}^{fog}\ v\ F_{i}(t))^{3}\); \(Q_{i,j}^{c}\ (t)\) is the energy required to transfer data from node \(I\) to \(j\); \(K\) represents the number of IoT nodes; and \(N\) represents the set of fog nodes. * Modeling for Load Balancing in IoT-Fog-Cloud Environment  
This segment presents various mechanisms for load balancing in the fog-cloud model. The prime objective of this technique is to improve the usage of present resources by uniformly distributing the tasks among computing nodes, avoiding the underloading and overloading of one node. It also takes care of idle nodes. Using fog computing, a group of fog nodes is responsible for workload distribution among different computing nodes in the cloud model, thereby achieving more reliability in incoming jobs and increasing the capability of present clients. Balancing uniform load is important in the cloud environment owing to the dynamic number of requests coming from the client for network resources. To minimize the lag, dynamic load balancing is essential to avoid lagging in execution considering the long queue of tasks at the computing node. Architecture balancing load at various layers is shown in Figure 3 for the IoT-fog-cloud model. The current _Load_ status of devices is represented in Equation  
\[Load\big{(}D_{j}\big{)}=\frac{\sum_{n=1}^{N}P(t)}{t} \tag{5}\]  
Figure 3: IoT-fog–cloud model architecture. where \(P(t)\) signifies the job size, and the simulation time is \"\(t\)\". A total number of tasks N processed at node \(D_{j}\). The average load at each device is calculated as follows:  
\[A_{Loadi}=\frac{\sum_{j=1}^{M}\left[\ RT_{j}(N)+TET\ (N)\right]}{M} \tag{6}\]  
where \(RT_{j}\) denotes the remaining time of the node. Fog nodes \(M\) presently used at time \"\(i\)\". Execution time is denoted by \(TET(N)\) of all jobs. At the output layer, the balanced workload is predicted for all \(M\) fog devices. Algorithm 1 show the proposed algorithm for load balancing. ```
Step 1. PowerStatus = Check_power_status (node\({}_{\text{s}}\)) Step 2. For fog node from i = 1 to n do Step 3. Calculate the existing load of each fog node using Equation (5) Step 4. Calculate the Power status of each fog node Step 5. The transmission delay and Computational delay of each node are computed using Equations (2) and (3) Step 6. Calculate the Energy consumption of each fog and IoT device Step 7.