# Minimum-Cost-Based Neighbour Node Discovery Scheme for Fault Tolerance under IoT-Fog Networks
## 3 Materials and Methods
### Communication Model  
The tasks generated from any IoT/User devices are represented as a set of T = {t\({}_{1}\), t\({}_{2}\),..., t\({}_{n}\)}. In this, each element, t\({}_{i}\), will describe as a set of attributes, as follows:  
\[\text{t}_{i}=\left\{\text{X}_{i},\text{t}_{c},\text{t}_{y},\text{D}_{i}\right\} \tag{1}\]  
where (i = 1, 2,..., n); X\({}_{i}\) stands for the size/length of the task to be transmitted to the Fog access nodes for task-processing; t\({}_{c}\) represents the required computations for task execution; t\({}_{y}\) denotes the task type (i.e., time-sensitive or time-tolerance); D\({}_{i}\) represents the task deadline for completion. The Fog nodes (F\({}_{n}\)) set will be divided further into Fog control nodes, F\({}_{nc}\) = {N\({}_{c1}\), N\({}_{c2}\),......., N\({}_{cm}\)}, for monitoring and controlling actions and Fog access nodes, F\({}_{na}\) = {N\({}_{a1}\), N\({}_{a2}\),......., N\({}_{an}\)}, for task-offloading, which can also be represented by the following details:  
\[\text{Fn }=\left\{\text{SC}_{i}^{\text{max}},\text{CC}_{i}^{\text{max}},\text{ BC}_{i}^{\text{max}}\right\} \tag{2}\]  
where i = 1,2,...n, SC\({}_{i}^{\text{max}}\) refers to the storage capacity, CC\({}_{i}^{\text{max}}\) gives the computing capacity, and BC\({}_{i}^{\text{max}}\) denotes the total battery capacity of the Fog access nodes. The total time taken for user/IoT task assignment to the Fog access nodes is described as follows:  
\[\text{T}_{\text{tot}}=\text{T}_{\text{up}}+\text{T}_{\text{exe}} \tag{3}\]  
where T\({}_{\text{up}}\) denotes the time taken to forward and offload tasks to a Fog access node within the same or a neighbouring server, and T\({}_{\text{exe}}\) refers to the execution time of the task in F\({}_{\text{na}}\). T\({}_{\text{up}}\) is related to the transferral of data from the user/IoT device to the selected Fog access node. From this, the T\({}_{\text{up}}\) is defined as the ratio of task size/length (X\({}_{i}\)) to the transmission capacity (C\({}_{t/(\text{k}\rightarrow\text{na})}\)) between the corresponding user/IoT device (k) and Fog access node (na), and is expressed as follows:  
\[\text{T}_{\text{up}}=\frac{\text{X}_{i}}{\text{C}_{t/(\text{k}\rightarrow\text {na})}} \tag{4}\]  
where  
\[\text{C}_{t/(\text{k}\rightarrow\text{na})}=\text{BW}\times\text{log}_{2}(1+ \frac{\text{P}_{\text{k}}\times\text{c}_{k,\text{na}}}{\text{N}_{0}\times\text {BW}}) \tag{5}\]  
C\({}_{t/(\text{k}\rightarrow\text{na})}\) is calculated by [PERSON]'s formula, where p\({}_{\text{k}}\) indicates the power consumption of the user/IoT device, c\({}_{k,\text{na}}\) refers to the channel cost between the K\({}_{\text{k}}\) and F\({}_{na}\), N\({}_{0}\) gives the channel noise power (dBm/Hz), and BW denotes the bandwidth (Hz). The execution time of the task on the Fog access node is defined as the number of tasks and their size/length, multiplied by the required computation and divided by the computational complexity \(\left(\text{CC}_{1}^{\text{max}}\right)\) of the Fog access node, and is expressed as follows:  
\[\text{T}_{\text{exe}}=\text{X}_{i}\times\frac{\text{t}_{c}}{\text{CC}_{i}^{ \text{max}}} \tag{6}\]  
where the computational complexity of the proposed methods mainly depends on the number of freely available candidate fog access nodes in a fog network, and this can be represented as O[F\({}_{s}\)[min(F\({}_{\text{lan}}\))]]. This will find the minimum-cost Fog access node within a server that can be used for task-processing.