# Automated Real-Time Intelligent Traffic Control System for Smart Cities Using Wireless Sensor Networks

Authors: Adil Hilmani; Abderrahim Maizate; Larbi Hassouni
Journal: Wireless Communications and Mobile Computing
 (2020)

---

## Abstract

Over the years, the number of vehicles has increased dramatically, which has led to serious problems such as traffic jams, accidents, and many other problems, as cities turn into smart cities. In recent years, traffic jams have become one of the main challenges for engineers and designers to create an intelligent traffic management system capable of effectively detecting and reducing the overall density of traffic in most urban areas visited by motorists such as offices, downtown, and establishments based on several modern technologies, including wireless sensor networks (WSNs), surveillance camera, and IoT. In this article, we propose an intelligent traffic control system based on the design of a wireless sensor network (WSN) in order to collect data on road traffic and also on available parking spaces in a smart city. In addition, the proposed system has innovative services that allow drivers to view the traffic rate and the number of available parking spaces to their destination remotely using an Android mobile application to avoid traffic jams and to take another alternative route to avoid getting stuck and also to make it easier for drivers when looking for a free parking space to avoid unnecessary trips. Our system integrates three smart subsystems connected to each other (crossroad management, parking space management, and a mobile application) in order to connect citizens to a smart city.


---

## Body

## 1. Introduction

Today, people spend the majority of their time outside of their home environments, they travel daily to work, and they go frequently to the shopping centers and attractions, without forgetting the displacements to the center of the city. This certainly caused an imbalance in the daily mobility that led to the development of parking services to avoid unnecessary driving around the city center to simply search for a parking space. This, on the one hand, causes additional carbon dioxide emissions and damages the environment of the city’s ecosystem. On the other hand, it increases the driver’s frustration and traffic congestion in the city, which will certainly cause traffic accidents.Recently, the cities are growing at an exponential rate due to the changing global economy and modern life. Information and communication technologies play a crucial role in sustainability plans and urban development of cities. New technologies and various smart devices connected to the network (the Internet of things or IoT) provide modern and solid solutions with the aim of creating smart cities and optimizing the efficiency of urban operations and services connected to citizens [1]. Smart cities are used in all areas of life, including medical facilities, industry, hospitals, offices, transport, and parking lots [2–4]. In the past five years, the number of vehicles has increased in a frightening manner which has caused several major problems for the development of cities causing traffic jams, accidents, and even illnesses due to the frustration and stress of the drivers. These problems are due, on the one hand, to poor management of road traffic in cities, especially at road intersections based on traditional traffic light management systems, and, on the other hand, to unnecessary movement of drivers when looking for free parking spaces in congested areas of cars that only injects more traffic into the roads. In this article, we will present an intelligent and connected system based on the deployment and implementation of wireless sensor networks (WSNs) at road intersections and also in car parks in order to make roads and cities smarter. This system is different from existing systems, because it regroups two intelligent systems (the traffic light control system and the intelligent parking system) into a single innovative system in order to connect citizens to roads and parking spaces in their city remotely and in real time using only one mobile application (Figure 1).Figure 1
Intelligent traffic control system.The rest of this paper is organized as follows. The related work is presented in Section2. In Section 3, we describe the general architecture of the proposed intelligent traffic control system. The presentation of our system and the proposal of a self-organization protocol are presented in Section 4. Section 5 presents the algorithm of our intelligent system. The simulation and the evaluation of the performances in terms of energy consumption, lifetime of the WSN, etc. are presented in Section 6. Section 7 presents our Android Smart Traffic mobile application. Finally, Section 8 is the conclusion.


## 2. Related Work

Several traffic control systems have been implemented in recent years using different communication and surveillance technologies to control and manage the problem of urban traffic in cities and resolve the limitations of traditional traffic light systems.The authors in [5] propose a new architecture for the urban traffic control system (S1) based on an IoT network. This system makes it possible to connect roads to the Internet via sensor nodes, capable of detecting the arrival of vehicles and sending the detected data to a cloud from a border router. Data collected in the cloud allows middleware to decide the future state of traffic lights. This decision is disseminated via the network to actuators installed in traffic lights to manage traffic in city intersections. This system is based on the implementation of a self-organization protocol that creates a star network topology allowing all detection nodes to send their data to the sink node via a single hop. However, this protocol is not adequate for the management of linear car parks and for large car parks because it will create a load imbalance between the different detection nodes during the communication of a single hop towards the sink node quickly exhausting the most distant nodes which will negatively affect the quality of communication and the reliability of the system. In addition, this approach uses recent technologies such as wireless sensors to limit the cost of system deployment. However, such a solution remains obsolete vis-à-vis citizens and drivers because they cannot connect to the roads and know the state of traffic in real time and remotely which are part of the concept of the creation of smart cities.In [6], a new intelligent traffic control system (S2) is presented, which is based on the deployment of wireless sensor networks on roads, on traffic lights, and on specific places (such as hospitals and petrol pumps) in order to monitor road traffic in the city and find the shortest route to the destination in terms of time and distance, avoiding traffic jams. This system employs intelligent cameras on the roads to identify the vehicle numbers and send this information to the central system to monitor the cars in the city. The proposed system uses more recent technologies which allow the interconnection of the various urban services between them by creating a smart city. However, the deployment of smart cameras can be expensive and also less effective, especially when detecting the numbers of cars in cases where there are visibility problems such as the reflection of light from car headlights, given that there are other cheaper and efficient solutions such as RFID technology which interacts with WSN networks and which allows vehicles to send this information to the central system in a sustainable and efficient way.In [7], the authors propose an intelligent traffic congestion control (S3) based on the deployment of wireless sensor networks in order to measure the density of road congestion created at road crossings. This system consists of two modules. The first is TDMM (traffic density monitoring module) which uses an ultrasonic sensor to measure the length of the queue created by the crowd of cars, and the second is TMM (traffic management module) which is software deployed in a computer which makes it possible to control the traffic lights according to the data collected by the various TDMM implemented in the roads. The TDMM deployed on each road in a road crossing send their collected data to their nearest TMM via Wi-Fi using multihop or single-hop communication depending on the communication range in order to determine the density of road congestion (strong, medium, or low) and dynamically define the operating time of the traffic lights according to the values obtained from the different routes. This system uses a self-organization protocol which creates a nonautonomous tree type topology between the different nodes, of which each monitoring node communicates via a single hop with the nearest node which in turn communicates with the sink node via intermediate nodes to transmit data to the traffic management module. However, the nonautonomous tree structure formed by this system creates an imbalance in the energy consumption between the various monitoring nodes, especially for the intermediate nodes, and also, it decreases the quality of data delivery to the central node when one of the routing nodes becomes faulty or exhausted in energy. In addition, the deployment of ultrasonic sensors should only be used on roads with little traffic and moderate traffic. Car vehicle detection on multiple lanes with roadside ultrasonic sensors is subject to a reduction in detection accuracy in heavy traffic. This can cause a system stability problem, especially during peak hours with heavy traffic, which can lead to poor decisions when estimating the running time of traffic lights.The authors in [8] propose a system for monitoring road traffic (S4) based on mobile devices and Bluetooth beacons with low energy consumption. The vehicle detection offered by this system uses mobile devices (for example, smartphones) installed on the side of the road to measure the strength of the RSSI signal when receiving radio frequency frames emitted by Bluetooth beacons on the other across the street. Bluetooth beacons are installed along the road at different heights in order to identify and classify the type of vehicles traveling on the road (cars or trucks). The RSSI values detected by mobile devices on each route as well as their positions are sent via a cellular network or Wi-Fi communication to a server in order to measure the density of road congestion and monitor traffic on the roads. On the other hand, Bluetooth technology can cause major synchronization problems and communication breakdowns between the BLE beacon and the smartphone, which negatively affect the feasibility of the system, especially in the case of heavy traffic. So, an agent must be on-site to pair the two devices to resume communication.The authors in [9] present a new intelligent traffic monitoring and traffic light control system (S5) based on wireless sensor networks. These sensor nodes are installed along the roads constituting a road intersection. The data captured by the sensors is sent to a two-traffic signal controller to assess the congestion conditions of traffic on each road at an intersection and to predict the state of traffic jams. This system uses a self-organization protocol (Alg5) which creates a star topology between the different nodes of the network. However, the algorithm adopted by this system will create dark areas for certain nodes far from their associated central node which they will not be able to communicate with it and which will cause degradation in the quality and in the feasibility of this system. This solution makes it possible to dynamically manage the traffic lights according to the states of traffic congestion obtained in an intersection and also makes it possible to optimize the synchronization phase of traffic light control in order to avoid traffic jams before its formation. The intelligence of this system remains beyond the reach of drivers and citizens because they do not interact with the remote system and also do not connect to roads in real time.The authors in [10] describe a new intelligent system of adaptive traffic light control (S6) based on the deployment of the wireless sensor network (WSN) in the roadways leading to an intersection. These nodes are magnetic sensors installed in the ground along all the paths that form an intersection. These sensors form a cluster-type network topology in which each node detects the presence of vehicles and sends the data to the nearest head cluster to reach the base station. The data collected by the WSN is used by the base station by running an algorithm to detect the rate of traffic congestion in each lane and dynamically control the traffic lights at the road intersection. La transmission des données à la station de base par les nœuds capteurs est basée sur l’utilisation d’un protocole d’auto-organisation qui permet à tous les nœuds du réseau de former une topologie en cluster dont les têtes de cluster (CH) transmettent toutes les données de leur cluster à la station de base via un seul saut. Cependant, ce protocole crée un déséquilibre de charge entre certains nœuds de capteurs qui sont élus en tant que clusters de têtes et qui sont éloignés de la station de base car la communication d’un seul bond vers la station de base consomme beaucoup d’énergie ce qui provoque un épuisement rapide de ces nœuds. This system adopts recent, intelligent, and inexpensive technology to monitor traffic congestion and to control traffic lights. However, such a solution to create a smart city and be connected to citizens remains isolated from drivers who ignore what is happening on the roads of their city.


## 3. Architecture of the Intelligent Traffic Control System

The proposed system contains 3 basic parts: parking space management center, traffic light management center, and global information and management center (Figure1).The parking space management center is based on the deployment of WSNs in all parking spaces in order to consolidate all the availability states of spaces in each zone of the city for those sent to the corresponding gateway (sink), and these will then be transferred to the global information and management center to be used by and made available to drivers and citizens. The sensor nodes used are hybrid sensors (presence sensor+RFID readers) which make it possible on the one hand to detect the presence of vehicles and on the other hand to identify the vehicle by its registration number available in its RFID tag (Figure2). In the case of hybrid sensors detecting the presence of a car without any RFID tag, the system informs the parking agent to enter the registration number of the car parked in the system.Figure 2
Car presence detection using hybrid sensors.The traffic light management center is responsible for the management and control of traffic lights at road intersections in order to minimize the traffic jam and ensure the flow of traffic in the city. This center is based on the implementation of sensor networks to collect the density and the number of cars circulating in each road forming crossroads in order to make a decision when estimating the maximum duration during which a traffic light can remain in green. This center is based on innovative and robust calculations which make our road traffic management system more efficient and more performant (see Section5.2).The global information and management center is a database of all the information collected from all the sensors installed in the city, which provides a general overview of the available parking spaces, and it manages the traffic lights to increase traffic flow in the city. This center provides drivers with an Android mobile application which identifies free parking spaces for their destinations and also the traffic rate in real time in order to avoid unnecessary trips and to look for another alternative route and other places available in locations closer to their destinations to avoid getting stuck in a traffic jam and increasing traffic congestion in the city.


## 4. System Overview

### 4.1. Types of Sensors

The proposed system uses sensor nodes to detect the presence of vehicles and send the detection states to the corresponding gateway in order to transmit them to the global information and management center. To detect the presence of vehicles, several systems use different types of sensors, magnetic sensors, ultrasonic sensors, light sensors, etc. But the majority of systems use magnetic sensors installed in the ground for a simple reason: a vehicle contains more than 100 magnetic parts, of which these sensors are able to measure the magnetic fields generated and to detect with precision the presence of a car. Table1 presents a comparison made between the 3 most used types of sensors.Table 1
Comparison between the different types of most used sensors.
Magnetic sensorLight sensorUltrasonic sensorAdvantages(i) Low cost (20-120 €)(ii) Range greater(iii) Reacts to north pole and south pole(iv) Insensible to vibrations(v) Best detection of cars(i) Average cost (60-300 €)(ii) Large range (1 m)(iii) Insensible to vibrations and no wear(iv) Detects any type of room with reflective power (direct reflection mode)(i) Large range (15 m)(ii) Detect without contact with any object (whatever the material)(iii) Adjustable sensitivityLimitations(i) Average range (<300 mm)(ii) Requires the use of a magnet(iii) Sensitive to electromagnetic disturbances(i) Supports badly the harsh environments(ii) Sensitive to the appearance of parts (material, surface condition, color, gloss, impact, etc.)(i) High cost (200-1000 €)(ii) Sensitive to drafts(iii) Sensitive to temperature


### 4.2. Wireless Communication

For a better management of parking spaces and traffic control in the city, the choice of wireless communication technology is essential to obtain good results of reliability and efficiency of the system when exchanging data between the different sensors and the gateway. Wireless communication between sensors is affected by several major factors: cars, their noise and external interference, etc. The most common wireless communication technologies used for sensor networks are Bluetooth, Wi-Fi, and ZigBee.In this type of application, a large number of monitoring and control systems based on sensor networks have been exploited by the Bluetooth and ZigBee standards. Bluetooth is a short-distance radio technology intended to simplify communication and interconnection between sensors which allows data to be transferred at low speed and at short distance. On the other hand, this technology has a great defect which is reflected in its too great consumption of energy and cannot therefore be adapted to the sensors which are supplied by a battery and which should function for several years. On the other hand, the ZigBee standard, despite its low data transmission rate, offers characteristics that even better meet the needs of sensor networks in terms of energy saving. In addition, this technology offers fairly high reliability and a low-cost price, whose energy consumption is a selection criterion [11, 12].Table2 shows the advantages and limitations of ZigBee compared to other wireless technologies.Table 2
Comparison between different wireless communication technologies.
ZigBeeBluetoothWi-FiRange (meters)1-2001-501-100Operating frequency (GHz)2.42.42.4-5Bandwidth (kb/s)20-25072011000System resources (KB)4-3225016000Battery life (days)100-10001-75ComplexityLowHighHighPower consumptionVery lowMediumHighNodes per network65000732ApplicationsControl and monitoring, sensor networks, automationWireless connectivity between devices (PDA, phones, and headsets)Wireless LAN connectivity, broadband Internet access


### 4.3. Network Topologies

Wireless sensor networks are made up of small sensor nodes that use limited energy resources and low communication and processing power to collect information in a given geographic area and transfer it to the gateway (called sink). These sensors are individual nodes that know nothing about the network, and they do not have an existing fixed infrastructure; they are often completely decentralized. So, these nodes must self-organize, unlike conventional wired networks, autonomously to form a network topology so that they can communicate and transfer the detected data to the sink. Direct communication from the sensor node with BS or multihop communication from sensor nodes to BS is not practical as the power consumption is high, which leads to early expiration of the sensor nodes and duplication of data, and the most distant nodes die quickly. To overcome these problems, two-level communication via a hierarchical clustering approach is used when the nodes are grouped into clusters, and a leader node, called the cluster head (CH), is responsible for aggregating the data and then transmitting it to the gateway. The communication within a cluster and between clusters is single hop (intracluster) and multihop (intercluster), respectively, as shown in Figure3. Techniques based on clustering are the hierarchical techniques most commonly used in wireless sensor networks [13–15].Figure 3
Cluster topology.In our proposed system, the sensor nodes execute a hierarchical self-organization algorithm based on cluster formation by creating a cluster tree topology [16]. The protocol consists of three phases: (1) the collection of node positions and cluster formation, (2) the selection of cluster heads (CHs), and (3) the collection and transmission of data.


#### 4.3.1. Collection of Node Positions and Cluster Formation

In this phase, the sensor network is divided into several levels of localization (level 1, level 2, etc.) until reaching all the nodes of the network. The creation of the localization levels is done in a progressive and recursive way in which the BS is responsible for the training of the first level (level 1). The BS sends a HELLO message to the nearest nodes to send their positions. Once the BS receives the positions of these nodes, it begins to divide this first level into several sections (clusters) based on the angular value of each nodeθi. The BS calculates for each node of the first level its corresponding angular value (Figure 4).Figure 4
The angular value of each node of the first level.Then, the BS begins to divide the first level intoα clusters Clusteri, whose parameter α is the number of clusters in each localization level, using formula (1) from which each node receives a Cluster_ADV message (Node-Id, Level, Cluster-Id) which contains the identifier of the node, the location level, and the cluster identifier that is part of it.
(1)Clusteri∈i−1θmax−θminα,iθmax−θminα,iϵ1,2,⋯,α,where Clusteri is an area presented by an interval of angular values which corresponds to the ith cluster.To group the positions of all the nodes, the BS selects the node furthest away from each cluster of each level as much as relay node by sending the message RelayNode_ADV_MSG (Node-Id, Level, Cluster-Id, Relay-Id) of which Relay-Id is the identifier of the relay node (Relay-Id is the BS for the first level). Each selected relay node will play the role of the BS by sending the broadcast message HELLO to all the nearest nodes to send their positions. The nodes that will send their positions are those that are not part of any localization level and also have no cluster (this decision is based on the strength of the received signal). Then, each relay node of each cluster will gather all the positions received from the higher level of location, and it will send them to its Relay-Id for transmission to the BS. Once the BS receives new positions of the relay nodes, it starts the same process in a recursive way by sending the two messages Cluster_ADV (Node-Id, Level, Cluster-Id) and RelayNode_ADV_MSG (Node-Id, Level, Cluster-Id, Relay-Id) to the new nodes with the value of the level of location which will be incremented and with the value of the cluster which will be the same as that of their relay node. Figure5 shows the exchange of different messages, and Figure 6 provides a general overview of the recursive algorithm used to minimize energy consumption and increase the durability of the nodes during the collection of all the positions of these nodes by the BS.Figure 5
Messages exchanged in the first phase.Figure 6
Recursive algorithm for collecting positions of all WSN nodes.Figure7 shows an example of the formation of localization levels and also the formation of clusters in a wireless sensor network with the α value equal to 3.Figure 7
Formation of localization levels and clusters withα=3.


#### 4.3.2. Cluster Head Selection

After creation of clusters and location levels, multiple candidate nodes compete to be selected as cluster heads for the current round. In this phase, each node broadcasts a message in its cluster containing its location. Each node receiving this message updates its neighborhood table which contains the distance to its neighbors and the number of neighbors, and it calculates its weight according to formula (2). After calculating the weight, each node competes to be selected as much as CH in the next turn if its weight is greater than a certain threshold Tn indicated in formula (3).
(2)Weighti=REi×∑j=1Nei1dist2Si,Sj,where REiis the estimated current residual energy of node i, distSi,Sj is the distance between node i and node j, and Nei is the number of neighbors of node i.
(3)Tn=P1−P∗rmod1/P,ifn∈G,0,otherwise.where P is the percentage of cluster heads to all nodes, r is the selected round number, rmod1/P stands for the number of selected cluster head nodes before this round, and G is the group of nodes which have not been elected as cluster head nodes previously [17].In each cluster, the candidate nodes exchange their weight among themselves and the node with the largest weight is elected as CH in its cluster for the current round. Noncandidate nodes go into sleep to minimize power consumption while waiting to receive the Cluster_Head_ADV_MSG message from the CH node to begin transmitting the data.The selection of CHs is not done periodically in each round. During the selection phase of the CHs, each node CH checks the value of its weight if it is below the thresholdTn. In this case, the process for selecting a new CH begins by sending a Selection_Cluster Head_MSG message (Figure 8). In the opposite case, the node remains as much as CH in the next round to prevent the nodes from consuming more power during the CHS selection process and to balance the load between the different nodes in the next rounds. The selection of a new CH in each cluster is done independently of the rest of the clusters in each location level.Figure 8
The selection phase of cluster heads.


#### 4.3.3. Data Transmission

After selecting the CHs, the process of transmitting data to the base station begins. Based on the TDMA protocol, communication is initiated between the different nodes of each cluster and their respective CHs in their corresponding time slots. The CHs aggregate the collected data and transmit it to the intermediate CH node or the BS according to the location level. To maximize the energy levels of the nodes, we designed an energy-efficient multihop communication when transmitting intercluster data to the base station taking into account residual energy and distances from neighboring CH nodes and the base station.For the first level of location, all the nodes are close to the base station including the CHs. For this reason and in order to reduce the energy consumption of these nodes, we have to use the single-hop communication to the base station for the first level as shown in Figure9.Figure 9
The communication phase of the first level of location.For the other location levels, there are several routes between the neighboring CHs and the base station using the intercluster multihop communication. The process of selecting the optimal routes between the different CHs and the BS starts with the CHs of the first level of location. EachCHj selected in the second phase broadcasts a nexthop_ClusterHead_MSG message containing the residual energy, the cumulative distance of its route to the base station, its identifier CH-Id, its location, its location level, and the identification of its cluster Cluster-Id. Each upper-level node CHi receiving this message updates its neighborhood table of CHs and calculates Weight‐CHj of each neighbor CHj according to formula (4). Each CHi node chooses a neighbor node CHj with the largest weight belonging to the lower location level as the next hop to transmit the collected data to the base station.
(4)Weight‐CHj=EjEmax+dcSj,BSdcSj,BS+dSj,Si,ifLeveli>Levelj,where Ejdenotes the estimated current residual energy, Emax is the maximum energy for all nodes, dcSj,BSis the cumulative distance between node j and the base station, and dSj,Siis the distance between node i and node j.This process of selecting optimal data paths is repeated in all network location levels (Figure10). Figure 11 illustrates the optimal route construction steps and the data transmission between the CHs.Figure 10
The phase of data transmission and the selection of optimal routes to the base station.Figure 11
Optimal routes and data transmission between CHs: (a) message propagation, (b) the transmission distance between the first-level CHs and the base station, (c) the different routes between the CHs, and (d) selection of the best routes for intercluster data transmission.
(a)(b)(c)(d)Figure12 illustrates an example which CH 22 fills its neighborhood table with the CHs after reception of the nexthop_ClusterHead_MSG messages from different neighboring CHs (1, 8, and 27). CH 22 deletes the route to the base station passing through CH 27 because it belongs to the same level, and it chooses the optimal route passing through CH 1 which belongs at the lower level and whose weight is greater than that of CH 8.Figure 12
(a) Reception of the nexthop_ClusterHead_MSG messages by a CH. (b) Example of a neighborhood table and the selection of the next hop by a CH.
(a)(b)When transmitting data, the CHs closest to the base station will consume more energy compared to the others. Then, it will have a new selection of the new CHs in each cluster in an independent way according to the phase of the CH selection. For each newly selected cluster head, it sends a New_nexthop_ClusterHead_MSG broadcast message containing the residual energy, its CH-Id, its location, its location level, and the identification of its cluster Cluster-Id. EachCHi node receiving this message and which belongs to the higher level modifies its neighborhood table according to the location level and the Cluster-Id of the new CH selected to make a new selection of a new optimal route to the base station as shown in Figure 13. For lower-level CHs receiving the same message, they send the nexthop_ClusterHead_MSG message to the new CH again so that it can refill its neighbor table and select the next hop as the best route to the base station.Figure 13
(a) Sending a New_nexthop_ClusterHead_MSG broadcast message by the new CH. (b) Example of a neighborhood table and selection of a new CH.
(a)(b)


### 4.4. Data Sent by Sensor Nodes

Our road traffic control system contains two types of sensor nodes: hybrid nodes which detect occupied parking spaces and nodes which detect the density of road traffic in each lane. These nodes rely on the network topology of the cluster tree to send their data packets in order to reach the gateway. Before sending the data packets, each type of sensor prepares the detected data to send them to the corresponding CH (Figure14).Figure 14
Data sent by sensor nodes. Crossroad ID is the identifier of the road crossing. Lane ID is the identifier of the road in the corresponding intersection. Lane direction ID is the identifier of the direction of the road (1 for incoming lanes at the crossing and 2 outgoing lanes). Sensor type is the identifier of the type of sensor (1: detection of parking spaces, 2: detection of traffic in the lane). Node ID is the node identifier. State is the state detected by the sensor (1: occupied, -0: free), and this field is filled in by the nodes which monitor road traffic. Parking space state is the state of parking space occupancy, and this field is filled in by the hybrid nodes which monitor the parking spaces in each lane. Car registration number is the registration number of the parked car captured by hybrid sensors thanks to the RFID reader.Figure15 illustrates the different packets sent by the different nodes of the proposed system.Figure 15
The different packets sent by the different nodes.Once the data packets are sent by the various sensors, the gateway gathers all the data collected in a corresponding road crossing and transfers them to the global information and management center of the system in order to update the information available to drivers and also for better and efficient management and control of traffic lights in real time. The management center organizes all the data sent by each gateway of each road crossing in the form of a given database in order to facilitate the monitoring of parking spaces and also to control the density of traffic in the lanes that form each crossing. Figure16 shows an example of the situation of lane 2 crossing from packets sent by the gateway.Figure 16
The different packets sent by the different nodes.


## 4.1. Types of Sensors

The proposed system uses sensor nodes to detect the presence of vehicles and send the detection states to the corresponding gateway in order to transmit them to the global information and management center. To detect the presence of vehicles, several systems use different types of sensors, magnetic sensors, ultrasonic sensors, light sensors, etc. But the majority of systems use magnetic sensors installed in the ground for a simple reason: a vehicle contains more than 100 magnetic parts, of which these sensors are able to measure the magnetic fields generated and to detect with precision the presence of a car. Table1 presents a comparison made between the 3 most used types of sensors.Table 1
Comparison between the different types of most used sensors.
Magnetic sensorLight sensorUltrasonic sensorAdvantages(i) Low cost (20-120 €)(ii) Range greater(iii) Reacts to north pole and south pole(iv) Insensible to vibrations(v) Best detection of cars(i) Average cost (60-300 €)(ii) Large range (1 m)(iii) Insensible to vibrations and no wear(iv) Detects any type of room with reflective power (direct reflection mode)(i) Large range (15 m)(ii) Detect without contact with any object (whatever the material)(iii) Adjustable sensitivityLimitations(i) Average range (<300 mm)(ii) Requires the use of a magnet(iii) Sensitive to electromagnetic disturbances(i) Supports badly the harsh environments(ii) Sensitive to the appearance of parts (material, surface condition, color, gloss, impact, etc.)(i) High cost (200-1000 €)(ii) Sensitive to drafts(iii) Sensitive to temperature


## 4.2. Wireless Communication

For a better management of parking spaces and traffic control in the city, the choice of wireless communication technology is essential to obtain good results of reliability and efficiency of the system when exchanging data between the different sensors and the gateway. Wireless communication between sensors is affected by several major factors: cars, their noise and external interference, etc. The most common wireless communication technologies used for sensor networks are Bluetooth, Wi-Fi, and ZigBee.In this type of application, a large number of monitoring and control systems based on sensor networks have been exploited by the Bluetooth and ZigBee standards. Bluetooth is a short-distance radio technology intended to simplify communication and interconnection between sensors which allows data to be transferred at low speed and at short distance. On the other hand, this technology has a great defect which is reflected in its too great consumption of energy and cannot therefore be adapted to the sensors which are supplied by a battery and which should function for several years. On the other hand, the ZigBee standard, despite its low data transmission rate, offers characteristics that even better meet the needs of sensor networks in terms of energy saving. In addition, this technology offers fairly high reliability and a low-cost price, whose energy consumption is a selection criterion [11, 12].Table2 shows the advantages and limitations of ZigBee compared to other wireless technologies.Table 2
Comparison between different wireless communication technologies.
ZigBeeBluetoothWi-FiRange (meters)1-2001-501-100Operating frequency (GHz)2.42.42.4-5Bandwidth (kb/s)20-25072011000System resources (KB)4-3225016000Battery life (days)100-10001-75ComplexityLowHighHighPower consumptionVery lowMediumHighNodes per network65000732ApplicationsControl and monitoring, sensor networks, automationWireless connectivity between devices (PDA, phones, and headsets)Wireless LAN connectivity, broadband Internet access


## 4.3. Network Topologies

Wireless sensor networks are made up of small sensor nodes that use limited energy resources and low communication and processing power to collect information in a given geographic area and transfer it to the gateway (called sink). These sensors are individual nodes that know nothing about the network, and they do not have an existing fixed infrastructure; they are often completely decentralized. So, these nodes must self-organize, unlike conventional wired networks, autonomously to form a network topology so that they can communicate and transfer the detected data to the sink. Direct communication from the sensor node with BS or multihop communication from sensor nodes to BS is not practical as the power consumption is high, which leads to early expiration of the sensor nodes and duplication of data, and the most distant nodes die quickly. To overcome these problems, two-level communication via a hierarchical clustering approach is used when the nodes are grouped into clusters, and a leader node, called the cluster head (CH), is responsible for aggregating the data and then transmitting it to the gateway. The communication within a cluster and between clusters is single hop (intracluster) and multihop (intercluster), respectively, as shown in Figure3. Techniques based on clustering are the hierarchical techniques most commonly used in wireless sensor networks [13–15].Figure 3
Cluster topology.In our proposed system, the sensor nodes execute a hierarchical self-organization algorithm based on cluster formation by creating a cluster tree topology [16]. The protocol consists of three phases: (1) the collection of node positions and cluster formation, (2) the selection of cluster heads (CHs), and (3) the collection and transmission of data.


### 4.3.1. Collection of Node Positions and Cluster Formation

In this phase, the sensor network is divided into several levels of localization (level 1, level 2, etc.) until reaching all the nodes of the network. The creation of the localization levels is done in a progressive and recursive way in which the BS is responsible for the training of the first level (level 1). The BS sends a HELLO message to the nearest nodes to send their positions. Once the BS receives the positions of these nodes, it begins to divide this first level into several sections (clusters) based on the angular value of each nodeθi. The BS calculates for each node of the first level its corresponding angular value (Figure 4).Figure 4
The angular value of each node of the first level.Then, the BS begins to divide the first level intoα clusters Clusteri, whose parameter α is the number of clusters in each localization level, using formula (1) from which each node receives a Cluster_ADV message (Node-Id, Level, Cluster-Id) which contains the identifier of the node, the location level, and the cluster identifier that is part of it.
(1)Clusteri∈i−1θmax−θminα,iθmax−θminα,iϵ1,2,⋯,α,where Clusteri is an area presented by an interval of angular values which corresponds to the ith cluster.To group the positions of all the nodes, the BS selects the node furthest away from each cluster of each level as much as relay node by sending the message RelayNode_ADV_MSG (Node-Id, Level, Cluster-Id, Relay-Id) of which Relay-Id is the identifier of the relay node (Relay-Id is the BS for the first level). Each selected relay node will play the role of the BS by sending the broadcast message HELLO to all the nearest nodes to send their positions. The nodes that will send their positions are those that are not part of any localization level and also have no cluster (this decision is based on the strength of the received signal). Then, each relay node of each cluster will gather all the positions received from the higher level of location, and it will send them to its Relay-Id for transmission to the BS. Once the BS receives new positions of the relay nodes, it starts the same process in a recursive way by sending the two messages Cluster_ADV (Node-Id, Level, Cluster-Id) and RelayNode_ADV_MSG (Node-Id, Level, Cluster-Id, Relay-Id) to the new nodes with the value of the level of location which will be incremented and with the value of the cluster which will be the same as that of their relay node. Figure5 shows the exchange of different messages, and Figure 6 provides a general overview of the recursive algorithm used to minimize energy consumption and increase the durability of the nodes during the collection of all the positions of these nodes by the BS.Figure 5
Messages exchanged in the first phase.Figure 6
Recursive algorithm for collecting positions of all WSN nodes.Figure7 shows an example of the formation of localization levels and also the formation of clusters in a wireless sensor network with the α value equal to 3.Figure 7
Formation of localization levels and clusters withα=3.


### 4.3.2. Cluster Head Selection

After creation of clusters and location levels, multiple candidate nodes compete to be selected as cluster heads for the current round. In this phase, each node broadcasts a message in its cluster containing its location. Each node receiving this message updates its neighborhood table which contains the distance to its neighbors and the number of neighbors, and it calculates its weight according to formula (2). After calculating the weight, each node competes to be selected as much as CH in the next turn if its weight is greater than a certain threshold Tn indicated in formula (3).
(2)Weighti=REi×∑j=1Nei1dist2Si,Sj,where REiis the estimated current residual energy of node i, distSi,Sj is the distance between node i and node j, and Nei is the number of neighbors of node i.
(3)Tn=P1−P∗rmod1/P,ifn∈G,0,otherwise.where P is the percentage of cluster heads to all nodes, r is the selected round number, rmod1/P stands for the number of selected cluster head nodes before this round, and G is the group of nodes which have not been elected as cluster head nodes previously [17].In each cluster, the candidate nodes exchange their weight among themselves and the node with the largest weight is elected as CH in its cluster for the current round. Noncandidate nodes go into sleep to minimize power consumption while waiting to receive the Cluster_Head_ADV_MSG message from the CH node to begin transmitting the data.The selection of CHs is not done periodically in each round. During the selection phase of the CHs, each node CH checks the value of its weight if it is below the thresholdTn. In this case, the process for selecting a new CH begins by sending a Selection_Cluster Head_MSG message (Figure 8). In the opposite case, the node remains as much as CH in the next round to prevent the nodes from consuming more power during the CHS selection process and to balance the load between the different nodes in the next rounds. The selection of a new CH in each cluster is done independently of the rest of the clusters in each location level.Figure 8
The selection phase of cluster heads.


### 4.3.3. Data Transmission

After selecting the CHs, the process of transmitting data to the base station begins. Based on the TDMA protocol, communication is initiated between the different nodes of each cluster and their respective CHs in their corresponding time slots. The CHs aggregate the collected data and transmit it to the intermediate CH node or the BS according to the location level. To maximize the energy levels of the nodes, we designed an energy-efficient multihop communication when transmitting intercluster data to the base station taking into account residual energy and distances from neighboring CH nodes and the base station.For the first level of location, all the nodes are close to the base station including the CHs. For this reason and in order to reduce the energy consumption of these nodes, we have to use the single-hop communication to the base station for the first level as shown in Figure9.Figure 9
The communication phase of the first level of location.For the other location levels, there are several routes between the neighboring CHs and the base station using the intercluster multihop communication. The process of selecting the optimal routes between the different CHs and the BS starts with the CHs of the first level of location. EachCHj selected in the second phase broadcasts a nexthop_ClusterHead_MSG message containing the residual energy, the cumulative distance of its route to the base station, its identifier CH-Id, its location, its location level, and the identification of its cluster Cluster-Id. Each upper-level node CHi receiving this message updates its neighborhood table of CHs and calculates Weight‐CHj of each neighbor CHj according to formula (4). Each CHi node chooses a neighbor node CHj with the largest weight belonging to the lower location level as the next hop to transmit the collected data to the base station.
(4)Weight‐CHj=EjEmax+dcSj,BSdcSj,BS+dSj,Si,ifLeveli>Levelj,where Ejdenotes the estimated current residual energy, Emax is the maximum energy for all nodes, dcSj,BSis the cumulative distance between node j and the base station, and dSj,Siis the distance between node i and node j.This process of selecting optimal data paths is repeated in all network location levels (Figure10). Figure 11 illustrates the optimal route construction steps and the data transmission between the CHs.Figure 10
The phase of data transmission and the selection of optimal routes to the base station.Figure 11
Optimal routes and data transmission between CHs: (a) message propagation, (b) the transmission distance between the first-level CHs and the base station, (c) the different routes between the CHs, and (d) selection of the best routes for intercluster data transmission.
(a)(b)(c)(d)Figure12 illustrates an example which CH 22 fills its neighborhood table with the CHs after reception of the nexthop_ClusterHead_MSG messages from different neighboring CHs (1, 8, and 27). CH 22 deletes the route to the base station passing through CH 27 because it belongs to the same level, and it chooses the optimal route passing through CH 1 which belongs at the lower level and whose weight is greater than that of CH 8.Figure 12
(a) Reception of the nexthop_ClusterHead_MSG messages by a CH. (b) Example of a neighborhood table and the selection of the next hop by a CH.
(a)(b)When transmitting data, the CHs closest to the base station will consume more energy compared to the others. Then, it will have a new selection of the new CHs in each cluster in an independent way according to the phase of the CH selection. For each newly selected cluster head, it sends a New_nexthop_ClusterHead_MSG broadcast message containing the residual energy, its CH-Id, its location, its location level, and the identification of its cluster Cluster-Id. EachCHi node receiving this message and which belongs to the higher level modifies its neighborhood table according to the location level and the Cluster-Id of the new CH selected to make a new selection of a new optimal route to the base station as shown in Figure 13. For lower-level CHs receiving the same message, they send the nexthop_ClusterHead_MSG message to the new CH again so that it can refill its neighbor table and select the next hop as the best route to the base station.Figure 13
(a) Sending a New_nexthop_ClusterHead_MSG broadcast message by the new CH. (b) Example of a neighborhood table and selection of a new CH.
(a)(b)


## 4.3.1. Collection of Node Positions and Cluster Formation

In this phase, the sensor network is divided into several levels of localization (level 1, level 2, etc.) until reaching all the nodes of the network. The creation of the localization levels is done in a progressive and recursive way in which the BS is responsible for the training of the first level (level 1). The BS sends a HELLO message to the nearest nodes to send their positions. Once the BS receives the positions of these nodes, it begins to divide this first level into several sections (clusters) based on the angular value of each nodeθi. The BS calculates for each node of the first level its corresponding angular value (Figure 4).Figure 4
The angular value of each node of the first level.Then, the BS begins to divide the first level intoα clusters Clusteri, whose parameter α is the number of clusters in each localization level, using formula (1) from which each node receives a Cluster_ADV message (Node-Id, Level, Cluster-Id) which contains the identifier of the node, the location level, and the cluster identifier that is part of it.
(1)Clusteri∈i−1θmax−θminα,iθmax−θminα,iϵ1,2,⋯,α,where Clusteri is an area presented by an interval of angular values which corresponds to the ith cluster.To group the positions of all the nodes, the BS selects the node furthest away from each cluster of each level as much as relay node by sending the message RelayNode_ADV_MSG (Node-Id, Level, Cluster-Id, Relay-Id) of which Relay-Id is the identifier of the relay node (Relay-Id is the BS for the first level). Each selected relay node will play the role of the BS by sending the broadcast message HELLO to all the nearest nodes to send their positions. The nodes that will send their positions are those that are not part of any localization level and also have no cluster (this decision is based on the strength of the received signal). Then, each relay node of each cluster will gather all the positions received from the higher level of location, and it will send them to its Relay-Id for transmission to the BS. Once the BS receives new positions of the relay nodes, it starts the same process in a recursive way by sending the two messages Cluster_ADV (Node-Id, Level, Cluster-Id) and RelayNode_ADV_MSG (Node-Id, Level, Cluster-Id, Relay-Id) to the new nodes with the value of the level of location which will be incremented and with the value of the cluster which will be the same as that of their relay node. Figure5 shows the exchange of different messages, and Figure 6 provides a general overview of the recursive algorithm used to minimize energy consumption and increase the durability of the nodes during the collection of all the positions of these nodes by the BS.Figure 5
Messages exchanged in the first phase.Figure 6
Recursive algorithm for collecting positions of all WSN nodes.Figure7 shows an example of the formation of localization levels and also the formation of clusters in a wireless sensor network with the α value equal to 3.Figure 7
Formation of localization levels and clusters withα=3.


## 4.3.2. Cluster Head Selection

After creation of clusters and location levels, multiple candidate nodes compete to be selected as cluster heads for the current round. In this phase, each node broadcasts a message in its cluster containing its location. Each node receiving this message updates its neighborhood table which contains the distance to its neighbors and the number of neighbors, and it calculates its weight according to formula (2). After calculating the weight, each node competes to be selected as much as CH in the next turn if its weight is greater than a certain threshold Tn indicated in formula (3).
(2)Weighti=REi×∑j=1Nei1dist2Si,Sj,where REiis the estimated current residual energy of node i, distSi,Sj is the distance between node i and node j, and Nei is the number of neighbors of node i.
(3)Tn=P1−P∗rmod1/P,ifn∈G,0,otherwise.where P is the percentage of cluster heads to all nodes, r is the selected round number, rmod1/P stands for the number of selected cluster head nodes before this round, and G is the group of nodes which have not been elected as cluster head nodes previously [17].In each cluster, the candidate nodes exchange their weight among themselves and the node with the largest weight is elected as CH in its cluster for the current round. Noncandidate nodes go into sleep to minimize power consumption while waiting to receive the Cluster_Head_ADV_MSG message from the CH node to begin transmitting the data.The selection of CHs is not done periodically in each round. During the selection phase of the CHs, each node CH checks the value of its weight if it is below the thresholdTn. In this case, the process for selecting a new CH begins by sending a Selection_Cluster Head_MSG message (Figure 8). In the opposite case, the node remains as much as CH in the next round to prevent the nodes from consuming more power during the CHS selection process and to balance the load between the different nodes in the next rounds. The selection of a new CH in each cluster is done independently of the rest of the clusters in each location level.Figure 8
The selection phase of cluster heads.


## 4.3.3. Data Transmission

After selecting the CHs, the process of transmitting data to the base station begins. Based on the TDMA protocol, communication is initiated between the different nodes of each cluster and their respective CHs in their corresponding time slots. The CHs aggregate the collected data and transmit it to the intermediate CH node or the BS according to the location level. To maximize the energy levels of the nodes, we designed an energy-efficient multihop communication when transmitting intercluster data to the base station taking into account residual energy and distances from neighboring CH nodes and the base station.For the first level of location, all the nodes are close to the base station including the CHs. For this reason and in order to reduce the energy consumption of these nodes, we have to use the single-hop communication to the base station for the first level as shown in Figure9.Figure 9
The communication phase of the first level of location.For the other location levels, there are several routes between the neighboring CHs and the base station using the intercluster multihop communication. The process of selecting the optimal routes between the different CHs and the BS starts with the CHs of the first level of location. EachCHj selected in the second phase broadcasts a nexthop_ClusterHead_MSG message containing the residual energy, the cumulative distance of its route to the base station, its identifier CH-Id, its location, its location level, and the identification of its cluster Cluster-Id. Each upper-level node CHi receiving this message updates its neighborhood table of CHs and calculates Weight‐CHj of each neighbor CHj according to formula (4). Each CHi node chooses a neighbor node CHj with the largest weight belonging to the lower location level as the next hop to transmit the collected data to the base station.
(4)Weight‐CHj=EjEmax+dcSj,BSdcSj,BS+dSj,Si,ifLeveli>Levelj,where Ejdenotes the estimated current residual energy, Emax is the maximum energy for all nodes, dcSj,BSis the cumulative distance between node j and the base station, and dSj,Siis the distance between node i and node j.This process of selecting optimal data paths is repeated in all network location levels (Figure10). Figure 11 illustrates the optimal route construction steps and the data transmission between the CHs.Figure 10
The phase of data transmission and the selection of optimal routes to the base station.Figure 11
Optimal routes and data transmission between CHs: (a) message propagation, (b) the transmission distance between the first-level CHs and the base station, (c) the different routes between the CHs, and (d) selection of the best routes for intercluster data transmission.
(a)(b)(c)(d)Figure12 illustrates an example which CH 22 fills its neighborhood table with the CHs after reception of the nexthop_ClusterHead_MSG messages from different neighboring CHs (1, 8, and 27). CH 22 deletes the route to the base station passing through CH 27 because it belongs to the same level, and it chooses the optimal route passing through CH 1 which belongs at the lower level and whose weight is greater than that of CH 8.Figure 12
(a) Reception of the nexthop_ClusterHead_MSG messages by a CH. (b) Example of a neighborhood table and the selection of the next hop by a CH.
(a)(b)When transmitting data, the CHs closest to the base station will consume more energy compared to the others. Then, it will have a new selection of the new CHs in each cluster in an independent way according to the phase of the CH selection. For each newly selected cluster head, it sends a New_nexthop_ClusterHead_MSG broadcast message containing the residual energy, its CH-Id, its location, its location level, and the identification of its cluster Cluster-Id. EachCHi node receiving this message and which belongs to the higher level modifies its neighborhood table according to the location level and the Cluster-Id of the new CH selected to make a new selection of a new optimal route to the base station as shown in Figure 13. For lower-level CHs receiving the same message, they send the nexthop_ClusterHead_MSG message to the new CH again so that it can refill its neighbor table and select the next hop as the best route to the base station.Figure 13
(a) Sending a New_nexthop_ClusterHead_MSG broadcast message by the new CH. (b) Example of a neighborhood table and selection of a new CH.
(a)(b)


## 4.4. Data Sent by Sensor Nodes

Our road traffic control system contains two types of sensor nodes: hybrid nodes which detect occupied parking spaces and nodes which detect the density of road traffic in each lane. These nodes rely on the network topology of the cluster tree to send their data packets in order to reach the gateway. Before sending the data packets, each type of sensor prepares the detected data to send them to the corresponding CH (Figure14).Figure 14
Data sent by sensor nodes. Crossroad ID is the identifier of the road crossing. Lane ID is the identifier of the road in the corresponding intersection. Lane direction ID is the identifier of the direction of the road (1 for incoming lanes at the crossing and 2 outgoing lanes). Sensor type is the identifier of the type of sensor (1: detection of parking spaces, 2: detection of traffic in the lane). Node ID is the node identifier. State is the state detected by the sensor (1: occupied, -0: free), and this field is filled in by the nodes which monitor road traffic. Parking space state is the state of parking space occupancy, and this field is filled in by the hybrid nodes which monitor the parking spaces in each lane. Car registration number is the registration number of the parked car captured by hybrid sensors thanks to the RFID reader.Figure15 illustrates the different packets sent by the different nodes of the proposed system.Figure 15
The different packets sent by the different nodes.Once the data packets are sent by the various sensors, the gateway gathers all the data collected in a corresponding road crossing and transfers them to the global information and management center of the system in order to update the information available to drivers and also for better and efficient management and control of traffic lights in real time. The management center organizes all the data sent by each gateway of each road crossing in the form of a given database in order to facilitate the monitoring of parking spaces and also to control the density of traffic in the lanes that form each crossing. Figure16 shows an example of the situation of lane 2 crossing from packets sent by the gateway.Figure 16
The different packets sent by the different nodes.


## 5. Proposed Algorithm

Our intelligent traffic control system is based on the implementation and deployment of sensor networks in each road crossing in order to detect the number of occupied parking spaces in the available parking areas and also to identify the traffic density in the tracks that form this crossing in order to effectively control and manage the traffic lights corresponding to this crossing. To monitor the availability of parking spaces, the system uses hybrid sensors to detect the presence of vehicles in the available space and also to identify the car parked by its registration number provided by the RFID tag. This system also uses presence sensors installed in the lanes of each road crossing to detect traffic density and to manage traffic lights to increase the flow of traffic in this crossing. Our system is based on the deployment of the cluster network topology so that the different types of sensors installed in each crossing can send their data to the global information and management center of the system from the corresponding gateway in order to increase the lifetime of the system and also increase excellent efficiency and feasibility of the system.


### 5.1. Behavior of the WSN

In each road crossing, the sensors execute a self-organizing algorithm which makes it possible to create a cluster tree topology between the different sensor nodes in order to minimize energy consumption and increase the life of the nodes due to transmission directly to the gateway. In each network formed in a crossing, there are two types of sensors. The first sends the status of the parking space and registration number of the parked car, and the second sends only the state of the traffic in the corresponding lane of this crossing. Each of these nodes plays a specific role in the network: either a node member of a cluster, which will send only the detection state to its cluster head, or a head cluster, which will then perform the aggregation of this data with the data received by the member nodes of its cluster to the next CH.In each round and before starting to send the data, each sensor checks the data detected in the current round with the data detected in the previous round. If the detection state has not changed between the current round and the previous round, then the node saves its energy during this round and it does not send any data in order to minimize the energy consumption when sending unnecessary and duplicated data. The following flowchart (Figure17) allows nodes to send data packets in case there is a change in the detection state.Figure 17
Flowchart of validation of the detection state by the nodes.The pseudocode shown in Pseudocode1 shows the behavior of different sensor nodes in a road crossing.Pseudocode 1: Behavior of different sensor nodes in a road crossing.
1: All the nodes of each crossroads execute out self-organization protocol to form a cluster-free network topology2: Cluster Head Selection in each Cluster3: For i=1 to N do   //N: Number of the crossroad in the city4: For j=1 to M do //M: Number of the nodes in the crossroad5:  Execute flowchart // execute flowchart of validation of the detection state by the nodes (Figure17)6:  T⟵flowchart// flowchart: return 1 occupied state, return 0 open state7:  If (T==1)then  //return 1 occupied state8:   Sensor node prepares the corresponding data structure with occupied state9:   If (Sensor node is a cluster head) then10:    Sensor node uses the aggregation of all the data received from these members11:    Sends all information to the neighboring Cluster Head or to the Gateway depending on its next hop12:   Else13:    Sensor node prepares the corresponding data structure according to its role in the crossroad14:    Sends those data to its Cluster Head15:   End if16:  Else     //return 0 open state17:   Sensor node prepares the corresponding data structure with open state18:   Go to 919:  End if20: End for21: End for22: Next round23: Go to 2Each gateway installed in a road crossing sends all the data collected from the corresponding WSN to the global information and management center in order to exploit all the data and send them to the management center for parking spaces and also towards the traffic light management center.


### 5.2. Parking Space Management Center

The parking space management center plays a crucial role in detecting the number of free spaces in each road crossing in the city. This center receives the filtered data from the global information and management center according to the type of sensors which sent the detected information, that is to say, the data sent by type 1 nodes (see Section4.4).Once a car has just parked in a space available in a concrete crossing, the appropriate sensor detects on the one hand the presence of the vehicle. On the other hand, the integrated RFID reader reads the driver data using the RFID tag installed in the vehicle and transfers it by merging it with the seat status to the seat management center. The data related to parking will be used when paying for the parking time and also to check for incidents while parking the vehicle. In the case of cars not tagged with RFID, a message is sent, with the identifier of the crossing and of the parking space, to the officials responsible for managing the parking spaces to enter the vehicle registration number in the system to guarantee payment of parking fees. The pseudocode shown in Pseudocode2 shows the management of parking spaces in each road crossing.Pseudocode 2: The management of parking spaces in each road crossing.
1: Foreach (data packet received)2: Read Crossroad ID, Lane ID, Lane direction, Node ID3: Locate the parking space4: If (State==1) then5:  Update the information received in the database6:  Increment the number of occupied places7:  Decrease the number of available places8:  Start counting the parking time9:  If (The RFID tag is detected) then10:   Update occupied place with RFID data received in the database11:  Else12:   Send a message to the parking agents with the identifier of the crossroad and the parking space that has just been occupied13:   The agent introduces the registration number of the car parked in the database14:  End if15: Else16  Decrease the number of occupied places17:  Increment the number of available places18:  Stop parking time19:  Calculation the parking fees20: End if21: Go to 1The payment for parking time is made online using the mobile application (see Section7) or manually using the automatic parking machines available in each lane of a crossroad. In both cases, only the registration number of the parked vehicle has to be entered so that the system can detect it in the database and the owner of the vehicle can make the payment.


### 5.3. Traffic Light Management Center

The traffic light management center has a fundamental role in controlling road traffic by calculating the density of traffic in each lane that forms a crossing in the city. This center uses the filtered data from the global information and management center according to the type of sensors that sent the detected information, that is to say, the data sent by type 2 nodes (see Section4.4). The center calculates the number of type 2 sensors in each lane that detected the presence of cars in stable condition. For this type of nodes, they execute a detection state stability flowchart (Figure 18) before sending the data packets to the gateway, knowing that the states detected in the traffic state of cars can influence the calculation of traffic density which may result in poor decisions when estimating the length of time for the green light.Figure 18
Detection state stability flowchart.The calculation of the road density is based on the calculation of the rate of cars existing in each lane in a road crossing taking into account the incoming traffic and also the outgoing traffic. Figure19 shows the calculations made.Figure 19
The calculation of the road density.Depending on the traffic density calculated, the traffic light management center will make the decision when estimating the length of time for which a traffic light can remain green. Several studies have been carried out to determine and estimate the time for the green light. Between them, we find Kell and Fullerton [18] who suggest that the maximum time for the green light should be between 30 and 60 seconds. Orcutt [19] observed that the maximum time for the green light should be long enough to allow 1.3 times the average length of the queue and minimize the cycles of stops and resumptions. Courage et al. [20] indicated that a maximum high green light time did not have negative consequences if the traffic was too light. In [21], the authors propose more modern methods in order to fix a coherent maximum green light time, complex to define due to the complexity and the possible diversity of an intersection. On the one hand, the authors of the article [22] estimated the green light time in a dynamic and rotating manner according to the density of traffic calculated in each using video surveillance cameras and video processing techniques. On the other hand, our proposed system calculates the green light time TLane based on the traffic density of each lane which forms a road crossing taking into account the fact that this duration must be between 30 and 60 seconds. Figure 20 describes the proposed length of green light time.Figure 20
The green light time.DensityLanei is the density of lane i and TL is the minimum green light time estimated by the proposed system which varies between 30 and 60 seconds.Once the green light time is calculated, the traffic light management center distributes the orders to the traffic lights of each road crossing in order to increase traffic flow and reduce congestion.


### 5.4. The Global Information and Management Center

The global information and management center distributes the data packets received from the gateway to the parking space management center and also to the traffic light management center according to the type of sensors that sent the packet. This center has another important role in our proposed intelligent traffic control system, which is to collect real-time information from these two centers, containing the traffic jam rate in each road crossing and the number of parking spaces available to a given destination, and to update and save them in a MySQL database server to connect drivers and citizens to our system via an Android mobile application in order to avoid getting stuck and take another alternative route. Figure21 illustrates the role of the global information and management center in the proposed intelligent traffic control system.Figure 21
The global information and management center.


## 5.1. Behavior of the WSN

In each road crossing, the sensors execute a self-organizing algorithm which makes it possible to create a cluster tree topology between the different sensor nodes in order to minimize energy consumption and increase the life of the nodes due to transmission directly to the gateway. In each network formed in a crossing, there are two types of sensors. The first sends the status of the parking space and registration number of the parked car, and the second sends only the state of the traffic in the corresponding lane of this crossing. Each of these nodes plays a specific role in the network: either a node member of a cluster, which will send only the detection state to its cluster head, or a head cluster, which will then perform the aggregation of this data with the data received by the member nodes of its cluster to the next CH.In each round and before starting to send the data, each sensor checks the data detected in the current round with the data detected in the previous round. If the detection state has not changed between the current round and the previous round, then the node saves its energy during this round and it does not send any data in order to minimize the energy consumption when sending unnecessary and duplicated data. The following flowchart (Figure17) allows nodes to send data packets in case there is a change in the detection state.Figure 17
Flowchart of validation of the detection state by the nodes.The pseudocode shown in Pseudocode1 shows the behavior of different sensor nodes in a road crossing.Pseudocode 1: Behavior of different sensor nodes in a road crossing.
1: All the nodes of each crossroads execute out self-organization protocol to form a cluster-free network topology2: Cluster Head Selection in each Cluster3: For i=1 to N do   //N: Number of the crossroad in the city4: For j=1 to M do //M: Number of the nodes in the crossroad5:  Execute flowchart // execute flowchart of validation of the detection state by the nodes (Figure17)6:  T⟵flowchart// flowchart: return 1 occupied state, return 0 open state7:  If (T==1)then  //return 1 occupied state8:   Sensor node prepares the corresponding data structure with occupied state9:   If (Sensor node is a cluster head) then10:    Sensor node uses the aggregation of all the data received from these members11:    Sends all information to the neighboring Cluster Head or to the Gateway depending on its next hop12:   Else13:    Sensor node prepares the corresponding data structure according to its role in the crossroad14:    Sends those data to its Cluster Head15:   End if16:  Else     //return 0 open state17:   Sensor node prepares the corresponding data structure with open state18:   Go to 919:  End if20: End for21: End for22: Next round23: Go to 2Each gateway installed in a road crossing sends all the data collected from the corresponding WSN to the global information and management center in order to exploit all the data and send them to the management center for parking spaces and also towards the traffic light management center.


## 5.2. Parking Space Management Center

The parking space management center plays a crucial role in detecting the number of free spaces in each road crossing in the city. This center receives the filtered data from the global information and management center according to the type of sensors which sent the detected information, that is to say, the data sent by type 1 nodes (see Section4.4).Once a car has just parked in a space available in a concrete crossing, the appropriate sensor detects on the one hand the presence of the vehicle. On the other hand, the integrated RFID reader reads the driver data using the RFID tag installed in the vehicle and transfers it by merging it with the seat status to the seat management center. The data related to parking will be used when paying for the parking time and also to check for incidents while parking the vehicle. In the case of cars not tagged with RFID, a message is sent, with the identifier of the crossing and of the parking space, to the officials responsible for managing the parking spaces to enter the vehicle registration number in the system to guarantee payment of parking fees. The pseudocode shown in Pseudocode2 shows the management of parking spaces in each road crossing.Pseudocode 2: The management of parking spaces in each road crossing.
1: Foreach (data packet received)2: Read Crossroad ID, Lane ID, Lane direction, Node ID3: Locate the parking space4: If (State==1) then5:  Update the information received in the database6:  Increment the number of occupied places7:  Decrease the number of available places8:  Start counting the parking time9:  If (The RFID tag is detected) then10:   Update occupied place with RFID data received in the database11:  Else12:   Send a message to the parking agents with the identifier of the crossroad and the parking space that has just been occupied13:   The agent introduces the registration number of the car parked in the database14:  End if15: Else16  Decrease the number of occupied places17:  Increment the number of available places18:  Stop parking time19:  Calculation the parking fees20: End if21: Go to 1The payment for parking time is made online using the mobile application (see Section7) or manually using the automatic parking machines available in each lane of a crossroad. In both cases, only the registration number of the parked vehicle has to be entered so that the system can detect it in the database and the owner of the vehicle can make the payment.


## 5.3. Traffic Light Management Center

The traffic light management center has a fundamental role in controlling road traffic by calculating the density of traffic in each lane that forms a crossing in the city. This center uses the filtered data from the global information and management center according to the type of sensors that sent the detected information, that is to say, the data sent by type 2 nodes (see Section4.4). The center calculates the number of type 2 sensors in each lane that detected the presence of cars in stable condition. For this type of nodes, they execute a detection state stability flowchart (Figure 18) before sending the data packets to the gateway, knowing that the states detected in the traffic state of cars can influence the calculation of traffic density which may result in poor decisions when estimating the length of time for the green light.Figure 18
Detection state stability flowchart.The calculation of the road density is based on the calculation of the rate of cars existing in each lane in a road crossing taking into account the incoming traffic and also the outgoing traffic. Figure19 shows the calculations made.Figure 19
The calculation of the road density.Depending on the traffic density calculated, the traffic light management center will make the decision when estimating the length of time for which a traffic light can remain green. Several studies have been carried out to determine and estimate the time for the green light. Between them, we find Kell and Fullerton [18] who suggest that the maximum time for the green light should be between 30 and 60 seconds. Orcutt [19] observed that the maximum time for the green light should be long enough to allow 1.3 times the average length of the queue and minimize the cycles of stops and resumptions. Courage et al. [20] indicated that a maximum high green light time did not have negative consequences if the traffic was too light. In [21], the authors propose more modern methods in order to fix a coherent maximum green light time, complex to define due to the complexity and the possible diversity of an intersection. On the one hand, the authors of the article [22] estimated the green light time in a dynamic and rotating manner according to the density of traffic calculated in each using video surveillance cameras and video processing techniques. On the other hand, our proposed system calculates the green light time TLane based on the traffic density of each lane which forms a road crossing taking into account the fact that this duration must be between 30 and 60 seconds. Figure 20 describes the proposed length of green light time.Figure 20
The green light time.DensityLanei is the density of lane i and TL is the minimum green light time estimated by the proposed system which varies between 30 and 60 seconds.Once the green light time is calculated, the traffic light management center distributes the orders to the traffic lights of each road crossing in order to increase traffic flow and reduce congestion.


## 5.4. The Global Information and Management Center

The global information and management center distributes the data packets received from the gateway to the parking space management center and also to the traffic light management center according to the type of sensors that sent the packet. This center has another important role in our proposed intelligent traffic control system, which is to collect real-time information from these two centers, containing the traffic jam rate in each road crossing and the number of parking spaces available to a given destination, and to update and save them in a MySQL database server to connect drivers and citizens to our system via an Android mobile application in order to avoid getting stuck and take another alternative route. Figure21 illustrates the role of the global information and management center in the proposed intelligent traffic control system.Figure 21
The global information and management center.


## 6. Simulation and Results

### 6.1. Simulation Platform

To simulate our algorithm, we used the CupCarbon simulator [2–25]. It is a smart city and Internet of things wireless sensor network simulator (SCI-WSN). Its objective is to design, visualize, debug, and validate distributed algorithms for monitoring, collecting environmental data, etc. and to visualize the operating concepts of sensor networks and their deployment, and it can also help scientists test their topologies, protocols, etc. wirelessly [26]. Figure 22 represents the CupCarbon interface, in which our network and our intelligent traffic control system are implemented on the openstreet map (Google Maps) and the sensors are deployed in a real city (Kenitra, Morocco). The simulator uses a scripting language to encode distributed algorithms called SenScript which allows one to program and configure each sensor node individually.Figure 22
CupCarbon simulator interface.The simulation is configured as follows:(i)
There are two road crossings(ii)
The number of nodes for traffic management is 40 sensors(iii)
The number of nodes for monitoring parking spaces is 40 sensors(iv)
There is only one gateway deployed in each crossing(v)
The sensor nodes are subject to energy constraints; that is to say, they are not rechargeableThe parameters used in the simulation are presented in Table3 and Figure 23.Table 3
The simulation parameters.
ParametersValueStandard802.15.4Communication radius150 mSensor radius2 mInitial energy (E0)4 JETx50μJERx50μJSimulation time300 sFigure 23
The simulation parameters in CupCarbon.Figure24 shows the data transmission between the nodes and their cluster (intracluster communication), and Figure 25 illustrates the aggregation and data transmission between the CHs to the gateway using the cluster tree topology (intercluster communication).Figure 24
Intracluster communication.Figure 25
Intercluster communication.The gateway of each crossing executes a Sink.csc script which allows it to collect all the data received from all the nodes of its corresponding road crossing in order to save them in a file and send them to the global information and management center. Figure26 illustrates the data received by the gateway according to the data structure used by our intelligent traffic control system.Figure 26
The data received by the gateway in each road crossing.


### 6.2. Simulation Results and Analysis

To assess the performance and quality of service of our proposed system, we simulated our system in three types of traffic density scenario: 40%, 60%, and 80%, and we will compare it with existing traffic control systems using the following performance measures: energy consumption, first node death (FND) and network lifetime (NL), and packet delivery ratio (PDR).


#### 6.2.1. Energy Consumption

The energy consumption is the amount of energy consumed by the nodes in relation to a number of revolutions. The main objective of this experiment is to compare the influence of the density of road traffic on the energy consumption of the whole network. Figures27–29 show the experimental results.Figure 27
Comparison of energy consumption with 40% of traffic density.Figure 28
Comparison of energy consumption with 60% of traffic density.Figure 29
Comparison of energy consumption with 80% of traffic density.During 40% of traffic density, our proposed system consumes less energy in the first rounds because the detection states of the sensors change rapidly with the number of cars in circulation. That is to say, only 40% of the sensors will send their stable detection states which will consume energy during data transmission. On the other hand, the other systems do not execute any algorithm of stability and there is no process of verification of the states of detection of the sensors, which causes the transmission of useless and duplicated data in each round which will increase energy consumption and rapid depletion of these nodes and the WSN.At 60% of traffic density, our system consumes more energy compared to 40% of traffic density; this is due to the increased number of cars in circulation, which leads to the sending of more data in the network. For the other systems, there is no change in energy consumption, because the sensor nodes used in these systems send data during each round.On the other hand, in 80% of traffic density, our system consumes a significant amount of energy in the first rounds, because there are a high number of cars that circulate in the city roads. But, in the last rounds, we observe that there is a stability of energy consumption in the network, because the detection states of our sensors have not changed, due to the high traffic jam rate on the roads and less car traffic.


#### 6.2.2. First Node Death (FND) and Network Lifetime (NL)

We represent the lifetime of the network based on two main metrics. The first is the time until the death of the first node (FND). The FND duration is considered a period of stability for the network since a node becomes dead during this period. The second is the total network life which represents the time that there is no more node to continue the communication; this time is called network life (NL). The result illustrated in Figures30–32 concerns the lifetime of the network.Figure 30
Comparison of the network lifetime with 40% of traffic density.Figure 31
Comparison of the network lifetime with 60% of traffic density.Figure 32
Comparison of the network lifetime with 80% of traffic density.In the 3 illustrations, we observe that our proposed system increases the lifetime of the network based on the deployment of an efficient and effective network topology which adapts to the change in the density of existing traffic in the roads, which allows it to be an intelligent and innovative system. On the other hand, the other existing systems use simple and standard algorithms which make it possible to obtain the same poor results of the lifetime of the network in the different scenarios of traffic density in the city.


#### 6.2.3. Packet Delivery Ratio (PDR)

The packet delivery ratio is the ratio of the number of packets that are successfully delivered to the destination to the total number of packets that are sent by the source (formula (5)). This metric provides an indication of the robustness and reliability of a protocol. Therefore, a high packet delivery rate indicates better protocol performance. Figures 33–35 show the experimental results.
(5)PDR=∑Numberofpacketsreceived∑Numberofpacketssent.Figure 33
Comparison of the packet delivery ratio with 40% of traffic density.Figure 34
Comparison of the packet delivery ratio with 60% of traffic density.Figure 35
Comparison of the packet delivery ratio with 80% of traffic density.According to the 3 illustrations, we observe that our system ensures a significant rate of data reception at the level of the destination compared to other existing systems in the different scenarios. This result reflects the efficiency and robustness of our system, as it minimizes the traffic of data transmitted over the network and it also reduces the loss of packets sent. In addition, the proposed system is based on an intelligent and efficient algorithm which allows nodes not to send duplicate data in every round, as this injects more useless data into the network and it minimizes the lifespan of nodes and network longevity.


## 6.1. Simulation Platform

To simulate our algorithm, we used the CupCarbon simulator [2–25]. It is a smart city and Internet of things wireless sensor network simulator (SCI-WSN). Its objective is to design, visualize, debug, and validate distributed algorithms for monitoring, collecting environmental data, etc. and to visualize the operating concepts of sensor networks and their deployment, and it can also help scientists test their topologies, protocols, etc. wirelessly [26]. Figure 22 represents the CupCarbon interface, in which our network and our intelligent traffic control system are implemented on the openstreet map (Google Maps) and the sensors are deployed in a real city (Kenitra, Morocco). The simulator uses a scripting language to encode distributed algorithms called SenScript which allows one to program and configure each sensor node individually.Figure 22
CupCarbon simulator interface.The simulation is configured as follows:(i)
There are two road crossings(ii)
The number of nodes for traffic management is 40 sensors(iii)
The number of nodes for monitoring parking spaces is 40 sensors(iv)
There is only one gateway deployed in each crossing(v)
The sensor nodes are subject to energy constraints; that is to say, they are not rechargeableThe parameters used in the simulation are presented in Table3 and Figure 23.Table 3
The simulation parameters.
ParametersValueStandard802.15.4Communication radius150 mSensor radius2 mInitial energy (E0)4 JETx50μJERx50μJSimulation time300 sFigure 23
The simulation parameters in CupCarbon.Figure24 shows the data transmission between the nodes and their cluster (intracluster communication), and Figure 25 illustrates the aggregation and data transmission between the CHs to the gateway using the cluster tree topology (intercluster communication).Figure 24
Intracluster communication.Figure 25
Intercluster communication.The gateway of each crossing executes a Sink.csc script which allows it to collect all the data received from all the nodes of its corresponding road crossing in order to save them in a file and send them to the global information and management center. Figure26 illustrates the data received by the gateway according to the data structure used by our intelligent traffic control system.Figure 26
The data received by the gateway in each road crossing.


## 6.2. Simulation Results and Analysis

To assess the performance and quality of service of our proposed system, we simulated our system in three types of traffic density scenario: 40%, 60%, and 80%, and we will compare it with existing traffic control systems using the following performance measures: energy consumption, first node death (FND) and network lifetime (NL), and packet delivery ratio (PDR).


### 6.2.1. Energy Consumption

The energy consumption is the amount of energy consumed by the nodes in relation to a number of revolutions. The main objective of this experiment is to compare the influence of the density of road traffic on the energy consumption of the whole network. Figures27–29 show the experimental results.Figure 27
Comparison of energy consumption with 40% of traffic density.Figure 28
Comparison of energy consumption with 60% of traffic density.Figure 29
Comparison of energy consumption with 80% of traffic density.During 40% of traffic density, our proposed system consumes less energy in the first rounds because the detection states of the sensors change rapidly with the number of cars in circulation. That is to say, only 40% of the sensors will send their stable detection states which will consume energy during data transmission. On the other hand, the other systems do not execute any algorithm of stability and there is no process of verification of the states of detection of the sensors, which causes the transmission of useless and duplicated data in each round which will increase energy consumption and rapid depletion of these nodes and the WSN.At 60% of traffic density, our system consumes more energy compared to 40% of traffic density; this is due to the increased number of cars in circulation, which leads to the sending of more data in the network. For the other systems, there is no change in energy consumption, because the sensor nodes used in these systems send data during each round.On the other hand, in 80% of traffic density, our system consumes a significant amount of energy in the first rounds, because there are a high number of cars that circulate in the city roads. But, in the last rounds, we observe that there is a stability of energy consumption in the network, because the detection states of our sensors have not changed, due to the high traffic jam rate on the roads and less car traffic.


### 6.2.2. First Node Death (FND) and Network Lifetime (NL)

We represent the lifetime of the network based on two main metrics. The first is the time until the death of the first node (FND). The FND duration is considered a period of stability for the network since a node becomes dead during this period. The second is the total network life which represents the time that there is no more node to continue the communication; this time is called network life (NL). The result illustrated in Figures30–32 concerns the lifetime of the network.Figure 30
Comparison of the network lifetime with 40% of traffic density.Figure 31
Comparison of the network lifetime with 60% of traffic density.Figure 32
Comparison of the network lifetime with 80% of traffic density.In the 3 illustrations, we observe that our proposed system increases the lifetime of the network based on the deployment of an efficient and effective network topology which adapts to the change in the density of existing traffic in the roads, which allows it to be an intelligent and innovative system. On the other hand, the other existing systems use simple and standard algorithms which make it possible to obtain the same poor results of the lifetime of the network in the different scenarios of traffic density in the city.


### 6.2.3. Packet Delivery Ratio (PDR)

The packet delivery ratio is the ratio of the number of packets that are successfully delivered to the destination to the total number of packets that are sent by the source (formula (5)). This metric provides an indication of the robustness and reliability of a protocol. Therefore, a high packet delivery rate indicates better protocol performance. Figures 33–35 show the experimental results.
(5)PDR=∑Numberofpacketsreceived∑Numberofpacketssent.Figure 33
Comparison of the packet delivery ratio with 40% of traffic density.Figure 34
Comparison of the packet delivery ratio with 60% of traffic density.Figure 35
Comparison of the packet delivery ratio with 80% of traffic density.According to the 3 illustrations, we observe that our system ensures a significant rate of data reception at the level of the destination compared to other existing systems in the different scenarios. This result reflects the efficiency and robustness of our system, as it minimizes the traffic of data transmitted over the network and it also reduces the loss of packets sent. In addition, the proposed system is based on an intelligent and efficient algorithm which allows nodes not to send duplicate data in every round, as this injects more useless data into the network and it minimizes the lifespan of nodes and network longevity.


## 6.2.1. Energy Consumption

The energy consumption is the amount of energy consumed by the nodes in relation to a number of revolutions. The main objective of this experiment is to compare the influence of the density of road traffic on the energy consumption of the whole network. Figures27–29 show the experimental results.Figure 27
Comparison of energy consumption with 40% of traffic density.Figure 28
Comparison of energy consumption with 60% of traffic density.Figure 29
Comparison of energy consumption with 80% of traffic density.During 40% of traffic density, our proposed system consumes less energy in the first rounds because the detection states of the sensors change rapidly with the number of cars in circulation. That is to say, only 40% of the sensors will send their stable detection states which will consume energy during data transmission. On the other hand, the other systems do not execute any algorithm of stability and there is no process of verification of the states of detection of the sensors, which causes the transmission of useless and duplicated data in each round which will increase energy consumption and rapid depletion of these nodes and the WSN.At 60% of traffic density, our system consumes more energy compared to 40% of traffic density; this is due to the increased number of cars in circulation, which leads to the sending of more data in the network. For the other systems, there is no change in energy consumption, because the sensor nodes used in these systems send data during each round.On the other hand, in 80% of traffic density, our system consumes a significant amount of energy in the first rounds, because there are a high number of cars that circulate in the city roads. But, in the last rounds, we observe that there is a stability of energy consumption in the network, because the detection states of our sensors have not changed, due to the high traffic jam rate on the roads and less car traffic.


## 6.2.2. First Node Death (FND) and Network Lifetime (NL)

We represent the lifetime of the network based on two main metrics. The first is the time until the death of the first node (FND). The FND duration is considered a period of stability for the network since a node becomes dead during this period. The second is the total network life which represents the time that there is no more node to continue the communication; this time is called network life (NL). The result illustrated in Figures30–32 concerns the lifetime of the network.Figure 30
Comparison of the network lifetime with 40% of traffic density.Figure 31
Comparison of the network lifetime with 60% of traffic density.Figure 32
Comparison of the network lifetime with 80% of traffic density.In the 3 illustrations, we observe that our proposed system increases the lifetime of the network based on the deployment of an efficient and effective network topology which adapts to the change in the density of existing traffic in the roads, which allows it to be an intelligent and innovative system. On the other hand, the other existing systems use simple and standard algorithms which make it possible to obtain the same poor results of the lifetime of the network in the different scenarios of traffic density in the city.


## 6.2.3. Packet Delivery Ratio (PDR)

The packet delivery ratio is the ratio of the number of packets that are successfully delivered to the destination to the total number of packets that are sent by the source (formula (5)). This metric provides an indication of the robustness and reliability of a protocol. Therefore, a high packet delivery rate indicates better protocol performance. Figures 33–35 show the experimental results.
(5)PDR=∑Numberofpacketsreceived∑Numberofpacketssent.Figure 33
Comparison of the packet delivery ratio with 40% of traffic density.Figure 34
Comparison of the packet delivery ratio with 60% of traffic density.Figure 35
Comparison of the packet delivery ratio with 80% of traffic density.According to the 3 illustrations, we observe that our system ensures a significant rate of data reception at the level of the destination compared to other existing systems in the different scenarios. This result reflects the efficiency and robustness of our system, as it minimizes the traffic of data transmitted over the network and it also reduces the loss of packets sent. In addition, the proposed system is based on an intelligent and efficient algorithm which allows nodes not to send duplicate data in every round, as this injects more useless data into the network and it minimizes the lifespan of nodes and network longevity.


## 7. Mobile Application

The global information and management center of our proposed intelligent traffic control system connects drivers to city streets via an Android mobile application compared to other existing traffic control systems. This management center sends the collected information, from the parking space management center and also from the traffic light management center, to a central web server to display the available parking spaces and the traffic jam rate in each road crossing of the city and update them in the MySQL database automatically. Clients of our proposed system (computers, smartphones, tablets, etc.) will make HTTP requests containing the URL of the central server via the Internet. Once the request has arrived at its destination, it first passes through an API (Application Programming Interface) which has a procedure which will associate the form of the URL with an action to be performed. This API will communicate and dialogue with the server to retrieve the data. It retrieves the result and formats it in a JSON data format. Afterwards, our customers then receive the response to their requests by obtaining a JSON response which contains the data requested in order to be used by our Android Smart Traffic mobile application (Figure36).Figure 36
The overall software architecture of our proposed system.Our Smart Traffic application is developed on the basis of the Android Studio 3.5.3, and it is illustrated in Figure37. The mobile phone is used to access the Internet, via Wi-Fi or a 3G cellular network, to obtain information on the availability of parking places to a given destination and also the existing traffic jam rate in real time.Figure 37
Smart Traffic application.The main features of our mobile application are as follows (Figures38 and 39):Figure 38
(a) Opening the application. (b) Finding a destination.
(a)(b)Figure 39
The search results and the alternative routes.(1) Monitoring of Parking Spaces. It allows the driver to know the number of parking spaces available in a given area.(2) Traffic Density Monitoring. It allows the driver to know in advance the traffic jam rate and the traffic density rate to a given destination.(3) Suggestion of Alternative Routes. It allows alternative routes to be offered around the given destination.Figures38 and 39 illustrate the design of our Smart Traffic application.With the help of this android application, drivers and citizens can remotely view the traffic jam and available parking spaces in real time to avoid unnecessary trips in order to minimize road traffic on the roads and minimize dissipation of CO2 in the city.


## 8. Conclusion

In this work, an intelligent traffic control system based on the combined use of several innovative IoT technologies, such as WSN, RFID, and mobile application, was presented. The system operates a network of hybrid RFID and WSN sensors based on IEEE 802.15.4 that can be quickly deployed to any location outside the city. Our system adopts an efficient and effective cluster tree self-organization algorithm in order to maximize the performance of the WSN and increase its longevity and robustness. A central server implementing advanced database management techniques constantly monitors the available parking spaces and also the traffic density in the city in real time. In addition, a different mobile application allows drivers to find vacant parking spaces for their destination and also offers alternative routes to avoid moving around and getting stuck in a traffic jam.In future work, we will develop our proposed system according to customer needs by adding innovative services such as booking remote parking spaces, paying online parking fees, and NFC, without forgetting to improve our car algorithm. We proposed a self-organizing algorithm to further improve energy consumption and further increase the life of the WSN.



---

*Source: 8841893-2020-09-11.xml*