Novel Approach Sizing and Routing of Wireless Sensor Networks for Applications in Smart Cities

Citizens are expected to require the growth of multiple Internet of Things (IoT) -based applications to improve public and private services. According to their concept, smart cities seek to improve the efficiency, reliability, and resilience of these services. Consequently, this paper searches for a new vision for resolving problems related to the quick deployment of a wireless sensor network (WSN) by using a sizing model and considering the capacity and coverage of the concentrators. Additionally, three different routing models of these technology resources are presented as alternatives for each WSN deployment to ensure connectivity between smart meters and hubs required for smart metering. On the other hand, these solutions must reduce costs when this type of wireless communication network is deployed. The present work proposes various optimization models that consider the physical and network layers in order to integrate different wireless communication technologies, thus reducing costs in terms of the minimum number of data aggregation points. Using a heterogeneous wireless network can reduce resource costs and energy consumption in comparison to a single cellular technology, as proposed in previous works. This work proposes a sizing model and three different models for routing wireless networks. In each case, constraints are evaluated and can be associated with different real-world scenarios. This document provides an optimization model that encompasses all of the proposed constraints; due to the combinatorial nature of the problem, this would require a heuristic technique.


Introduction
This paper outlines the need for rapid deployment of wireless sensors for applications of the Internet of Things (IoT), which are particularly required in smart cities where, in each case, rapid deployment, low costs, and the possibility of using a variety of technological solutions are required [1,2].
IoT applications for smart cities have critical importance; among these applications, some examples include medical assistance for patients with contagious viruses (COVID- 19), smart metering of electricity, home delivery of parcels (medicines, food), and "education 4.0". Consequently, there are areas of opportunity for advanced technologies and techniques that support innovative services with adequate performance to ensure the control and operations of devices with the possibility of wireless communication [3,4]. Furthermore, telecommunication technologies require rapid deployment in order to cover the demand for smart city applications, such as those mentioned above.
Thus, the central offices of local governments require the monitoring and surveillance of sensors placed in previously defined areas or strata of cities to make the operation of S8 S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S21  S6 S12 S13 S14 S15 S16 S17 S18 S19 S20  Earlier work presented classical wireless sensor network routing solutions, including the novelties of reducing energy consumption with short-range wireless technologies. In addition, hardware prototypes concerned with the interoperability of communication protocols among wireless sensors were presented [4,16].
However, routing can create various logical topologies according to the need for scalability and the use of multi-layers depending on the number of nodes and the physical complexity of the network [17].
There have been contributions to sensor fault location and applications for the reconstruction of a sampled signal with a percentage of measured data through compressed sensing techniques, as presented by [18]. Other contributions sought to improve the quality of service in packet forwarding by using multi-hop delays, and other work addressed the types of wireless sensor networks employed in the IoT. In addition, it is essential to remember that all applications must be scalable, as noted in [19]. There were also contributions to the dimensioning of wireless sensor networks, as presented in [20]. Furthermore, when deploying a wireless network for smart cities, for more sensors to be incorporated daily to generate new services, the WSN must be flexible, and the proposed algorithms must converge to the optimal solution on time for fast management.
The authors note the possibility of using RFID-enabled sensors in an unlicensed band, which can reduce the costs for such applications; however, the interoperability between devices from various manufacturers is not open, and this type of technology was first proposed for electricity metering and for rubbish collection in smart cities.
Other work related to IEEE 802.15.4 (Zigbee) offered alternatives for the achievement of the rapid deployment of a wireless communications network and presented the possibility of implementing network topologies that support various types of topologies, such as star, extended star, or mesh topologies. In addition, other work proposed heterogeneous solutions that sought to ensure that investment in communications infrastructure was minimal. The proposals were hybrid networks based on fiber-optic and wireless networkscalled FiWi-or networks based on WiFi and Zigbee [21].
Regarding the technologies for WSNs, data concentrators are gateways, and are also used in LPWAN technologies; therefore, the process of optimal network sizing can also be modeled to adequately locate these concentrators with the same rigor as that in the technologies discussed in the previous paragraph [22]. A routing analysis will determine the technology used in order to interconnect the DAPs required in the WSN's deployment while considering a star topology among the sensor nodes and gateways.
The optimization problem is of the combinatorial type due to its complexity, and it is called an NP-complete problem. Consequently, some authors proposed heuristic algorithms to explore local optimization solutions that are close to the global solution. On the other hand, there was risk in different works that presented the use of clusters. There were sensors without connectivity in their proposed solutions, even though they previously managed to minimize the cost of energy consumption [23,24]. Methods such as k-means or Kmedoids are not balanced or give multiple answers.
Consequently, other works, such as that of [30], showed the integration of a network from a cross-layer between the access control layer and the routing protocol used to reduce the load of information flow in wireless links. This type of work presents a significant achievement in reducing congested links and, thus, allowing the redirection of data flows in the less saturated network. In this sense, we could consider a multi-layer solution in which the physical layer and the network layer interconnect with each other when sizing and routing the DAPs while taking the wireless link capacity and its coverage radius into consideration.
The need to connect sensors for various applications should not be subject only to the deployment of a unique wireless communication network because using existing technologies reduces the investment cost. Seeking a heterogeneous wireless network solution incorporates the possibility of integrating technologies that facilitate data transmission between sensors and the central office, as is the case of applications linked to the smart metering of electricity, water, or gas.
Graph theory provides an exciting alternative for achieving novel solutions, but above all; it develops solutions with a low computational cost, also facilitates scalability when increasing the number of sensors. Table 1 refers to the scientific articles related to the relaxation of an NP-complete problem. In addition, the differences between the present work and other proposals are presented. Hassan [24] Wang et al. [25] Guodong [26] Wang et al. [27] Passos [7] Masoud [6] Afaneh [2] Wang [29] Current Work

Problem Formulation
This work is divided into two sections that offer novel contributions to the rapid implementation of WSNs required for various services in smart cities. This section divides the model into (a) WSN sizing and (b) WSN routing.

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 , . . . , 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 , . . . , 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 α j,i ∈ {0, 1}, which implies that if sensor i is covered by DAP j, then the value is 1; otherwise, the value is 0. Thus, for each candidate site, the quantity Z j ∈ {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 ∈ {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: which is subject to: 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 α j,i ∈ {0, 1}. If a sensor i is covered by a DAP j, α j,i is 1 and 0 otherwise.
-For each s j candidate site, Z j ∈ {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.

Wireless Sensor Network Routing
This work suggests three sub-models for the routing of wireless sensor networks with variations that are important to note when planning the deployment of a communication network.

Routing Based on Graph Theory
A set of sensors is defined and connected using one-way wireless communication links. Then, if a link exists between sensor A and sensor B, it is denoted as e A,B ; in this way, A can send data directly to B. The link e A,B has a weight or distance (Haversine for geo-referencing) that is associated and denoted as d A,B .
Here, the concept of graph theory becomes essential, and we define V as the set of sensors and E as the set of existing links (partial or complete mesh topology). Therefore, graph theory describes G = (V, E) as a directed graph that represents a network topology. Below, a data stream must be transmitted from a source sensor named S to a destination sensor called T. This flow is transmitted through the intermediate sensors using existing links. The flow between a pair of sensors (s, t) belonging to V represents the information's source and destination.
Then, if we define a path P of the set of sensors, we will have that P = {P 1 , P 2 , . . . , P M } such that the links e Pk,Pk+1 ∈ E. Thus, we define the path length P as d P , which is given by d P = ∑ M−1 k=1 d Pk,Pk+1 , and define a path for the flow (s, t) as a path P s,t such that P 1 = s and P M = t.
In addition, the path with the minimum distance is defined as the path P s,t * such that d Ps,t * <= d Ps,t for any other possible path P s,t . The optimization problem posed in this paper then requires one to find the path with the minimum distance for the flow (s, t).
To write this optimization problem, it is required to define the variable X i,j , where the link e i,j is assumed to exist and X i,j has a value of 1 if the link (i, j) belongs to the path P s,t * ; otherwise, the value is 0. Similarly, for a sensor i ∈ V, we define E i,out as the set of outgoing links of i. We define E i,in as the set of incoming links of i.
Objective function: which is subject to:

Multicast Routing
This second model proposed for the routing of the wireless sensor network considers a set of sensors connected by bi-directional communication links. For example, if between sensor A and sensor B, there is a link denoted as e A,B , then A can send data directly to B and B can send information directly to A. Furthermore, the link e A,B will have a cost, weight, or distance associated with it and is given by It is important to note that the link e A,B is arbitrary in the ordering of a and b; that is, e A,B represents the same as e B,A ; therefore, the link can be named as e i , where i is the index of the link. Now, we define V as the set of sensors, E as the set of existing links, and G = (V, E) as an undirected graph; additionally, this represents a set of unordered pairs of elements of V and, thus, the network topology. An undirected graph indicates that the links are all bidirectional. For this stage, the optimization model seeks to find a minimum-cost spanning tree, which is defined as an undirected graph in which a single path connects any two vertices; that is, a tree is a connected graph with no loops.
Hence, for this problem, we define the set V = {V 1 , V 2 , . . . , V N } as the set of wireless sensors and we define a tree as a set of links A = {e 1 , e 2 , . . . , e N−1 } such that the links e i ∈ E. According to this, the cost of tree A can be defined as d A and is represented by Thus, the minimum-cost tree is defined as tree A * such that "d A * <= d A " for any other possible tree. The problem started as the need to find a minimum-cost tree, which requires the definition of certain variables, such as X i,j , and the establishment of the link e i,j that exists and where X i,j has a value of 1 when the link (i, j) belongs to the solution tree A. Otherwise, the value is 0; furthermore, a subset B of any sensors belonging to the same set A is defined within the group of sensors V.
Thus, the problem is defined as the cost minimization of the chosen links and is subject to the constraint that the sensors are connected with N − 1 links, where N is the number of sensors belonging to V.
Objective function: which is subject to: ∑ e i,j ∈E,i∈B,j∈B

Multiple Flow Routing
For the third routing case of the wireless sensor network, a set of sensors is assumed to be connected via unidirectional wireless links. If a link exists between node A and node B, denoted as e A,B , then A can send data directly to B. The link e A,B has an associated weight or distance and is given by d A,B ; additionally, the capacity of the link e A,B is given by C A,B . Thus, V is defined as the set of sensors, E as the set of existing links, and G = (V, E) as a directed graph that represents the network topology.
On the other hand, we assume a set of data flows F = { f 1 , f 2 , . . . , f k } that require the transmission of data from a source node S k to a destination sensor T k ; this requirement refers to the link capacity in terms of the flow F k and is determined by R k . The flow is transmitted through the intermediate sensors by using existing links. A flow between a pair of sensors f k = (S k , T k ) belonging to V represents the source and destination sensors.
To define the optimization model, it is necessary to define a path P as a set of sensors P = {P 1 , P2, . . . , P M } such that the sensors e Pk,Pk+1 ∈ E; in addition, we define the length of the path P as d P , which is given by d P = ∑ M−1 k=1 d Pk,Pk+1 . We then define the path for the flow (s, t) as a path P s,t such that P 1 = s and P M = t.
The minimum-distance path is defined as the path P s,t * such that d Ps,t * <= d Ps,t for any other possible path P s,t . A possible route is defined as a route that contains links that exist within the topology and that can transmit the flows passing through them.
In this way, the optimization problem that seeks to find the minimum-distance path is defined by considering the flows belonging to F.
To determine the problem in the field of optimization, it is required to define the variable X i,j,k ; for this, it is assumed that the link e i,j exists and that X i,j,k has a value of 1 if the link (i, j) belongs to the path P sk,tk ; that is, the k-th flow uses the link e i,j ; otherwise, the value is 0.
Similarly, for a sensor i ∈ V, E i,out is defined as the set of outgoing links of i and E i,in is defined as the set of incoming links of i.
Overall, the model supporting the above is as follows: Objective function: which is subject to: In this way, as with multicast routing, one can seek to determine the tree with the minimum cost allowed by the downstream Dijkstra algorithm; however, in this case, it is necessary to subtract the capacity of the links of the current network from the transmission rate of the current flow over the links affected by the same link [32,33].
The pseudocode for the optimal sizing of the wireless sensor network is presented in the ODRSI Algorithm 1, and the pseudocode with the optimal routing according to the sizing results is presented in the OERSI Algorithm 2; furthermore, Table 2 summarizes the variables used in Algorithms 1 and 2.

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 × 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 2a represents the original scenario before solving the mixed-integer linear programming problem (MILP). Figure 2b 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.

Routing Based on Graph Theory
After solving the sizing problem, a change in the scenario was generated, and we then had N = 40 sensors and M = 9 DAPs with which we proceeded to apply the routing model based on graph theory. For this stage, a connectivity matrix was generated among all resources (sensors and DAPs) based on the calculation of distances between two geographical points using the Haversine distance; then, the connectivity matrix G was generated based on the passing weight, which was the coverage radius of the DAPs: R = 60 m. Therefore, to find the minimum cost of the tree, Dijkstra's algorithm was used. The model presented two minimum-cost trees from two Dijkstra variations. Figure 4a shows the solution generated in the shortest time (0.4219 s) by starting the routing from the DAPs to the sensors (down-link). Figure 4b presents the routing from the sensors to the DAPs (up-link) in a longer time (1.6094 s). This variation in time and computational performance is important when generating a planning model with a larger number of resources to explore. S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S8 S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20

Multi-Cast Routing
A variation of the routing presented in this work allowed us to make a minimum spanning tree (MST) to link the resources to be placed (sensors and DAPs). This offered the possibility of achieving an MST that generated resilience when interconnecting the resources. This solution is less expensive than a partial or total mesh topology in smart cities depending on the type of application. If it is necessary to ensure the real-time collection of information, this type of routing can contribute. Figure 5 presents a feasible mesh from the distance restriction represented by the coverage radius (R = 60 m); it depends on this variable. The MST was determined to generate a multi-cast routing.

Multiple-Flow Routing
In general, this model presents a routing that considers the capacity of the links as a constraint. In addition, it calculates the number of data flows that can pass through each wireless link; in the case of finding a congested route, the model shows resilience and evaluates another route through which it can send the data. Figure 6a shows the MST achieved in the previous stage, which was acted upon by defining links with an origin and destination; the cost and link capacity were previously use to make a flow matrix with its source and destination, as well as a requirement in terms of the number of packets to be sent. Figure 6b presents the best route that was constructed by the algorithm, which connected the link from DAP9 to DAP2.  S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20  S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20  In Figure 7, we can see that the most significant amount of flow per wireless link was from DAP2 due to the number of DAPs around it. It was solved as an MILP.
This model allowed us to dimension the amount of traffic that could circulate from the beginning to the end in order to optimize the resources and ensure the correct quality of service in the wireless links. Table 3 shows the results generated by LPSolve.  Table 3. Table 3. ZigBee simulation (250 Kbps)-flows were generated by using LPSolve.

Source Node
Destination Node The capacity of each DAP has a direct impact on the search for optimal candidate sites and the problem graph because the selected DAPs may be different. Therefore, there is a direct impact on the total path cost when varying the capacity of a DAP. However, when the capacity of each DAP is low, the total path cost is higher and may remain somewhat higher in contrast to medium or higher capacities. Figure 8 also shows that there is a trend of linear growth as the the radius of coverage becomes more significant. Depending on the arrangement of the resulting networks, scenarios with higher total path costs can occur. Finally, Figure 8 shows that after 200 m of coverage, the total path cost remains constant. Table 4 identifies the innovations of this research in contrast to those of other proposals that address the problem of the sizing and routing of wireless sensors. The present work focuses on scenarios such as the smart metering of electrical energy; in fact, it focuses on relaxing the complexity of the sizing and routing problem by independently and consecutively solving each stage. In this way, the present work was compared with other proposals to highlight the contributions regarding the problem addressed.

Conclusions
The model for the resolution of the problem of flow capacity achieved the optimal coordination of data routing in the network layer and allocated resources in the physical layer by fixing the costs in the capacities of the DAPs, thus providing a cross-layer solution.
The novel contribution of this model was the establishment of a multi-hop WSN that used cross-layer information to determine the routing of the network layers while involving decision aspects, such as wireless link capacity and traffic flow demands. The model did not use clustering methods to relax the NP-complete problem.
This paper focused on the sizing and routing of wireless sensor networks deployed for the provision of new IoT services and applications for smart cities by considering the locations of DAPs in a neighborhood area network. Therefore, to achieve this objective, a problem was formulated in three stages (graph theory, multi-casting, and multiple flows) that were sequentially simulated, but had the same goal: to minimize the cost of the minimum number of DAPs and the minimum distance.
This paper presented an actual urban area that was geo-referenced with the latitude and longitude of each technological resource, and the performance of the optimization models was evaluated. Simulation results verified that the proposed solution could reduce the number of DAPs and generate random answers based on clustering methods. Additionally, a minimum-cost tree was initially created by considering the weight of the cost per distance for the backup wireless network. Finally, the binding capacity restriction was added.
Inter-DAP interference was not considered in this work, as it can be solved by assigning different channels to each DAP.