# Novel Approach Sizing and Routing of Wireless Sensor Networks for Applications in Smart Cities
## 3 Problem Formulation
### Wireless Sensor Network Routing
#### 3.2.3 Multiple Flow Routing
\begin{tabular}{c l} \hline \hline
**Variable** & **Definition** \\ \hline \(C_{j}\) & Capacity of DAP \\ \(R\) & Coverage radius of wireless technology/DAP \\ \(P\) & Wireless coverage percentage \\ \(dist\) & Distance matrix: from each sensor to each candidate site \\ \(coordS\) & Coordinates of sites for DAPs \\ \(coordD\) & Coordinates of sensors \\ \(M\) & Number of candidate sites \\ \(N\) & Number of sensors \\ \(Z_{j}\) & Set of links \\ \(X_{j,i}\) & Wireless link \\ \(Y_{i}\) & Sensor with coverage of a DAP \\ \(dmin\) & Minimum distance of wireless technology \\ \(G\) & Connectivity matrix—graph \\ \(dp\) & Minimum distance between resources and a vertex \\ \(pred\) & Vertex preceding v in the shortest path \\ \(path\) & Connectivity path \\ \(totalCost\) & Tree extension in meters \\ \hline \hline \end{tabular}   
* **Algorithm 1**\(OSW\): Sizing of Wireless Sensor Networks  
* **Algorithms**  
```
1 Definitions Inputs:\(\mathit{dmin}=R\), \(\mathit{Geo}-\mathit{referenced coordinates}\mathit{for}\mathit{DAPs}\) and sensors: \(\mathit{coordS}=\left\{\left(xs_{1},ys_{1}\right),\left(xs_{2},ys_{2}\right), \ldots,\left(xs_{j},ys_{j}\right),\ldots,\left(xs_{M},ys_{M}\right)\right\}\); \(\mathit{coordD}=\left\{\left(xd_{1},yd_{1}\right),\left(xd_{2},yd_{2}\right), \ldots,\left(xd_{i},yd_{i}\right),\ldots,\left(xd_{N},yd_{N}\right)\right\}\); Output:\(\mathit{minimal\ tree\ cost}\)
```
2 Set \(\mathit{coord}=\mathit{coordD}\cup\mathit{coordsS}\);
3 Set \(G\in\mathbb{R}^{(N+M)\times(N+M)}\); \(G=\mathbf{0}\); forall\(\ j\)=1 to M+N \(\mathit{forall}\ i\)=1 to M+N \(G[i,j]=\mathit{dist}_{\mathit{horewise}}(\mathit{coord}(i),\mathit{coord}(j))\) if\(G[i,j]==0\); then\(G[i,j]=\infty\); endif if\(G[i,j]>\mathit{dmin}\); then\(G[i,j]=\infty\); endif if\(G[i,j]\leq\mathit{dmin}\); then\(G[i,j]=1\); endforall endforall ```
4 \([\mathit{dp},\mathit{pred}]=\mathit{dijkstra}(G,N+M)\);
5 Set \(\mathit{path}=\varnothing\) forall\(i=1:N+M\) \(\mathit{node}=i\); \(\mathit{path}=\mathit{path}\cup\{\mathit{node}\}\); while\(\mathit{pred}(\mathit{node})<N+M+1\) & \(\mathit{pred}(\mathit{node})>0\) \(\mathit{pred}(\mathit{node})\); \(\mathit{path}=\mathit{path}\cup\{\mathit{pred}(\mathit{node})\}\); \(\mathit{totalCost}=\mathit{totalCost}+\mid\mathit{dist}_{\mathit{horewise}}( \mathit{node},\mathit{pred}(\mathit{node}))\mid\); \(\mathit{node}=\mathit{pred}(\mathit{node})\); endwhile endforall
```

**Algorithm 2**\(\mathit{ORWN}\): Routing of Wireless Sensor Networks

## 4 Analysis of Results

The models for solving the sizing and routing of wireless sensor networks required for different smart city applications are presented according to the stages outlined above. The simulation process was performed in Matlab R2020b, which was interfaced with the LPSolve optimizer (developed by MIT) on a computer with an E3-1535M v5 CPU, Intel Xeon 2.90 GHz, and 64 GB of RAM. ### Wireless Sensor Network Sizing

The scenario included \(N=40\) sensors located in an approximately \(L\times L\) defined area of 300 m\({}^{2}\). A total of \(M=25\) candidate sites were established for the placement of a DAP. The optimization model sought to minimize the cost per number of DAPs subject to the capacity constraint of \(C=20\), a coverage radius of \(R=60\) m, and a percentage of \(P=100\%\). Figure 1(a) represents the original scenario before solving the mixed-integer linear programming problem (MILP). Figure 1(b) shows that the optimal result was reduced from \(M=25\) to \(M=9\), which would be the sites where the DAPs would be actively placed. Figure 3 indicates the variations in power consumption among the wireless technologies. It is remarkable to see that when opting for a single technology, such as a cellular network, energy consumption is higher than for technologies that have lower coverage but have a multi-hop option and lower energy consumption.