131.

 C++ Neural Networks and Fuzzy Logic by Valluru B. Rao M&T Books, IDG Books Worldwide, Inc. ISBN: 1558515526   Pub Date: 06/01/95

Section II: Fuzzy Control

This section discusses the fuzzy logic controller (FLC), its application and design. Fuzzy control is used in a variety of machines and processes today, with widespread application especially in Japan. A few of the applications in use today are in the list in Table 16.10, adapted from Yan, et al.

Table 16.10 Applications of Fuzzy Logic Controllers (FLCs) and Functions Performed

Application FLC function(s)
Video camcorder Determine best focusing and lighting when there is movement in the picture
Washing machine Adjust washing cycle by judging the dirt, size of the load, and type of fabric
Motor control Improve the accuracy and range of motion control under unexpected conditions
Subway train Increase the stable drive and enhance the stop accuracy by evaluating the passenger traffic conditions. Provide a smooth start and smooth stop.
Vacuum cleaner Adjust the vacuum cleaner motor power by judging the amount of dust and dirt and the floor characteristics
Hot water heater Adjust the heating element power according to the temperature and the quantity of water being used
Helicopter control Determine the best operation actions by judging human instructions and the flying conditions including wind speed and direction

Designing a Fuzzy Logic Controller

A fuzzy logic controller diagram was shown in Chapter 3. Let us redraw it now and discuss a design example. Refer to Figure 16.2. For the purpose of discussion, let us assume that this FLC controls a hot water heater. The hot water heater has a knob, HeatKnob(0-10) on it to control the heating element power, the higher the value, the hotter it gets, with a value of 0 indicating the heating element is turned off. There are two sensors in the hot water heater, one to tell you the temperature of the water (TempSense), which varies from 0 to 125° C, and the other to tell you the level of the water in the tank (LevelSense), which varies from 0 = empty to 10 = full. Assume that there is an automatic flow control that determines how much cold water (at temperature 10° C) flows into the tank from the main water supply; whenever the level of the water gets below 40, the flow control turns on, and turns off when the level of the water gets above 95.

Figure 16.2  Fuzzy control of a water heater.

The design objective can be stated as:

Keep the water temperature as close to 80° C as possible, in spite of changes in the water flowing out of the tank, and cold water flowing into the tank.

Step One: Defining Inputs and Outputs for the FLC

The range of values that inputs and outputs may take is called the universe of discourse. We need to define the universe of discourse for all of the inputs and outputs of the FLC, which are all crisp values. Table 16.11 shows the ranges:

Table 16.11 Universe of Discourse for Inputs and Outputs for FLC

Name Input/Output Minimum value Maximum value
LevelSense I 0 10
HeatKnob O 0 10
TempSense I 0 125

Step Two: Fuzzify the Inputs

The inputs to the FLC are the LevelSense and the TempSense. We can use triangular membership functions to fuzzify the inputs, just as we did in Chapter 3, when we constructed the fuzzifier program. There are some general guidelines you can keep in mind when you determine the range of the fuzzy variables as related to the crisp inputs (adapted from Yan, et al.):

1.  Symmetrically distribute the fuzzified values across the universe of discourse.
2.  Use an odd number of fuzzy sets for each variable so that some set is assured to be in the middle. The use of 5 to 7 sets is fairly typical.
3.  Overlap adjacent sets (by 15% to 25% typically) .

Both the input variables LevelSense and TempSense are restricted to positive values. We use the following fuzzy sets to describe them:

XSmall, Small, Medium, Large, XLarge

In Table 16.12 and Figure 16.3, we show the assignment of ranges and triangular fuzzy membership functions for LevelSense. Similarly, we assign ranges and triangular fuzzy membership functions for TempSense in Table 16.13 and Figure 16.4. The optimization of these assignments is often done through trial and error for achieving optimum performance of the FLC.

Crisp Input Range Fuzzy Variable 0–2 XSmall 1.5–4 Small 3–7 Medium 6–8.5 Large 7.5–10 XLarge

Figure 16.3  Fuzzy membership functions for LevelSense.

Table 16.13 Fuzzy Variable Ranges for TempSense

Crisp Input Range Fuzzy Variable
0–20 XSmall
10–35 Small
30–75 Medium
60–95 Large
85–125 XLarge

Figure 16.4  Fuzzy membership functions for TempSense.