4.5. System Budget Constraints
As deployment of various objects in the IoT framework is very expensive, one requirement is to keep the budget low as estimated initially in Equation (13). It can be considered during the hardware installation of the components, but this requirement is out of the scope in the recent work proposed in this paper:
Theorem 1. The problem in Equation (12) is a NPhard problem.
Proof of Theorem 1. To find the route to solving the Equation (12) is a NPhard problem like the travelling salesman problem as it tries to find out the least cost cyclic route in weighted graphs. As we want to establish an energy efficient IoT framework, we require minimizing the energy consumption in the whole network, so we develop the MECBCCP to reduce the energy consumption by balancing the load on the CHs and CCOs which act as the destinations (including BS which have unlimited supply of power) for the normal nodes.
The basic idea behind this algorithm is to use clustering topology on the basis of division of the area into same sized rectangle shaped cells which are known as layers of clusters. MECBCCP follows five steps to accomplish the main objective:
Step 1, suggests the deployment of thousands nodes randomly in the fixed area.
In Step 2, MECBCCP employs the method of dividing the area into same size cells with fixed boundaries. For example, if the area is 200 m^{2}, then each subarea is about 200 m by 20 m and there will be 10 clusters. Within a cluster, the normal nodes (NN1) select the closest relay nodes and form different groups under different relay nodes (RN1). Relay nodes are formed randomly and the percentage of relay nodes within the cluster is 0.1. Other nodes (0.9) act as the normal nodes.
MECBCCP elects one CH and a varied number of CCOs in each cluster in Step 3. The energy of each CH and CCO is checked, and should be greater than the threshold energy. The distance between the relay nodes and normal nodes is checked and if it is less than or equal to the communication radius, then that node is added to the set of nodes under that relay node.
In Step 4, the data transmission starts from normal nodes to the relay nodes, which is further transmitted to CH and then via CCOs, it is finally submitted to the BS in the topmost layer.
Algorithm 1. Minimum Energy Consumption Chain Based Algorithm (MECBCCP) 
Input 
$\text{NN},\text{RN},\text{CH},\text{CCO},\text{BS},\text{R}\text{r}0$ 
Output 
Enhanced network lifetime 
1: Deploy nodes randomly in the fixed area 
2: Apply subarea division algorithm to form the clusters ($\text{numberofclusters}=\text{k}$) with fixed boundaries, allocate the cluster IDs to each layer of the cluster $\text{cls}\_\text{id}<=\text{k}$. That is for $\forall \text{NN}\in \text{N},\text{NN1}\in \text{Local}\_\text{cluster}$ Select the closest $RN1$ within cluster $\text{u}\u03f5\text{RN},\text{v}\in \text{NN1}$. 
3: for each $\text{cls}\_\text{id}<=\text{k}$, repeat3.1 Elect one $\text{CH}$ in each cluster randomly $\text{x}\in \text{CH}$ where $\text{x}.\text{energy}>\text{threshold}.\text{energy}$. Elect $\text{CCO}$ in each cluster where $y\in \text{CCO}$ and $y.\text{energy}>\text{threshold}\_\text{energy}$ and value of $0<\text{y}<\text{cls}\_\text{id}\text{1}$ and. Number of C $\text{CCO}$ in each cluster = $\text{cls}\_\text{id}\text{1}$. 3.2 for $\text{u}\u03f5\text{RN},\text{v}\in \text{NN1}$, $\text{u}\ne \text{v}$ and $\text{u}.\text{energyandv}.\text{energy}\text{}0$ do 3.3 compute the distance ${\text{d}}_{\text{uv}}$ between $u$ and $v$ 3.4 if ${\text{d}}_{\text{uv}}\le R$ then 3.5 add the node $u$ and $v$ to the set of $RN1$ in local cluster, set $\text{P}\left(\text{u},\text{v}\right)=\text{1}$ End if End for

End for 
4: for each $\text{cls}\_\text{id}<=\text{k}$, repeat4.1 transmit the data from $v$ nodes ($\text{v}\in \text{NN1}$) to $u$ nodes ($\text{u}\u03f5\text{RN}1$), 4.2 transmit data in order from $\text{j}\to \text{x}\to \text{y}\to \text{z}$ nodes $(\text{x}\in \text{CH},\text{y}\in \text{CCO},\text{z}\in \text{BS})$

End for 
5: for each $\text{cls}\_\text{id}<=\text{k}$, repeat 
Continue with step 4. 

End for 
As the network grows in size, it becomes difficult to maintain its reliability, but all the applications require that the network should not be partitioned and the transmission algorithm should be robust. To make MECBCCP more suitable for IoT applications, in Step 5, the energy level of each CH and CCO is checked, and if it is found that their energy level is far less than the required level to act as the CH and CCO, then their role is changed by reelecting CHs and CCOs by moving back to Step 3. In this way the transmission process will continue even when some nodes have depleted their energy up to the largest extent.
Equation (12) presents the optimization problem, by which the energy consumption in each cluster should be decreased. This is achieved by balancing the load on the clusters by a cooperation method among the nodes, CHs and CCOs. Moreover MECBCCP is a static algorithm in contrast to the traditional dynamic algorithms of WSNs. In dynamic algorithms, nodes exchange their information about the routes during the network operation and this increases the network overhead which is why those algorithms cannot be applied to IoT framework.
Theorem 2. The clusters are formed in fixed iterations and the complexity is O (1).
Proof of Theorem 2. According to Algorithm 1, in Step 2 the clusters are formed by division of the area into subareas which are fixed. Due to static clustering, this process is accomplished in one round only. For $\text{NN1}$ nodes the probability of election as the CH is much less during the initial phase that is $\text{1/NN1}$. With the increase in the number of dead nodes (d), the $\text{CH}\text{\_}\text{prob}$ also increases. $\mathrm{CH}\_\text{prob}=1/NN1d$, where $\text{0}\text{=}\text{d}\text{}\text{NN1}$. Nodes with more energy than the threshold energy can be CH and nodes with less energy than the required energy will join the cluster as normal nodes. As the number of dead nodes increases, the number of iterations decreases ($\text{NN\_ itr\alpha 1/NN1}\text{d}$).
Theorem 3. The complexity for N nodes for message exchange is O (N).
Proof of Theorem 3. According to Theorem 2, the number of iterations is fixed for clustering and for electing CHs. So it takes, at most, N time for their processing. Computation of the total time taken in the data communication process can be considered as $\text{N \_ ITR}\times \text{N}$ (for the transmission) of data of N nodes in $\text{N \_ ITR}$). Hence the complexity to exchange the messages in N nodes is taken as O (N).
Theorem 4. Each rectangle cell has at least CH to aggregate the data from local nodes.
Proof of Theorem 4. Data is aggregated from the local nodes by CHs in each cell. From Step 3 in Algorithm 1, each cluster will have one CH. In the worst case, if a cluster has only one node, then it will act as the CH till its energy falls below the threshold level. It will coordinate with the upper layer CCO in transmitting the data. If there is no CCO in the upper layer (due to depletion of energy of the nodes by time) then data is transmitted directly to the BS to avoid delay in transmitting the data which are the requirement of many applications of IoT.
The network lifetime of MECBCCP can be easily computed. The network lifetime can be considered in various ways. For example, it can be considered as the time period from the initial operation till the death of first node or it can be considered as the time span from initial operation of the death of all the nodes. We have considered the second option. To provide an indepth insight for the whole IoT, the worst case of network lifetime can be given as:
where
${E}_{1},{E}_{2},{E}_{3},{E}_{4}$ defines the initial energy of normal nodes, relay nodes, cluster heads and luster coordinators.
With the use of RNs, CHs and CCOs the network is connected and an energy efficient IoT can be easily deployed with this scheme.