A Fuzzy Logic-Based Smart Traffic Management Systems

La congestión del tráfico es un problema grave en muchos países en desarrollo como Egipto. En presencia del sistema tradicional de semáforos, crea riesgos para la salud, desperdicia tiempo y combustible y contamina el aire. Por lo tanto, existe una gran necesidad de un sistema inteligente de gestión del tráfico. Este estudio contribuye a resolver este problema mediante la introducción de un sistema de semáforos inteligente basado en inteligencia artificial que utiliza una lógica difusa para garantizar el flujo fluido del tráfico en las ciudades. Los resultados de la investigación indican que la gestión inteligente de los semáforos es muy crucial en las ciudades inteligentes para reducir su huella de carbono para salvar el mundo y ahorrar energía. Otra posible aplicación podría implementarse con actualizaciones menores del sistema, como la detección y gestión de la congestión del tráfico, la facturación automática de los peajes, la detección automática de la violación del límite de velocidad, la planificación de rutas, el Internet inteligente de los vehículos y la prevención de accidentes de tráfico. Cuatro enfoques de semáforos (tiempo fijo, tiempo inteligente, lógica difusa de tiempo fijo y lógica difusa de tiempo inteligente) se desarrollan con diferentes ocho escenarios de tráfico. Los cuatro enfoques se aplican con dos herramientas, la primera herramienta es una Marquette real que consta de 4 carreteras con solo uno o dos vehículos. La segunda es un software de simulación que consta de 4 carreteras con más de 100 vehículos a través de 10 minutos. Muchos sensores como (sensores IR, sensores de lluvia y LED para controlar el semáforo) se utilizan para recopilar datos y luego se utiliza el algoritmo difuso para garantizar el flujo fluido del tráfico en las ciudades. Los datos de tráfico adquiridos de los vehículos se introducen en el modelo propuesto para maximizar la duración de la luz verde en función del estado de la carretera. Según los resultados experimentales, el software de simulación de técnica difusa inteligente propuesto redujo el tiempo de espera promedio de los vehículos de 769 a 289 segundos en condiciones de lluvia intensa. También redujo el tiempo total para todos los vehículos de 2490 a 1154 segundos.

section_content: Many major cities around the world can face significant traffic congestion. The traditional traffic light system is based on a fixed time concept that is assigned to each side of the intersection and does not fluctuate in response to traffic congestion at specific intersections. This results in wasted time and fuel usage and undesired traffic jams. Traffic congestion leads to high levels of pollution affecting the health of local residents, passengers, and animals. Most of this is due to the poor timing cycle of the countdown timers. The timer was set equally for both high-intensity lanes and low-intensity lanes. This causes unnecessary parking in the high-density lane even if other lanes are empty. The straight forward solution to the matter is to regulate traffic signals consistent with traffic density based on fuzzy logic control Nigam et al. (2022). 

The main purpose of this study is to create a smart system to control the road traffic based on the density and rain condition information using fuzzy logic Tomar et al. (2022) technique to obtain the perfect time for every junction. The proposed model uses two types of sensors to collect road data. The IR Agarwal and Rai (2022) sensors arranged at four lanes to detect presence of the vehicles and rain sensor Yang et al. (2022) to presence the rain condition. The sensors data is given to ARDUINO MEGA Hlavacek and Gotthans (2022) which processes data to control traffic signals accordingly to road status based on fuzzy logic control. Seven segments display-based count timer are used. Initially, when sensors aren't obstructed by any vehicles, count time is zero and the light status is red. when sensors are obstructed by vehicles, count time is start, and the light change to the green. Thus, this provides effective solution for traffic jam in busy roads. There are four main traffic light approaches with eight traffic scenarios presented in this study. 

Fixed-Time approach: In this system, the green light is given with a fixed time for each road that does not change due to the intensity of the road or the rain conditions. 

Smart-Time approach: In this system, the traffic light time changes based on the numerical density of each road without taking into account the weather conditions such as rain and it opens the densest road first, then the least, etc. It is converted to a red light in the absence of vehicles. 

Fixed-Time-Fuzzy-Logic approach: In this system, the traffic light time changes based on two factors. First, rain condition is (No, Light, Medium, High). The second is the numerical density of each road. The routes change sequentially that mean it start from route A until route D and repeat the turn again. If any route has no cars, the controller will be skipped to the next route. Also, if there are no cars in all routes the light will become red. Counter time is flexible change depend on the number of care and the rain value. 

Smart-Time-Fuzzy-Logic approach: In this system, the traffic light time changes based on two factors. First, the rain condition is (No, Light, Medium, or High). The second is the numerical density of each road. It also opens the densest road first, then the least, and so on like smart time approaches but it gives more time for each road based on the rain condition. It is converted to a red light in the absence of vehicles. 

The proposed system considered not only the density of vehicles on the roads but also the weather conditions. The proposed smart system contributes to optimally solving the problem by: • Increase traffic rates accuracy • Decrease the average waiting time that leads to fuel consumption • Provide more stability • Increase the degree of reliability whenever applied in the traffic system This section reviews the recent research studies of traffic light systems. For example, Kammoun et al. (2014) suggested a hierarchical fuzzy model and ant colony behavior-based adaptive multiagent system. By including an adaptive vehicle route guidance system, this system enables effective traffic adjustment in response to realtime changes in road networks. Ahmad et al. (2014). Define the Earliest Deadline First (EDF) algorithm to alleviate traffic congestion in metropolitan areas and manage to reduce the average waiting time. Adewale et al. (2018) provided a fuzzybased model and achieved an average vehicle speed performance of 8%. Adewale et al. (2018) proposed a smart traffic system based on fuzzy logic control systems by using IR sensor and siren detection system using for emergency and security road users. This system given priority for high-density road with suitable time to increase and pedestrians available. This system decreases junction and delay of traffic. Studyana et al. (2018) proposed another model based on fuzzy logic for traffic signal intersection in Indonesia highway capacity. Fuzzy logic system analysis based on linguistic variables that obtained from signal intersection from the 2015 traffic research survey in Bandung. This system decreased the number of vehicle queues compare with intersection with a fixedtime signal. Elda et al. (2019) proposed a new traffic light model using Fuzzy Logic. This system determined the time of the green signal based on a variable density. This study applied at Tirana which is the capital of Albania. This model succeeded to minimize the congestion at an intersection. Mualifah and Abadi (2019) proposed another fuzzy logic control system to enhancement on easy traffic. This system applied at Sultan Agung Street Yogyakarta. This system is based on three in puts variables like number of cars, number of motorcycles, and the length of the queue. Traffic light is varied for each traffic conditions. They achieved high results compared with traditional fixed time. Patel and Rohilla (2020) proposed an adaptive control traffic system using Arduino mega and IR sensor. The model has been used to measure only the density of vehicles the road lanes and give green signal based on lane density to reduce traffic congestion. By transmit the data from detected vehicle by IR sensors to controller and mega give priority to lane density. They didn't consider the rain condition. From the previous studied, it can be concluded that many techniques were used to address the traffic signaling challenges. The green time management, cycle time improvements, and optimization of the average speed of the vehicle are the most common techniques. Also, these studies didn't consider the conditions and weather factors such as rain and fog.
section_name: Introduction

section_content: Two types of traffic light tools are being studied some of using the fuzzy logic algorithm. The first is a Maquette of real traffic signal intersection with four roads, each containing one or two vehicles as shown in Fig. 1. The second is a simulation software to simulate a complex traffic light intersection with four roads and more than 100 vehicles through 10 min. The Architecture design of traffic road is shown in Fig. 2. 

In the proposed model environment, there are four routes with only one intersection. The routes will be given the following symbols: A, B, C, and D. The sensors used for each route are two Infrared sensors and one led indicator (Green, Red). Rain sensor to detect the level of rain. It is also found in the intersection one cathode seven segment display and ARDUINO MEGA and connected wires are created in the maquette. The software used in the experiments are Arduino IDE (Integrated Development Environment). The experimental setup of the proposed models is to prepare and assemble the hardware components and write a program file to control the smart traffic signal through the intersection and system that we are designing as a prototype system for the real system. Adoni et al. (2022) proposed, a scalable and real-time intelligent transportation system based on a big data framework. Their system allows for the use of existing data from road sensors to better understand traffic flow and traveler behavior and increase road network performance. The transportation system is designed to process large-scale stream data to analyze traffic events such as incidents, crashes, and congestion.
section_name: Methodology and System Design

section_content: Fuzziness refers to the degree of uncertainty in concept or a system. Control models are easily implemented using fuzzy logic, providing effective solutions based on ambiguous and confusing information Xiao (2022). For each road at an intersection, the created fuzzy logic model takes two inputs and generates an optimized green time duration. Figure 3 shows the operations of fuzzy logic. Based on proposed model, the proposed fuzzy model uses different rules to determine the duration of the green light.
section_name: Fuzzy Logic System (FLS)

section_content: Four roads with one junction intersection models were built to be consistent with the Egypt traffic system. These roads are similar to the real roads in Egypt. This prototype collect data from eight IR sensors arranged on 4 roads. Each road contains two sensors and all roads contain only one rain sensor. Rather than requiring a physical press of the reset button before an upload, the Mega 2560 is designed in a way that allows it to be reset by software running on a connected computer. 

The Arduino Software (IDE) uses this capability to allow you to upload code by simply pressing the upload button in the Arduino environment. The Mega 2560 board has a number of facilities for communicating with a computer. The Arduino Software (IDE) includes a serial monitor which allows simple textual data to be sent to and from the board. The traffic light system consists of five important components. The first part is the controller that represents the Brain of the Traffic System that controls the selection and timing of the traffic movements according to the different requirements of the traffic signal consisting of red and green lights. Red for stopping vehicle and green for pass the vehicle. The third part is the IR sensor. A sensor or detector is a device to indicate the presence of vehicles the fourth is the rain sensor that defines the condition rain if any. the five parts is the seven-segment display recorded by the control unit Sensors. The second part is the LEDs. These usually for count to turn on the signal and close another.
section_name: System Design and Simulation Software A. System Maquette Prototype

section_content: This system collect data from only the simulation software and rain sensor. This software simulates the maquette by opening and closing traffic lights, choosing roads and meter timings, and sensing rain through the rain sensor. Also, it can print the number of vehicles in all roads, the value of rain sensor in the case of raining and also printing the road that will be open, and the timings of the meter on the serial monitor of IDE.
section_name: B. System Simulation

section_content: Each Scenario was analyzed individually in this study and the ideal green light time was predicted using a generated fuzzy logic model. For ten minutes, 100 vehicle, and value of rain sensor, the simulated models were tested. In maquette use case, the proposed fuzzy model was used with data from IR and rain sensors. As a result, we aim to reduce the total time, average vehicle waiting times, and average queue length at intersections.
section_name: Proposed Models

section_content: This method includes four models for the four approaches (Fixed-Time, Smart-Time, Fixed-Time Fuzzy-Logic, Smart-Time-Fuzzy-Logic) in prototype Maquette. Each model will be discussed independently.
section_name: Maquette-Based Traffic Light System

section_content: It is a description of the current normal state of the roads that expresses the constant duration of the signal for the regular opening of each traffic light in order with a pre-established time limit for the opening of each signal, which has been set at 20 sec and here, open signal a, then count for 20 sec, then open signal b, then count for 20 sec, then open signal d, then count for 20 sec, and so on.
section_name: A. Maquette-Based Fixed-Time Model 1

section_content: It's a description of this system It takes into account the density first, as it opens the densest road and in the case of two vehicles, it opens the signal for 20 and 15 sec in the case of one vehicle. In all condition weather. This system can't open for null route from vehicle.
section_name: B. Maquette Based Smart-Time Model 2

section_content: This system chosen will route depend on the highest number of vehicles in any route. The route has highest number of vehicles their route will be open first and so on.
section_name: C. Maquette Based Smart-Time-Fuzzy-Logic Model 3

section_content: This system change sequentially that mean it start from route A until route D and repeat the turn again. If any route doesn't have vehicle the controller will be skipped to the next route and if there is no vehicle in all routes the light is become red. Counter time is flexibility change depend on the number of vehicle and the rain value.
section_name: D. Maquette Based Fixed-Time-Fuzzy-Logic Model 4

section_content: This Section expands experiments with more than 100 in 10 min vehicles distributed randomly with different air conditions.
section_name: Simulation-Based Traffic Light System

section_content: As mentioned before, this system opens traffic lights in ordered manner regardless of the road density. The control system opens the light for 20 sec in all weather conditions. Each vehicle can take 5, 7, 9, and 11 sec to exit from the road based on weather condition.
section_name: Simulation-Based Fixed-Time Model 5

section_content: It's a description of this system It takes into account the density first, as it opens the densest road and in the case of one vehicle, it opens the signal for 15 or 20 sec in the case of two vehicles and 35 sec in the case of five vehicles in all condition weather. The one-only vehicle can take 5, 7, 9, and 11 sec to pass from route based on weather condition. This system can't open for null route from vehicle.
section_name: B. Simulation-Based Smart-Time Model 6

section_content: This system change sequentially that mean it start from route A until route D and repeat the turn again. If any route doesn't have vehicle the controller will be skipped to the next route and if there is no vehicle in all routes the light is become red. Counter time is flexibility change depend on the number of vehicle and the rain value.
section_name: C. Simulation Based Fixed-Time-Fuzzy-Logic Model 7

section_content: This system chosen will route depend on the highest number of vehicles in any route. The route has highest number of vehicles their route will be open first and so on. 

where, W is the waiting time, (i) is the car number, 2 is the time after the car left the road and 1 is the time when the car entered the road.
section_name: D. Simulation Based Smart-Time-Fuzzy-Logic Model 8

section_content: Equation 2 is used to calculate the total waiting time of car:

where, W is the waiting time, (i) is the car number and n is the number of cars.
section_name: B. Total Waiting Time

section_content: The average waiting time of car is calculated by:

where, Tc is the total waiting time and n is the number of cars.
section_name: C. Average Waiting Time

section_content: As stated above, the proposed prediction algorithms are tested in two separate methods: Real Maquette with low congestion and simulation software with high congestion. All of them tested with four states of rain (norain, low-rain, medium-rain, high-rain) and low congestion, and high congestion.
section_name: Experimental Results

section_content: Table 1 shows the results of the average leaving waiting time of the proposed four approaches in different four weather condition with 60 Road Movement cases. While Table 2 shows the improvement percentages and compares the results with fixed traditional time in Light-Rain, medium-Rain, and Heavy-Rain condition consequently. 

After comparing the results of the previous four systems, it is possible to occur on the roads which simulates reality by using a four-way micro simulator model in which each method can contain two vehicles. The best of the previous systems was found to be a fuzzy logic system both for fixed and smart fuzzy logic.
section_name: A. Results of Maquette Real Traffic Signal

section_content: This section will discuss the proposed models executed on the simulation platform. Table 3 shows the results of the proposed four approaches in normal weather (No-Rain) in terms of average waiting time and total waiting time. While Table 4 compares the results in Low-Rain condition, Table 5 in case of medium-rain Condition, and Table 6 with the High rain Condition. A simulation system has been done on both smart-time systems, smarttime-fuzzy-logic system, fixed-time fuzzy-system, and fixed-time-system, but with a time limit, and here are 10 min that can be changed by deficiency or increase. Also specified are the number of vehicles that will pass through the roads during this time. Here are 100 vehicles that can be changed by deficiency or increase as the waiting time for each vehicle appears until it passes through the road or path that will also appear. Finally, total Waiting Time for all vehicle, average waiting time for each vehicle, and the total time taken to pass through all vehicles are calculated. All results are through the smart time system, fixed time system, fuzzy logic fixed time system, and smart fuzzy logic system programs. These results will also be calculated by replicating the simulator (3) times each and the results and explanations are as follows.
section_name: Results of Simulation Traffic Signal

section_content: Eight different models have been thoroughly researched and it has been found that the best model is that which is based on the smart fuzzy logic system. The proposed fuzzy model enhanced the total time for all vehicles from 2490 to 1154 sec the average waiting time of the vehicles also reduced from 769 to 289 sec in heavy rain condition resulting in 2. 7 times reduction in processing speed. The proposed model contributed to many solutions such as: Reduction of waiting time which leads to a reduction in fuel consumption and air pollution.
section_name: Discussion

section_content: In densely populated areas, several intersections are linked. In Egypt, these crossings can sometimes lead to endless traffic density and long queues of traffic. The idea behind smart traffic systems is that drivers will not spend unnecessary time waiting for traffic lights to change. In this study, eight scenarios are simulated using the Arduino IDE and real Maquette to help address this type of traffic challenge. The acquired road-related data such as (density and rain conditions) are used in the fuzzy model to optimize the time of green light. The main goal of the proposed smart traffic light system is to reduce the waiting time for each vehicle's lane and to maximize the total number of cars that can cross the intersection. To solve the above problems, we used a smart fuzzy logic control system' algorithm to detect the density for every road and select the most stable time for the cars in every road with consideration of the rain condition if any. The IR sensor can be used to detect the density and the rain sensor to define the road condition. The proposed fuzzy model enhanced the total time for all vehicles from 2490 to 1154 sec The average waiting time of the vehicles also reduced from 769 to 289 sec in heavy rain condition. The proposed model contributed to many solutions such as: Reduction of waiting time which leads to a reduction in fuel consumption and air pollution. Furthermore, Favoritism is eradicated as the system strictly follows the programmed sequence regardless of the personnel in the queue. The mistake of assigning green light time to a particular route over and over again to the detriment of others can be overcome. There is no fixed time for a route, the green light time is flexible depending on traffic density and weather conditions. The system can work 24 h depending on the power supply. The system provided increased rate of traffic and more stability. In future work, new optimization techniques such as Genetic algorithm and particle swarm optimization will be used to optimize the parameters of the smart traffic light system.
section_name: Conclusion

section_name: Acknowledgment

section_content: This study was supported by The Information Systems Department, Faculty of Computers & Information, Fayoum University, Fayoum, Egypt.
section_name: Acknowledgment

section_name: Funding Information

section_content: This research wasn't funded by any organization. This research received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.
section_name: Funding Information

section_name: Rule Base of the Proposed Models

section_content: This section presents all rules of eight scenarios with real World Maquette and Simulation Software.
section_name: Rule Base of the Proposed Models

section_content: A. Maquette Based Fixed-Time Model 1
section_name: Maquette-Based Traffic Light System

section_content: This system is based on density road first and then less density road and so on with variable green time based on density and rain conditions as shown:

• All signals open for 15 or 20 sec for any road in the case without rain
section_name: D. Maquette Based Smart-Time-Fuzzy-Logic Model 4

section_content: This system opens roads regularly with variable green time based on density vehicle and rain conditions but does not open a road when it has no vehicles as shown:
section_name: C. Simulation Based Fixed-Time-Fuzzy-Logic Model 7

section_content: This system is based on density road first and then less density road and so on with variable green time based on density and rain conditions as shown:
section_name: D. Simulation-Based Smart-Time-Fuzzy-Logic Model 8

section_name: Experimental Results and Discussion

section_content: Three evaluation metrics are used to evaluate the experimental results.
section_name: Performance Evaluations

section_content: To estimate the car waiting time, the following equation is used:
section_name: A. Waiting Time of Vehicle

section_content: Adel Abdallah Abdou: Developed the implementation and the system design. Also, he has conducted the literature review and performed the analysis. He provided the first paper draft and interpretated the results. 

Mohamed Hassan Farrag and A. S. Tolba: Developed the methodology and performed the computations. He has supervised all the work and validated the idea.
section_name: Author's Contributions

section_content: This manuscript substance is the author's original work and has not been previously published somewhere else. Authors already read and approved the manuscript and no potential ethical issues are immersed.
section_name: Ethics