## 4 Performance Analysis
### Cluster Formation  
Clusterhead Selection  
In the initialization phase, each sensor broadcasts a \(Hello\) message to its neighboring sensors. Therefore, the number of transmissions \(N_{T_{x}}\) is equal to the number of sensors in the network, \(n\), and the number of receptions \(N_{R_{x}}\) is the sum of the number of neighboring sensors of each sensor. That is, \(N_{T_{x}}=n\) and \(N_{R_{x}}=\sum_{j=1}^{n}N_{j}\). As a sensor, say sensor \(i\), meets the conditions of being a clusterhead, it broadcasts this and assigns cluster ID \(i\) to its neighboring sensors. Its neighboring sensors then transmit a signal to their neighbors to update cluster ID information. During this clustering phase, \((1+N_{i})\) transmissions and \((N_{i}+\sum_{j\in NB_{i}}N_{j})\) receptions are executed, where \(NB_{i}\) is the index set of neighboring sensors of sensor \(i\). This procedure is applied to all clusterheads and their cluster members. Now let \(N_{T_{x}}^{c}\) and \(N_{R_{x}}^{c}\) denote the number of transmissions and receptions for all clusters, respectively. Hence, \(N_{T_{x}}^{c}=\sum_{i\in I}(1+N_{i})\) and \(N_{R_{x}}^{c}=\sum_{i\in I}(\sum_{j\in NB_{i}}N_{j}+N_{i})\), where \(I\) is a index set of clusterheads. Therefore, the total energy consumption, \(E_{cluster}\), for cluster formation in the mobile wireless sensor network is \(E_{cluster}=N_{T}\cdot E_{T}+N_{R}\cdot E_{R}\), where  
\[N_{T}=N_{T_{x}}+N_{T_{x}}^{c}=n+\sum_{i\in I}(1+N_{i}), \tag{29}\]  
\[N_{R}=N_{R_{x}}+N_{R_{x}}^{c}=\sum_{j=1}^{n}N_{j}+\sum_{i\in I}(\sum_{j\in NB_ {i}}N_{j}+N_{i}). \tag{30}\]  
Gateway Selection  
The energy consumption for determining gateways is evaluated based on the description in Section 3.1. There are three possible determinations of a gateway in a cluster: (a) a 1-hop cluster member, (b) a 1-hop cluster member with a 2-hop member, and (3) a 2-hop cluster member. In order to simplify the presentation, the main notations are introduced as follows: let \(I\) denote the index set of clusterheads; let \(H\) denote the index set of 1-hop cluster members in the network; let \(H_{i}^{(1)}\) denote the index set of 1-hop cluster members of cluster \(i\) without 2-hop neighboring cluster members (a subset of \(H\)); let \(H_{i}^{(2)}\) denote the index set of 1-hop cluster members of cluster \(i\) with 2-hop neighboring cluster members (a subset of \(H\)); let \(M\) denote the index set of 2-hop cluster members in the network; let \(M_{i}\) denote the index set of 2-hop cluster members of cluster \(i\) (a subset of \(M\)); let \(G\) be the index set of gateway nodes; let \(B\) be the index set of border nodes.  
When clusterheads broadcast messages to trigger the gateway selection procedure, the number of transmission \(N_{T_{1}}\) and reception \(N_{R_{1}}\) can be expressed by  
\[N_{T_{1}}=|I|+|H_{i}^{(2)}| \tag{31}\]  
\[N_{R_{1}}=\sum_{i\in I}N_{i}+\sum_{i\in I}\sum_{j\in H_{i}^{(2)}}N_{j}. \tag{32}\]  
When applying the procedure for choosing gateways, the border sensors compute the weighting values and then broadcast messages to update the connectivity information and further activate the linked cluster architecture. Accordingly, the number of transmission \(N_{T_{2}}\), reception \(N_{R_{2}}\), and processing \(N_{P_{g}}\), are given by  
\[N_{T_{2}}=|B|+|G| \tag{33}\]  
\[N_{R_{2}}=\sum_{j\in B}N_{j}+\sum_{i\in I}\sum_{j\in G\cap M_{i}}N_{j}+\sum_{i \in I}\sum_{j\in G\cap H_{i}^{(1)}}N_{j}+\sum_{i\in I}\sum_{j\in G\cap H_{i}^{ (2)}}N_{j}. \tag{34}\]  
\[N_{P_{g}}=|B|. \tag{35}\]  
Thus, based on the energy needed to transmit and receive, the total energy consumption for gateway selection can be assessed by \(E_{g}=(N_{T_{1}}+N_{T_{2}})\cdot E_{T}+(N_{R_{1}}+N_{R_{2}})\cdot E_{R}+N_{P_{ g}}\cdot E_{P}\).