# Novel Approach Sizing and Routing of Wireless Sensor Networks for Applications in Smart Cities
## 3 Problem Formulation
### Wireless Sensor Network Sizing  
For WSN sizing, a square area of \(L\) by \(L\) m in an open space is assumed. The data aggregation points (DAPs) will be located in this area to achieve the connectivity of wireless IoT sensors. The DAPs are assumed to enable the connectivity of the sensors within a coverage radius of \(R\) m; consequently, the wireless sensors can be at any position within the bounded region.  
The DAPs can be located at any position within the region and installed on street lighting poles or elevated areas. In this way, the mathematical model minimizes the cost in terms of the lowest number of DAPs. Moreover, the variables used to cover the wireless sensors are described below. A set of \(N\) sensors is installed in different areas of the region; additionally, we consider a set of \(M\) possible locations or candidate sites where the are DAPs deployed.  
The possible location that was previously described is a candidate for a place where a DAP could be installed or sited; therefore, it will not be mandatory for a DAP to be installed at that location unless it covers a percentage of the sensors. The model defines that a wireless sensor is covered if it is within a distance \(R\) from at least one DAP; the Haversine distance (\(dist_{haversine}\)) is used to consider the Earth's curvature for geo-referenced points [31].  
A candidate site is considered an active site if a DAP is enabled or installed on the candidate site. Each DAP has a limited capacity in terms of the sensors. From the above details, an optimization problem is defined that aims to find the minimum number of active sites such that at least a percentage \(P\) of the sensors are covered.  
It is necessary to define a set \(S=\{s_{1},s_{2},s_{3},\ldots,s_{M}\}\) of candidate sites, where the j-th position is given by \((xs_{j},ys_{j})\). A set of \(D=\{d_{1},d_{2},\ldots,d_{N}\}\) sensors or wireless devices is also defined. The position of the i-th sensor is given by \((xd_{i},yd_{i})\).  
We define the quantity \(\alpha_{jj}\in\{0,1\}\), which implies that if sensor \(\mathbf{i}\) is covered by DAP \(\mathbf{j}\), then the value is 1; otherwise, the value is 0. Thus, for each candidate site, the quantity \(Z_{j}\in\{0,1\}\) is defined, which implies that the value is 1 when candidate site \(j\) is an active site.  
In the same way, for each sensor \(d_{i}\), the quantity \(Y_{i}\in\{0,1\}\) is defined when the value is one, which indicates that the sensor is covered by at least one candidate site. \(C\) is defined as the capacity of the DAPs to accommodate sensors. The optimization model for the sizing is presented below:  
Objective function:  
\[\min\ \ \sum_{j=1}^{M}Z_{j}, \tag{1}\]  
which is subject to:  
\[Y_{i}=\sum_{j=1}^{M}X_{j,j};\ \ \ \ \ \ \ \ \forall\ i\in D; \tag{2}\] \[\sum_{i=1}^{N}X_{j,i}\leq C\cdot Z_{j};\ \ \ \ \ \ \ \ \forall\ j\in S;\] (3) \[\sum_{i=1}^{N}Y_{i}\geq N\cdot P;\ \ \ \ \ \ \ \ \forall\ i\in D;\] (4) \[X_{j,i}\leq\alpha_{j,i}\cdot Z_{j};\ \ \ \ \forall j\in S; \forall\ i\in D; \tag{5}\]where  
* The percentage \(P\) of sensors are covered in a delimited area or region.
* The term \(N\) defines the number of sensors in a delimited area or region.
* The term \(M\) defines the number of candidate sites in a delimited zone or region.
* The number of covered DAPs is \(\alpha_{j,i}\in\{0,1\}\). If a sensor \(i\) is covered by a DAP \(j\), \(\alpha_{j,i}\) is 1 and 0 otherwise.
* For each \(s_{j}\) candidate site, \(Z_{j}\in\{0,1\}\) is defined, where \(Z_{j}\) is 1 if the candidate site is active and 0 otherwise.
* \(X_{j,i}\) indicates if sensor \(i\) is connected to DAP \(j\). \(X_{j,i}\) is 1 if the connection exists, and 0 otherwise.  
Before applying the optimization model that aims to minimize the number of candidate sites for the DAPs, it is necessary to make an on-site visit to verify the availability of the candidate sites for use as inputs for the optimization model.