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.

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 [24]. 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).

The rest of this paper is organized as follows. The related work is presented in Section 2. 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.

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 (Figure 1).

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 (Figure 2). 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.

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 Section 5.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. Table 1 presents a comparison made between the 3 most used types of sensors.

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].

Table 2 shows the advantages and limitations of ZigBee compared to other wireless technologies.

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 Figure 3. Techniques based on clustering are the hierarchical techniques most commonly used in wireless sensor networks [1315].

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 . The BS calculates for each node of the first level its corresponding angular value (Figure 4).

Then, the BS begins to divide the first level into clusters , 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. where is an area presented by an interval of angular values which corresponds to the 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. Figure 5 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 7 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.

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 indicated in formula (3). where is the estimated current residual energy of node , is the distance between node and node , and is the number of neighbors of node . where is the percentage of cluster heads to all nodes, is the selected round number, stands for the number of selected cluster head nodes before this round, and 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 threshold . 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.

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 Figure 9.

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. Each 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 receiving this message updates its neighborhood table of CHs and calculates of each neighbor according to formula (4). Each node chooses a neighbor node with the largest weight belonging to the lower location level as the next hop to transmit the collected data to the base station. where denotes the estimated current residual energy, is the maximum energy for all nodes, is the cumulative distance between node and the base station, and is the distance between node and node .

This process of selecting optimal data paths is repeated in all network location levels (Figure 10). Figure 11 illustrates the optimal route construction steps and the data transmission between the CHs.

Figure 12 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.

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. Each 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.

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 (Figure 14).

Figure 15 illustrates the different packets sent by the different nodes of the proposed system.

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. Figure 16 shows an example of the situation of lane 2 crossing from packets sent by the gateway.

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 (Figure 17) allows nodes to send data packets in case there is a change in the detection state.

The pseudocode shown in Pseudocode 1 shows the 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 topology
2: Cluster Head Selection in each Cluster
3: For i=1 to N do   //N: Number of the crossroad in the city
4: For j=1 to M do //M: Number of the nodes in the crossroad
5:  Execute flowchart // execute flowchart of validation of the detection state by the nodes (Figure 17)
6:  T⟵flowchart// flowchart: return 1 occupied state, return 0 open state
7:  If (T==1)then  //return 1 occupied state
8:   Sensor node prepares the corresponding data structure with occupied state
9:   If (Sensor node is a cluster head) then
10:    Sensor node uses the aggregation of all the data received from these members
11:    Sends all information to the neighboring Cluster Head or to the Gateway depending on its next hop
12:   Else
13:    Sensor node prepares the corresponding data structure according to its role in the crossroad
14:    Sends those data to its Cluster Head
15:   End if
16:  Else     //return 0 open state
17:   Sensor node prepares the corresponding data structure with open state
18:   Go to 9
19:  End if
20: End for
21: End for
22: Next round
23: Go to 2

Each 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 Section 4.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 Pseudocode 2 shows the management of parking spaces in each road crossing.

1: Foreach (data packet received)
2: Read Crossroad ID, Lane ID, Lane direction, Node ID
3: Locate the parking space
4: If (State==1) then
5:  Update the information received in the database
6:  Increment the number of occupied places
7:  Decrease the number of available places
8:  Start counting the parking time
9:  If (The RFID tag is detected) then
10:   Update occupied place with RFID data received in the database
11:  Else
12:   Send a message to the parking agents with the identifier of the crossroad and the parking space that has just been occupied
13:   The agent introduces the registration number of the car parked in the database
14:  End if
15: Else
16  Decrease the number of occupied places
17:  Increment the number of available places
18:  Stop parking time
19:  Calculation the parking fees
20: End if
21: Go to 1

The payment for parking time is made online using the mobile application (see Section 7) 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 Section 4.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.

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. Figure 19 shows the calculations made.

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 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.

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. Figure 21 illustrates the role of the global information and management center in the proposed intelligent traffic control system.

6. Simulation and Results

6.1. Simulation Platform

To simulate our algorithm, we used the CupCarbon simulator [225]. 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.

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 rechargeable

The parameters used in the simulation are presented in Table 3 and Figure 23.

Figure 24 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).

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. Figure 26 illustrates the data received by the gateway according to the data structure used by our intelligent traffic control system.

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. Figures 2729 show the experimental results.

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 Figures 3032 concerns the lifetime of the network.

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 3335 show the experimental results.

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 (Figure 36).

Our Smart Traffic application is developed on the basis of the Android Studio 3.5.3, and it is illustrated in Figure 37. 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.

The main features of our mobile application are as follows (Figures 38 and 39):

(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.

Figures 38 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.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.