# The Concept Of Fuzzy Logic Fuzzy Logic 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.

The concept of Fuzzy Logic (FUZZY LOGIC) was conceived by Lotfi Zadeh, a professor at the University of California at Berkley, and presented not as a control methodology, but as a way of processing data by allowing partial set membership rather than crisp set membership or non-membership. This approach to set theory was not applied to control systems until the 70's due to insufficient small-computer capability prior to that time. Professor Zadeh reasoned that people do not require precise, numerical information input, and yet they are capable of highly adaptive control. If feedback controllers could be programmed to accept noisy, imprecise input, they would be much more effective and perhaps easier to implement. Unfortunately, U.S. manufacturers have not been so quick to embrace this technology while the Europeans and Japanese have been aggressively building real products around it.

In this context, Fuzzy Logic is a problem-solving control system methodology that lends itself to implementation in systems ranging from simple, small, embedded micro-controllers to large, networked, multi-channel PC or workstation-based data acquisition and control systems. It can be implemented in hardware, software, or a combination of both. Fuzzy logic provides a simple way to arrive at a definite conclusion based upon vague, ambiguous, imprecise, noisy, or missing input information. Fuzzy logic's approach to control problems mimics how a person would make decisions, only much faster.

Fuzzy logic incorporates a simple, rule-based IF X AND Y THEN Z approach to a solving control problem rather than attempting to model a system mathematically. The fuzzy logic model is empirically-based, relying on an operator's experience rather than their technical understanding of the system. For example, rather than dealing with temperature control in terms such as "SP =500F", "T <1000F", or "210C <TEMP <220C", terms like "IF (process is too cool) AND (process is getting colder) THEN (add heat to the process)" or "IF (process is too hot) AND (process is heating rapidly) THEN (cool the process quickly)" are used. These terms are imprecise and yet very descriptive of what must actually happen. Consider what you do in the shower if the temperature is too cold: you will make the water comfortable very quickly with little trouble. Fuzzy logic is capable of mimicking this type of behavior but at very high rate.

Fuzzy logic requires some numerical parameters in order to operate such as what is considered significant error and significant rate-of-change-of-error, but exact values of these numbers are usually not critical unless very responsive performance is required in which case empirical tuning would determine them. For example, a simple temperature control system could use a single temperature feedback sensor whose data is subtracted from the command signal to compute "error" and then time-differentiated to yield the error slope or rate-of-change-of-error, hereafter called "error-dot". Error might have units of degrees F and a small error considered to be 2F while a large error is 5F. The "error-dot" might then have units of degs/min with a small error-dot being 5F/min and a large one being 15F/min. These values don't have to be symmetrical and can be "tweaked" once the system is operating in order to optimize performance. Generally, fuzzy logic is so forgiving that the system will probably work the first time without any tweaking.

Fuzzy logic was conceived as a better method for sorting and handling data but has proven to be an excellent choice for many control system applications since it mimics human control logic. It can be built into anything from small, hand-held products to large computerized process control systems. It uses an imprecise but very descriptive language to deal with input data more like a human operator. It is very robust and forgiving of operator and data input and often works when first implemented with little or no tuning.

## APPLICATIONS OF FUZZY LOGIC

There are countless applications for fuzzy logic. In fact, some claim that fuzzy logic is the encompassing theory over all types of logic. Some common applications of Fuzzy Logic are:

Bus Time Tables :

Bus schedules are formulated on information that does not remain constant. They use fuzzy logic because it is impossible to give an exact answer to when the bus will be at a certain stop. Many unforeseen incidents can occur. There can be accidents, abnormal traffic backups, or the bus could break down. An observant scheduler would take all these possibilities into account, and include them in a formula for figuring out the approximate schedule. It is that formula which imposes the fuzziness.

Predicting genetic traits:

Genetic traits are a fuzzy situation for more than one reason. There is the fact that many traits can't be linked to a single gene. So only specific combinations of genes will create a given trait. Secondly, the dominant and recessive genes that are frequently illustrated with Punnet squares are sets in fuzzy logic. The degree of membership in those sets is measured by the occurrence of a genetic trait. In clear cases of dominant and recessive genes, the possible degrees in the sets are pretty strict. Take, for instance, eye color. Two brown-eyed parents produce three blue-eyed children. Sounds impossible, right? Brown is dominant, so each parent must have the recessive gene within them. Their membership in the blue eye set must be small, but it is still there. So their children have the potential for high membership in the blue eye set, so that trait actually comes through. According to the Punnet square, 25% of their children should have blue eyes, with the other 75% having brown. But in this situation, 100% of their children have the recessive color. Was the wife being unfaithful with that nice, blue-eyed salesman? Probably not. It's just fuzzy logic at work.

Temperature control (heating/cooling) :

The trick in temperature control is to keep the room at the same temperature consistently. Well, that seems pretty easy, right? But how much does a room have to cool off before the heat kicks in again? There must be some standard, so the heat (or air conditioning) isn't in a constant state of turning on and off. Therein lays the fuzzy logic. The set is determined by what the temperature is actually set to. Membership in that set weakens as the room temperature varies from the set temperature. Once membership weakens to a certain point, temperature control kicks in to get the room back to the temperature it should be.

Auto Focus on cameras:

Auto-focus cameras are a great revolution for those who spent years struggling with "old-fashioned" cameras. These cameras somehow figure out, based on multitudes of inputs, what is meant to be the main object of the photo. It takes fuzzy logic to make these assumptions. Perhaps the standard is to focus on the object closest to the center of the viewer. Maybe it focuses on the object closest to the camera. It is not a precise science, and cameras err periodically. This margin of error is acceptable for the average camera owner, whose main usage is for snapshots. However, the "old-fashioned" manual focus cameras are preferred by most professional photographers. For any errors in those photos cannot be attributed to a mechanical glitch. The decision making in focusing a manual camera is fuzzy as well, but it is not controlled by a machine.

Antilock Braking System

The point of an ABS is to monitor the braking system on the vehicle and release the brakes just before the wheels lock. A computer is involved in determining when the best time to do this is. Two main factors that go into determining this are the speed of the car when the brakes are applied, and how fast the brakes are depressed. Usually, the times you want the ABS to really work are when you're driving fast and slam on the brakes. There is, of course, a margin for error. It is the job of the ABS to be "smart" enough to never allow the error goes past the point when the wheels will lock. (In other words, it doesn't allow the membership in the set to become too weak.)

## 3.1 Three types of Automations:

There are three basic variants of automated railway operation which apply irrespective of type of train used.

Where the trains travel automatically from station to station but a human train driver is always present at the front of the train, with responsibility for door closing, obstacle detection on the track before the train and handling of emergency situations.

In a driverless system where the trains runs automatically from station to station but a human Passenger Service Agent is always present somewhere in the train, with responsibility for door closing and to reassure nervous passengers that there is someone 'onboard' who can take control in the (unlikely) event of a failure or an emergency situation.

In a completely driverless system where the trains run automatically at all times, handle door closing, obstacle detection and emergency situations, with the only input from transport staff being from a remote control centre.

Automation offers financial savings in both energy and wear & tear costs because trains are driven to an optimum specification - instead of according to each motorman's 'style'. Automated trains react more quickly to changes, such as pulling away immediately after a red signal changes to green - rather than the delay of even a second or two which occurs with human drivers. Although delays of even one second may sound minimal, their cumulative effects, when translated to every train, negatively impinges upon the service frequency (especially during rush hours) and therefore reduces the number of trains which can travel along a section of track.

Where trains are completely unstaffed having fewer people on the payroll is financially advantages as staff represent a significant part of the cost of running a transport system. Some other advantages of not requiring staff to be available to drive the trains include the ability to provide far more frequent services at quiet times (such as evenings and weekends) when passenger levels are lower and the revenue earned would not justify the costs of employing a full complement of train drivers, and the ability of train operators to vary the service frequency to meet a sudden unexpected demand

## 3.2 Automated 'Driverless' Metro Systems

Automated braking system has been used in the past before .It is still used in the present metro systems.

Automated systems are sometimes also called people-movers and automated guided transits.

The term people-mover usually applies to small cabin type transports such as are often found at airports. Few examples are the Monorails, Maglev's and 'Cabin' Transports.

The transports shown here are all rapid transit urban métro (or mini-métro) systems that serve full size towns and cities. Some of these could also be called automated guided transits, this being a term that refers to fully automated, grade-separated transports that (often) use rubber-tyred vehicles which are self-guided - usually by horizontally running guide wheels.

The term 'grade-separated' means that they are always kept separated from other transports and pedestrians - usually by being elevated above or below everything else, although if they are at ground level safety will dictate that they will need to be fenced in so as to keep all other types of transport and pedestrians away from their rights of way. Which of course makes sense for an automated system which is not capable of etecting possible unexpected hazards along its right of way.

## 3.2.1 Automated Train system in London:

After initial safety trials proved successful the first known automatically driven passenger train ran in 1963 between Stamford Brook and Ravenscourt Park on the London Underground District Line. Only one specially modified train was involved, all other trains on this route continued to operate in normal 'human driven' mode.

With further trials between these two stations continuing to prove successful, in 1964 full scale trails of automatically operated trains began on the Hainault - Woodford section of the Central Line, which at that time was operated as a small branch line shuttle service. Initially a dedicated fleet of four trains was involved, later all the new trains destined for what was to become the first fully automated line (and is known as the Victoria Line) were tested here too.

Because the shuttle service operated over the tracks used by other trains so these trials effectively included shared operation of automated and human driven trains. The latter included Underground trains on both the Epping route as well as (between Woodford and Grange Hill) on peak-hour 'extra' workings travelling to & from the depôt located partway along the automated route. At this time the mainline railway (British Railways) still operated freight - and a few passengers - services to Epping and Newbury Park via Woodford, so their steam (diesel in later days) trains also travelled on sections of track served by the automated trains.

British Railways operated trains here because when passenger services along this section of railway were converted from steam to electric traction this was achieved by using Underground trains to replace most of the passenger services provided by the mainline railway.

http://citytransport.info/PhotoCD/2111_23a.jpg

Figure 3.a: One of the trains used on the Hainault - Woodford route to test the automated passenger train technology.

## 3.2.2 Automated train System in Tokyo:

Tokyo's first AGT system is the New Transit Yurikamone, which when it opened in 1995 was known as the Tokyo Waterfront New Transit Waterfront Line.This line serves the artificial island of Odaiba which has become a popular entertainment and leisure destination. Despite charging premium fares and there being cheaper (subterranean) alternatives the line is popular because being elevated it offers passengers excellent skyline views. Carrying over 100,000 passengers per day it makes a net profit and will fully pay off its construction cost loans more quickly than the originally anticipated 20 year period. The line is 14.7km (little over 9 miles) in length and serves 16 stations.

http://citytransport.info/NotMine/Yurikamome-7280a.jpg

Figure 3.b: The New Transit Yurikamone, Tokyo, Japan.

## 3.2.3 Automated Train System in Dubai:

On 9 September 2009, Dubai inaugurated its metro network, becoming the first urban metro network in the Gulf's Arab states. It is hoped that the system will ease the daily commute for thousands of the emirate's workers.

The driverless, fully automated trains are fully air-conditioned and designed to meet Dubai's specific requirements. Unusual for metro operation, the trains offer standard 'silver' class, a women and children only section plus a first-class 'gold' section (a carriage for VIPs). The five-car sets are approximately 75m long, seating around 400 passengers but with standing room for many more. Numerous double doors will allow fast and smooth flows.

The automatic train control system will allow headways of between 90 seconds and two minutes. In 2005 MHI contracted Alcatel (now Alcatel-Lucent) to supply the driverless train control system and a communications system for on-train video surveillance, passenger information, public address and the integrated control centre. Trains will be Wi-Fi enabled.

Occupying 10,000m², the system's control centre is at Rashidiya depot. The project's signaling system is moving block and fully automated with in-cab signaling.

http://newsimg.bbc.co.uk/media/images/46360000/jpg/_46360834_dubaimetro466.jpg

Figure 3.c: Dubai metro, Dubai, U.A.E

## 4.1 FUZZY LOGIC CONTROL DETAILS:

Fuzzy controllers are very simple conceptually. They consist of an input stage, a processing stage, and an output stage. The input stage maps sensor or other inputs, such as switches, thumbwheels, and so on, to the appropriate membership functions and truth values. The processing stage invokes each appropriate rule and generates a result for each, then combines the results of the rules. Finally, the output stage converts the combined result back into a specific control output value.

The most common shape of membership functions is triangular, although trapezoids and bell curves are also used, but the shape is generally less important than the number of curves and their placement. From three to seven curves are generally appropriate to cover the required range of an input value, or the "universe of discourse" in fuzzy jargon.

The processing stage is based on a collection of logic rules in the form of IF-THEN statements, where the IF part is called the "antecedent" and the THEN part is called the "consequent". Typical fuzzy control systems have dozens of rules.

The rules have membership functions defining them. The membership functions can be modified by "hedges" that are equivalent to adjectives. Common hedges include "about", "near", "close to", "approximately", "very", "slightly", "too", "extremely", and "somewhat". These operations may have precise definitions, though the definitions can vary considerably between different implementations.

The fuzzy rule sets usually have several antecedents that are combined using fuzzy operators, such as AND, OR, and NOT, though again the definitions tend to vary: AND, in one popular definition, simply uses the minimum weight of all the antecedents, while OR uses the maximum value. There is also a NOT operator that subtracts a membership function from 1 to give the "complementary" function.

There are several different ways to define the result of a rule, but one of the most common and simplest is the "max-min" inference method, in which the output membership function is given the truth value generated by the premise.

Rules can be solved in parallel in hardware, or sequentially in software. The results of all the rules that have fired are "defuzzified" to a crisp value by one of several methods.

## 4.2 AUTOMATED BRAKING SYSTEMS USING FUZZY LOGIC:

A fuzzy logic based automatic braking system is proposed using distance and relative speed sensors as inputs and brake-pressure as output. Heuristic rules have been developed and implemented. The controller monitors the deceleration rate of the vehicle to prevent tire lock-up and the consequent loss of directional stability. The system offers the flexibility of setting the separation distance. Simulation of the controller for driving into a stationary or moving objects shows that the system is performing well. It also uses an anti lock braking system to decelerate the vehicle and a throttle on-off controller to accelerate the vehicle and maintain a fixed separation distance and drive behind the object in a tracking mode.

## 5.1 Automated Braking System in trains using the Fuzzy Logic Controller:

This project focuses a new way of approach to find the solution for the artificial intelligent braking system in train using the fuzzy logic controller. Here we are designing the fuzzy logic controller using fuzzy logic tool box in mat lab software. The fuzzy logic controller is simulated using Matlab-Simulink fuzzy logic toolbox. The main function of the fuzzy logic controller used here is to automatically stop the train in each station without any manual procedure of stopping the train. The fuzzy logic controller in train gets activated about 500 m from the station so that the train stops at the station smoothly and automatically. The fuzzy controller takes the decision with reference to the speed and distance of the train.

Generally the design of automatic braking system becomes more complex but it can be made easier and flexible by using fuzzy logic controller. In order to get the dynamic output the necessary inputs chosen for the fuzzy controller are distance and speed. The dynamic output of the fuzzy controller is breaking power. Based on rules of logic obtained from RTA metro unit, I have framed 4Ã-4 (16) rules for fuzzy logic controller. This approach uses the triangular and trapezoidal member functions. The results obtained from matlab simulation will clearly show that the braking power output is smooth and the train comes to a stop as the distance reduces down to zero.

## 5.2 OVERVIEW OF DESIGN:

The first step in the design is to select the number of stations where the train stops.

The distances between the stations are calculated and stored. The fuzzy logic controller is fed with the instantaneous values of speed and distance. The controller constantly compares the distance between the previous and the next station to distance traveled by the train towards the approaching station, as and when the train is about 500m from the station the braking system in train gets activated.

Consider the case where the train is at a distance of 200m from the station approaching it at a speed 70 kmph. The numerical values thus obtained are converted into fuzzy sets by fuzzification technique. The fuzzy set relevant to this input is,

Speedâ†’ {very fast, 1}

Distance â†’ {far, 0.8}

After the fuzzification the corresponding rules are fired for the case considered, the rule 'If distance is (FAR) and speed is (VERY FAST) then braking power is (HEAVY)' is fired.

Then output fuzzy value of the fuzzy sets is converted into numerical values by the defuzzification technique. This numerical value, which is the output of the fuzzy logic controller, is used to control the braking system of the train.

## 5.3 DESIGN PROCEDURE:

The first step in creating a design is forming membership functions for the inputs and outputs. There are two inputs, Speed and Distance, and one output Braking Power. The membership functions in this design consists both Triangular and Trapezoidal components.

The second step in the design procedure is rule formation using the membership functions combined using fuzzy operators, such as AND & OR. This design has 4x4(16) rules which uses membership function of speed, distance and braking power.

While designing this fuzzy logic controller in mat lab FIS editor (fuzzy logic toolbox), first the input and output membership functions are designed and then the rules are formed.

## Speed Distance

1. Very slow 1.Very close

2. Slow 2.Close

3. Fast 3.Far

4. Very fast 4.Very far

1. Very Light

2. Light

3. Heavy

4. Very Heavy

## 5.3.2 Rules Formation:

1. If distance is (VERY_CLOSE) and speed is (VERY SLOW) then braking is (LIGHT)

2. If distance is (VERY_CLOSE) and speed is (SLOW) then braking is (HEAVY)

3. If distance is (VERY_CLOSE) and speed is (FAST) then braking is (VERY HEAVY)

4. If distance is (VERY_CLOSE) and speed is (VERY FAST) then braking is (LIGHT)

5. If distance is (CLOSE) and speed is (VERY SLOW) then braking is (LIGHT)

6. If distance is (CLOSE) and speed is (SLOW) then braking is (LIGHT)

7. If distance is (CLOSE) and speed is (FAST) then braking is (HEAVY)

8. If distance is (CLOSE) and speed is (VERY FAST) then braking is (VERY HEAVY)

9. If distance is (FAR) and speed is (VERY SLOW) then braking is (LIGHT)

10. If distance is (FAR) and speed is (SLOW) then braking is (VERY LIGHT)

11. If distance is (FAR) and speed is (FAST) then braking is (LIGHT)

12. If distance is (FAR) and speed is (VERY FAST) then braking is (HEAVY)

13. If distance is (VERY FAR) and speed is (VERY SLOW) then braking is (VERY LIGHT)

14. If distance is (VERY FAR) and speed is (SLOW) then braking is (VERY LIGHT)

15. If distance is (VERY FAR) and speed is (FAST) then braking is (LIGHT)

16. If distance is (VERY FAR) and speed is (VERY FAST) then braking is (LIGHT)

## 5.4 SIMULATION CIRCUIT:

The final step for the completion is the design of the simulation circuit of fuzzy logic controller. The circuit takes the inputs in the form of speed and distance and gives the output in the form of breaking power.

The simulation circuit is shown in Figure 5.4.a wherein the amount of braking power required for stopping the train at the station is obtained from the inputs Distance and Speed.

Figure 5.4.a: Mat lab Simulation for Fuzzy Logic Controller

Figure 5.4.b shows the simulation circuit, which proves that the train is stops at the station.

Figure 5.4.b: Mat lab Simulation for Fuzzy Logic Controller

## CONCLUSION AND FURTHER SCOPE:

The rules and membership functions that are formed for implementation of the project on mat lab platform. The membership functions and the rules have been solved on paper to check their correctness and efficiency.

The future plans for the project is to implement the simulation circuit it on mat lab using Simulink fuzzy logic toolbox.

Find the results of the simulations and verify if the train would stop at the required number of stations automatically and smoothly.