# An Energy-Efficient Mobile Sink-Based Unequal Clustering Mechanism for WSNs
## 4 Proposed Algorithm  
One purpose of using clustering techniques in WSNs is to decrease the energy consumption of sensor nodes. Accordingly, one objective of applying clustering on a simple corona-based WSN (SCWSN) is to reduce the energy consumption of nodes. Selecting the optimal cluster size can be effective in this regard [27]. In CCWSN, the cluster size depends on the angle of the sectors (\(\theta\)). If this angle is too large, the distance between member nodes and local CHs will increase and energy consumption of member nodes will be more than their energy consumption in SCWSNs. Then, in this situation, clustering on corona-based WSN cause an increase in the energy usage of sensor nodes. On the other hand, if this angle is too small, the network may encounter connectivity and coverage problems. Therefore, an optimal cluster size interval is needed. In our model, the lower bound of this interval is calculated based on the lowest number of nodes in the interior zone according to the density of nodes. The upper bound is obtained based on the comparison between the total transmission range of nodes in the SCWSN and the total distance between member nodes and local CHs in CCWSN. We use the two-stage GA (GA) to obtain the maximum angle and also derive the exact value of the angle from this interval. At the first stage, we define a new cost function, with the objective of minimizing the difference between total transmission range of nodes in SCWSN and the total distance between member nodes and local CHs in CCWSN for obtaining the maximum value of the interval. Then, the exact value of the angle is derived from this interval at the second stage with the objective of minimizing the total energy consumption of network. In the second part of this work, the Circular Motion of MSs with Varied Velocity (CMS2V2) algorithm is proposed to solve the unbalanced energy consumption of CHs in different coronas. For this reason, some MSs which have a circular motion in coronas are used to compensate the extra energy usage of CHs. In CMS2V2 algorithm the velocity of MS belonging to the \(i\)th corona (except for innermost corona) is regulated in the different angles (from (\(j\)-1)th sector to \(j\)th sector) in a way that the total energy consumption of CH belonging to \(i\)th corona and \(j\)th sector is balanced with the energy consumption of CH located in 1 st corona and \(j\)th sector. In fact, by decreasing the velocity of MSs belonging to outer coronas, a chance is given to inner MSs to increase their sojourn time in clusters. The details of the CMS2V2 strategy are described in the algorithm flow of this mobile sink-based strategy (Algorithm 1). \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Define the Parameters** \\ \hline \(n\) & Path loss exponent \\ \(\alpha\) & Energy dissipated in the op-amp \\ \(r\) & Width of each corona \\ \(E_{elc}\) & The electrical energy consumption \\ \(E_{tx}\) & Energy usage for data transmission \\ \(E_{rx}\) & Energy consumption for receiving data \\ \(k\) & The number coronas \\ \(M\) & Total number of nodes \\ \(N_{i}\) & The number of nodes in \(i\)th corona \\ \(R\) & The network radius \\ \(\varepsilon_{0}\) & Initial energy of each corona \\ \(E_{i}\) & The energy expenditure \(i\)th corona \\ \(l\) & Packet Length \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Parameters Definition. ```
1. Initialize all the parameters;
2. Round = 0;
3. Static sinks computes the velocities of MSs based on Equation (30);
4. MSi Starts to move in predetermined circular path from position (((2\(j\)-1)(d/2)), 0)
5. Turn Round = Turn Round +1;
6. J = 1;// sector number
7. Stops at (((2\(j\)-1)(d/2).cos(\(\theta\)/2) + Xcenter), ((2\(j\)-1)(d/2).Sin(\(\theta\)/2) + Xcenter)); //MS stops at the bisector of sectors
8. MS sends a Hello packet to the nearest CH;
9. CH sends a data packet to the MS //data packet contains corona number, sector number and waiting time parameter;
10. MSi Computes the sojourn time in Cluster(i, j) based on Equation (30);
11.