## 3 Background
### Virtual Grid Margin Optimization
The total energy consumed by the network during one cycle is given as:  
\[E_{total}=E_{form}+E_{comp}+E_{tran} \tag{4}\]  
Taking into account the length of the control class message in the network is much less than the length of the actual packet, we assume that \(l_{0}=l_{1}=(1/\delta)l\), \(\delta>>~{}1\). In the cluster head selection stage, the energy consumed by a temporary cluster head is far less than that consumed by the whole network broadcasting a short message in one cycle. To obtain a simplified model for the energy consumption calculation, the calculation equation mentioned above could be further transformed and reduced as:  
\[E_{total}=[2(N-\rho)+\frac{(2N-1)\rho}{\delta}]lE_{elec}+(N-\rho)(1+\frac{1}{ \delta})l\varepsilon_{fs}d_{toCH}^{2}+\rho\varepsilon_{mp}d_{toBS}^{4}+\frac{ \rho}{\delta}l\varepsilon_{mp}R^{4} \tag{5}\]  
We assume that the probability density of the nodes in the cluster is denoted by \(\rho(x,y)\), and the cluster head locates at the middle of the cluster, then the expected value of the square of the distance between ordinary nodes and cluster head can be calculated by:  
\[ \begin{split} E[d_{toCH}^{2}]=\iint d_{toCH}^{2}\rho(x,y)dxdy= \iint(x^{2}+y^{2})\rho(x,y)dxdy=\iint r^{2}\rho(r,\theta)rdrd\theta\\ =\rho\int_{\delta=0}^{2\pi}\int_{r=0}^{L/\sqrt{\pi k}}r^{3}drd \theta=\frac{\rho L^{4}}{2\pi k^{2}}=\frac{L^{2}}{2\pi k}\end{split}  \tag{6}\]  
Substituting Equation (6) into Equation (7), and letting its first-order derivative about k be equal to zero, then the number of optimal clusters can be obtained as:  
\[\hat{\rho}=\frac{\sqrt{N}}{\sqrt{2\pi}}\times\sqrt{\frac{\delta\varepsilon_{fs }}{(N-\delta)\varepsilon_{mp}}}\times\frac{LR^{2}}{d_{toBS}^{2}} \tag{7}\]  
It can be observed from the Equation (9) that when the number of clusters equals the optimal clustering number \(\hat{\rho}\), the variable \(T_{total}\) can take its minimum value, and the energy consumption of the whole network would be optimized in the same time. According to Equation (9), the number of optimal cluster as well as the total number of the grids partitioned on the monitoring area can be obtained, respectively. Since the shape of each grid is made up of a square, the total number of the grids can be calculated as:  
\[Gr_{num}=\text{int}(\sqrt{\hat{\rho}}) \tag{8}\]  
To obtain a full coverage of the area of interest and avoid losses of acquired data, grid margin should satisfy the condition \(Gr_{num}\times D^{2}\geq R^{2}\), and obtain:  
\[D=\left\lceil\frac{R^{2}}{Gr_{num}}\right\rceil \tag{9}\]  
Once the area of interest is partitioned completely by virtual grids, each grid area would have an unique indexing number, denoted by \([Gr_{x},Gr_{y}]\). Each sensor node is assigned a coordinate (\(x_{i}y_{i}\)) in its initialization stage, and the grid that belongs to each node can be calculated by the following equation:  
\[\left\{ \begin{array}{l}G^{i}_{x}=\left[\frac{x_{i}-x_{0}}{D}\right]\\ G^{i}_{y}=\left|\frac{y_{i}-y_{0}}{D}\right|\end{array} \right. \tag{10}\]  
where \(x_{0},y_{0}\) represent the initial values of the horizontal and the vertical distances between the base station and the area of interest, respectively. Nodes in the network would fail to perform due to energy dissipation. When the number of failed nodes reaches a specified threshold value, the base station would recalculate the margins of the virtual grids, and then send a broadcast message. In this manner, the cluster would be reconstructed.