## 4 Proposed Model of SACFIR and SAMCFIR
### Network Settling Phase of SACFIR and SAMCFIR  
In this phase, the SDN central controller primarily computes the routing responsibilities and organizes the cluster-based reconfiguration schemes for WSNs nodes. The proposed protocols, SACFIR and SAMCFIR, and the utilized SDN central controller contain unlimited energy resources and higher computational capabilities to perform flexible network monitoring in every period and effectively develop a re-clustering configuration every 10 th period. During NTMP, the SDN controller receives updates from heterogeneous WSNs about their initial energy and distance from BS. During NSP, the SDN central controller maintains the global view of network energy resources and computes the average residual energy of the scattered sensor nodes by the linear equation of:  
\[\overline{rE_{i}(q)}=\frac{1}{N}\sum_{i=1}^{N}rE_{i}(q) \tag{12}\]  
\(\overline{rE_{i}(q)}\) is the average energy, and \(rE_{i}(q)\) is the residual energy of sensor nodes. BS compares the residual energy of each node \((1\leq i\geq N)\) to their corresponding region's average energy. Nodes with higher energy or average energy \((E_{i}\geq AverageEnergy)\) have a better chance of being selected as the Expected FECHs (EFECHs). However, the controller needs to consider other factors of distance and the centrality of nodes within the neighborhood. The minimum distance between ECHs and BS is calculated by equation:  
\[Min-dist_{toBS}=^{\sqrt{(X-xj)^{2}+(Y-yj)^{2}}} \tag{13}\]  
\(Min-dist_{toBS}\) is the minimum distance between BS and the \(j\)-th ECH. X and Y are the location coordinates of BS. Similarly, \(xj\) and \(yj\) are the location coordinates of the \(j\)-th ECH in the whole network region. The SDN controller has to select the FECHs with the maximum value of centrality, which is referred to as point centrality in graph theory [24]. Here, we consider nodes with different points, and nodes with a higher degree have better centrality and become the ideal nodes with which cluster member nodes link. The Clustering Centrality (CC) of an EFECH is the average ratio by which a source Sneighboring non-FECH needs to pass through a specific node EFECH to reach destination (D), which can be intermediate FECHs or BS, via the shortest path in the network. Therefore, the CC of a specific EFECH is given by:  
\[CC_{EFECH}=\sum_{S\
eq EFECH\
eq D}\frac{SD(EFECH)}{SD} \tag{14}\]  
The \({}_{SD}\) is the total number of shortest paths from the source to destination, and \({}_{SD}(EFECH)\) is the number of shortest paths between S and D that pass through EFECHs. Clearly, a node with higher CC has greater influence in its network, and thus, it is prone to becoming FECH. In a dense network environment, the process of \(CC_{EFECH}\) can nominate too many FECHs; in this situation, the SDN central controller selects \(AliveNodes\times P\) FECHs with maximum residual energy and \(CC_{EFECH}\). BS announces these nodes' FECHs by setting up their type and reconfigures the new configurations throughout the network. Every further FECH starts clustering by advertising the cluster membership request in the neighborhood. In the case of non-FECHs nodes, the SDN controller leaves them alone and does not exchange any further hello messages in order to save energy resources, which is why FECHs are responsible for carrying out the membership process. Furthermore, non-FECHs select the optimal FECHs based on the criteria of RSSI and minimum distance. FECHs' selection by the proposed algorithms is simple so as to avoid algorithm complexity, but the major task is to optimize the performance of reconfigurations according to the residual energy resources and workload shared by FECHs. In this regard, SDN controllers continue analytical operations to redistribute the responsibilities evenly in the next reconfiguration period. Sensing and processing cost very little energy, which is why the SDN controller ignores this factor and concentrates on communication load to optimize the reconfigurations.