第二章 Fuzzy Control:The Basics 2.1 Overview Questions: n Why do we select fuzzy controllers in many real-world systems? n How much of the success can be attributed to the use of the mathematical model and conventional control design approach? n How much should be attributed to the clever heuristic tuning that the control engineer uses upon implementation? n If we exploit the use of heuristic information throughout the entire design process, can we obtain higher performance control systems? n What is a fuzzy controller composed of ? n How do we design a fuzzy controller? n Whether do we need a model in fuzzy control? n What are the performance evaluation of fuzzy control? n What should we pay attention in fuzzy controller design? n What areas does fuzzy controller apply to ? What, then, is the motivation for turning to fuzzy control? Basically, the difficult task of modeling and simulating complex real world systems for control systems development, especially when implementation issues are considered, is well documented. Even if a relatively accurate model of a dynamic system can be developed, it is often too complex to use in controller development, especially for many conventional control design procedures that require restrictive assumptions for the plant (e.g., linearity). Why do we select fuzzy controllers in many real-world systems?It is for this reason that in practice conventional controllers are often developed via simple models of the plant behavior that satisfy the necessary assumptions, and via the ad hoc(special) tuning of relatively simple linear or nonlinear controllers. Regardless, it is well understood (although sometimes forgotten) that heuristics enter the conventional control design process as long as you are concerned with the actual implementation of the control system. It must be acknowledged, moreover, that conventional control engineering approaches that use appropriate heuristics to tune the design have been relatively successful. How much of the success can be attributed to the use of the mathematical model and conventional control design approach, and how much should be attributed to the clever heuristic tuning that the control engineer uses upon PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn implementation? And if we exploit the use of heuristic information throughout the entire design process, can we obtain higher performance control systems? Fuzzy control provides a formal methodology for representing, manipulating, and implementing a human's heuristic knowledge about how to control a system. In this section we seek to provide a philosophy of how to approach the design of fuzzy controllers. The fuzzy controller block diagram is given in Figure 3.1, where we show a fuzzy controller embedded in a closed-loop control system. The plant outputs are denoted by y(t), its inputs are denoted by u (t), and the reference input to the fuzzy controller is denoted by r (t). Figure 2.1 Fuzzy controller architecture. Basically, you should view the fuzzy controller as an artificial decision maker that operates in a closed-loop system in real time. It gathers plant output data y(t), compares it to the reference input r (t), and then decides what the plant input u(t) should be to ensure that the performance objectives, will be met. What is a fuzzy controller composed of ? The fuzzy controller has four main components: (1) The "rule-base" holds the knowledge, in the form of a set of rules, of how best to control the system. (2) The inference mechanism evaluates which control rules are relevant at the current time and then decides what the input to the plant should be. (3) The fuzzification interface simply modifies the inputs so that they can be interpreted and compared to the rules in the rule-base. (4) the defuzzification interface converts the conclusions reached by the inference mechanism into the inputs to the plant. How do we design a fuzzy controller? To design the fuzzy controller, the control engineer must gather information on how the artificial decision maker should act in the closed-loop system. Sometimes this information can come from a human decision maker who performs the control task, while at other times the control engineer can come to understand the plant dynamics and write down a set of rules about how to control the system without outside help. These "rules" basically say, "If the plant output and reference input are behaving in a certain manner, then the plant input should be some value." A whole set of such "If-Then" rules is loaded into the rule-base, and an inference strategy is chosen, then the system is ready to be tested to see if the PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn closed-loop specifications are met. This brief description provides a very high level overview of how to design a fuzzy control system. Below we will expand on these basic ideas and provide more details on this procedure and its relationship to the conventional control design procedure. Whether do we need a model in fuzzy control? People working in fuzzy control often say that "a model is not needed to develop a fuzzy controller, and this is the main advantage of the approach." However, will a proper understanding of the plant dynamics be obtained without trying to use first principles of physics to develop a mathematical model? And will a proper understanding of how to control the plant be obtained without simulation-based evaluations that also need a model? We always know roughly what process we are controlling (e.g, we know whether it is a vehicle or a nuclear reactor), and it is often possible to produce at least an approximate model, so why not do this? For a safety-critical application, if you do not use a formal model, then it is not possible to perform mathematical analysis or simulation-based evaluations. Is it wise to ignore these analytical approaches for such applications? Clearly, there will be some applications where you can simply "hack" together a controller (fuzzy or conventional) and go directly to implementation. In such a situation there is no need for a formal model of the process; however, is this type of control problem really so challenging that fuzzy control is even needed? Could a conventional approach (such as PID control) or a "table look-up" scheme work just as well or better, especially considering implementation complexity? Overall, when you carefully consider the possibility of ignoring the information that is frequently available in a mathematical model, it is clear that it will often be unwise to do so. Basically, then, the role of modeling in fuzzy control design is quite similar to its role in conventional control system design. In fuzzy control there is a more significant emphasis on the use of heuristics, but in many control approaches (e.g, PID control for process control) there is a similar emphasis. Basically, in fuzzy control there is a focus on the use of rules to represent how to control the plant rather than ordinary differential equations (ODE). This approach can offer some advantages in that the representation of knowledge in rules seems more lucid and natural to some people. For others, though, the use of differential equations is more clear and natural. Basically, there is simply a "language difference" between fuzzy and conventional control: ODEs are the language of conventional control, and rules are the language of fuzzy control. The performance objectives and design constraints are the same as the ones for conventional control that we summarized above, since we still want to meet the same types of closed-loop specifications. The fundamental limitations that the plant provides affect our ability to achieve high-performance control, and these are still present just as they were for conventional control (e.g, nonminimum phase or unstable behavior still presents challenges for fuzzy control). How do we design a fuzzy controller? Fuzzy control system design essentially amounts to (1) choosing the fuzzy controller inputs and outputs, (2) choosing the preprocessing that is needed for the controller inputs and possibly postprocessing that is needed for the outputs, and (3) designing each of the four components of the fuzzy controller shown in Figure 2.1. As you will see in the next chapter, there are standard choices for the fuzzification and defuzzification interfaces. Moreover, most often the designer settles on an inference mechanism and may use this for many different processes. Hence, the main part of the fuzzy controller that we focus on for design to the rule-base. What is the main task in fuzzy controller design process? The rule-base is constructed so that it represents a human expert "in-the-loop." Hence, the information that we load into PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn the rules in the rule-base may come from an actual human expert who has spent a long time learning how best to control the process. In other situations there is no such human expert, and the control engineer will simply study the plant dynamics (perhaps using modeling and simulation) and write down a set of control rules that makes sense. As an example, in the cruise control problem discussed above it is clear that anyone who has experience driving a car can practice regulating the speed about a desired set-point and load this information into a rule-base. For instance, one rule that a human driver may use is "If the speed is lower than the set-point, then press down further on the accelerator pedal." A rule that would represent even more detailed information about how to regulate the speed would be "If the speed is lower than the set-point AND the speed is approaching the set-point very fast, then release the accelerator pedal by a small amount." This second rule characterizes our knowledge about how to make sure that we do not overshoot our desired goal (the set-point speed). Generally speaking, if we load very detailed expertise into the rule-base, we enhance our chances of obtaining better performance. What are the performance evaluation of fuzzy control? Each and every idea on performance evaluation for conventional controllers applies here as well. The basic reason for this is that a fuzzy controller is a nonlinear controller—so many conventional modeling, analysis (via mathematics, simulation, or experimentation), and design ideas apply directly. Since fuzzy control is a relatively new technology, it is often quite important to determine what value it has relative to conventional methods. Unfortunately, few have performed detailed comparative analyses between conventional and intelligent control that have taken into account a wide array of available conventional methods (linear, nonlinear, adaptive, etc.); fuzzy control methods (direct, adaptive, supervisory); theoretical, simulation, and experimental analyses; computational issues; and so on. What should we pay attention in fuzzy controller design? Moreover, most work in fuzzy control to date has focused only on its advantages and has not taken a critical look at what possible disadvantages there could be to using it (hence the reader should be cautioned about this when reading the literature). For example, the following questions are cause for concern when you employ a strategy of gathering heuristic control knowledge: ? Will the behaviors that are observed by a human expert and used to construct the fuzzy controller include all situations that can occur due to disturbances, noise, or plant parameter variations? ? Can the human expert realistically and reliably foresee problems that could arise from closed-loop system instabilities or limit cycles? ? Will the human expert be able to effectively incorporate stability criteria and performance objectives (e.g., rise-time, overshoot, and tracking specifications) into a rule-base to ensure that reliable operation can be obtained? These questions may seem even more troublesome (1) if the control problem involves a safety-critical environment where the failure of the control system to meet performance objectives could lead to loss of human life or an environmental disaster, or (2) if the human expert's knowledge implemented in the fuzzy controller is somewhat inferior to that of the very experienced specialist we would expect to design the control system (different designers have different levels of expertise). Clearly, then, for some applications there is a need for a methodology to develop, implement, and evaluate fuzzy controllers to ensure that they are reliable in meeting their performance specifications. This is the basic theme and focus of this book. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Application Arears: Fuzzy systems have been used in a wide variety of applications in engineering, science, business, medicine, psychology, and other fields. For instance, in engineering some potential application areas include the following: ?Aircraft/spacecraft: Flight control, engine control, avionic systems, failure diagnosis, navigation, and satellite attitude control. ?Automated highway systems: Automatic steering, braking, and throttle control for vehicles. ?Automobiles: Brakes, transmission, suspension, and engine control. ?Autonomous vehicles: Ground and underwater. ?Manufacturing systems: Scheduling and deposition process control. ?Power industry: Motor control, power control/distribution, and load estimation. ?Process control: Temperature, pressure, and level control, failure diagnosis, distillation column control, and desalination processes. ?Robotics: Position control and path planning. This list is only representative of the range of possible applications for the methods of this book. Others have already been studied, while still others are yet to be identified. The primary goal of control engineering is to distill and apply knowledge about how to control a process so that the resulting control system will reliably and safely achieve high-performance operation. In this chapter we show how fuzzy logic provides a methodology for representing and implementing our knowledge about how best to control a process. 2.2 Fuzzy Control: A Tutorial Introduction Questions: n How do we choose fuzzy controller inputs and outputs ? n How do we put control knowledge in to rule-bases? n How do we quantify the knowledge in fuzzy controller design? Why do that? Review: What are a fuzzy controller composed? A block diagram of a fuzzy control system is shown in Figure 2.1.The fuzzy controller is composed of the following four elements: 1. A rule-base (a set of If-Then rules), which contains a fuzzy logic quantification of the expert's linguistic description of how to achieve good control. 2. An inference mechanism (also called an "inference engine" or "fuzzy inference" module), which emulates the expert's decision making in interpreting and applying knowledge about how best to control the plant. 3. A fuzzification interface, which converts controller inputs into information that the inference mechanism can easily use to activate and apply rules. 4. A defuzzification interface, which converts the conclusions of the inference mechanism into actual inputs for the PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn process. We introduce each of the components of the fuzzy controller for a simple problem of balancing an inverted pendulum on a cart, as shown in Figure 2.2. Here, y denotes the angle that the pendulum makes with the vertical (in radians), l is the half-pendulum length (in meters), and u is the force input that moves the cart (in Newtons). We will use r to denote the desired angular position of the pendulum. The goal is to balance the pendulum in the upright position (i.e., r = 0) when it initially starts with some nonzero angle off the vertical (i.e., y≠0). Figure 2.2 Inverted pendulum on a cart 2.2.1 Choosing Fuzzy Controller Inputs and Outputs How do we choose fuzzy controller inputs and outputs ? Consider a human-in-the-loop whose responsibility is to control the pendulum, as shown in Figure 2.3. The fuzzy controller is to be designed to automate how a human expert who is successful at this task would control the system. First, the expert tells us (the designers of the fuzzy controller) what information she or he will use as inputs to the decision-making process. Suppose that for the inverted pendulum, the expert (this could be you!) says that she or he will use ()()()etrtyt=? and ()d et dt as the variables on which to base decisions. Certainly, there are many other choices (e.g., the integral of the error e could also be used) but this choice makes good intuitive sense. Next, we must identify the controlled variable. For the inverted pendulum, we are allowed to control only the force that moves the cart, so the choice here is simple. For more complex applications, the choice of the inputs to the controller and outputs of the controller (inputs to the plant) can be more difficult. Essentially, you want to make sure that the controller will have the proper information available to be able to make good decisions and have proper control inputs to be able to steer the system in the directions needed to be able to achieve high-performance operation. Practically speaking, access to information and the ability to effectively control the system often cost money. If the designer believes that proper information is not available for making control decisions, he or she may have to invest in another sensor that can provide a measurement of another system variable. Alternatively, the designer may implement some filtering or other, processing of the plant outputs. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Figure 2.3 Human controlling an inverted pendulum on a cart In addition, if the designer determines that the current actuators will not allow for the precise control of the process, he or she may need to invest in designing and implementing an actuator that can properly affect the process. Hence, while in some academic problems you may be given the plant inputs and outputs, in many practical situations you may have some flexibility in their choice. These choices affect what information is available for making on-line decisions about the control of a process and hence affect how we design a fuzzy controller. Once the fuzzy controller inputs and outputs are chosen, you must determine what the reference inputs are. For the inverted pendulum, the choice of the reference input r = 0 is clear. In some situations, however, you may want to choose r as some nonzero constant to balance the pendulum in the off-vertical position. To do this, the controller must maintain the cart at a constant velocity so that the pendulum will not fall. Figure 2.4 Fuzzy controller for an inverted pendulum on a cart After all the inputs and outputs are defined for the fuzzy controller, we can specify the fuzzy control system. The fuzzy control system for the inverted pendulum, with our choice of inputs and outputs, is shown in Figure 2.4. Now, within this framework we seek to obtain a description of how to control the process. We see then that the choice of the inputs and outputs of the controller places certain constraints on the remainder of the fuzzy control design process. If the proper information is not provided to the fuzzy controller, there will be little hope for being able to design a good rule-base or inference mechanism. Moreover, even if the proper information is available to make control decisions, this will be of little use if the controller is not able to properly affect the process variables via the process inputs. It must be understood that the choice of the controller inputs and outputs is a fundamentally important part of the control design process. This is a very simple and academic nonlinear control problem, and many good techniques already exist for its solution. Indeed, for this standard configuration, a simple PID controller works well even in implementation. In the remainder of this section, we will use the inverted pendulum as a convenient problem to illustrate the design and basic mechanics of the operation of a fuzzy control system. We will also use this problem in Section 2.4 to discuss much more general issues in fuzzy control system design that the reader will find useful for more challenging PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn applications (e.g., the ones in the next chapter). 2.2.2 Putting Control Knowledge into Rule-Bases How do we put control knowledge in to rule-bases? Suppose that the human expert shown in Figure 2.3 provides a description of how best to control the plant in some natural language (e.g., English). We seek to take this "linguistic" description and load it into the fuzzy controller, as indicated by the arrow in Figure 2.4. n Linguistic description n Rules n Rule-bases Linguistic Descriptions The linguistic description provided by the expert can generally be broken into several parts. There will be "linguistic variables" that describe each of the time-varying fuzzy controller inputs and outputs. For the inverted pendulum, l "error" describes e(t) l "change-in-error" describes ()d etdt l "force" describes u(t) Note that we use quotes to emphasize that certain words or phrases are linguistic descriptions, and that we have added the time index to, for example, e(t), ()d etdt to emphasize that generally e varies with time. There are many possible choices for the linguistic descriptions for variables. Some designers like to choose them so that they are quite descriptive for documentation purposes. However, this can sometimes lead to long descriptions. Others seek to keep the linguistic descriptions as short as possible (e.g., using "e(t)" as the linguistic variable for e(t )), yet accurate enough so that they adequately represent the variables, Regardless, the choice of the linguistic variable has no impact on the way that the fuzzy controller operates; it is simply a notation that helps to facilitate the construction of the fuzzy controller via fuzzy logic. Just as e(t) takes on a value of, for examples 0.1 at t = 2 (e(2) = 0.1), linguistic variables assume "linguistic values" . That is, the values that linguistic variables take on overtime change dynamically. Suppose for the pendulum example that "error ," "change-in-error , " and "force" take on the following values: l "neglarge" l "negsmall" l "zero" l "possmall" l "poslarge" Note that we are using "negsmall" as an abbreviation for "negative small in size" and so on for the other variables. Such abbreviations help keep the linguistic descriptions short yet precise. For an even shorter description we could use integers: l "-2" to represent "neglarge" l "-1" to represent "negsmall" PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn l "0" to represent "zero" l "1" to represent "possmall" . l "2" to represent "poslarge" This is a particularly appealing choice for the linguistic values since the descriptions are short and nicely represent that the variable we are concerned with has a numeric quality. We are not, for example, associating "-1" with any particular number of radians of error; the use of the numbers for linguistic descriptions simply quantifies the sign of the error (in the usual way) and indicates the size in relation to the other linguistic values. We shall find the use of this type of linguistic value quite convenient and hence will give it the special name, "linguistic-numeric value." The linguistic variables and values provide a language for the expert to express her or his ideas about the control decision-making process in the context of the framework established by our choice of fuzzy controller inputs and outputs. Recall that for the inverted pendulum r = 0 and e = r - y so that ey=? and ddeydtdt=? since 0d rdt = . First, we will study how we can quantify certain dynamic behaviors with linguistics. In the next subsection we will study how to quantify knowledge about how to control the pendulum using linguistic descriptions. For the inverted pendulum each of the following statements quantifies a different configuration of the pendulum: ? The statement "error is poslarge" can represent the situation where the pendulum is at a significant angle to the left of the vertical. ? The statement"error is negsmall" can represent the situation where the pendulum is just slightly to the right of the vertical, but not too close to the vertical to justify quantifying it as ''zero" and not too far away to justify quantifying it as "neglarge." ? The statement "error is zero" can represent the situation where the pendulum is very near the vertical position (a linguistic quantification is not precise, hence we are willing to accept any value of the error around e(t) = 0 as being quantified linguistically by "zero" since this can be considered a better quantification than "possmall" or "negsmall“). ? The statement "error is poslarge and change-in-error is possmall" can represent the situation where the pendulum is to the left of the vertical and, since , the pendulum is moving away from the upright position (note that in this case the pendulum is moving counterclockwise). Overall, we see that to quantify the dynamics of the process we need to have a good understanding of the physics of the underlying process we are trying to control. While for the pendulum problem, the task of coming to a good understanding of the dynamics is relatively easy, this is not the case for many physical processes. Quantifying the process dynamics with linguistics is not always easy, and certainly a better understanding of the process dynamics generally leads to a better linguistic quantification. Often, this win naturally lead to a better fuzzy controller provided that you can adequately measure the system dynamics so that the fuzzy controller can make the right decisions at the proper time. Rules: Next, we will use the above linguistic quantification to specify a set of rules (a rule-base) that captures the expert's knowledge about how to control the plant. In particular, for the inverted pendulum in the three positions shown in Figure 2.5, we have the following rules (notice that we drop the quotes since the whole rule is linguistic): 1. If error is neglarge and change-in-error is neglarge Then force is poslarge This rule quantifies the situation in Figure 2.5(a) where the pendulum has a large positive angle and is moving clockwise; hence it is clear that we should apply a strong positive force (to the right) so that we can try to start the pendulum moving in the proper direction. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn (a) (b) (c) Figure 2.5 Inverted pendulum in various positions 2. If error is zero and change-in-error is possmall Then force is negsmall This rule quantifies the situation in Figure 2.5(b) where the pendulum has nearly a zero angle with the vertical (a linguistic quantification of zero does not imply that e(t) = 0 exactly) and is moving counterclockwise; hence we should apply a small negative force (to the left) to counteract the movement so that it moves toward zero (a positive force could result in the pendulum overshooting the desired position). 3. If error is poslarge and change-in-error is negsmall Then force is negsmall This rule quantifies the situation in Figure 2.5(c) where the pendulum is far to the left of the vertical and is moving clockwise; hence we should apply a small negative force (to the left) to assist the movement, but not a big one since the pendulum is already moving in the proper direction. Each of the three rules listed above is a "linguistic rule" since it is formed solely from linguistic variables and values. Since linguistic values are not precise representations of the underlying quantities that they describe, linguistic rules are not precise either. They are simply abstract ideas about how to achieve good control that could mean somewhat different things to different people. They are, however, at a level of abstraction that humans are often comfortable with in terms of specifying how to control a process. The general form of the linguistic rules listed above is If premise Then consequent As you can see from the three rules listed above, the premises (which are sometimes called "antecedents") are associated with the fuzzy controller inputs and are on the left-hand-side of the rules. The consequents (sometimes called "actions") are associated with the fuzzy controller outputs and are on the right-hand-side of the rules. Notice that each premise (or consequent) can be composed of the conjunction of several "terms" (e.g., in rule 3 above "error is poslarge and change-in-error is negsmall" is a premise that is the Conjunction of two terms). The number of fuzzy controller inputs and outputs places an upper limit on the number of elements in the premises and consequents. Note that there does not need to be a premise (consequent) term for each input (output) in each rule, although often there is. Rule-Bases Using the above approach, we could continue to write down rules for the pendulum problem for all possible cases (the reader should do this for practice, at least for a few more rules). Note that since we only specify a finite number of linguistic variables and linguistic values, there is only a finite number of possible rules. For the pendulum problem, with two inputs and five linguistic values for each of these, there are at most 25 = 25 possible rules (all possible combinations of premise linguistic values for two inputs). PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn A convenient way to list all possible rules for the case where there are not too many inputs to the fuzzy controller (less than or equal to two or three) is to use a tabular representation. A tabular representation of one possible set of rules for the inverted pendulum is shown in Table 2.1. Notice that the body of the table lists the linguistic-numeric consequents of the rules, and the left column and top row of the table contain the linguistic-numeric premise terms. Then, for instance, the (2, -1) position (where the "2" represents the row having "2" for a numeric-linguistic value and the "-1" represents the column having "-1" for a numeric-linguistic value) has a -1 ("negsmall") in the body of the table and represents the rule: If error is poslarge and change-in-error is negsmall Then force is negsmall which is rule 3 above. Table 2.1 represents abstract knowledge that the expert has about how to control the pendulum given the error and its derivative as inputs. Table 2.1 Rule Table for Inverted Pendulum “change-in-error” e ? “force” u -2 -1 0 1 2 -2 2 2 2 1 0 -1 2 2 1 0 -1 0 2 1 0 -1 -2 1 1 0 -1 -1 -2 “error” e 2 0 -1 -2 -2 -2 The reader should convince him- or herself that the other rules are also valid and take special note of the pattern of rule consequents that appears in the body of the table. Notice the diagonal of zeros and viewing the body of the table as a matrix we see that it has a certain symmetry to it. This symmetry that emerges when the rules are tabulated is no accident and is actually a representation of abstract knowledge about how to control the pendulum; it arises due to a symmetry in the system's dynamics. We will actually see later that similar patterns will be found when constructing rule-bases for more challenging applications, and we will show how to exploit this symmetry in implementing fuzzy controllers. 2.2.3 Fuzzy Quantification of Knowledge How do we quantify the knowledge in fuzzy controller design? Why do that? Up to this point we have only quantified, in an abstract way, the knowledge that the human expert has about how to control the plant. Next, we will show how to use fuzzy logic to fully quantify the meaning of linguistic descriptions so that we may automate, in the fuzzy controller, the control rules specified by the expert. n Membership functions n Fuzzifiction Membership Functions First, we quantify the meaning of the linguistic values using "membership functions." Consider, for example, Figure 2.6. This is a plot of a function versus e(t) that takes on special meaning. The function n quantifies the certainty1 that e(t) can be classified linguistically as "possmall." PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn To understand the way that a membership function works, it is best to perform a case analysis where we show how to interpret it for various values of e(t): ?If () 2et p=? then ()02pm?=, indicating that we are certain that () 2et p=? is not "possmall." ?If () 8et p= then ()0.58pm = , indicating that we are halfway certain that () 8et p= is"possmall" (we are only halfway certain since it could also be "zero" with some degree of certainty this value is in a "gray area" in terms of linguistic interpretation). ?If () 4et p= then ()1.04pm = , indicating that we are absolutely certain that () 4et p= is what we mean by "possmall." ?If ()et p= then ()0mp = , indicating that we are certain that ()et p= is not "possmall" (actually, it is "poslarge"). Figure 2.6 Membership function for linguistic value "possmall." The membership function quantifies, in a continuous manner, whether values of e(t) belong to (are members of) the set of values that are "possmall," and hence it quantifies the meaning of the linguistic statement "error is possmall." This is why it is called a membership function. It is important to recognize that the membership function in Figure 2.6 is only one possible definition of the meaning of "error is possmall"; you could use a bell-shaped function, a trapezoid, or many others. Figure 2.7(a) A few membership function choices for representing "error is possmall." For instance, consider the membership functions shown in Figure 2.7. For some application someone may be able to PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn argue that we are absolutely certain that any value of e(t) near 4 p is still "possmall" and only when you get sufficiently far from 4 p do we lose our confidence that it is "possmall." One way to characterize this understanding of the meaning of "possmall" is via the trapezoid-shaped membership function in Figure 2.7(a). For other applications you may think of membership in the, set of "possmall" values as being dictated by the Gaussian-shaped membership function (not to be confused with the Gaussian probability density function) shown in Figure 2.7(b). For still other applications you may not readily accept values far away from 4p as being "possmall," so you may use the membership function in Figure 2.7(c) to represent this. Finally, while we often think of symmetric characterizations of the meaning of linguistic values, we are not restricted to these symmetric representations. Figure 2.7 (b) A few membership function choices for representing "error is possmall." Figure 2.7(c) A few membership function choices for representing "error is possmall." For instance, in Figure 2.7(d) we represent that we believe that as e(t) moves to the left of 4 p we are very quick to reduce our confidence that it is "possmall," but if we move to the right of 4p our confidence that e(t) is "possmall," diminishes at a slower rate. In summary, we see that depending on the application and the designer (expert), many, different choices of membership functions are possible. We will further discuss other ways to define membership functions in Section 2.3.2. It is important to note here, however, that for the most part the definition of a membership function is subjective rather than objective. That is, we simply quantify it in a manner that makes sense to us, but others, may quantify it in a different manner. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Figure 2.7(d) A few membership function choices for representing "error is possmall." The set of values that is described by as being "positive small" is called a "fuzzy set." Let A denote this fuzzy set. Notice that from Figure 2.6. we are absolutely certain that e(t) = 4p is an element of A, but we are less certain that e(t) =16p is an element of A. Membership in the set, as specified by the membership function, is fuzzy; hence we use the term "fuzzy set." A "crisp" (as contrasted to "fuzzy") quantification of "possmall" can also be specified, but via the membership function shown in Figure 2.8. This membership function is simply an alternative representation for the interval on the real line 3()88etpp≤≤, and it indicates that this interval of numbers represents "possmall." Clearly,this characterization of crisp sets is simply another way to represent a normal interval (set) of real numbers. Figure 2.8 Membership function for a crisp set. While the vertical axis in Figure 2.6represents certainty, the horizontal axis is also given a special name. It is called the "universe of discourse" for the input e(t) since it provides the range of values of e(t) that can be quantified with linguistics and fuzzy sets. In conventional terminology, a universe of discourse for an input or output of a fuzzy system is simply the range of values the inputs and outputs can take on.. Now that we know how to specify the meaning of a linguistic value via a membership function (and hence a fuzzy set), we can easily specify the membership functions for all 15 linguistic values (five for each input and five for the output) of our inverted pendulum example. See Figure 2.9for one choice of membership functions. Notice that (for our later convenience) we list both the linguistic values and the linguistic-numeric values associated with each membership function. Hence, we see that the membership function in Figure 2.6 for "possmall" is embedded among several others that describe other sizes of values (so that, for instance, the membership function to the right of the one for "possmall" is the one that represents "error is poslarge"). Note that other similarly shaped membership functions PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn make sense (e.g., bell-shaped membership functions). The membership functions at the outer edges in Figure 2.9 deserve special attention. For "the inputs and we see that the outermost membership functions "saturate" at a value of one. This makes intuitive sense as at some point the human expert would just group all large values together in a linguistic description such as "poslarge." The membership functions at the outermost edges appropriately characterize this phenomenon since they characterize "greater than" (for the right side) and "less than" (for the left side). Figure 2.9 Membership functions for an inverted pendulum on a cart. For the output u, the membership functions at the outermost edges cannot be saturated for the fuzzy system to be properly defined. The basic reason for this is that in decision-making processes of the type we study, we seek to take actions that specify an exact value for the process input. We do not generally indicate to a process actuator, "any value bigger than, say, 10, is acceptable." It is important to have a clear picture in your mind of how the values of the membership functions change as, for example, e(t) changes its value over time. For instance, as e(t) changes from 2p? to 2p we see that various membership functions will take on zero and nonzero values indicating the degree to which the linguistic value appropriately describes the current value of e(t). For example, at e(t) = 2p? we are certain that the error is "neglarge," and as the value of e(t) moves toward 4p? we become less certain that it is "neglarge" and more certain that it is "negsmall." We see that the membership functions quantify the meaning of linguistic statements that describe time-varying signals. Finally, note that often we will draw all the membership functions for one input or output variable on one graph; hence, we often omit the label for the vertical axis with the understanding that the plotted functions are membership PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn functions describing the meaning of their associated linguistic values. Also, we will use the notation zerom to represent the membership function associated with the linguistic value "zero" and a similar notation for the others. The rule-base of the fuzzy controller holds the linguistic variables, linguistic values, their associated membership functions, and the set of all linguistic rules (shown in Table 2.1), so we have completed the description of the simple inverted pendulum. Next we describe the fuzzification process. Fuzzification It is actually the case that for most fuzzy controllers the fuzzification block in Figure 2.1 can be ignored since this process is so simple. In Section 2.3.3 we will explain the exact operations of the fuzzification process and also explain why it can be simplified and under certain conditions virtually ignored. For now, the reader should simply think of the fuzzification process as the act of obtaining a value of an input variable (e.g., e(t)) and finding the numeric values of the membership function(s) that are defined for that variable. For example, if () 4et p= and () 16d etdt p= ,the fuzzification process amounts to finding the values of the input membership functions for these. In this case ( )( ) 1possmall etm = (with all others zero) and () () 0.5zeropossmallddetetd dtmm????==????????.Some think of the membership function values as an "encoding" of the fuzzy controller numeric input values. The encoded information is then used in the fuzzy inference process that starts with "matching." 2.2.4 Matching: Determining Which Rules to Use How do we decide which rules to use? Next, we seek to explain how the inference mechanism in Figure 2.1 operates. The inference process generally involves two steps: 1. The premises of all the rules are compared to the controller inputs to determine which rules apply to the current situation. This "matching" process involves determining the certainty that each rule applies, and typically we will more strongly take into account the recommendations of rules that we are more certain apply to the current situation. 2. The conclusions (what control actions to take) are determined using the rules that have been determined to apply at the current time. The conclusions are characterized with a fuzzy set (or sets) that represents the certainty that the input to the plant should take on various values. n Premise quantification via fuzzy logic n Determining which rules are on Premise Quantification via Fuzzy Logic To perform inference we must first quantify each of the rules with fuzzy logic. To do this we first quantify the meaning of the premises of the rules that are composed of several terms,each of which involves a fuzzy controller input. Consider Figure 2.10, where we list two terms from the premise of the rule, If error is zero and change-in-error is possmall Then force is negsmall Above, we had quantified the meaning of the linguistic terms "error is zero" and "change-in-error is possmall" via the membership functions shown in Figure 2.9. Now we seek to quantify the linguistic premise "error is zero and change-in-error is possmall." Hence, the main item to focus on is how to quantify the logical "and" operation that combines the meaning of two linguistic terms. While we could use standard Boolean logic to combine these linguistic PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn terms, since we have quantified them more precisely with fuzzy sets (i.e., the membership functions), we can use these. To see how to quantify the "and" operation, begin by supposing that e(t) = 8p and () 32d etdt p= , so that using Figure 2.9 (or Figure 3.10) we see that ( )( ) 0.5zero etm = and () 0.25possmall d etdtm ??=????.What, for these values of e(t) and ()detdt , is the certainty of the statement "error is zero and change-in-error is possmall" that is the premise from the above rule? We will denote this certainty by premisem . Figure 2.10 Membership functions of premise terms. There are actually several ways to define it: ? Minimum: Define premisem = min{0.5,0.25} = 0.25, that is, using the minimum of the two membership values. ? Product: Define premisem = (0.5)(0.25) = 0.125, that is, using the product of the two membership values. Do these quantifications make sense? Notice that both ways of quantifying the "and" operation in the premise indicate that you can be no more certain about the conjunction of two statements than you are about the individual terms that make them up (note that 01premisem≤≤for either case). If we are not very certain about the truth of one statement, how can we be any more certain about the truth of that statement "and" the other statement? It is important that you convince yourself that the above quantifications make sense. To do so, we recommend that you consider other examples of "anding" linguistic terms that have associated membership functions. While we have simply shown how to quantify the "and" operation for one value of e(t) and ()detdt , if we consider all possible e(t) and ()detdt values, we will obtain a multidimensional membership function () (),premise detetdtm ??????that is a function of e(t) and ()detdt for each rule. For our example, if we choose PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn the minimum operation to represent the "and" in the premise, then we get the multidimensional membership function () (),premise detetdtm ?????? shown in Figure 2.11. Figure 2.11 Membership function of the premise for a single rule Notice that if we pick values for e(t) and () (),premise detetdtm ??????, the value of the premise certainty represents how certain we are that the rule : If error is zero and change-in-error is possmall Then force is negsmall is applicable for specifying the force input to the plant. As e(t) and ()detdt change, the value of () (),premise detetdtm ??????changes according to Figure 2.11, and we become less or more certain of the applicability of this rule. In general we will have a different premise membership function for each of the rules in the rule-base, and each of these will be a function of e(t) and ()detdt so that given specific values of e(t) and ()detdt we obtain a quantification of the certainty that each rule in the rule-base applies to the current situation. It is important you picture in your mind the situation where e(t) and ()detdt change dynamically over time. When this occurs the values of () (),premise detetdtm ??????for each rule change, and hence the applicability of each rule in the rule-base for specifying the force input to the pendulum, changes with time. Determining Which Rules Are On Determining the applicability of each rule is called "matching." We say that a rule is "on at time t" if its premise membership function () (),0premise detetdtm ??>????. Hence, the inference mechanism seeks to determine which rules are on to find out which rules are relevant to the current situation. In the next step, the inference mechanism will seek to combine the recommendations of all the rules to come up with a single conclusion. Consider, for the inverted pendulum example, how we compute the rules that are on. Suppose PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn that ( ) 0et = and () 0.294832d etdt pp=?= . Figure 2.12 Input membership functions with input values Figure 2.12 shows the membership functions for the inputs and indicates with thick black vertical lines the values above for e(t) and ()detdt . Notice that (())1zero etm = but that the other membership functions for the e(t) input are all "off' (i.e., their values are zero).For the ()detdt input we see that (() 0.25zero d etdtm = and (() 0.75possmall d etdtm = and that all the other membership functions are off. This implies that rules that have the premise terms "error is zero" "change-in-error is zero" "change-in-error is possmall" are on (all other rules have () (),0premise detetdtm ??=????). So, which rules are these? Using Table 2.1, we find that the rules that are on are the following: 1. If error is zero and change-in-error is zero Then force is zero 2. If error is zero and change-in-error is possmall Then force is negsmall Note that since for the pendulum example we have at most two membership functions overlapping, we will never have more than four rules on at one time (this concept generalizes to many inputs). Actually, for this system we will either have one, two, or four rules on at any one time. To get only one rule on choose, for example, e(t) = 0 and () 8d etdt p= so that only rule 2 above is on. It is useful to consider pictorially which rules are on. Consider Table 2.2, which is a copy of Table 2.1 with boxes drawn around the consequents of the rules that are on (notice that these are the same two rules listed above). Notice that since e(t) = 0 (e(t) is directly in the middle between the membership functions for "possmall" and "negsmall") both these membership functions are off. If we perturbed e(t) slightly positive (negative), then we would have the two rules below PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn (above) the two highlighted ones on also. With this, you should picture in your mind how a region of rules that are on (that involves no more than four cells in the body of Table 2.2 due to how we define the input membership functions) will dynamically move around in the table as the values of e(f) and ()detdt change. This completes our description of the "matching" phase of the inference mechanism. Table 2.2 Rule Table for the Inverted Pendulum with Rules That Are "On" Highlighted. “change-in-error” e ? “force” u -2 -1 0 1 2 -2 2 2 2 1 0 -1 2 2 1 0 -1 0 2 1 0 -1 -2 1 1 0 -1 -1 -2 “error” e 2 0 -1 -2 -2 -2 2.2.5 Inference Step: Determining Conclusions How do we determine conclusions? Next, we consider how to determine which conclusions should be reached when the rules that are on are applied to deciding what the force input to the cart carrying the inverted pendulum should be. To do this, we will first consider the recommendations of each rule independently. Then later we will combine all the recommendations from all the rules to determine the force input to the cart. Recommendation from One Rule Consider the conclusion reached by the rule: “If error is zero and change-in-error is zero Then force is zero” which for convenience we will refer to as "rule (1)." Using the minimum to represent the premise, we have () { }1 min0.25,10.25premisem == (the notation ()1premisem represents for rule (1)) so that we are 0.25 certain that this rule applies to the current situation. The rule indicates that if its premise is true then the action indicated by its consequent should be taken. For rule (1) the consequent is "force is zero" (this makes sense, for here the pendulum is balanced, so we should not apply any force since this would tend to move the pendulum away from the vertical). The membership function for this consequent is shown in Figure 2.13(a). The membership function for the conclusion reached by rule (1), which we denote by ()1m , is shown in Figure 2.13(b) and is given by () ( ){ }1 min0.25, zero umm= . This membership function defines the "implied fuzzy set" for rule (1) (i.e., it is the conclusion that is implied by rule (1)). The justification for the use of the minimum operator to represent the implication is that we can be no more certain about our consequent than our premise. We could use the product operation to represent the implication also. Notice that the membership function ()( )1 um is a function of u and that the minimum operation will generally PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn "chop off the top" of the membership function ( )zero um to produce ()( )1 um . For different values of e(t) and ()detdt there will be different values of the premise certainty () () ()1 ,premise detetdtm ??????or rule (1) and hence different functions obtained (i.e., it will chop off the top at different points). Figure2.13 (a) Consequent membership function and (b) implied fuzzy set with membership function M(i)(?) for rule (1). Recall that the units for u(t) are Newtons (N). We see that ()( )1 um is in general a time-varying function that quantifies how certain rule (1) is that the force input u should take on certain values. It is most certain that the force input should lie in a region around zero (see Figure 2.13(b)), and it indicates that it is certain that the force input should not be too large in either the positive or negative direction—this makes sense if you consider the linguistic meaning of the rule. The membership function ()( )1 um quantifies the conclusion reached by only rule (1) and only for the current e(t) and ()detdt . Recommendation from Another Rule Next, consider the conclusion reached by the other rule that is on: “If error is zero and change-in-error is possmall Then force is negsmall” which for convenience we will refer to as "rule (2)." Using the minimum to represent the premise, we have () { }2 min0.75,10.75premisem ==so that we are 0.75 certain that this rule applies to the current situation. Notice that we are much more certain that rule (2) applies to the current situation than rule (1). For rule (2) the consequent is "force is negsmall" (this makes sense, for here the pendulum is perfectly balanced but is moving in the counterclockwise direction with a small velocity). The membership function for this consequent is shown in Figure 2.14(a). The membership function for the conclusion reached by rule (2), which we denote by ()2m , is shown in Figure 2.14(b) (the shaded region) and is given by ()( ) ( ){ }2 min0.75, negsmalluumm= . This membership function defines the implied fuzzy set for rule (2) (i.e., it is the conclusion that is reached by rule (2)). Once again, for different values of e(t) and ()detdt there will be different values of () () ()2 ,premise detetdtm ??????for rule(2)and hence different function obtained. Rule (2) is quite certain that the control output (process input) should be a small negative value. This makes sense since if the pendulum has some counterclockwise velocity then we would want to apply a negative force (i.e., one to the left). As rule (2) has a premise PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn membership function that has higher certainty than for rule (1), we see that we are more certain of the conclusion reached by rule (2). Figure 2.14 (a) Consequent membership function and (b) implied fuzzy set with membership function for rule (2). 2.2.6 Converting Decisions into Actions Next, we consider the defuzzification operation, which is the final component of the fuzzy controller shown in Figure 2.1. Defuzzification operates on the implied fuzzy sets produced by the inference mechanism and combines their effects to provide the "most certain" controller output (plant input). Some think of defuzzification as "decoding" the fuzzy set information produced by the inference process (i.e., the implied fuzzy sets) into numeric fuzzy controller outputs. To understand defuzzification, it is best to first draw all the implied fuzzy sets on one axis as shown in Figure 2.15. We want to find the one output, which we denote by crispu that best represents the conclusions of the fuzzy controller that are represented with the implied fuzzy sets. There are actually many approaches to defuzzification Combining Recommendations Due to its popularity, we will first consider the "center of gravity" (COG) defuzzification method for combining the recommendations represented by the implied fuzzy sets from all the rules. Let ib denote the center of the membership function (i.e., where it reaches its peak for our example) of the consequent of rule (i). For our example we have 1 0.0b = and b2 = -10 as shown in Figure 2.15. Let ()im∫ denote the area under the membership function ()im . The COG method computes to be () () i iicrisp ii bu m m= ∑ ∫ ∑ ∫ (2.1) This is the classical formula for computing the center of gravity. In this case it is for computing the center of gravity of the implied fuzzy sets. Figure 2.15 Implied fuzzy sets. Three items about Equation (2.1) are important to note: 1. Practically, we cannot have output membership functions that have infinite area since even though they may be "chopped off' in the minimum operation for the implication (or scaled for the product operation) they can still end up PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn with infinite area. This is the reason we do not allow infinite area membership functions for the linguistic values for the controller output (e.g., we did not allow the saturated membership functions at the outermost edges as we had for the inputs shown in Figure 2.9). 2. You must be careful to define the input and output membership functions so that the sum in the denominator of Equation (3.1) is not equal to zero no matter what,the inputs to the fuzzy controller are. Essentially, this means that we must have some sort of conclusion for all possible control situations we may encounter. 3. While at first glance it may not appear so, ()im∫ is easy to compute for our example. For the case where we have symmetric triangular output membership functions that peak at one and have a base width of w, simple geometry can be used to show that the area under a triangle “chopped off” at a height of h is equal to 2 2 hhw????? ?? . Given this, the computations needed to compute are not too significant. We see that the property of membership functions being symmetric for the output is important since in this case no matter whether the minimum or product is used to represent the implication, it will be the case that the center of the implied fuzzy set will be the same as the center of the consequent fuzzy set from which it is computed. If the output membership functions are not symmetric, then their centers, which are needed in the computation of the COG, will change depending on the membership value of the premise. This will result in the need to recompute the center at each time instant. Using Equation (2.1) with Figure 2.15 we have ( )( ) ( )( )04.375109.375 6.81 4.3759.375 crispu +?==? + as the input to the pendulum for the given e(t) and ()detdt . Does this value for a force input (i.e., 6.81 Newtons to the left) make sense? Consider Figure 2.16, where we have taken the implied fuzzy sets from Figure 2.15 and simply added an indication of what number COG defuzzification says is the best representation of the conclusions reached by the rules that are on. Notice that the value of crispm is roughly in the middle of where the implied fuzzy sets say they are most certain about the value for the force input. In fact, recall that we had e{t} = O and () ()8320.294detdt pp=?= ,so the pendulum is in the inverted position but is moving counterclockwise with a small velocity; hence it makes sense to pull on the cart, and the fuzzy controller does this. It is interesting to note that for our example it will be the case that 2020crispu?≤≤. To see this, consider Figure 2.17, where we have drawn the output membership functions. Notice that even though we have extended the membership functions at the outermost edges past -20 and +20 (see the shaded regions), the COG method will never compute a value outside this range. The reason for this comes directly from the definition of the COG method in Equation (2.1). The center of gravity for these shapes simply cannot extend beyond -20 and +20. Practically speaking, this ability to limit the range of inputs to the plant is useful; it may be the case that applying a force of greater than 20 Newtons is impossible for this plant. Thus we see that in defining the membership functions for the fuzzy controller, we must take into account what method is going to be used for defuzzification. Other Ways to Compute and Combine Recommendations PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn As another example, it is interesting to consider how to compute, by hand, the operations that the fuzzy controller takes when we use the product to represent the implication or the "center-average" defuzzification method. Figure 2.16 Implied fuzzy sets Figure 2.17 Output membership functions First, consider the use of the product. Consider Figure 2.18, where we have drawn the output membership functions for "negsmall" and "zero" as dotted lines. The implied fuzzy set from rule (1) is given by the membership function ()( ) ( )1 0.25 zerouumm= shown in Figure 2.18 as the shaded triangle; and the implied fuzzy set for rule (2) is given by the membership function ()( ) ( )2 0.75 negsmalluumm= shown in Figure 2.18 as the dark triangle. Notice that computation of the COG is easy since we can use 12 hw as the area for a triangle with base width w and height h. When we use product to represent the implication, we obtain ( )( ) ( )( ) 02.5107.5 7.5 2.57.5 crispu +?==? + which also makes sense. Figure 2.18 Implied fuzzy sets when the product is used to represent the implication. Next, as another example of how to combine recommendations, we will introduce the "center-average" method for defuzzification. For this method we let PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn () () ipremiseicrisp i premiseii b mm m= ∑ ∑ (2.2) where to compute ()premiseim we use, for example, minimum. We call it the "center-average" method since Equation (2.2) is a weighted average of the center values of the output membership function centers. Basically, the center-average method replaces the areas of the implied fuzzy sets that are used in COG with the values of ()premiseim . This is a valid replacement since the area of the implied fuzzy set is generally proportional to ()premiseim since ()premiseim is used to chop the top off (minimum) or scale (product) the triangular output membership function when COG is used for our example. For the above example, we have ( )( ) ( )( ) 00.25100.75 7.5 0.250.75 crispu +?==? + which just happens to be the same value as above. Some like the center-average defuzzification method because the computations needed are simpler than for COG and because the output membership functions are easy to store since the only relevant information they provide is their center values ( ib ) (i.e., their shape does not matter, just their center value). Notice that while both values computed for the different inference and defuzzification methods provide reasonable command inputs to the plant, it is difficult to say which is best without further investigations (e.g., simulations or implementation). This ambiguity about how to define the fuzzy controller actually extends to the general case and also arises in the specification of all the other fuzzy controller components, as we discuss below. Some would call this "ambiguity" a design flexibility, but unfortunately there are not too many guidelines on how best to choose the inference strategy and defuzzification method, so such flexibility is of questionable value. This completes the operations of the inference mechanism in Figure 2.1. While the input to the inference process is the set of rules that are on, its output is the set of implied fuzzy sets that represent the conclusions reached by all the rules that are on. For our example, there are at most four conclusions reached since there are at most four rules on at any one time. (In fact, you could say that there are always four conclusions reached for our example, but that the implied fuzzy sets for some of the rules may have implied membership functions that are zero for all values.) 2.2.7 Graphical Depiction of Fuzzy Decision Making For convenience, we summarize the procedure that the fuzzy controller uses to compute its outputs given its inputs in Figure 2.19. Here, we use the minimum operator to represent the "and" in the premise and the implication and COG defuzzification. Then, repeat the process when center-average defuzzification is used with either minimum or product used for the premise. Also, learn how to picture in your mind how the parameters of this graphical representation of the fuzzy controller operations change as the fuzzy controller inputs change. This completes the description of the operation of a simple fuzzy controller. You will find that while we will treat the fully general fuzzy controller in the next section, there will be little that is conceptually different from this simple example. We simply show how to handle the case where there are more inputs and outputs and show a fuller range of choices that you can make for the various components of the fuzzy controller. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn As evidenced by the different values obtained by using the minimum, product, and defuzzification operations, there are many ways to choose the parameters of the fuzzy controller that make sense. This presents a problem since it is almost always difficult to know how to first design a fuzzy controller. Basically, the choice of all the components for the fuzzy controller is somewhat ad hoc. What are the best membership functions? How many linguistic values and rules should there be? Should the minimum or product be used to represent the "and" in the premise—and which should be used to represent the implication? What defuzzification method should be chosen? These are all questions that must be addressed if you want to design a fuzzy controller. Figure 2.19 Graphical representation of fuzzy controller operations. We will show how to answer some of these questions by going through a design procedure for the inverted pendulum in Section 2.2.4. After this, we will discuss how to write a computer program to simulate a fuzzy control system and how to do a real-time implementation of the fuzzy controller. Ultimately, however, the answers to the above questions are best found by studying how to design fuzzy controllers for a wide range of applications that present more challenging characteristics than the inverted pendulum. 2.2.8 Visualizing the Fuzzy Controller's Dynamical Operation The figure on the cover of the book can serve as a nice visual depiction of how a fuzzy system operates dynamically over time. The figure represents a fuzzy system with two inputs, for example, e, and e ? , and one output u. There are triangular membership functions on the two input universes of discourse, and minimum is used to represent the conjunction in the premise. The blue pyramids represent the premise certainties of the rules in a rule-base with 49 rules. Note that for simplicity of the graphic, the outermost membership functions do not saturate in this fuzzy controller; hence if e or e ? goes outside the range it appears that there will be no rules on, so the defuzzification will fail. Actually, the pyramids should be viewed as part of a rule-base with many more rules, and only the central ones for the rule-base are shown for simplicity. The shading from blue, to red, to yellow, on the pyramids indicates progression in time of rules that were (are) on (i.e., the pyramids describing their premises had nonzero certainties) and the two in the middle that are fully shaded in yellow are the two rules that are on now. The pyramids with some blue on them, and some red, are ones that were on some time ago. The ones with red, and some yellow, were on more recently, while the ones that have a little less red shading and more yellow were on even more recently. The pyramids that are entirely blue, either were never turned on, or they were on a long time ago. Hence, the path of color (blue to red to yellow) could have traveled all over a large PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn landscape of blue pyramids. At this time the path has come very near the e = 0, 0e = ? location in the rule-base and this is normally where you want it to be (for a tracking problem where e= r- y where r is the reference input and y is the plant output we want e = 0 if y is to track r). The colored vertical beam holds the four numbers that are the premise certainties for the four rules that are on now. Note that two of the rules that are on, are on with a certainty of zero, so really they are off and this is why they go to the output universe of discourse (top horizontal axis) at the zero level of certainty (see the top figure with the tan-colored output membership functions). The colored vertical beam contains only green and orange since these represent the values of the premise certainties from the two rules that are on. The beam does not have any purple or pink in it as these colors represent the zero values of the premises of the two rules that are off (we have constructed the rule-base so that there are at most four rules on at any time). The green and orange values chop the tops off two triangular output membership functions that then become the implied fuzzy sets (i.e., we use minimum to represent the implication). The defuzzified value is shown as the arrow at the top (it looks like a COG defuzzification). 2.3 General Fuzzy Systems In the previous section we provided an intuitive overview of fuzzy control via a simple example. In this section we will take a step back and examine the more general fuzzy system to show the range of possibilities that can be used in defining a fuzzy system and to solidify your understanding of fuzzy systems. In particular, we will consider the case where there are many fuzzy controller inputs and outputs and where there are more general membership functions, fuzzification procedures, inference strategies, and defuzzification methods. Moreover, we introduce a class of "functional fuzzy systems" that have been found to be useful in some applications and characterize the general capabilities of fuzzy systems via the "universal approximation property." This section is written to build on the previous one in the sense that we rely on our intuitive explanations for many of the concepts and provide a more mathematical and complete exposition on the details of the operation of fuzzy systems. The astute reader will actually see intuitively how to extend the basic fuzzy controller to the case where there are more than two inputs. While an understanding of how to define other types of membership functions (Section 2.3.2) is important since they are often used in practical applications, the remainder of the material in Sections 2.3.2- 2.3.5 and 2.3.8 can simply be viewed as a precise mathematical characterization and generalization of what you have already learned in Section 2.2. Hence, if you are only concerned with gaining a basic understanding of fuzzy control you can skim the part in Section 2.3.2 on membership functions, teach yourself Section 2.3.7, and skip the remainder of this section on a first reading and come back to it later to deepen your understanding of fuzzy systems and the wide variety of ways that their basic components can be defined. 2.3.1 Linguistic Variables, Values, and Rules A fuzzy system is a static nonlinear mapping between its inputs and outputs (i.e., it is not a dynamic system). It is PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn assumed that the fuzzy system has inputs iiuU∈ , where i = 1,2,..., n and outputs iiyY∈ , where i = 1,2,..., m, as shown in Figure 2.20. The inputs and outputs are "crisp"—that is, they are real numbers, not fuzzy sets. The fuzzification block converts the crisp inputs to fuzzy sets, the inference mechanism uses the fuzzy rules in the rule-base to produce fuzzy conclusions (e.g., the implied fuzzy sets), and the defuzzification block converts these fuzzy conclusions into the crisp outputs. Figure 2.20 Fuzzy System Universes of Discourse The ordinary ("crisp") sets iU and iY are called the "universes of discourse" for iu and iy , respectively (in other words, they are their domains). In practical applications, most often the universes of discourse are simply the set of real numbers or some interval or subset of real numbers. Note that sometimes for convenience we will refer to an "effective" universe of discourse[,]ab wherea and b are the points at which the outermost membership functions saturate for input universes of discourse, or the points beyond which the outputs will not move for the output universe of discourse. For example, for the e(t) universe of discourse in Figure 2.12 we have 2pa =? and 2pb = ; or for the u(t) universe of discourse in Figure 2.17, we have 20a =? and 20b = . However, the actual universe of discourse for both the input and output membership functions for the inverted pendulum is the set of all real numbers. When we refer to effective universes of discourse, we will say that the "width" of the universe of discourse is ba? . Linguistic Variables To specify rules for the rule-base, the expert will use a "linguistic description"; hence, linguistic expressions are needed for the inputs and outputs and the characteristics of the inputs and outputs. We will use "linguistic variables" (constant symbolic descriptions of what ~ iu are in general time-varying quantities) to describe fuzzy system inputs and outputs. For our fuzzy system, linguistic variables denoted by ~ iu are used to describe the inputs ui .Similarly, linguistic variables denoted by ~ iy are used to describe outputs yi .For instance, an input to the fuzzy system may be described as ~ 1u ="position error" or ~ 2u ="velocity error," and an output from the fuzzy system may be ~ 1y ="voltage in." Linguistic Values Just as ui and yi take on values over each universe of discourseUi andYi, respectively, linguistic variables ~ iu and ~ iy , take PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn on "linguistic values" that are used to describe characteristics of the variables. Let ~ j iA denote the j th linguistic value of the linguistic variable ~ iu , defined over the universe of discourseUi.If we assume that there exist many linguistic values defined overUi, then the linguistic variable ~ iu , takes on the elements from the set of linguistic values denoted by ~ {:1,2,,}j iiiAAjN==? (sometimes for convenience we will let the j indices take on negative integer values, as in the inverted pendulum example where we used the linguistic-numeric values). Similarly, let ~ j iB denote the j th linguistic value of the linguistic variable ~ iy defined over the universe of discourseYi, The linguistic variable ~ iy , takes on elements from the set of linguistic values denoted by ~~ :1,2,...,piiiBBpM??==?? ?? (sometimes for convenience we will let the p indices take on negative integer values). Linguistic values are generally descriptive terms such as "positive large," "zero," and "negative big" (i.e., adjectives). For example, if we assume that ~ 1u denotes the linguistic variable "speed," then we may assign ~ 1 1A = "slow," ~ 2 1A = "medium," and ~ 3 1A ="fast" so that has a value from ~~~~ 123 1111,,AAAA ??= ?? ?? . Linguistic Rules The mapping of the inputs to the outputs for a fuzzy system is in part characterized by a set of condition action rules, or in modus ponens (If-Then) form, If premise Then consequent. (2.3) Usually, the inputs of the fuzzy system are associated with the premise, and the outputs are associated with the consequent. These If-Then rules can be represented in many forms. Two standard forms, multi-input multi-output (MIMO) and multi-input single-output (MISO), are considered here. The MISO form of a linguistic rule is ~~~~~ ~~ 1122 ,, jklp nnqqIfuisAanduisAandanduisAThenyisB? (2.4) It is an entire set of linguistic rules of this form that the expert specifies on how to control the system.. Note that if ~ 1u ="velocity error" and ~ 1 jA ="positive large," then “ ~ 1u is ~ 1 jA ”, a single term in the premise of the rule, means "velocity error is positive large." It can be easily shown that the MIMO form for a rule (i.e., one with consequents that have terms associated with each of the fuzzy controller outputs) can be decomposed into a number of MISO rules using simple rules from logic. For instance, the MIMO rule with n inputs and m = 2 outputs ~~~~~~ ~~~ 112 1122,, jklrs nnIfuisAanduisAandanduisAThenyisBandyisB? is linguistically (logically) equivalent to the two rules PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn ~~~~~ ~~ 112 11,, jklr nnIfuisAanduisAandanduisAThenyisB? ~ ~~~ ~~ 112 22,, j ls nnIfuisAanduisAandanduisAThenyisB? This is the case since the logical "and" in the consequent of the MIMO rule is still represented in the two MISO rules since we still assert that both the first "and" second rule are valid. For implementation, we would specify two fuzzy systems, one with output y1 and the other with output y2. The logical "and" in the consequent of the MIMO rule is still represented in the MISO case since by implementing two fuzzy systems we are asserting that 'ones set of rules is true "and" another is true. We assume that there are a total of R rules in the rule-base numbered 1,2... R, and we naturally assume that the rules in the rule-base are distinct (i.e., there are no two rules with exactly the same premises and consequents); however, this does not in general need to be the case. For simplicity we will use tuples ( ),,,;, ijklpq? to denote the thi MISO rule of the form given in Equation (2.4). Any of the terms associated with any of the inputs for any MISO rule can be included or omitted. For instance, suppose a fuzzy system has two inputs and one output with ~ 1u = "position," ~ 2u = "velocity," and ~ 1y = "force." Moreover, suppose each input is characterized by two linguistic values ~ 1 iA = "small" and ~ 2 iA = 'large" for i = 1,2. Suppose further that the output is characterized by two linguistic values ~ 1 1B = "negative" and ~ 2 1B = "positive." A valid If-Then rule could be: If position is large Then force is positive even though it does not follow the format of a MISO rule given above. In this case, one premise term (linguistic variable) has been omitted from the If-Then rule. We see that we allow for the case where the expert does not use all the linguistic terms (and hence the fuzzy sets that characterize them) to state some rules. Finally, we note that if all the premise terms are used in every rule and a rule is formed for each possible combination of premise elements, then there are 12 1 n in i NNNN = =∏ ???? rules in the rule-base. For example, if n = 2 inputs and we have Ni=11 membership functions on each universe of discourse, then there are 1111121×= possible rules. Clearly, in this case the number of rules increases exponentially with an increase in the mumber of fuzzy controller inputs or membership functions. 2.3.2 Fuzzy Sets, Fuzzy Logic, and the Rule-Base Fuzzy sets and fuzzy logic are used to heuristically quantify the meaning of linguistic variables, linguistic values, and linguistic rules that are specified by the expert. The concept of a fuzzy set is introduced by first defining a "membership function." Membership Functions Let iU denote a universe of discourse and ~ ~ j iiAA∈ denote a specific linguistic value for the linguistic variable iu ? . The PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn function ( )ium associated with ~ j iA that maps iU to [0,1] is called a "membership function." This membership function describes the "certainty" that an element of iU denoted , with a linguistic description iu? , may be classified linguistically as ~ j iA . Membership functions are subjectively specified in an ad hoc (heuristic) manner from experience or intuition. For instance, if iU = [-150,150], iu? ="velocity error," and ~ j iA ="positive large," then ( )ium may be a bell-shaped curve that peaks at one at iu? = 75 and is near zero when iu? < 50 or iu? > 100. Then if ui = 75, ( )75m = 1, so we are absolutely certain that ui is "positive large." If ui = -25 then ( )25m ? is very near zero, which represents that we are very certain that ui, is not "positive large." Clearly, many other choices for the shape of the membership function are possible (e.g., triangular and trapezoidal shapes), and these will each provide a different meaning for the linguistic values that they quantify. See Figure 2.21 for a graphical illustration of a variety of membership functions and Tables 2.3 and 2.4 for a mathematical characterization of the triangular and Gaussian membership functions (other membership functions can be characterized with mathematics using a similar approach). Figure 2.21 Some typical membership functions Table 2.3 Mathematical Characterization of Triangular Membership Functions Triangular membership functions Left L1 if uc () max{0,1} otherwise0.5 L L L u cu w m ? ≤? =? ? +?? Centers max{0,1} if uc 0.5() max{0,1} otherwise0.5 C uc wu cu w m ?? +≤ ??= ? ? ? +? ? Right Rmax{0,1} if uc () 0.5 1 otherwise R R R uc u wm ? ?+≤? = ? ?? PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn For practice, you should sketch the membership functions that are described in Tables 2.3 and 2.4. Notice that for Table 2.3 Lc specifies the "saturation point" and Lw specifies the slope of the nonunity and nonzero part of Lm . Similarly, for Rm . For Cm notice that c is the center of the triangle and w is the base-width. Analogous definitions are used for the parameters in Table 2.4. Table 2.4 Mathematical Characterization of Gaussian Membership Functions Gaussian membership functions Left L 2 1 if uc () 1exp() otherwise 2 L L L u ucm s ? ≤ ?= ???? ??? ??? Centers 21 ()exp()2 ucum s???=????? Right 2R1exp() if uc () 2 1 otherwise R R R uc um s ? ????≤ ? ??=??? ? In Table 2.4, for the "centers" case note that this is the traditional definition for the Gaussian membership function. This definition is clearly different from a standard Gaussian probability density function, in both the meaning of c ands , and in the scaling of the exponential function. Recall that it is possible that a Gaussian probability density function has a maximum value achieved at a value other than one; the standard Gaussian membership function always has its peak value at one. Fuzzy Sets Given a linguistic variable ~ iu with a linguistic value ~ j iA defined on the universe of discourse iU , and membership function ( )j i iA um (membership function associated with the fuzzy set jiA ) that maps iU to [0,1], a "fuzzy set" denoted with jiA is defined as ()( ){ },:j i j iiiiiAAuuuUm=∈ (2.5) (notice that a fuzzy set is simply a crisp set of pairings of elements of the universe of discourse coupled with their associated membership values).For example, suppose we assign a linguistic variable ~ 1u = "temperature" and the linguistic value ~ 1A = "hot," then 1 1A is a fuzzy set whose membership function describes the degree of certainty that the numeric value of the temperature, 11uU∈ , possesses the property characterized by ~ 1A (see the pendulum example in the previous section for other examples of fuzzy sets). PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Additional concepts related to membership functions and fuzzy sets are covered in the following: ? "Support of a fuzzy set": The set of points on the universe of discourse where the membership function value is greater than zero. ? "α-cut": The set of points on the universe of discourse where the membership function value is greater than a. ? "Height" of a fuzzy set or membership function: The peak value reached by the membership function. ? "Normal" fuzzy sets: Ones with membership functions that reach one for at least one point on the universe of discourse. ? "Convex fuzzy sets ": Ones that satisfy a certain type of convexity condition that is given in Equation 1212((1)min{(),()}xxxxmllmm+?≥ . ? "Linguistic hedges": Mathematical operations on membership functions of fuzzy sets that can be used to change the meaning of the underlying linguistics. ? "Extension principle": If you are given a function that maps some domain into some range and you have membership functions defined on the domain, the extension principle shows how to map the membership functions on the domain to the range. Fuzzy Logic Next, we specify some set-theoretic and logical operations on fuzzy sets. The reader should first understand the conventional counterparts to each of these; the fuzzy versions will then be easier to grasp as they are but extensions of the corresponding conventional notions. Also, we recommend that the reader sketch the fuzzy sets that result from the following operations. Fuzzy Subset Given fuzzy sets 1iAand 2iAassociated with the universe of discourse ( )2iiUN=, with membership functions denoted ()1 iiA um and ()2 iiA um , respectively, 1iA is defined to be a "fuzzy subset" of 2iA, denoted by 12iiAA?, if () ()12 iiAA uumm≤for all iiuU∈. Fuzzy Complement The complement (“not”) of a fuzzy set 1iAwith a membership function ()1 iiA um has a membership function given by ()11 iiA um? . Fuzzy Intersection (AND) The intersection of fuzzy sets 1iAand 2iA, which are defined on the universe of discourse iU, is a fuzzy set denoted by 12iiAA∩, with a membership function defined by either of the following two methods: 1. Minimum: Here, we find the minimum of the membership values as in ()(){ }1212min,: i iiiiiiA AA uuuUmmm∩=∈ (2.6) 2. Algebraic Product: Here, we find the product of the membership values as in ()(){ }1212min: i iiiiiiA AA uuuUmmm∩=∈ (2.7) PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Other methods can be used to represent intersection (and), but the two listed above are the most commonly used. Suppose that we use the notation { }*min,xyxy= , or at other times we will use it to denote the product *xyxy= (* is sometimes called the "triangular norm").Then ( ) ( )12* iiiiAA uummis a general representation for the intersection of two fuzzy sets. In fuzzy logic, intersection is used to represent the "and" operation. For example, if we use minimum to represent the "and" operation, then the shaded membership function in Figure 2.22 is 12 iiAA m ∩ , which is formed from the two others( ( ) ( )12 iiAA uandumm).This quantification of "and" provides the fundamental justification for our representation of the "and" in the premise of the rule. Figure 2.22 A membership function for the "and" of two membership functions. Fuzzy Union (OR) The union of fuzzy sets 1 iA and 2 iA , which are defined on the universe of discourse iU ,is a fuzzy set denoted by 12 iiAA∪ , with a membership function defined by either one of the following methods: 1. Maximum: Here, we find the maximum of the membership values as in ()()(){ }1212max,: i iiiiiiiA AA uuuuUmmm∩=∈ (2.8) 2. Algebraic Sum: Here, we find the algebraic sum of the membership values as in ()()()()(){ }121212: i iiiii iiiiiA AAAA uuuuuuUmmmmm∪ =+?∈ (2.9) Other methods can be used to represent union (or), but the two listed above are the most commonly used. Suppose that we use the notation { }max,xyxy⊕= , or at other times we will use it to denote xyxyxy⊕=+? (⊕ is sometimes called the "triangular co-norm"). Then ( ) ( )12 iiAA uumm⊕is a general representation for the union of two fuzzy sets. In fuzzy logic, union is used to represent the "or" operation. For example, if we use maximum to represent the "or" operation, then the shaded membership function in Figure 2.23, is 12 iiAA m ∪ , which is formed from the two others ( )1 i iA um and ( )2 i iA um . This quantification of "or" provides the fundamental justification for the "or" that inherently lies between the rules in the rule-base (note that we interpret the list of rules in the rule-base as "If premise-1 Then consequent-1" or "If premise-2 Then consequent-2," or so on). Note that in the case where we form the "overall implied fuzzy set" (to be defined more carefully below) this "or" between the rules is quantified directly with “⊕ " as it is described above. If we use only the implied fuzzy sets (as we did for the inverted pendulum problem in the last PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn section), then the "or" between the rules is actually quantified with the way the defuzzification operation works (consider the way that the COG defuzzification method combines the effects of all the individual implied fuzzy sets). Figure 2.23 A membership function for the "or" of two membership functions. Fuzzy Cartesian Product The intersection and union above are both defined for fuzzy sets that lie on the same universe of discourse. The fuzzy Cartesian product is used to quantify operations on many universes of discourse. If 12,,,jklnAAA? are fuzzy sets defined on the universes of discourse 12,,,nUUU? ,respectively, their Cartesian product is a fuzzy set (sometimes called a "fuzzy relation"), denoted by 12jklnAAA×××? ,with a membership function defined by ( ) () () () 22111212 , ***jjklkl nn nnAAAAAA uuuuuummmm××× =? ??. The reader may wonder why the "?" operation is used here. Basically, it arises from our interpretation of a standard Cartesian product, which is formed by taking an element from the first element of the product "and" the second element of the product "and" so on. Clearly, in light of this interpretation, the use of "*" and hence "and" makes sense. Note that the "ands" used in the Cartesian product actually represent the "ands" used in the rule premises since normally each of the terms in a premise comes from a different universe of discourse. Fuzzy Quantification of Rules: Fuzzy Implications Next, we show how to quantify the linguistic elements in the premise and consequent of the linguistic If-Then rule with fuzzy sets. For example, suppose we are given the If-Then rule in MISO form in Equation (2.4). We can define the fuzzy sets as follows: (2.10) These fuzzy sets quantify the terms in the premise and the consequent of the given If-Then rule, to make a "fuzzy implication" (which is a fuzzy relation) 12,, jklp nqIfAandAandAThenB? (2.11) PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn where the fuzzy sets 12,,,,jklpnqAAAandB? are defined in Equation (2.10). Therefore, the fuzzy set 1jAis associated with, and quantifies the meaning of the linguistic statement “ ~~ 11 juisA " and p qBquantifies the meaning of “ ~~ p qqyisB ”. Each rule in the rule-base, which we denote by( ),,,;,,1,2,,,ijklpqiR=??is represented with such a fuzzy implication (a fuzzy quantification of the linguistic rule). There are two general properties of fuzzy logic rule-bases that are sometimes studied. These are "completeness" (i.e., whether there are conclusions for every possible fuzzy controller input) and "consistency" (i.e., whether the conclusions that rules make conflict with other rules’ conclusions). 2.3.3 Fuzzification Fuzzy sets are used to quantify the information in the rule-base, and the inference mechanism operates on fuzzy sets to produce fuzzy sets; hence, we must specify how the fuzzy system will convert its numeric inputs iiuU∈into fuzzy sets (a process called "fuzzification") so that they can be used by the fuzzy system. Let * i Udenote the set of all possible fuzzy sets that can be defined on iU. Given iiuU∈, fuzzification transforms ui to a fuzzy set denoted by ?fuziAdefined on the universe of discourse iU. This transformation is produced by the fuzzification operatorFdefined by *: ii FUU→ where () ?fuziiFuA= . Quite often "singleton fuzzification" is used, which produces a fuzzy set *? i fuz iAU∈ with a membership function defined by ? 1 0fuzi i A xu otherwisem =?= ?? Any fuzzy set with this form for its membership function is called a "singleton." For a picture of a singleton membership function, see the single vertical line shown in Figure 2.1. Note that the discrete impulse function can be used to represent the singleton membership function. Basically, the reader should simply think of the singleton fuzzy set as a different representation for the number ui. Singleton fuzzification is generally used in implementations since, without the presence of noise, we are absolutely certain that , takes on its measured value (and no other value), and since it provides certain savings in the computations needed to implement a fuzzy system (relative to, for example, "Gaussian fuzzification," which would involve forming bell-shaped membership functions about input points, or triangular fuzzification, which would use triangles). Since most practical work in fuzzy control uses singleton fuzzification, we will also use it throughout the remainder of this book. The reasons other fuzzification methods have not been used very much are (1) they add computational complexity to the inference process and (2) the need for them has not been that well justified. This is partly due to the fact that very good functional capabilities can be achieved with the fuzzy system when only singleton fuzzification is used. 2.3.4 The Inference Mechanism What are the basic tasks of the inference mechanism ? PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn The inference mechanism has two basic tasks: (1) determining the extent to which each rule is relevant to the current situation as characterized by the inputs ui, i = 1,2,..., n (we call this task "matching"); and (2) drawing conclusions using the current inputs ui and the information in the rule-base (we call this task an "inference step"). For matching note that 12jklnAAA×××?is the fuzzy set representing the premise of the ith rule( ( ),,,;, ijklpq? ) (there may be more than one such rule with this premise). Matching Suppose that at some time we get inputs ui, i = 1,2,..., n, and fuzzification produces 12?? ?,,,fuzfuzfuznAAA? , the fuzzy sets representing the inputs. There are then two basic steps to matching. Step 1: Combine Inputs with Rule Premises: The first step in matching involves finding fuzzy sets 12?? ?,,,jklnAAA?with membership functions () () () ()()() ()()() 111 222 ??111 222 ?? * * jjfuz kkfuz llfuz nnn AAA AAA nAAA uuu uuu uuu mmm mmm mmm = = = ? (for all j,k,..., l) that combine the fuzzy sets from fuzzification with the fuzzy sets used in each of the terms in the premises of the rules. If singleton fuzzification is used, then each of these fuzzy sets is a singleton that is scaled by the premise membership function (e.g., () 1?11 11 0jAforuuanduforuum==≠). That is, with singleton fuzzification we have ()? 1fuz i iA um =for all i = 1,2,..., n for the given ui inputs so that () () ()() ()() 11 22 ?11 ?22 ? jj kk ll nn AA AA nnAA uu uu uu mm mm mm = = = ? We see that when singleton fuzzification is used, combining the fuzzy sets that were created by the fuzzification process to represent the inputs with the premise membership functions for the rules is particularly simple. It simply reduces to computing the membership values of the input fuzzy sets for the given inputs 12,,,nuuu? (as we had indicated at the end of Section 2.2.3 for the inverted pendulum). Step 2: Determine Which Rules Are On: In the second step, we form membership values ( )12,,,inuuum ?for the ith rule's premise (what we called premisem in the last section on the inverted pendulum) that represent the certainty that each rule premise holds for the given inputs. Define ( ) () () () 21 ???1212 ,, ***jkl ninnAAA uuuuuummmm=?? (2.12) which is simply a function of the inputs ui. When singleton fuzzification is used (as it is throughout this entire book), we have ( ) () () () 211212 ,, ***jkl ninnAAA uuuuuummmm=?? (2.13) PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn We use ( )12,,,inuuum ? to represent the certainty that the premise of rule i matches the input information when we use singleton fuzzification. This ( )12,,,inuuum ? is simply a multidimensional certainty surface, a generalization of the surface shown in Figure 2.11for the inverted pendulum example. It represents the certainty of a premise of a rule and thereby represents the degree to which a particular rule holds for a given set of inputs. Finally, we would remark that sometimes an additional "rule certainty" is multiplied by im . Such a certainty could represent our a priori confidence in each rule's applicability and would normally be a number between zero and one. If for rule i its certainty is 0.1, we are not very confident in the knowledge that it represents; while if for some rule j we let its certainty be 0.99, we are quite certain that the knowledge it represents is true. In this book we will not use such rule certainty factors.This concludes the process of matching input information with the premises of the rules. Inference Step How many choices to realize the inference step in fuzzy control? What about them? There are two standard alternatives to performing the inference step, one that involves the use of implied fuzzy sets (as we did for the pendulum earlier) and the other that uses the overall implied fuzzy set. Alternative 1: Determine Implied Fuzzy Sets: Next, the inference step is taken by computing, for the ith rule ( ),,,;, ijklpq? ,the "implied fuzzy set" ? q iB with membership function ( ) ( ) ( )??12,,,*ip qq qinqBByuuuymmm=? (2.14) The implied fuzzy set ? q iB specifies the certainty level that the output should be a specific crisp output y q within the universe of discourse Yq , taking into consideration only rule i. Note that since ( )12,,,inuuum ? will vary with time, so will the shape of the membership functions ( )?i q qB ym for each rule. Alteniative 2: Determine the Overall Implied Fuzzy Set: Alternatively, the inference mechanism could, in addition, compute the "overall implied fuzzy set" ?qB with membership function ( ) ( ) ( ) ( )12????R qqqqqB BBB yyyymmmm=⊕⊕⊕? (2.15) that represents the conclusion reached considering all the rules in the rule-base at the same time (notice that determining ?qB can, in general, require significant computational resources). Notice that we did not consider this possibility for the inverted pendulum example for reasons that will become clearer in the next subsection. Instead, our COG or center-average defuzzification method performed the aggregation of the conclusions of all the rules that are represented by the implied fuzzy sets. Discussion: Compositional Rule of Inference Using the mathematical terminology of fuzzy sets, the computation of ( )? q qB ym is said to be produced by a "sup-star compositional rule of inference," The "sup" in this terminology corresponds to the ⊕ operation, and the "star" corresponds to? . "Zadeh's compositional rule of inference" is the special case of the sup-star compositional rule of inference when maximum is used for ⊕ and minimum is used for ? . The overall justification for using the above operations to represent the inference step lies in the fact that we can be no more certain about our conclusions than we are about our premises. The operations performed in taking an inference PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn step adhere to this principle. To see this, you should study Equation (2.14) and note that the scaling from 12(,,,)inuuum ? that is produced by the premise matching process will always ensure that { }? 12sup()(,,,)iq qyqinByuuumm≤? The fact that we are no more certain of our consequents than our premises is shown graphically in Figure 2.19 where the heights of the implied fuzzy sets are always less than the certainty values for all the premise terms. Up to this point, we have used fuzzy logic to quantify the rules in the rule-base, fuzzification to produce fuzzy sets characterizing the inputs, and the inference mechanism to produce fuzzy sets representing the conclusions that it reaches after considering the current inputs and the information in the rule-base. Next, we look at how to convert this fuzzy set quantification of the conclusions to a numeric value that can be input to the plant. 2.3.5 Defuzzification A number of defuzzification strategies exist, and it is not hard to invent more. Each provides a means to choose a single output (which we denote with crisp qy ) based on either the implied fuzzy sets or the overall implied fuzzy set (depending on the type of inference strategy chosen, "Alternative 1 or 2," respectively, in the previous section). Defuzzification: Implied Fuzzy Sets As they are more common, we first specify typical defuzzification techniques for the implied fuzzy sets i qB: ? Center of gravity (COG): A crisp output crisp qy is chosen using the center of area and area of each implied fuzzy set, and is given by ( ) () ?1 ?1 i qq q i qq Rq iqqBi ycrisp R qqBiy bydy y ydy m m = = = ∑ ∫ ∑ ∫ where R is the number of rules, q ibis the center of area of the membership function of p qBassociated with the implied fuzzy set ? i qBfor the ith rule (,,,;,)ijklpq? , and ? ()i qq qqBy ydym∫ denotes the area under ? ()iq qBym . Notice that COG can be easy to compute since it is often easy to find closed-form expressions for ? ()i qq qqBy ydym∫ ,which is the area under a membership function (see the pendulum example in Section 2.2.6 where this amounts to finding the area of a triangle or a triangle with its top chopped off). Notice that the area under each implied fuzzy set must be computable, so the area under each of the output membership functions (that are used in the consequent of a rule) must be finite (this is why we cannot "saturate" the membership functions at the outermost edges of the output universe of discourse). Also, notice that the fuzzy system must be defined so that ()? 1 0i qq R qqBy i ydym = ≠∑∫ for all ui or crisp qy will not be properly defined. This value will be nonzero if there is a rule that is on for every possible combination of the fuzzy system inputs and the consequent fuzzy sets all have nonzero area. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn ? Center-average: A crisp output crisp qy is chosen using the centers of each of the output membership functions and the maximum certainty of each of the conclusions represented with the implied fuzzy sets, and is given by ( ){ } (){} ?1sup sup iq q q iq q R q iyqBicrisp R yqBi by y y m m = = = ∑∑ where "sup" denotes the "supremum" (i.e., the least upper bound which can often be thought of as the maximum value). Hence, { }sup()x xm can simply be thought of as the highest value of ()xm (e.g., { }(1)sup()0.25u um = for (1)m when product is used to represent the implication, as shown in Figure 2.18). Also, q ib is the center of area of the membership function of p qB associated with the implied fuzzy set ? i qB for the ith rule (,,,;,)ijklpq? . Notice that the fuzzy system must be defined so that ()? 1 0i qq R qqBy i ydym = ≠∑ ∫ for all ui. Also, note that { }?sup()iq qyqBym is often very easy to compute since if ()1pq qB ym = for at least one yq (which is the normal way to define consequent membership functions), then for many inference strategies, using Equation (2.14), we have ( ){ } ()?12sup,,,i q q qinB y yuuumm=? which has already been computed in the matching process. Moreover, the formula for defuzzification is then given by ()121 121 ,,, ,,,q Rq iincrisp i R buuuy uuu m m = = = ∑∑ ? ? (2.16) where we must ensure that 121 (,,,)0 R iniuuum= ≠∑ ? for all iu . Also note that this implies that the shape of the membership functions for the output fuzzy sets does not matter; hence, you can simply use singletons centered at the appropriate positions. Defuzzification: The Overall Implied Fuzzy Set Next, we present typical defuzzification techniques for the overall implied fuzzy set ?qB : ? Max criterion: A crisp output crisp qy is chosen as the point on the output universe of discourse yq for which the overall implied fuzzy set ?qB achieves a maximum—that is, (){ }?argsup iq q q crisp qB y yym??∈ ?? ?? PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Here, “ { }argsup()x xm " returns the value of x that results in the supremum of the function ()xm being achieved. For example, suppose that ()overall um denotes the membership function for the overall implied fuzzy set that is obtained by taking the maximum of the certainty values of (1)m and (2)m over all u in Figure 2.18 (i.e., (1)(2)()max{(),()}overalluuuummm= per Equation (2.15)). In this case, { }argsup()10uoverall um =? , which is the defuzzified value via the max criterion. Sometimes the supremum can occur at more than one point in yq(e.g., consider the use of the max criterion for the case where minimum is used to represent the implication, and triangular membership functions are used on the output universe of discourse, such as in Figure 2.19). In this case you also need to specify a strategy on how to pick only one point for crisp qy (e.g., choosing the smallest value). Often this defuzzification strategy is avoided due to this ambiguity; however, the next defuzzification method does offer a way around it. ? Mean of maximum: A crisp output crisp qy is chosen to represent the mean value of all elements whose membership in ?qB is a maximum. We define max? qB as the supremum of the membership function of ?qB over the universe of discourse yq. Moreover, we define a fuzzy set ?qqBy ? ∈ with a membership function defined as () ( )* max? ?10 q q Bqq qB yby otherwise mm ? =?= ? ?? then a crisp output, using the mean of maximum method, is defined as ( ) () * * ? ? qq q qq qqqBycrisp qqBy ydy y ydy m m= ∫ ∫ (2.17) where the fuzzy system must be defined so that ? ()0i qq qqBy ydym ≠∫ for all ui. As an example, suppose that for Figure 2.19 the two implied fuzzy sets are used to form an overall implied fuzzy set by taking the maximum of the two certainty values over all of u (i.e., (1)(2)()max{(),()}overalluuummm= per Equation (2.15)). In this case there is an interval of u values around -10 where the overall implied fuzzy set is at its maximum value, and hence there is an ambiguity about which is the best defuzzified value. The mean of the maximum method would pick the value in the middle of the interval as the defuzzified value, so it would choose -10. Note that the integrals in Equation (2.17) must be computed at each time instant since they depend on ?qB , which changes with time. This can require excessive computational resources for continuous universes of discourse. For some types of membership functions, simple ideas from geometry can be used to simplify the calculations; however, for some choices of membership functions, there may be many subintervals spread across the universe of discourse where the maximum is achieved. In these cases it can be quite difficult to compute the defuzzified value unless the membership functions are discretized. Complications such as these often cause designers to choose other defuzzification methods. ? Center of area (COA): A crisp output crisp qy is chosen as the center of area for the membership function of the overall PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn implied fuzzy set ?qB . For a continuous output universe of discourse yq, the center of area output is denoted by ( ) () ? ? qq q qq qqqBycrisp qqBy ydy y ydy m m= ∫ ∫ The fuzzy system must be defined so that ? ()0i qq qqBy ydym ≠∫ for all iu . Note that, similar to the mean of the maximum method, this defuzzification approach can be computationally expensive. For instance, we leave it to the reader to compute the area of the overall implied fuzzy set (1)(2)()max{(),()}overalluuuumm= for Figure 2.19. Notice that in this case the computation is not as easy as just adding the areas of the two chopped-off triangles that represent the implied fuzzy sets. Computation of the area of the overall implied fuzzy set does not count the area that the implied fuzzy sets overlap twice; hence, the area of the overall implied fuzzy set can in general be much more difficult to compute in real time. It is important to note that each of the above equations for defuzzification actually provides a mathematical quantification of the operation of the entire fuzzy system provided that each of the terms in the descriptions are fully defined. We discuss this in more detail in the next section. Overall, we see that using the overall implied fuzzy set in defuzzification is often undesirable for two reasons: (1) the overall implied fuzzy set ?qB is itself difficult to compute in general, and (2) the defuzzification techniques based on an inference mechanism that provides ?qB are also difficult to compute. It is for this reason that most existing fuzzy controllers (including the ones in this book) use defuzzification techniques based on the implied fuzzy sets, such as center-average or COG.. 2.3.6 Mathematical Representations of Fuzzy Systems Notice that each formula for defuzzification in the previous section provides a mathematical description of a fuzzy system. There are many ways to represent the operations of a fuzzy system with mathematical formulas. Next, we clarify how to construct and interpret such mathematical formulas for the case where center-average defuzzification is used for MISO fuzzy systems. Similar ideas apply for some of the other defuzzification strategies, MIMO fuzzy systems, and the Takagi-Sugeno fuzzy systems that we discuss in the next section. Assume that we use center-average defuzzification so that the formula describing how to compute the output is 1 1 R iii R ii by m m = = = ∑∑ (2.18) Notice that we removed the "crisp" superscript and "q" subscript from y (compare to Equation (2.16)). Also, we removed the "q" superscript from ib . The q index is no longer needed in both cases since we are considering MISO systems, so that while there can be many inputs, there is only one output. To be more explicit in Equation (2.18), we need to first define the premise membership functions im in terms of the individual membership functions that describe each of the premise terms. Suppose that we use product to represent the conjunctions in the premise of each rule. Suppose that we use the triangular membership functions in Table2.3 where we PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn suppose that ( ) ( )( )jj LR jjuummis the "left-" ("right-") most membership function on the jth input universe of discourse. In addition, let ( ) i j C jum be the ith "center" membership function for the jth input universe of discourse. In this case, to define ( )j L jum we simply add a "j" subscript to the parameters of the "left" membership function from Table 3.3. In particular, we use j Lc and j Lw to denote the jth values of these parameters. We take a similar approach for the ( )j R jum , j = 1,2,..., n. For ( ) i j C jum we use ( ) ii jjc w to denote the ith triangle center (triangle base width) on the jth input universe of discourse. Suppose that we use all possible combinations of input membership functions to form the rules, and that each premise has a term associated with each and every input universe of discourse. A more detailed description of the fuzzy system in Equation (2.18) is given by 1 1 121112 11 ()()() ()()() nnCLL j jjjj nL j jj bubu y uuu mmmm mmm ==++= ∏∏? ? The first term in the numerator is 11b m in Equation (2.18). Here, we have called the "first rule" the one that has premise terms all described by the membership functions ( )j L jum , j = 1,2.....n. The second term in the numerator is 22b m and it uses ( ) 1 1 1 C um on the first universe of discourse and the leftmost ones on the other universes of discourse (i.e., j = 2, 3, … n). Continuing in a similar manner, the sum in the numerator (and denominator) extends to include all possible combinations of products of the input membership functions, and this fully defines the im in Equation (2.18). Overall, we see that because we need to define rules resulting from all possible combinations of given input membership functions; of which there are three kinds (left, center, right), the explicit mathematical representation of the fuzzy system is somewhat complicated. To avoid some of the complications, we first specify a single function that represents all three types of input membership functions. Suppose that on the jth input universe of discourse we number the input membership functions from left to right as 1,2,…,Nj, where Nj is the number of input membership functions on the jth input universe of discourse. A single membership function that represents all three in Table 3.3 is () () () 1 1 1 max0,1 0.5 max0,1 0.5 j jj j j jjjj j j j jjj j N jj i j Nii jjji i j Ni jjji ifucanduc cuuifucanducanduc uc ifucanducanduc m w w ? ? ≤≥ ? ?????? =+≤><??? ????? ?????? +>><?? ?????? A similar approach can be used for the Gaussian membership functions in Table 2.4. Recall that we had used ( ),,,;, ijklpq? PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn to denote the ith rule. In this notation the indices in (the "tuple") (j, k,...,l) range over 121,1,,1 njNkNlN≤≤≤≤≤≤? , and specify which linguistic value is used on each input universe of discourse. Correspondingly, each index in the tuple (j, k,...,l) also specifies the linguistic-numeric value of the input membership function used on each input universe of discourse. Let ( ),,,;, ijklpqb ? denote the output membership function (a singleton) center for the ith rule (of course, q = 1 in our MISO case). Note that we use “i” in the notation( ),,,;, ijklpq? simply as a label for each rule (i.e., we number the rules in the rule-base, and i is this number). Hence, when we are given i, we know the values of j, k, .... l, p, and q. Because of this, an explicit description of the fuzzy system in Equation (2.18) is given by ( ) 12 12 ,,,;, 1 1 iR jklpq jkl ni R jkl ni by mmm mmm = = =∑ ∑ ? ? ? (2.19) This formula clearly shows the use of the product to represent the premise. Notice that since we use all possible combinations of input membership functions to form the rules there are 1 n j j RN = = ∏ rules, and hence it takes nn j1 j1 2 jjNN = = +∑ ∏ (2.20) parameters to describe the fuzzy system since there are two parameters for each input membership function and R output membership function centers. For some applications, however, all the output membership functions are not distinct. For example, consider the pendulum example where five output membership function centers are defined, and there are R = 25 rules. To define the center positions ( ) ,,,;, ijklpqb ? so that they take on only a fixed number of given values, that is less than R, one approach is to specify them as a function of the indices of the input membership functions. What is this function for the pendulum example? A different approach to avoiding some of the complications encountered in specifying a fuzzy system mathematically is to use a different notation, and hence a different definition for the fuzzy system. For this alternative approach, for the sake of variety, we will use Gaussian input membership functions. In particular, for simplicity, suppose that for the input universes of discourse we only use membership functions of the “center” Gaussian form shown in Table 2.4. For the ith rule, suppose that the input membership function is 2 1exp 2 j j i j i uc s ????? ????? ?? for the jth input universe of discourse. Hence, even though we use the same notation for the membership function, these centers j ic are different from those used above, both because we are using Gaussian membership functions here, and because the "i" in j ic is the index for the rules, not the membership function on the jth input universe of discourse. Similar PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn comments can be made about the j is ,i = 1,2, ...,R , j = 1,2, ...,n. If we let bi , i = 1,2,.... R, denote the center of the output membership function for the ith rule, use center-average defuzzification, and product to represent the conjunctions in the premise, then 2 1 1 2 1 1 1exp 2 1exp 2 j j j j i nR j i ii j i nR j ii j ucb y uc s s = = = = ????? ??? ?? ??= ????? ??? ?? ?? ∑∏ ∑∏ (2.21) is an explicit representation of a fuzzy system. Note that we do not use the "left" and "right" versions of the Gaussian membership functions in Table 2.4 as this complicates the notation. There are nR input membership function centers, nR input membership function spreads, and R output membership function centers. Hence, we need a total of (21)Rn+ parameters to describe this fuzzy system. Now, while the fuzzy systems in Equations (2.19) and (2.21) are in general different, it is interesting to compare the number of parameters needed to describe a fuzzy system using each approach. In practical situations, we often have 3jN ≥ for each j = 1,2,..., n, and sometimes the number of membership functions on each input universe of discourse can be quite large. From Equation (2.20) we can clearly see that large values of n will result in a fuzzy system with many parameters (there is an exponential increase in the number of rules). On the other hand, using the fuzzy system in Equation (2.21) the user specifies the number of rules and this, coupled with the number of inputs n, specifies the total number of parameters. There is not an exponential growth in the number of parameters in Equation (2.21) in the same way as there is in the fuzzy system in Equation (2.19) so you may be tempted to view the definition in Equation (2.21) as a better one. Such a conclusion, can, however be erroneous for several reasons. First, the type of fuzzy system defined by Equation (2.19)is sometimes more natural in control design when you use triangular membership functions since you often need to make sure that there will be no point on any input universe of discourse where there is no membership function with a nonzero value . Of course, if you are careful, you can avoid this problem with the fuzzy system represented by Equation (2.21) also. Second, suppose that the number of rules for Equation (2.21) is the same as that for Equation (2.19). In this case, the number of parameters needed to describe the fuzzy system in Equation (2.21) is ()n j1 21jNn = ??+ ?? ??∏ Now, comparing this to Equation (2.20) you see that for many values of Ni, j = 1,2,..., n, and number of inputs n, it is possible that the fuzzy system in Equation (2.21) will require many more parameters to specify it than the fuzzy system in Equation (2.19). Hence, the inefficiency in the representation in Equation (2.19) lies in having all possible combinations of output membership function centers, which results in exponential growth in the number of parameters needed to specify the fuzzy system. The inefficiency in the representation in Equation (2.21) lies in the fact that, in a sense, membership functions on the input universes of discourse are not reused by each rule. There are new input membership functions for every rule. Generally, it is difficult to know which is the best fuzzy system for a particular problem. In this book, we will sometimes use the mathematical representation in Equation (2.21) because it is somewhat simpler, and possesses some PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn properties that we will exploit. At other times we will be implicitly using the representation in Equation (2.19) because it will lend to the development of certain techniques. In every case, however, that we use Equation (2.21) (Equation (2.19)) you may want to consider how the concepts, approaches, and results change (or do not change) if the form of the fuzzy system in Equation (2.19) (Equation (2.21)) is used. Finally, we would like to recommend that you practice creating mathematical representations of fuzzy systems. For instance, it is good practice to create a mathematical representation of the fuzzy controller for the inverted pendulum of the form of Equation (2.19), then also use Equation (2.21) to specify the same fuzzy system. Comparing these two approaches, and resolving the issues in specifying the output centers for the Equation (2.19) case, will help clarify the issues discussed in this section. 2.3.7 Takagi-Sugeno Fuzzy Systems The fuzzy system defined in the previous sections will be referred to as a "standard fuzzy system." In this section we will define a "functional fuzzy system," of which the Takagi-Sugeno fuzzy system is a special case. For the functional fuzzy system, we use singleton fuzzification, and the MISO rule has the form ( )1122Ifandand,,andthenjklnniiuisAuisAuisAbg=????? ? where "?" simply represents the argument of the function ig and the ib are not output membership function centers. The premise of this rule is defined the same as it is for the MISO rule for the standard fuzzy system in Equation (2.4). The consequents of the rules are different, however. Instead of a linguistic term with an associated membership function, in the consequent we use a function bi=gi(.) (hence the name "functional fuzzy system") that does not have an associated membership function. Notice that often the argument of gi contains the terms ui, i = 1,2,...,n, but other variables may also be used. The choice of the function depends on the application being considered. Below, we will discuss linear and affine functions but many others are possible. For instance, you may want to choose ( ) ( ) ( ) ()()() 22 ,0,11, ,11,expsinsin iiiiinn ii inn bgaauau or bgauau =?=+++ ??=?=++?? ? ? Virtually any function can be used (e.g., a neural network mapping or another fuzzy system), which makes the functional fuzzy system very general. For the functional fuzzy system we can use an appropriate operation for representing the premise (e.g., minimum or product), and defuzzification may be obtained using 1 1 R iii R ii by m m = = = ∑∑ (2.22) where im is defined in Equation (2.13). It is assumed that the functional fuzzy system is defined so that no matter what its inputs are, we have 1 0R ii m= ≠∑ . One way to view the functional fuzzy system is as a nonlinear interpolator between the mappings that are defined by the functions in the consequents of the rules. An Interpolator Between Linear Mappings In the case where PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn ( ) ,0,11,iiiiinnbgaauau=?=+++? (where the ,jia are real numbers) the functional fuzzy system is referred to as a “Takagi-Sugeno fuzzy system." If ,0 0ia = , then the ( )ig ? mapping is a linear mapping and if ,0 0ia ≠ , then the mapping is called "affine." Often, however, as is standard, we will refer to the afflne mapping as a linear mapping for convenience. Overall, we see that the Takagi-Sugeno fuzzy system essentially performs a nonlinear interpolation between linear mappings. As an example, suppose that n=1, R = 2, and that we have rules 1 1 11 2 1121 If Then2 IfThen1 uisAbu uisAbu =+ =+ ?? ?? with the universe of discourse for u1 given in Figure 3.24 so that 1m represents 11A? and 2m represents 21A? . We have 1122 1122 12 bbybbmm mm mm +==+ + . We see that for 111,0u m>=, so 11yu=+ , which is a line. If 121,0u m<?=, so 12yu=+ , which is a different line. In between 111u?≤≤, the output y is an interpolation between the two lines. Plot y versus 1u to show how this interpolation is achieved. Figure 2.24 Membership functions for Takagi-Sugeno fuzzy system example. Finally, it is interesting to note that if we pick i,0g ia= (i.e., ai,j=0 for j > 0), then the Takagi-Sugeno fuzzy system is equivalent to a standard fuzzy system that uses center-average defuzzification with singleton output membership functions at ,0ia . It is in this sense that the Takagi-Sugeno fuzzy system—or, more generally, the functional fuzzy system—is sometimes referred to as a "general fuzzy system." An Interpolator Between Linear Systems It is important to note that a Takagi-Sugeno fuzzy system may have any linear mapping (affine mapping) as its output function, which also contributes to its generality. One mapping that has proven to be particularly useful is to have a linear dynamic system as the output function so that the ith rule has the form ( ) ( )11221if and and,,and then jklippiizisAzisAzisAxtAxtBu=+????? ? Here, ()()()()12,,, Tnxtxtxtxt= ????? is the n-dimensional state (now n is not necessarily the number of inputs); ()()()()12,,, Tmutututut= ? is the m-dimensional model input; Ai and Bi, i = 1,2,...,R are the state and input matrices of appropriate dimension; and ()()()()12,,, Tpztztztzt??= ??? is the p-dimensional input to the fuzzy PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn system. This fuzzy system can be thought of as a nonlinear interpolator between R linear systems. It takes the input z(t) and has an output () ()()( ) ()( )()() ()()()()()()() [] [] 1 1 11 11 1 (2.23) 1, ,, R iiii i R ii RR i i ii ii T RRR i AxtButztxt zt or xtAztxtBztut where m m xx xxxmm m = = == = + ????=+ ???????? ?? ??== ?? ∑ ∑ ∑∑ ∑ ? ? ?? If R=1, we get a standard linear system. Generally, forR>1and a given value of z(t), only certain rules will turn on and contribute to the output. Many choices are possible for z(t). For instance, we often choose z(t) = x(t), or sometimes z(t)=[xT(t),uT(t)]T . As an example, suppose that z(t) = x(t), p = n = m =1, and R = 2 with rules 11 111 22 1 11 2 2 ifisAthenxxu ifxisAthenxxu =?+ =?+ ? ? ? ?? Suppose that we use 1mand 2mfrom Figure 2.24 as the membership functions for 1211 AandA??, respectively (i.e., we relabel the horizontal axis of Figure 2.24 with 1x). In this case Equation (2.23) becomes () ( ) () ( ) ()1121122122xtxtutmmmmm=??++? If 1()1xt>, then 1 0m= and 2 1m= , so the behavior of the nonlinear system is governed by () () ()1112xtxtut=?+? which is the linear system specified by the second rule above. However, if 1()1xt<? , then 1 1m=and 2 0m= , so the behavior of the nonlinear system is governed by () () ()1112xtxtut=?+? which is the linear system specified by the first rule above. For ()111xt?≤≤, the Takagi-Sugeno fuzzy system interpolates between the two linear systems. We see that for changing values of 1()xt, the two linear systems that are in the consequents of the rules contribute different amounts. We think of one linear system being valid on a region of the state space that is quantified via 1mand another on the region quantified by 2m(with a "fuzzy boundary" in between). For the higher-dimensional case, we have premise membership functions for each rule quantify whether the linear system in the consequent is valid for a specific region on the state space. As the state evolves, different rules turn on, indicating that other combinations of linear models should be used. Overall, we find that the Takagi-Sugeno fuzzy system provides a very intuitive representation of a nonlinear system as a nonlinear interpolation between R linear models. 2.3.8 Fuzzy Systems Are Universal Approximators PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Fuzzy systems have very strong functional capabilities. That is, if properly constructed, they can perform very complex operations (e.g., much more complex than those performed by a linear mapping). Actually, many fuzzy systems are known to satisfy the "universal approximation property". For example, suppose that we use center-average defuzzification, product for the premise and implication, and Gaussian membership functions. Name this fuzzy system f(u). Then, for any real continuous function ( )uy defined on a closed and bounded set and an arbitrary 0e > , there exists a fuzzy system f(u) such that ( ) ( )sup u fuuye?< Note, however, that all this "universal approximation property" does is guarantee that there exists a way to define the fuzzy system f(u) (e.g., by picking the membership function parameters). It does not say how to find the fuzzy system, which can, in general, be very difficult. Furthermore, for arbitrary accuracy you may need an arbitrarily large number of rules. The value of the universal approximation property for fuzzy systems is simply that it shows that if you work hard enough at tuning, you should be able to make the fuzzy system do what you are trying to get done. For control, practically speaking, it means that there is great flexibility in tuning the nonlinear function implemented by the fuzzy controller. Generally, however, there are no guarantees that you will be able to meet your stability and performance specifications by properly tuning a given fuzzy controller. You also have to choose the appropriate controller inputs and outputs, and there will be fundamental limitations imposed by the plant that may prohibit achieving certain control objectives no matter how you tune the fuzzy controller (e.g., a nonminimum phase system may provide certain limits on the quality of the performance that can be achieved). 2.4 Simple Design Example: The Inverted Pendulum As there is no general systematic procedure for the design of fuzzy controllers that will definitely produce a high-performance fuzzy control system for a wide variety of applications, it is necessary to learn about fuzzy controller design via examples. Here, we continue with the inverted pendulum example to provide an introduction to the typical procedures used in the design (and redesign) of a fuzzy controller. After reading the next section, on simulation of fuzzy control systems, the reader can follow this section more carefully by fully reproducing our design steps. For a first reading, however, we recommend that you not worry about how the simulations were produced; rather, focus on their general characteristics as they are related to design. To simulate the fuzzy control system shown in Figure 3.4 it is necessary to specify a mathematical model of the inverted pendulum. Note that we did not need the model for the initial design of the fuzzy controller in Section 2.2.1; but to accurately assess the quality of a design, we need either a model for mathematical analysis or simulation-based studies, or an experimental test bed in which to evaluate the design. Throughout the book we will also show actual implementation results that are used to assess the performance of fuzzy controllers. One model for the inverted pendulum shown in Figure 2.2 is given by ()() ( ) () 2 2 0.25sin9.8sincos 1.5 410.5cos 33 uyyyy y y ????+ ???? = ?? ????? ? ?? (2.24) PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn 100100uuu ? =?+ The first order filter on u to produce u represents an actuator. Given this and the fuzzy controller developed in Section 2.2.1 (the one that uses the minimum operator to represent both the "and" in the premise and the implication and COG defuzzification), we can simulate the fuzzy control system shown in Figure 2.4. We let the initial condition be y(0) = 0.1 radians (= 5.73 deg.), ( )00y =? , and the initial condition for the actuator state is zero. The results are shown in Figure 2.25, where we see in the upper plot that the output appropriately moves toward the inverted position, and the force input in the lower plot that moves back and forth to achieve this. Figure 2.25 Fuzzy controller balancing an inverted pendulum, first design. 2.4.1 Tuning via Scaling Universes of Discourse Suppose that the rate at which the pendulum balances in Figure 2.25 is considered to be unacceptably slow and that there is too much control action. To solve these problems, we use standard ideas from control engineering to conclude that we ought to try to tune the "derivative gain." To do this we introduce gains on the proportional and derivative terms, as shown in Figure 2.26 and at the same time we also put a gain h between the fuzzy controller and the inverted pendulum. Choose 011,0,1ggandh===. To see the effect of this gain change, see Figure 2.27, where we see that the output angle reacts much faster and the control input is smoother. Figure2.26 Fuzzy controller for inverted pendulum with scaling gains g0,g1,and h PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Figure 2.27 Fuzzy controller balancing an inverted pendulum with g0=1,g1=0.1,and h=1. If we still find the response of the pendulum rather slow, we may decide, using standard ideas from control engineering, that the proportional gain should be increased (often raising the "loop-gain" can speed up the system). Suppose next that we choose 012,0.1,1ggandh===—that is, we double the proportional gain. Figure2.28 shows the resulting behavior of the fuzzy control system, where we see that the response is made significantly faster than in Figure2.27. Actually, a similar effect to increasing the proportional gain can be achieved by increasing the output gain h. Choose 012,0.1,5,ggandh===and see Figure 2.29, where we see that the response is made even faster than in Figure2.28. Indeed, as this is just a simulation study, we can increase h further and get even faster balancing provided that we simulate the system properly by having a small enough integration step size. However, the reader must be cautioned that this may stretch the simulation model beyond its range of validity. For instance, further increases in h will generally result in faster balancing at the expense of a large control input, and for a big enough h the input may be larger than what is allowed in the physical system. At that point the simulation would not reflect reality since if the controller were actually implemented, the plant input would saturate and the proper balancing behavior may not be achieved. Figure 2.28 Fuzzy controller balancing an inverted pendulum with g0=2,g1=0.1,and h=1. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Figure 2.29 Fuzzy controller balancing an inverted pendulum with g0=2,g1=0.1,and h=5. We see that the change in the scaling gains at the input and output of the fuzzy controller can have a significant impact on the performance of the resulting fuzzy control system, and hence they are often a convenient parameter for tuning. Because they are frequently used for tuning fuzzy controllers, it is important to study exactly what happens when these scaling gains are tuned. Input Scaling Gains First, consider the effect of the input scaling gains 0g and 1g . Notice that we can actually achieve the same effect as scaling via 1g by simply changing the labeling of the ()detdt axis for the membership functions of that input. The case where 011.0gg== corresponds to our original choice for the membership functions in Figure 2.9. The choice of 1 0.1g = as a scaling gain for the fuzzy controller with these membership functions is equivalent to having the membership functions shown in Figure2.30 with a scaling gain of 1 1g = . Figure 2.30 Scale membership function for We see that the choice of a scaling gain of 1g results in scaling the horizontal axis of the membership functions by 1 1 g . PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Generally, the scaling gain 1g has the following effects: n ? If 1 1g = , there is no effect on the membership functions. n ? If 1 1g < , the membership functions are uniformly "spread out" by a factor of 1 1 g (notice that multiplication of each number on the horizontal axis of Figure 2.9 on page 33 by 10 produces Figure2.30). n ? If 1 1g > , the membership functions are uniformly "contracted" (to see this, choose and notice that the numbers on the horizontal axis of the new membership functions that we would obtain by collapsing the gain into the choice of the membership functions, would be scaled by 0.1). The expansion and contraction of the horizontal axes by the input scaling gains is sometimes described as similar to how an accordion operates, especially for triangular membership functions. Notice that the membership functions for the other input to the fuzzy controller will be affected in a similar way by the gain 0g . Now that we see how we can either use input scaling gains or simply redefine the horizontal axis of the membership functions, it is interesting to consider how the scaling gains actually affect the meaning of the linguistics that form the basis for the definition of the fuzzy controller. Notice that n ? If 1 1g = , there is no effect on the meaning of the linguistic values. n ? If 1 1g < , since the membership functions are uniformly "spread out," this changes the meaning of the linguistics so that, for example, "poslarge" is now characterized by a membership function that represents larger numbers. n ? If 1 1g > , since the membership functions are uniformly "contracted," this changes the meaning of the linguistics so that, for example, "poslarge" is now characterized by a membership function that represents smaller numbers. Similar statements can be made about all the other membership functions and their associated linguistic values. Overall, we see that the input scaling factors have an inverse relationship in terms of their ultimate effect on scaling (larger 1g that is greater than 1 corresponds to changing the meaning of the linguistics so that they quantify smaller numbers). While such an inverse relationship exists for the input scaling gains, just the opposite effect is seen for the output scaling gains, as we shall see next. Output Scaling Gain Similar to what you can do to the input gains, you can collapse the output scaling gain into the definition of the membership functions on the output. In particular, n ? If h = 1, there is no effect on the output membership functions. n ? If h < 1, there is the effect of contracting the output membership functions and hence making the meaning of their associated linguistics quantify smaller numbers. n ? If h > 1, there is the effect of spreading out the output membership functions and hence making the meaning of their associated linguistics quantify larger numbers. There is a proportional effect between the scaling gain h and the output membership functions. As an example, for the inverted pendulum the output membership functions are scaled by h as shown in Figure2.31. The reader should verify the effect of h by considering how the membership functions shown in Figure 2.31 will move for varying values of h. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Figure 2.31 The effect of scaling gain h on the spacing of the output membership functions. Overall, the tuning of scaling gains for fuzzy systems is often referred to as "scaling a fuzzy system." Notice that if for the pendulum example the effective universes of discourse for all inputs and outputs are [-1, +1] (i.e., the input (output) left-most membership function saturates (peaks) at -1 and the right-most input (output) membership function saturates (peaks) at +1), then we say that the fuzzy controller is "normalized." Clearly, scaling gains can be used to normalize the given fuzzy controllers for the pendulum. 2.4.2 Tuning Membership Functions It is important to realize that the scaling gains are not the only parameters that can be tuned to improve the performance of the fuzzy control system. Indeed, sometimes it is the case that for a given rule-base and membership functions you cannot achieve the desired performance by tuning only the scaling gains. Often, what is needed is a more careful consideration of how to specify additional rules or better membership functions. The problem with this is that there are often too many parameters to tune (e.g., membership function shapes, positioning, and number and type of rules) and often there is not a clear connection between the design objectives (e.g., better rise-time) and a rationale and method that should be used to tune these parameters. There are, however, certain methods to overcome this problem, and here we will examine one of these that has been found to be very useful for real implementations of fuzzy control systems for challenging applications. Output Membership Function Tuning In this method we will tune the positioning of the output membership functions (assume that they are all symmetric and equal to one only at one point) by characterizing their centers by a function. Suppose that we use ci , i = -2, -1,0,1,2, to denote the centers of the output membership functions for the fuzzy controller for the inverted pendulum, where the indices i for the ic are the linguistic-numeric values used for the output membership functons(see Figure 2.9). If h=1 then 10ici= describes the positioning of the centers of the output membership functions shown in Figure 2.9 and if we scale by h then 10ichi= describes the position centers as shown in Figure 2.31. We see that a linear relationship in the ci equation produces a linear (uniform) spacing of the membership functions. Suppose that we instead choose ( ) 25ichsignii= (2.25) (sign(x) returns the sign of the number x and sign(0) = 1), then this will have the effect of making the output membership PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn function centers near the origin be more closely spaced than the membership functions farther out on the horizontal axis. The effect of this is to make the "gain" of the fuzzy controller smaller when the signals are small and larger as the signals grow larger (up to the point where there is a saturation, as usual). Hence, the use of Equation (2.25) for the centers indicates that if the error and change-in-error for the pendulum are near where they should be, then do not make the force input to the plant too big, but if the error and change-in-error are large, then the force input should be much bigger so that it quickly returns the pendulum to near the balanced position (note that a cubic function 35ichi= will provide a similar effect as the ( ) 2signiiterm in Equation (2.25)). Effect on Performance At this point the reader should wonder why we would even bother with more complex tuning of the fuzzy controller for the inverted pendulum since the performance seen in our last design iteration, in Figure 2.29, was quite successful. Consider, however, the effect of a disturbance such that during the previous simulation in Figure 2.29 we let ' 600uu=+ for t such that 0.99 < t < 1.01 sec where u’ is now the force input to the pendulum and u is as before the output of the fuzzy controller (for 0.99t ≤ and 1.01t ≥ , we let 'uu= ). This corresponds to a 600 Newton pulse on the input to the pendulum, and simulates the effect of someone bumping the cart so that we can study the ability of the controller to then rebalance the pendulum. The performance of our best controller up till now, shown in Figure 2.29, is shown in Figure 2.32, where we see that the fuzzy controller fails to rebalance the pendulum when the cart is bumped. Suppose that to overcome this problem we decide that while the design in Figure 2.29 was good for small-angle perturbations, something needs to be done for larger perturbations. In particular, let us attempt to use the fact that if there is a large variation from the inverted position there had better be a large enough input to get the pendulum closer to its inverted position so that it will not fall. To do this, we will use the above approach and choose ( ) 25ichsignii= where h = 10.0 (we keep 012.00.1gandg==). If you were to simulate the resulting fuzzy control system for the case where there is no disturbance, you would find a performance that is virtually identical to that of the design that resulted in Figure 2.29. The reason for this can be explained as follows: Notice that for Figure 3.29 the gains were 012.00.1gandg==and that we have the output membership function centers given by 5ichi= where h = 10. Notice that for both controllers, if i = 0 or i = 1 we get the same positions of the output membership functions. Hence, if the signals are small, we will get nearly the same effect from both fuzzy controllers. However, if, for example, i = 2 then the center resulting from the controller with ( ) 25ichsignii= will have a membership function that is much farther out, which says that the input to the plant should be larger. The effect of this will be to have the fuzzy controller provide very large force inputs when the pendulum is not near its inverted position. To see this, consider Figure 2.33, where we see that the newly redesigned fuzzy controller can in fact rebalance the pendulum in the presence of the disturbance (and it performs similarly to the best previous one, shown in Figure 2.29, in response to smaller perturbations from the inverted position, as is illustrated by how it recovers from the initial condition). Notice, however, that it used a large input force to counteract the bump to the pendulum. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Figure 2.32 Effect of a disturbance (a bump to the cart of the pendulum) on the balancing capabilities of the fuzzy controller You may wonder why we did not just increase the gain on the fuzzy controller depicted in Figure 2.29 to the point where it would be able to recover similarly to this new control system. However, if we did this, we would also raise the gain of the controller when its input signals are small, which can have adverse effects of amplifying noise in a real implementation. Besides, our redesign above was used simply to illustrate the design approach. In the applications, we will use a similar design approach where the need for the nonlinear spacing of the output membership functions is better motivated due to the fact that a more challenging application dictates this. 2.4.3 The Nonlinear Surface for the Fuzzy Controller Ultimately, the goal of tuning is to shape the nonlinearity that is implemented by the fuzzy controller. This nonlinearity, sometimes called the "control surface," is affected by all the main fuzzy controller parameters. Consider, for example, the control surface for the fuzzy controller that resulted in the response shown in Figure 2.29 (i.e., 012.0,0.1,and 5ggh===), which is shown in Figure 2.34, where the output of the fuzzy controller is now plotted against its two inputs. Notice that the surface represents in a compact way all the information in the fuzzy controller (but of course this representation is limited in that if there are more than two inputs it becomes difficult to visualize the surface). To convince yourself of this, you should pick a value for e and ()detdt , read the corresponding fuzzy controller output value off the surface, and determine if the rule-base would indicate that the controller should behave in this way. Figure 2.34 simply represents the range of possible defuzzified values for all possible inputs e and ()detdt . Note that the control surface for a simple proportional-derivative (PD) controller is a plane in three dimensions. With the proper choice of the PD gains, the linear PD controller can easily be made to have the same shape as the fuzzy controller near the origin. Hence, in this case the fuzzy controller will behave similarly to the PD controller provided its inputs are small. However, notice that there is no way that the linear PD controller can achieve a nonlinear control surface of the shape shown in Figure 2.34 (this is not surprising considering the complexity difference of the two controllers). PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn Figure 2.33 Effect of a disturbance (a bump to the cart of the pendulum) on the balancing capabilities of the fuzzy controller Next, notice changing the gains 0g and 1g will rescale the axis, which will change the slope of the surface. Increasing 0g is analogous to increasing the proportional gain in a PD controller (i.e., it will often make the system respond faster). Increasing the gain 1g is analogous to increasing the derivative gain in a PD controller. Notice, also, that changing h will scale the vertical axis of the controller surface plot. Hence, for instance, increasing h will make the entire surface have a higher slope and make the output saturate at higher values. It is useful to notice that there is a type of interpolation that is performed by the fuzzy controller that is nicely illustrated in Figure 2.34. If you study the plot carefully, you will notice that the rippled surface is created by the rules and membership functions. For instance, if we kept a similar uniform distribution of membership functions for the input and outputs of the fuzzy system, but increased the number of membership functions, the ripples would correspondingly increase in number and the amplitude of the ripple would decrease (indeed, in the limit, as more and more membership functions are added in this way, the controller can be made to approximate a plane in a larger and larger region—but this may not occur for other membership function distributions and rule-base choices). What is happening is that there is an interpolation between the rules. The output is an interpolation of the effects of the four rules that are on for the inverted pendulum fuzzy controller. For more general fuzzy controllers, it is important to keep in mind that this sort of interpolation is often occurring (but not always—it depends on your choice of the membership functions). When we tune the fuzzy controller, it changes the shape of the control surface, which in turn affects the behavior of the closed-loop control system. Changing the scaling gains changes the slope of the surface and hence the "gain" of the fuzzy controller as we discussed above. The output membership function centers will also affect the shape of the surface. For instance, the control surface for the fuzzy controller that had ( ) 25ichsignii= where 0110,2.0,0.1hgandg===is shown in Figure 2.35. You must carefully compare this surface to the one in Figure 2.34 to assess the effects of using the nonlinear spacing of the output membership function centers. Notice that near the center of the plot (i.e., where the inputs are zero) PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn the shape of the two plots is nearly the same (i.e., as explained above, the two controllers will behave similarly for small input signals). Notice, however, that the slope of the surface is greater for larger signals in Figure 2.35 than in Figure 2.34. This further illustrates the effect of the choice of the nonlinear spacing for the output membership function centers. Figure 2.34 Control surface of the fuzzy controller for g0=2.0, g1=0.1, and h=5. This concludes the design process for the fuzzy controller for the pendulum. Certainly, if you were concerned with the design of a fuzzy controller for an industrial control problem, many other issues besides the ones addressed above would have to be considered. Here, we simply use the inverted pendulum as a convenient example to illustrate the design procedures that are often used for fuzzy control systems. Figure 2.35 Control surface of the fuzzy controller for ci=5hsign(i)i2, h=10.0, g0=2.0, and g1=0.1 2.4.4 Summary: Basic Design Guidelines PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn This section summarizes the main features of the design process from the previous subsection. The goal is to try to provide some basic design guidelines that are generic to all fuzzy controllers. In this spirit, we list some basic design guidelines for (nonadaptive) fuzzy controllers: 1. Begin by trying a simple conventional PID controller. If this is successful, do not even try a fuzzy controller. The PID is computationally simpler and very easy to understand. 2. Perhaps you should also try some other conventional control approaches (e.g., a lead-lag compensator or state feedback) if it seems that these may offer a good solution. 3. For a variety of reasons, you may choose to try a fuzzy controller. Be careful to choose the proper inputs to the fuzzy controller. Carefully assess whether you need proportional, integral, and derivative inputs (using standard control engineering ideas). Consider processing plant data into a form that you believe would be most useful for you to control the system if you were actually a "human-in-the-loop." Specify your best guess at as simple a fuzzy controller as possible (do not add inputs, rules, or membership functions until you know you need them). 4. Try tuning the fuzzy controller using the scaling gains, as we discussed in the previous section. 5. Try adding or modifying rules and membership functions so that you more accurately characterize the best way to control the plant (this can sometimes require significant insight into the physics of the plant). 6. Try to incorporate higher-level ideas about how best to control the plant. For instance, try to shape the nonlinear control surface using a nonlinear function of the linguistic-numeric values, as explained in the previous section. 7. If there is unsmooth or chattering behavior, you may have a gain set too high on an input to the fuzzy controller (or perhaps the output gain is too high). Setting the input gain too high makes it so that the membership functions saturate for very low values, which can result in oscillations (i.e., limit cycles). 8. Sometimes the addition of more membership functions and rules can help. These can provide for a "finer" (or "higher-granularity") control, which can sometimes reduce chattering or oscillations. 9. Sometimes it is best to first design a linear controller, then choose the scaling gains, membership functions, and rule-base so that near the origin (i.e., for small controller inputs) the slope of the control surface will match the slope of the linear controller. In this way we can incorporate all of the good ideas that have gone into the design of the linear controller (about an operating point) into the design of the fuzzy controller. After this, the designer should seek to shape the nonlinearity for the case where the input signals are not near the origin using insights about the plant. Generally, you do not tune the fuzzy controller by evaluating all possibilities for representing the "and" in the premise or for the implication (e.g., minimum or product operations) or by studying different defuzzification strategies. While there are some methods for tuning fuzzy controllers this way, these methods most often do not provide insights into how these parameters ultimately affect the performance that we are trying to achieve (hence it is difficult to know how to tune them to get the desired performance). We must emphasize that the above guidelines do not constitute a systematic design procedure. As with conventional control design, a process of trial and error is generally needed. Generally, we have found that if you are having trouble coming up with a good fuzzy controller, you probably need to gain a better understanding of the physics of the process you are trying to control, and you then need to get the knowledge of how to properly affect the plant dynamics into the fuzzy controller. 2.5 Summary In this chapter we have provided a "tutorial introduction" to direct fuzzy control. In our tutorial introduction we provided a step-by-step overview of the operations of the fuzzy controller. We provided an inverted pendulum problem for which PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn we discussed several basic issues in the design of fuzzy controllers. Moreover, we discussed simulation and implementation via the use of a pseudocode for a fuzzy controller. Our introduction is designed to provide the reader with an intuitive understanding of the mechanics of the operation of the fuzzy controller. Our mathematical characterization served to show how the fuzzy controller can handle more inputs and outputs, the range of possibilities for the definition of universes of discourse, the membership functions, the rules, the inference mechanism, and defuzzification methods. The reader who studies the mathematical characterization of fuzzy systems will gain a deeper understanding of fuzzy systems. The design example for the inverted pendulum problem is meant to be an introduction to basic design methods for fuzzy controllers. The section on coding is meant to help the reader bridge the gap between theory and application so that you can quickly get a fuzzy controller implemented. Upon completing this chapter, the reader should understand the following topics: n Issues in the choice of the inputs and outputs of the fuzzy controller. n Linguistic variables. n Linguistic values (and linguistic-numeric values). n Linguistic rules (MISO, MIMO, and ones that do not use all their premise or consequent terms). n Membership functions (in terms of how they quantify linguistics and their mathematical definition). n Fuzzy sets (mathematical definition and relation to crisp sets). n Operations on fuzzy sets (subset, complement, union, intersection, and relations to representation of the logical "and" and "or"). n The multidimensional premise membership function that represents the conjunction of terms in the premise. n Fuzzification (singleton and more general forms). n Fuzzy Cartesian product and its use in representation of the premise. n Inference mechanism (three stages: matching, selection of rules that are on, and taking the actions specified by the applicable rules). n Implied fuzzy sets. n Overall implied fuzzy sets (and the differences from the implied fuzzy sets). n Sup-star and Zadeh's compositional rule of inference. n Defuzzification methods (including those for the implied fuzzy sets and overall implied fuzzy set). n The method of providing a graphical explanation of the inference process that was given at the end of Section 3.2.1. n Mathematical representations of fuzzy systems, including issues related to the number of parameters needed to represent a fuzzy system. n Functional fuzzy systems (and Takagi-Sugeno fuzzy systems). n The universal approximation property and its implications. n Basic approaches to the design of the fuzzy controller, including the use of proportional, integral, and derivative terms. n The value of getting the best knowledge about how to achieve good control into the rule-base and methods for doing this (e.g., the use of functions mapping the linguistic-numeric indices to the centers of the output membership functions). n The manner in which a fuzzy controller implements a nonlinearity and connections between the choice of controller parameters(e.g., scaling gains) and the shape of this nonlinearity. n How to simulate a nonlinear system. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn n How to simulate a fuzzy system and a fuzzy control system. n Methods to optimize the code that implements a fuzzy controller (with respect to both time and memory). Essentially, this is a checklist for the major topics of this chapter. The reader should be sure to understand each of the above concepts or approaches befor moving on to later chapters. PDF 文件使用 "pdfFactory Pro" 试用版本创建 www.fineprint.com.cn