Designing fuzzy controller requires knowledge of fuzzy inference systems such as Mamdani approach of Takagi-Sugeno approach. Fuzzy logic controllers are based on fuzzy logic. Most of the embedded devices are nowadays implements one or other kind of FLC, for example air conditioner, washing machine, traffic light controller, flight navigation system and many more.

Following steps should be followed to for designing fuzzy controller:

**Identification of variables**: Input, output and state variables must be identified of the plant**Fuzzy subset configuration**: The universe of information spanned by each variable is divided into number of fuzzy subsets and each subset is assigned a linguistic variable**Obtaining membership function**: Obtain membership function for each fuzzy subset**Fuzzy Rule Base Configuration**: Formulate fuzzy rule base by assigning relationship between fuzzy input and output**Normalizing and scaling factors**: Appropriate scaling factors for input and output variables must be chosen to normalize variables between [0, 1] and [-1, 1] intervals**Fuzzification**: The Fuzzification process is done in this step with the help of Fuzzifier**Identification of output**: Identify the output from each rule using fuzzy approximate reasoning and combine the fuzzy output obtained from each rule**Defuzzification**: Initiate Defuzzification process to form crisp output

Let us try to understand this with an example:

## Example:

Consider the design of a fuzzy controller for a steam turbine. Assume the input of the fuzzy controller as temperature and pressure. The output will be the throttle setting of a steam turbine. Use 3 descriptors for input and 5 descriptors for output variables. Derive the set of rules for controller action and get the defuzzified values.

Assume that the current temperature is 30% and pressure is 40% and we have to determine the throttle position of the turbine for this particular condition

**Solution:**

**Step 1: **Identification of variables

**Inputs**: Temperature and pressure**Output**: Throttle setting of steam turbine

**Step 2: **Fuzzy subset configuration

Assign a linguistic descriptor for each fuzzy subset

**Temperature:**Cool, Nominal, Warm**Pressure**: Low, Ok, Strong**Throttle Setting**:- N
_{2}: Large Negative - N
_{1}: Small Negative - Z: Zero
- P
_{1}: Small Positive - P
_{2}: Large Positive

- N

**Step 3**: Obtain Membership Function

Define membership functions for descriptors **(Temperature)**

The fuzzy membership function for temperature is depicted in following figure:

From similar triangle rule we know that, (y_{2} – y_{1}) / (x_{2} – x_{1}) = (y – y_{1}) / (x – x_{1})

**For fuzzy set COOL:**

[0, 20] â‡’ (0 – 1) / (20 – 0) = (y – 1) / (x – 0)

Î¼_{Cool} = (20 – x_{T}) / 20

**For fuzzy set NOMINAL:**

[0, 20] â‡’ (1 – 0) / (20 – 0) = (y – 0) / (x – 0)

â‡’ Î¼ =x_{T} / 20

[20, 40] â‡’ (0 – 1) / (40 – 20) = (y – 1) / (x – 20)

â‡’ Î¼ = (40 – x_{T}) / 20

Combining both in single equation,

**For fuzzy set WARM:**

[20, 40] â‡’ (1 – 0) / (40 – 20) = (y – 0) / (x – 20)

Î¼_{warm} = (x_{T} – 20) / 20

Define membership functions for descriptors **(Pressure)**

The fuzzy membership function for pressure is depicted in following figure:

**For fuzzy set LOW:**

[0, 50] â‡’ (0 – 1) / (50 – 0) = (y – 1) / (x – 0)

Î¼_{low} = (50 – x_{P}) / 50

**For fuzzy set OK:**

[0, 50] â‡’ (1 – 0) / (50 – 0) = (y – 0) / (x – 0)

â‡’ Î¼ = x_{P} / 50

[50, 100] â‡’ (0 – 1) / (100 – 50) = (y – 1) / (x – 500)

â‡’ Î¼ = (100 – x_{P}) / 50

Combining both in single equation,

**For fuzzy set STRONG:**

[50, 100] â‡’ (1 – 0) / (100 – 50) = (y – 0) / (x – 50)

Î¼_{Strong} = (x_{P} – 50) / 50

Define membership functions for descriptors **(Rotation)**

In similar way, we can compute the membership function for rotation, as shown below:

**Step 4: **Fuzzy rule base configuration

As we assumed, this controller has 3 fuzzy sub sets for temperature and 3 fuzzy subsets for pressure. So rule base will contain 3 x 3 i.e. 9 rules.

The rule base for given inputs and fuzzy sub sets is depicted in following table:

**Step 6: **Fuzzification

**30 % of temperature: **

x_{T} = (40 âˆ— 30) / 100 = 12

Î¼_{Cool} = (20 – x_{T}) / 20 = (20 – 12) / 20 = 8 / 20 = 2/5

Î¼_{Nominal} = x_{T} / 20 = 12 / 20 = 3/5

**40 % of pressure:**

x_{P} = (100 âˆ— 40) / 100 = 40

Î¼_{low} = (50 – x_{P}) / 50 = (50 – 40) / 50 = 10 / 50 = 1/5

Î¼_{Ok} = x_{P} / 50 = 40 / 50 = 4/5

Fired rules and the rule base for them is shown here:

**Step 7: **Identification of output

From rule base of fired rules, we can derive following rules,

**Rule 1**: If temperature is*cool*and pressure is*low*, then throttle setting is*P2***Rule 2**: If temperature is*cool*and pressure is*ok*, then throttle setting is*Z***Rule 3**: If temperature is*nominal*and pressure is*low*, then throttle setting is*P2***Rule 4**: If temperature is*nominal*and pressure is*ok*, then throttle setting is*Z*

** Step 8: **Defuzzification

Firing strength of each rule is highlighted in different colors in above figures. To compute the corresponding crisp value, we shall aggregate all output functions by placing them on same axis.

We can apply any defuzzification method on above aggregated output function to find the crisp value. Let us apply weighted average method.

Thus, for 40% of temperature (x_{T} = 12) and 30% of pressure (x_{P} = 30), we shall rotate the throttle by 16.984^{o}.

Thanks for your complete tutorial. I think in the last formula for computing x*, denominator should be sum of miu1 and miu2. It matches with the final answer.

Yes dear. Thanks for bringing it to my notice. Good observation. I will correct the typo mistake.