# A Fuzzy Logic Controller Computer Science Essay

**Published:** **Last Edited:**

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Abstract- This paper presents a fuzzy logic controller for an isolated signalized intersection. The controller controls traffic light timings and phase sequence to ensure smooth flow of traffic with minimal waiting time and length of queues. Usually, fuzzy traffic controllers are optimized to maximize traffic flows /minimize traffic waiting time under typical traffic conditions. Consequentially, these are not the optimal traffic controllers under exceptional traffic cases such as roadblocks and road accidents. We apply State-space equations to formulate the average waiting time vehicles in traffic network at fixed time control. Results show that the performance of the proposed traffic controller at conventional model is better that of conventional fuzzy traffic controllers under normal and abnormal traffic conditions.

Keywords- signalized intersection; state-space equations; traffic light timing; fuzzy controller; abnormality conditions

## Introduction

Traffic signal control has been one of the most active research areas in intelligent transportation systems (ITS), because such control directly affects the efficiency of urban transportation systems. For years many investigators have conducted research into optimal signal control algorithms. Webster[1] gave equations for the optimal cycle length and the green phase time assignment, which are the basis of fixed-time control which has been widely used. Akcelik[2,3] modified Webster's theory for the over-saturated scenario in a new signal timing algorithm called ARRB. These methods perform well with low calculational costs when traffic conditions are consistent with historical records, but cannot respond to real-time variations. With the development of a variety of inexpensive sensors and computer and communication technologies, many advanced methods have been developed to adjust signal timings according to real-time traffic data. For instance, vehicle actuated control, which extends green signals according to the detected headway in real time, is one such method. A number of adaptive traffic control systems have been deployed all over the world, such as SCOOT[4], SCATS[5], OPAC[6], and RHODES[7]. In recent years, artificial intelligence techniques have been introduced into signal control using fuzzy logic controllers[8] and genetic algorithms (GA)[9]. These systems have various properties and varying effectiveness in field applications.

Transportation systems are complex dynamic systems that are hard to be modeled exactly. For this reason, many current methods do not have good theoretical bases. However, without a model description, the inner properties of the transportation system cannot be identified to evaluate existing algorithms and to recognize potential problems and improve them. Sen and Head[10] proposed a general formulation to model signal controls as discrete-time optimal control problems. They also pointed out that the problem can, in principle, be solved using the dynamic programming (DP) method when the performance index is separable in the DP sense, and that this solution is not virtually feasible due to "the curse of dimensionality". In this paper, state-space equations are used to formulate the signal control problem for a single intersection in a simplified mathematical model, which can lead to designing better signal controllers [12].

## The modeling of single intersections

## State - Space Equations

The queue length is an important variable that describes the traffic state of an intersection. The queue evolves as

(1)

where is the index of the traffic streams; is the index of the discretized time intervals; , in unit of number of vehicles, is the queue length of the i -th stream at the onset of the n -th time interval; is the number of vehicles that join the i -th queue in the n -th time interval; is the number of vehicles that depart from the i -th queue in the n -th time interval; and, which takes 0 (for stop) or 1 (for go), is the signal state of the i -th stream in the n -th time interval. and are normally distributed random signals.

A two Phases Signalized Intersection that utilizes for demonstrating single intersections is Fig. 1

## Leg 4

## Leg 2

## Leg 1

## Leg 3

Two Phase Signalized Intersection shape

In Fixed-time control and Fuzzy intelligent control model, the control variables was considered in follows. For phase 1 intersection means that traffic light is green in lane 2 and 4 and it is red in lane 1 and 3. Therefore , the vehicles can go in lane 2 and 4 and they shoud stop in lane 1 and 3. on the other hand, for phase 2 intersection means that traffic light is green in lane 1 and 3 and it is red in lane 2 and 4. Therefore , the vehicles can go in lane 1 and 3 and they shoud stop in lane 2 and 4.

Integrating the length of queue with respect to time yields the average vehicles waiting time of the queue. Let T denote the length of the discretized time interval. If T is short enough, the vehicles arrivals can be treated as being uniform in every time interval. Hence, integrating Eq. (1) yields

(2)

where is the average vehicle-wise waiting time of the i -th queue from the beginning of the period to the onset of the n -th time interval.

Equations (1) and (2) are the state-space equations describing the dynamic evolution of the traffic state at a single intersection. The waiting time and the number of vehicles are popular performance indices for signal controls. The waiting time is used here as the performance index. Therefore, the optimization objective is

(3)

To facilitate the formulation, the state-space equations and the optimization objective can be rewritten in matrix form as

(4)

(5)

where are the state variables and are the control variables. The various coefficient matrices and vectors are [12]:

## ,

(6)

## , ,

## fuzzy logic controller

## Fuzzy Logic

The development of fuzzy logic dates back to 1973 [14]. Introducing a concept he called "approximate reasoning", Zadeh successfully showed that vague logical statements enable the formation of algorithms that can use vague data to derive vague inferences. Fuzzy logic makes it possible to compute with words, which enables complex analysis reflecting the human thinking process. Each fuzzy logic system can be divided into three elements fuzzification, fuzzy inference and defuzzification [15,16,17,18].

Input data are most often crisp values. Fuzzification maps crisp numbers into fuzzy sets. The fuzzifier decides the corresponding membership grades (or degrees of membership) from the crisp inputs. The resulting fuzzy values are then entered into the fuzzy inference engine. Fuzzy inference is based on a fuzzy rule base which contains a set of IfThen fuzzy rules.

The fact following "If" is a premise or antecedent and the fact following "Then" is a consequent. A fuzzy inference system can be composed of more than one rule with each rule consisting of more than one premise variable. During defuzzification, one value is chosen for the output variable. A commonly used defuzzification strategy for continuous membership functions is the centroid method (center of area) [13,15]

## Methodology

Signal control is basically a process for allocating green time among conflicting movements. Alternatively, signal control is a process for determining whether or to extend or terminate the current green phase. The proposed fuzzy logic controller (FLC) works in the same way but it is significantly different from actuated control. Actuated control extends green time based on an extension interval, a maximum green time and the vehicular actuations on the subject approach. No examination of the conditions on conflicting movements and no optimization is involved in the actuated control process [13].

The proposed fuzzy logic controller determines whether to extend or terminate the current green phase based on a set of fuzzy rules. The fuzzy rules compare traffic conditions with the current green phase and traffic conditions with the next candidate green phase. The set of control parameters is:

= is the total vehicle-wise waiting time of the i -th queue from the beginning of the period to the onset of the n -th time interval.

= is the number of vehicles that join the i -th queue in the n -th time interval.

= is the signal state of the i -th stream in the n -th time interval.

The fuzzy logic controller determines whether to extend or terminate the current green phase after a minimum green time has been displayed. If the green time is extended, then the fuzzy logic controller will determine whether to extend the green after a time interval. The interval may vary from 0.1 to 10 sec. depending on the controller processor speed. If the fuzzy logic controller determines to terminate the current phase, then the signal will go to the next phase. If not, the current phase will be extended and the fuzzy logic controller will make the next decision after and so forth until the maximum green time is reached [13].

The decision making process is based on a set of fuzzy rules which takes into account the traffic conditions with the current and next phases. The general format of the fuzzy rules is as follows:

If { is } and { is } Then { is GO or STOP}.

Where and are linguistic variables for ; is divided into four fuzzy sets: "Low(L)", "Medium(M)" and "High(H)". is divided into three fuzzy sets: "Low(L)", "Medium(M)" and "High(H)". is divided into two fuzzy sets: "STOP" and "GO".

The number of fuzzy rules is dependent on the combinations of fuzzy sets for , , and . In this paper the number of fuzzy rules is 81 fuzzy rules.

The parameters , and for are characterized by fuzzy numbers as shown in Fig. 2-7. Trapezoidal fuzzy numbers are used in this study.

The input data (traffic conditions) are first fuzzified using the proposed fuzzy sets for ,and . Then the fuzzified input data are entered into the fuzzy inference system which is composed of a set of fuzzy rules . The max-min composition method [15,18,19] is applied for making inferences and The centroid method is applied for defuzzification [13]. The membership grades for GO and STOP are compared. The one with the highest membership grade is chosen as the control action .

Fuzzy Sets for

Fuzzy Sets for

Fuzzy Sets for

Fuzzy Sets for

Fuzzy Sets for

Fuzzy Sets for

## simulation results

The simulation is carried out using MATLAB 7.4 and the Fuzzy Logic Toolbox. The Fuzzy logic toolbox is useful to build quickly the required rules and changes are easily made. This significantly reduces the development time of the simulation model. The novel fuzzy controller that can optimally control traffic flows under both normal and exceptional traffic conditions. The Criterion of optimization are the decrement length of queues and the average of waiting time vehicles in intersection . the results of simulation of model was stated in the both of open and close loop models. In simulation , is sampling time and the cycle time of traffic light is 100 seconds. The simulator is run 1000 seconds with the following assumptions:

1. A four arm intersection and each arm has three lanes.

2. The arrival of vehicles is independent on each lane.

The inter-arrival of vehicles is also independent and normal distribution is used to generate arrivals.

This results in inter-arrival of vehicles is 5 seconds.

3. Pedestrian crossing is considered.

4. Sensors are placed at a certain distant from the intersection, the maximum vehicle that can be detected queuing is 30 vehicles.

5. Maximum green time is 40 seconds and the minimum green time is 5 seconds.

The number of vehicles that depart from the i -th queue in the n -th time interval is adapted by equation

(7)

such that saturation flow rate is

(8)

for . The parameter is greater equal fifty , ( ) . The parameter is between 0 and 1, such that it's variations are related to follows table (TABLE I). The traffic informations was recorded every 5 seconds and was used in the simulations. The and variables are normally distributed random signals in this model.

The results of simulation of classic model for Fixed time control and Fuzzy intelligent control were demonstrated in follows .

TABLE I

The position of traffic by variations of

## Fixed-Time Control

The traffic lights of Leg1 and Leg3 in Fig. 1 were considered green in first 40 seconds and red in second 60 seconds. On the other hand ,The traffic lights of Leg2 and Leg4 in Fig. 1 were considered red in first 40 seconds and green in second 60 seconds. The goal of simulation is the decrement of waiting time vehicles and the length of queue. The classic model of Two Phase Signalized Intersection was designed in Fig. 8 without controller. The output of classic model was demonstrated in Fig. 9 on intersection in fixed time control. The time of simulation is 1000 second.

The classic model of Two Phase Signalized Intersection

The summation of number vehicles in Queues on intersection were demonstrated in every 5 seconds in Fig. 9.

The Number of vehicles in Four Queues of Intersection without controller

## Fuzzy Intelligent Control

The output of controller is the control of variables (). This control of variables for the Leg1 and Leg3 of intersection were demonstrated in Fig. 10. also, The summation of number vehicles in Queues on intersection were demonstrated in every 5 seconds in Fig. 11. The time of simulation is 1000 seconds.

The Control of Variables of Leg1 and Leg3

The Number of vehicles in Four Queues of Intersection with Fuzzy controller

## Conclusion

The classic model of urban traffic network was represented for a single intersection. The goal was calculating the length of queue and the average waiting time vehicles in any lane as the state of variables. However, for demonstrating the percentage of improvement traffic, a new fuzzy signal controller was designed. The controller was tested using simulink program on Matlab 7.4. The results of simulation and the percentage of improvement show that the intelligent fuzzy of controller reduces the average waiting time vehicles in any lane of intersection compared to Fixed-time control (TABLE II) . The methods of other for designin of fuzzy controller and control in complicated intersections and nonisolated intersections in urban traffic network and investigation into heuristic methods of solving developed optimal control problem based on the state-space equations must be done in the future.

TABLE II

the compare of results average waiting time in lanes of classical model

Summation of

Queues

Queue 4

Queue 3

Queue 2

Queue 1

## Average Waiting Time (second)

2000

270

465

740

525

## Fixed Time Control

110

13

25

42

30