Monday, 16 March 2015

Traffic light controller using Fuzzy Logic

The main aim of the traffic light controller is controlling and management of traffic through the use of traffic signals i.e. ensuring the traffic safety at intersections and minimizing the delays. Traffic flow leads to various economic and environmental benefits. The traffic signal requires a certain cycle for its operation i.e. the output is yielded in Green, Yellow and Red colors. Figure below. With the passage of time as technology is getting improved there are various technological advancements in traffic control being made.

Two routes for our traffic light controller and named them as Route A & Route B. The vehicles are supposed to have a run on these routes.Our traffic light has been installed on the T-junction of these two routes as shown in Figure, which is responsible for routing the cars according to Fuzzy Rules.
Our traffic light controller will get the input number of cars at T-junction through a vision camera using image processing tool box in Matlab. The main concept and idea can easily be understood with the help of a Block diagram which is explained and shown in Figure


If the number of cars in Route A are greater than or equal to the number of cars at Route B then the Traffic Light Controller will get Green for Route A for a specified period, to let the cars passed, meanwhile for Route B the signal will be Red. Once all the cars at Route A are passed then the controller will get Green for Route B for a specific period while this time Route A will get a Red signal from controller. While at the execution of number of cars being counted by Microcontroller a delay logic will come into act. (Delay is defined as “summation of time specified for Route A and B) meanwhile it will start a countdown for the two Routes. While the countdown is in progress no further input is taken. As the Delay reaches to 0 it will take another input.

Fuzzy Controller
Fuzzification
The Fuzzification comprises the process of transforming crisp values into grades of membership for linguistic terms of fuzzy sets OR Modifies inputs so that rule base can be interpreted and compared in rule base. The membership function is used to associate a grade to each linguistic term such as
NEGATIVE LARGE (NL), NEGATIVE MEDIUM (NM), ZERO, POSITIVE MEDIUM (PM), POSITIVE LARGE (PL)



Fuzzy Rules

The defined Rules for our Traffic Light Controller are given as under.

Defuzzification:

Converts the conclusion to crisp input for the controller. In Mamdani FIS, expects the output membership functions to be fuzzy sets. After the aggregation process, there is a fuzzy set for each output variable that needs defuzzification(e.g centroid method). We have define output membership functions  labels i.e. DECREASE, NORMAL & INCREASE.


Lets us consider we have 3 cars at route A and 17 cars at route B then time for Green signal A after defuzzification  will be 16 sec(Decrease) and time for Green signal B after defuzzification be will be 80 sec(Increase) as Shown in Figure 8

Simulink:

Fuzzy Crisp output is given to Controller (chart (Matlab)). If Signal A is Greater than Or Equal to Signal B the output of controller ‘y’ will be equal to ‘1’ it means that the rule will be triggered for Green time A first and then for Green time B and output ‘u’ of controller will be ‘zero’.

Similarly when Signal A is less than Signal B output of controller ‘y’ will be equal to ‘zero’ and output ‘u’ of controller will be ‘1’ which means that the rule will be triggered for Green time B first and then for Green time A.

Hardware
Code for Fuzzy Microcontroller
Arduino FIST: MATLAB Fuzzy Inference System to Arduino C Convertion




No comments:

Post a Comment