## 25. FUZZY LOGIC• Fuzzy logic theory; sets, rules and solving • To understand fuzzy logic control. • Be able to implement a fuzzy logic controller. Fuzzy logic is well suited to implementing control rules that can only be expressed verbally, or systems that cannot be modelled with linear differential equations. Rules and membership sets are used to make a decision. A simple verbal rule set is shown in Figure 25.1 A Fuzzy Logic Rule Set. These rules concern how fast to fill a bucket, based upon how full it is. Figure 25.1 A Fuzzy Logic Rule Set The outstanding question is "What does it mean when the bucket is empty, half full, or full?" And, what is meant by filling the bucket slowly or quickly. We can define sets that indicate when something is true (1), false (0), or a bit of both (0-1), as shown in Figure 25.1 Fuzzy Sets. Consider the bucket is full set. When the height is 0, the set membership is 0, so nobody would think the bucket is full. As the height increases more people think the bucket is full until they all think it is full. There is no definite line stating that the bucket is full. The other bucket states have similar functions. Notice that the angle function relates the valve angle to the fill rate. The sets are shifted to the right. In reality this would probably mean that the valve would have to be turned a large angle before flow begins, but after that it increases quickly. Now, if we are given a height we can examine the rules, and find output values, as shown in Figure 25.1 Fuzzy Rule Solving. This begins be comparing the bucket height to find the membership for bucket is full at 0.75, bucket is half full at 1.0 and bucket is empty at 0. Rule 3 is ignored because the membership was 0. The result for rule 1 is 0.75, so the 0.75 membership value is found on the stop filling and a value of a1 is found for the valve angle. For rule 2 the result was 1.0, so the fill slowly set is examined to find a value. In this case there is a range where fill slowly is 1.0, so the center point is chosen to get angle a2. These two results can then be combined with a weighted average to get . Figure 25.1 Fuzzy Rule Solving An example of a fuzzy logic controller for controlling a servomotor is shown in Figure 25.1 A Fuzzy Logic Servo Motor Controller [Lee and Lau, 1988]. This controller rules examines the system error, and the rate of error change to select a motor voltage. In this example the set memberships are defined with straight lines, but this will have a minimal effect on the controller performance. Figure 25.1 A Fuzzy Logic Servo Motor Controller Consider the case where verror = 30 rps and d/dt verror = 1 rps/s. Rule 1to 6 are calculated in Figure 25.1 Rule Calculation. The results from the individual rules can be combined using the calculation in Figure 25.1 Rule Results Calculation. In this case only two of the rules matched, so only two terms are used, to give a final motor control voltage of 15.8V. |