# Computation Of Fuzzy Logic Algorithm For Macroscopic Traffic Network Computer Science Essay

Published:

Traffic congestion is a major concern in Malaysia due to rapid increase in vehicle usage rates. The existing traffic light controller in Malaysia is based on fixed-time strategies which the traffic lights change at constant cycle time. These predetermined systems do not provide optimal control for fluctuating traffic volumes. This scenario necessitates the development of advanced traffic management systems to increase the performance of signalized intersection. A traffic light system based on fuzzy logic is proposed. Fuzzy logic technology has the capability of mimicking the human intelligence for controlling the traffic flow. It allows the implementation of real-life rules similar to the way in which humans would think. With Fuzzy Logic controller, network traffic flow can be improved with considerably less cost than other infrastructural improvements. The proposed Fuzzy Logic based traffic light controller allows signal timing parameters such as cycle time, green split and phase sequence to be optimized with objective to improve vehicular throughput and minimize delays.

### Professional

#### Essay Writers

Get your grade

or your money back

using our Essay Writing Service!

Keywords-Fuzzy Logic; Traffic Signal Control

## Introduction

Necessities for suitable approaches to manage traffic flow are increasing in urban cities. Traffic congestion is an important problem in big city. In Malaysia, the problem was used to be solved by extend traffic infrastructures. However, due to limited spatial, environmental, and economic issues, it is not viable and perfect solution. Hence, in order to solve this problem, careful design of traffic signal control will result in increasing the efficiency of the traffic network. Traffic lights are common features of urban area throughout the world, controlling the number of vehicles. Their main purposes are improving vehicular throughput at intersections while maximize the capacity and minimize the delays at the same time [1]. A fuzzy logic based traffic light controller can be used to improve vehicular throughput. It is an attempt to control the traffic flows by synthesizing a set of linguistic control rules which are formulated the protocols that human operator would use to control the time intervals of the traffic light. The basic of fuzzy logic traffic signal controller is 'to model control strategy based on human expert knowledge rather than the modeling of the process itself'.

In Malaysia, traffic light control implemented is fixed-time strategies where cycle length had fixed, preset phase intervals and operates according to predetermined timing plans. These controllers use a limited number of predetermined traffic light patterns based on the historical data and implement these patterns depending upon the time of the day. However, this type of system is inflexible and cannot respond adequately to unpredictable changes in traffic demands. Nevertheless, it will cause excessive delay when there exist a high degree of variability in traffic flows.

Hence, fuzzy logic traffic controller is proposed. Fuzzy logic has been used for its simplicity and its capability to adapt to traffic condition [2]. Tian et al. [3] has reported that several research had shown that better performance of fuzzy logic controllers compared to a fixed-time controller or an actuated controller. MATLAB M-file and Fuzzy Logic Toolbox has been chosen as the tool to develop fuzzy logic traffic controller due to the interactive numerical computing environment provided by MATLAB [4]. The rest of this paper is organized as follows. Section II presents the Webster's Method Implementation Traffic Control. Section III and IV presents single input single output fuzzy implementation and two input single output fuzzy implementation respectively. Finally, Section V set out some concluding remarks and project future research.

## WEBSTER'S METHOD IMPLEMENTATION

The famous British transportation researcher, F. V. Webster, developed a series of useful traffic theories, which have had a very big influence on the modern traffic analysis since the 1950s [5]. In particular, he established his method of optimal signal setting by using computer simulation. Ohno et al. [6] state that although the method is an approximation method for the optimal signal setting, it has been used popularly due to its simplicity.

Nowadays in Malaysia, the traffic light control system is under the supervision of Jabatan Kerja Raya (JKR). JKR builds the traffic light control system of Malaysia using the JKR Standards that adapted from Webster Method. However, in the Webster Method used by the JKR, certain parameters and constant are modified to cope with the traffic condition on Malaysia.

## Data Collection

### Comprehensive

#### Writing Services

Plagiarism-free

Always on Time

Marked to Standard

In the Webster Method, Passenger Car Unit which also defined as PCU is the input of the system. The unit of PCU is vehicles/hours. This paper takes the traffic flow with unit of vehicles/seconds. Hence mathematic unit conversion from vehicles/seconds to vehicles/hours has to be done by multiply the inputs by 3600. By obtaining the PCU, Webster Method calculates , the ratio of traffic flow to the saturation flow. Saturation flow is the traffic flows of the roads if all vehicles pass through the intersection for all the time without any red times. As every lane to the intersection has its own Y, total of Y is also calculated. The value of and can be obtained from equation (1) and (2).

(1)

(2)

A survey is carried out to collect data for every approach at the intersection as shown in Figure 1. Approach A (Alam Mesra) has 3 incoming lane, approach B (From K.K) has 4 incoming lane, approach C (UMS) has 2 incoming lane and approach D (From I.P) has 5 incoming lane. The survey has been carried out manually to provide accurate results and overall pictures of the study area. The PCU factors are adopted as given in Table I.

Figure 1: Intersection studied

TABLE I ADOPTED PCU FACTORS

Saturation Flow is a constant after considered about the road width, 2.75 meters per lane, with a basic saturation constant, 525. Table II show the road width for the intersection studied in this project.

TABLE II Road Width

## Data Analysis

In JKR Standard system, there is another parameter that being set, the lost time of a cycle (. According to the study of the JKR system, lost time is the time which is lost during the interchange of all the lights with the value of 12 seconds. To calculate a JKR standard cycle time (, equation (3) is used.

(3)

Lastly, the green time of each lane is computed from equation (4).

(4)

Where denote the th the lane of the intersection.

By using the equations (3) and (4), the ratio of saturation flow and the green time of each phase in the intersection is shown in Table III. Thus, and Cycle Time can also be computed.

TABLE III Ratio of saturation flow and Green Time in each phase

## Results

MATLAB M-file has been chosen as the tool used to develop Webster Method traffic light controller. By using the parameters obtained from the previous section, a program is written to simulate the output for 4 cycle times. Figure 2 shows the total number of queuing vehicles in each cycle time.

Figure 2: Total number of queuing vehicles in each cycle time

From the results obtained, it show that number of queuing vehicles in B and D are stable with not much of different. However, A and C shows that the number of queuing vehicles are increasing. Due to the Webster's traffic light controller was based on fixed-time strategies, it will not provide an optimal control for fluctuating traffic volumes. This show that the current Webster Method traffic control for this intersection is not optimum since this the number of queuing vehicles will become larger from time to time during peak hour. The result of this is longer delays and increased pollution as well as stress to drivers.

## IMPLEMENTATION OF FUZZY LOGIC TRAFFIC CONTROLLER USING TOOLBOX

Due to limited spatial, environmental, and economic issues, traffic congestion problem cannot be solved by extend traffic infrastructures. However, by optimize the signal settings at the traffic intersection we can maximize the utility of the existing road and hence increasing the efficiency of the traffic network to yield economical environmental benefits.

Traffic signal control for isolated intersection can be classified into two categories: fixed-time strategies and traffic-responsive strategies. Fixed-time strategies use historical traffic information to decide traffic signal setting. On the other hand, traffic-responsive strategies make use of real-time managements to calculate in real time the suitable signal settings. Traffic-responsive strategies signal settings is simple in structure and performs well at many traffic conditions, but its disadvantage is that it cannot coordinate the streams which currently has the right of way with other waiting streams.

As intelligent control develops in recent years, traffic signal control should be based on the tailor-made solutions and adjustments, which would be made by the traffic planners. Fuzzy logic control method may be the first and extensively studied and implemented in this field. Fuzzy logic based traffic controller can be used as optimum controller for fluctuating traffic volume.

### This Essay is

#### a Student's Work

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

Examples of our workPappis and Mamdani [7] simulated an isolated signalized one-way intersection with no turning movements using fuzzy logic controller. A set of linguistic control statements was formulated using the graded concept of fuzzy logic theory as applied to the traffic signal control. The intervention of the controller would take place every 10 s during each phase's effective green period. At each intervention, the length of the extension of the effective green time for the phase having the right of way was decided.

Fuzzy logic controller allows linguistic and inexact traffic data to be manipulated in controlling the signal timings. Fuzzy algorithms have the individual advantage of not relying on a mathematical transfer function for formulating a control strategy. Instead, the design of a fuzzy signal controller requires the expert knowledge and experience of traffic control in formulating the linguistic protocol, which generates the control input to be applied to the traffic signal control system [8].

The same intersection as shown in Figure 1 is considered again. This study is conducted to investigate the control strategy proposed by two input single output fuzzy logic controller employ to control the traffic when different number of queuing vehicles at the particular intersection. In this model, the fuzzy variables considered are number of queuing vehicles (Q), change of queue (CQ) and green time (GT). The membership functions for the queuing vehicles (Q) at approach having green phase are Lfew=-5 to 5, Sfew=0 to 10, few=5 to 15, medium=10 to 20, many=15 to 25, Smany=20 to 30 and Lmany=25 to 35. Figure 3 shows the input fuzzy variable, queuing vehicles (Q). Figure 4 shows the second input fuzzy variable, change of queue (CQ). The membership functions for the change of queue (CQ) are LN=-57.4 to -10.25(trapmf), SN=-14.35 to -2.05, Zero=-6.15 to 6.15, SP=2.05 to 14.35 and LP=10.25 to 57.4(trapmf).

Figure 3: Input Fuzzy Variable-Queuing Vehicles

Figure 4: Input Fuzzy Variable-Change of Queue

Based on the input fuzzy parameter, the duration of the output variable-green time (GT) is determined. The membership function for the output fuzzy variable green time (GT) are Lshort=-5 to 5 seconds, Sshort=0 to 10 seconds, short=5 to 15 seconds, medium=10 to 20 seconds, long=15 to 25 seconds, Slong=20 to 30 seconds and Llong=25 to 35 seconds. Figure 5 shows the output fuzzy variable, green time (GT).

Figure 5: Output Fuzzy Variable-Green Time

Fuzzy logic allows linguistic and inexact data to be manipulated as a useful tool in designing signal timing. The linguistic control strategy that is decided by 'if-then' statements can be converted into a control algorithm using fuzzy logic. Table IV shows the rule editor in Fuzzy Logic Toolbox.

TABLE IV Fuzzy Rule Base

If Q is Lfew and CQ is (LN or SN) then GT is Lshort.

If Q is Lfew and CQ is (zero or SP) then GT is Sshort.

If Q is Sfew and CQ is (LN or SN) then GT is Sshort.

If Q is Sfew and CQ is (zero or SP) then GT is short.

If Q is Sfew and CQ is LP then GT is medium.

If Q is few and CQ is (LN or SN) then GT is short.

If Q is few and CQ is (zero or SP) then GT is medium.

If Q is few and CQ is LP then GT is long.

If Q is medium and CQ is (LN or SN) then GT is medium.

If Q is medium and CQ is (zero or SP) then GT is long.

If Q is medium and CQ is LP then GT is Slong.

If Q is many and CQ is (LN or SN) then GT is long.

If Q is many and CQ is (zero or SP) then GT Slong.

If Q is many and CQ is LP then GT is Llong.

If Q is Smany and CQ is (LN or SN) then Slong.

If Q is Smany and CQ is (zero or SP or LP) then GT is Llong.

If Q is Lmany and CQ is (LN or SN or zero or SP or LP) then GT is Llong.

The above algorithm of fuzzy rule base is implemented using MATLAB m-file. By using the parameters such as ratio of saturation flow obtained from the in Section II, a program is written to simulate the output for 4 cycle times. Figure 6 shows the total number of queuing vehicles in each cycle time.

Figure 6: Total number of queuing vehicles in each cycle time

From the result obtained, the number of queuing vehicles in Phase B for Figure 6 is slightly more than the number of queuing vehicles in Phase B in Figure 2. However, in Figure 6, number of queuing vehicles in other Phases is equal or less than Figure 2. The benefit of adopted fuzzy logic in traffic control is that the green time for each phase is flexible based on the traffic condition. The decision made by rule base and the output generated is more precise and accurate. Phase B in Figure 6 is said to sacrifice its green time in order to allow more vehicles to pass through the intersection for the following phases in the same intersection. As a result, this had improved the traffic condition in Phase C as the number of queuing vehicles is decreasing from time to time.

## IMPLEMENTATION OF FUZZY LOGIC TRAFFIC CONTROLLER USING PROGRAMMING ALGORITHM

The main objective of this project is to develop a Fuzzy Logic based traffic light controller using programming algorithm instead of Fuzzy Logic toolbox which mentioned previously. Nevertheless, there is no huge difference between Fuzzy Logic Toolbox and Fuzzy Logic Programming Algorithm. However, due to a programming algorithm can be programmed into hardware i.e. Peripheral Interface Controller (PIC or also known as microcontroller), a Fuzzy Logic Traffic Light Microcontroller is more realistic and suitable to apply in real life. On the other hand, Fuzzy Logic Toolbox is more focus on modeling and simulation.

## Input Membership Function

Once again, the intersection in Figure 1 is considered. Similar input membership functions with Section V are used in this model. However, the way to generate the membership function in programming algorithm is slightly different with toolbox. A 7-13 matrix is used in the programming algorithm for the first input, Q and a 5-21 matrix for CQ. The data in the matrices is based on the degree in membership. Figure 7 and Figure 8 shows the matrix for both the input membership function.

Figure 7: Matrix for number of queuing vehicles

Figure 8: Matrix for change of queue

## Rules

This model controller takes two input parameters. The first parameter is number of queuing vehicles (Q) and the second parameter is change of queue (CQ). Again, the rules apply in Section III was converted into matrix in order to code into the programming algorithm. Nevertheless, the matrix had to include the fuzzy operator (AND) and the weight for each rule (in this model the weight is set to 1).

Interpreting a rule involves two parts. First, evaluating the antecedent (number of queuing vehicles and change of queue) by fuzzifying the inputs and apply the fuzzy operator (AND). Second, apply the result to the consequent (green time). By referring to the rule base, if the antecedent is true to some degree of membership, the consequent will also be true to that same degree.

## Fuzzy Inference

The first step is to fuzzify the fuzzy statements in the antecedent to a degree of membership functions. In this project, the input is a crisp value limited to the universe of discourse of the input variable (0 to 30 for number of queuing vehicles and -20.5 to 20.5 for change of queue) and the output is a fuzzy degree of membership (0 to 1).

After the inputs have been fuzzified, the degree to which each part of the antecedent has been satisfied for each rule can be determined. Due to there are two antecedent parts in this project i.e. number of queuing vehicles and change of queue, the AND operator with min method is applied to obtain one number that represents the results of the antecedent for that rule. The number will be applied to the output function and the output is a single value.

Rule's weight is an issue to take care before applying implication method. A weight of a rule is a number between 0 and 1. In this project, all the rules' weight is 1 and hence it has no effect on the implication process. Implication method is applied once the weight has been assigned to each rule. The consequent (green time) is a fuzzy set represented by membership function which weights appropriately the linguistic characteristics that are attributed to it. The function associated with the antecedent (single number) is used to reshape the consequent. This single number will then be used as the input for implication process to produce the output (fuzzy set). As mentioned previously, implication is applied for each rule and the AND operator min method is used to truncates the output fuzzy set.

The process which the fuzzy sets that represent the outputs of each rule are combined into a single fuzzy set is known as aggregation. The input of the aggregation process is the list of truncated output function returned by the implication process for each rule. On the other hand, the output of the aggregation process is one fuzzy set for each output variable. The aggregation method implemented in this fuzzy logic traffic controller programming algorithm is sum.

The aggregate of a fuzzy set encompasses a range of output values. Deffuzzification process takes the aggregate output fuzzy set as input and resolves a single output value from the fuzzy set. The defuzzification method implemented in this fuzzy logic traffic controller programming algorithm is weight average method (WAM). Nevertheless, there is an extra defuzzification method i.e. smallest of maximum (SOM) which will yielded green time, GT=0 for special case when the number of queuing vehicle is zero (Q=0).

## Results

The fuzzy logic traffic controller programming algorithm is developed by using MATLAB m-file. The flow of the algorithm is based on the input membership functions, rule base and fuzzy inference mentioned previously. By using the parameters such as ratio of saturation flow obtained from Section II, the program is stimulated for 4 cycle times. Figure 9 shows the total number of queuing vehicles in each cycle time.

Figure 9: Total number of queuing vehicles in each cycle time

From the results obtained by using fuzzy programming algorithm are slightly better than the results using fuzzy logic toolbox in MATLAB. In programming based fuzzy traffic controller the overall number of queuing vehicles for each phase in a cycle is lesser. These are due to the defuzzification method use in the programming based fuzzy traffic controller is different with the method used in fuzzy toolbox. Furthermore, there are two different defuzzification methods in programming based fuzzy traffic controller. Hence, the programming algorithm will base on the traffic situation in the intersection to decide which defuzzification method is more suitable for that particular situation. The decision made is said to be more precise and accurate.

## CONCLUSION

In this project, the Webster's Method and Fuzzy Logic Based traffic light controller has been developed. Fuzzy logic has been presented as a possibility for the traffic signal control of future. The Fuzzy Logic controller was divided into two: toolbox model and programming algorithm model.

It is important to tune the fuzzy rule correctly, as the performance of the fuzzy controller depends highly on this. At the beginning of this project, the fuzzy controller performed poorly since the parameters were not properly configured. After several repeated tuning and simulation, models which performed better than the Webster's Method were obtained.

The performance of the proposed Webster's Method traffic light control had been compared with the Fuzzy Logic Based traffic light controller. Furthermore, the two models of fuzzy controller were compared among themselves. When traffic flow is constant and small, these controllers' performance are almost the same. But when heavy constant traffic flow, fuzzy logic traffic controller yielded a better performance.

Results showed that the proposed programming based fuzzy traffic controller yield better performance because it has the ability to use expert knowledge well and better traffic fluency. This may due to the proposed programming based fuzzy traffic controller allow signal timing plan being evaluated base on global traffic condition as compare to the conventional approach adopted in Webster's Method. One basic advantage if fuzzy control is that it fires many soft rules simultaneously and makes a decision, which offers the compromise. Furthermore, programming algorithm is flexible and easy to debug or modify based on the traffic situation.

Nowadays most of the electronic device such as traffic light is made of microcontroller as it is small and cheap in cost. This microcontroller is programmed using machine language such as JAVA and C. Hence, a programming based fuzzy logic traffic controller is proposed in this project so that it can be programmed into Peripheral Interface Controller (PIC i.e. microcontroller) and hence implemented in real life. On the other hand, unlike the Fuzzy Logic Toolbox provided in MATLAB, programming algorithm is flexible and easy to debug or modify based on the traffic situation. It serves as a good platform to develop the real time adaptive traffic control system. Results from Section IV had showed that programming based fuzzy traffic controller yielded a better traffic condition for the intersection studied compare to the toolbox based fuzzy traffic controller which only have one defuzzification method.

This project has enormous potential to be exploited. It serves as a good platform to develop the real time adaptive traffic control system. Future work of this project includes further calibration on Fuzzy Logic controller parameters and the flexibility. In addition, the proposed Fuzzy Logic Controller was developed by using programming algorithm of Fuzzy Logic. Overall it shows a optimize traffic result in the intersection studied. In future, more aspect can take into the consideration when develop a programming algorithm for the fuzzy traffic controller. For examples, each phase of the intersection has a unique traffic flow rate and hence we can set different membership function for each phase.