# Fuzzy Logic – A Way to Achieve Control Based on Imprecise Inputs

In this era of digital control, almost every appliance is controlled using the digital control level using 1 and 0. But just think, isn’t it quite unpractical to think every output of the daily processes you come across, depends only on two states of the input. No, Definitely.  Just imagine your mother cooking some tasty food and you can’t stop yourself from praising her. So how the food does become so tasty? With the addition of ingredients in proper quantity and proportion, of course.  So how does she manage that? With perfect numerical knowledge of the quantities? Not always.  She does that with a known idea, which comes with experience. This is where comes the idea of a control logic that uses the degrees of input state rather than the inputs itself; a logic that doesn’t requires some perfect inputs but rather works with only a typical estimation of the inputs. This is fuzzy logic.

### What is Fuzzy Logic?

Fuzzy logic is a basic control system that relies on the degrees of state of the input and the output depends on the state of the input and rate of change of this state. In other words, a fuzzy logic system works on the principle of assigning a particular output depending on the probability of the state of the input.

### How did Fuzzy Logic Originate?

Fuzzy Logic was developed in 1965 by Lotfi Zadeh at the University of California, Berkley as a way to perform computer processes based on natural values rather than binary values. It was initially used as a way to process data and later began to be used as a control strategy.

### How does Fuzzy Logic Works?

Fuzzy logic works on the concept of deciding the output based on assumptions. It works based on sets. Each set represents some linguistic variables defining the possible state of the output. Each possible state of the input and the degrees of change of the state are a part of the set, depending upon which the output is predicted. It works on the principle of If-else-the, i.e. If A AND B Then Z.

Suppose we want to control a system where the output can be anywhere in the set X, with a generic value x, such that x belongs to X. Consider a particular set A which is a subset of X such that all members of A belong to the interval 0 and 1. The set A is known as a fuzzy set and the value of fA(x) at x denotes the degree of membership of x in that set. The output is decided based on the degree of membership of x in the set. This assigning of membership depends on the assumption of the outputs depending on the inputs and the rate of change of the inputs.

These fuzzy sets are represented graphically using membership functions and the output is decided based on the degree of membership in each part of the function. The membership of the sets is decided by the IF-Else logic.

Generally, the variables of the set are the state of the inputs and the degrees of changes of the input and the membership of the output depends on the logic of AND operation of the state of the input and the rate of change of the input. For a multi-input system, the variables can also be the different inputs and the output can be the possible result of the AND operation between the variables.

### Fuzzy Control System

A fuzzy control system consists of the following components:

A Fuzzifier which transforms the measured or the input variables in numerical forms into linguistic variables.

A Controller performs the fuzzy logic operation of assigning the outputs based on the linguistic information. It performs approximate reasoning based on the human way of interpretation to achieve control logic. The controller consists of the knowledge base and the inference engine. The knowledge base consists of the membership functions and the fuzzy rules, which are obtained by knowledge of the system operation according to the environment.

The Defuzzifier converts this fuzzy output to the required output to control the system.

### A Simple Control System using Fuzzy Logic to Control the Speed of the Fan Depending on the Temperature of the Input.

Suppose you want to control the speed of the fan depending on the temperature of the room. For a normal layman if the temperature of the room is such that he/she feels too hot, then the fan speed is increased to the full value. If he/she feels a bit hot, then the fan speed is increased moderately. If he/she feels too cold, the fan speed is decreased drastically.

### So How to make your Computer do this?

This is how we can achieve this:

• The temperature sensor measures the temperature values of the rooms. The obtained values are taken and then given to the fuzzifier.
• The fuzzifier assigns linguistic variables for each measured value and the rate of change of measured value.

For example, if the measured value is 40⁰C and above, then the room is too hot

If the measured value is between 30⁰C to 40⁰C, the room is quite hot

If the measured value is 22 to 28⁰C, the room is moderate

If the measured value is 10 to 20⁰C, the room is cold

If the measured value is below 10, the room is too cold.

• The next step involves the functioning of the knowledge base which contains the information of these member functions as well as the rule base.

For example, if Room is too hot AND the room is getting heated up rapidly, then set the fan speed to High

If Room is too hot AND the room is getting heated up slowly, then set the fan speed to less than High.

• The next step involves converting this linguistic output variable into numerical variables or logical variables used to drive the fan motor driver.
• The final step involves controlling the fan speed by giving proper input to the fan motor driver.

So this is a brief overview of the Fuzzy Logic, any further inputs are welcome to be added.