16.2 Fuzzy Logic and Fuzzy Expert System  A Primer. 16.3 Fuzzy ... Design of
Stable Feedback Fuzzy Expert Systems and Stable closed Loop. Systems with ...
CHAPTER 16 FUZZY LOGIC, FUZZY EXPERT SYSTEMS & FUZZY CONTROLLERS 16.1 16.2 16.3
Introduction to the Chapter Fuzzy Logic and Fuzzy Expert System  A Primer Fuzzy Expert Systems as Controllers. 16.3.1. Systems for Nonlinear Mapping / Transformation 16.3.2. Limitations of Classical Fuzzy Controllers 16.3.3. Stability of Closed Loop Systems using Fuzzy Controllers Results from Classical Nonlinear Control Theory Sector Condition and Aizerman's Conjecture Popov's Criterion 16.4. Fuzzy Expert Systems & Neural Networks: Compare, Contrast & Merge 16.4.1. Digital Architecture of FESs & FCs for RealTime Applications 16.4.2. Cerebellar Model Articulation Controllers (CMAC) Neural Network Vs Fuzzy Expert Systems. 16.5. Design of Stable Feedback Fuzzy Expert Systems and Stable closed Loop Systems with Feedback Fuzzy Controllers 16.5.1. Design of Stable Feedback Fuzzy Expert Systems 16.5.2. Design of Stable closed Loop Systems with Feedback Fuzzy Controllers Work to be completed: Below 16.25, we say power & energy concepts can be used .... We will see later.
16. FUZZY LOGIC, FUZZY EXPERT SYSTEMS & FUZZY CONTROLLERS
16.1 Introduction to the Chapter In this chapter, we consider another emerging, hot area in intelligent systems that of fuzzy logic (FL), fuzzy expert systems (FESs) and fuzzy controllers (FCs), mainly from the perspective of nonlinear systems. We first provide a simple and concise introduction to this area. We provide only the salient details about functional and implementational aspects of fuzzy expert systems and fuzzy controllers and omit mathematical details as much as possible. This section will be of interest to those who want to learn about these areas from a practical perspective without having to spend an enormous amount of time studying the underlying mathematical principles. The readers will find that fuzzy logic casts in an analytical mode the approaches taken by human beings in dealing with daytoday problems which are nonlinear by nature and the resulting solutions. What will emerge from the discussions in this section is that fuzzy logic and fuzzy expert systems are in fact excellent vehicles for specifying multiinput / multioutput (MIMO) static mappings. The beauty of fuzzy logic lies in the relatively simple and easy approach with which MIMO nonlinear functional mappings of practical relevance can be described and implemented. The use of fuzzy logic in control applications is considered in section 16.3. We give some examples that illustrate how fuzzy logic can be used to design control laws and discuss the performance of systems controlled by fuzzy controllers. We will find from the examples that fuzzy controllers (based on some appropriate knowledge) can indeed do a good job. Perhaps the important point to learn is that since the controller is in general nonlinear, better performance can be obtained from different fuzzy controllers based on the knowledge from different experts. That is, the nonlinearity by itself makes it possible to have more than one nearoptimal control law and leads to control laws that are robust. However, The nonlinear nature of the control law makes the closedloop system nonlinear even if the openloop system is LTI, and it is very difficult to prove the stability of such nonlinear systems. We present some results from classical control theory to show the efforts that went into proving
the stability of such systems and the difficulties encountered. Further, as indicated earlier, fuzzy logic leads to static (memoryless) control laws with abrupt changes that may not be acceptable in practice. Also, when the number of inputs is large, the design complexity also increases. Then, there is the question of adaptability or learning in fuzzy expert systems. In sections 16.4 and 16.5, we provide some solutions to these problems. In section 16.4, we show how fuzzy logic can be combined with neural nets to retain the best of both worlds: use of experts’ knowledge and further adaptation based on observed data. We also discuss a neural network architecture known as Cerebellar Model Articulation Controllers (CMAC) Neural Network, which was proposed independently some twenty five years ago, and its similarity to fuzzy expert systems. In section 16.5, we show how the building block concept can be used to overcome the stability problem, introduce memory into otherwise static fuzzy expert systems, and provide the ability to deal with a large number of input variables. The network approach thus leads to the next generation of fuzzy controllers, called feedback or recurrent fuzzy controllers, and can find use in a number of applications.
16.2 Fuzzy Logic and Fuzzy Expert System  A Primer We will explain the basic concepts of fuzzy logic and fuzzy expert systems through a common task encountered by most of us in real life  that of backing up a vehicle to a fixed location; for example a truck to a loading dock. Let us consider how this problem will be handled by a classical control engineer assigned the task of designing an electronic controller that can carry out the task of backing up a truck successfully and by a human being (the driver), perhaps with help from another person. Both the control designer and the driver will start with some meaningful assumptions to simplify the problem. For example, they will assume that the truck is initially within the loading zone, and there is enough clearance between the truck and the loading dock (Fig. 16.1a), so it is feasible to back up the truck under normal circumstances. The driver will basically eyeball the position of the truck and the distance left, and control the steering angle and speed properly. If a human helper is available to assist the driver1, he/she may give directions such as a little more to the left, swing to the right etc. The driver will move a certain distance before he/she eyeballs the position once again and/or seeks advice from the helper. He/She may feel that he/she is doing all or some of these things continuously though in reality they may be taking place in a discrete manner.
1
This statement perhaps might lead the readers to wonder, "how many professors will it take to back up a truck to a loading dock ?," !
loading dock (50,100)
(100, 100)
y rear (x,y)
φ
θ
front
(0,0)
x (a)
involved in those words meant for directions and the possible responses to those directions. In spite of all these ambiguities, normally (!), the job gets done satisfactorily (!!)2. The controllerdesigner will start with identifying the variables to be measured and made available to the controller, and the output(s) from the controller. He/She may decide if he/she needs a mathematical model of the plant (the truck) and assume a model for the controller (proportionalderivative or proportionalderivativeintegral control or PD and PID control for short). In this specific problem, the position of the truck (x, y) with respect to the loading dock coordinates, and the truck angle φ (with respect to the normal to the loading dock) are the three input parameters that can be measured and input to the controller, and the speed and the steering angle θ can be the outputs of the controller (Fig. 16.1b). Next comes the task of identifying the range of the variables and the resolution to which they can be and should be measured. The 'can be' will depend upon the technology available and the cost associated with it. The 'should be' depends on the problem being solved and the minimum acceptable value for successfully solving the problem. The range of values for the three input and the two output variables are:
xd
φd
φ = [ 0 360 ]
Speed
yd
Controller
Truck
x,y,φ
x = [ 0100 ]
θ
y = [ 0100 ]
(16.1)
θ = [−30 30] speed = [ 010 ] (x,y) new = (x,y) old + (dx,dy) dx = r cos( φ + θ ), dy = r sin( φ
+ θ)
(b)
Figure 161. Specifications for the truck backup problem. a) The dock and the truck; b) A closedloop system involving the truck and a fuzzy expert system as a controller.
In the above paragraph, there are a number of key words that need our attention: possible to back up under normal circumstances, control the steering angle (and speed) properly, a little more to left etc. There is a lot of subjectivity
An analog or continuous representation within these range of values or discrete representation using, say, an eight to 12bits (256 to 4096 quantization levels) may be assumed for the five variables of the truck backup problem. Thereafter, the sensors (and the A/D converter) will be assumed to provide correct or precise measurements of the input variables. The key word here is 'correct values', which differentiates the classical approach to engineering design and the humanistic approach. In the latter, approximate values or descriptors (such as a little more to left etc.) are used. In the classical approach to engineering design, we deal with the possibility for measurement error (and others) through analytical approaches such as probability theory etc., and counter the effects of erroneous measurements (and others) through redundancy in architecture etc. Fuzzy Logic Theory, as indicated earlier, casts in concrete mathematical and analytical framework the ability of human beings to describe/characterize 2
The key point to note here is that in such problems we have more than one nearoptimal solution each of which are acceptable.
information, events, and actions in approximate, and ambiguous linguistic terms and their ability to infer and deduce useful information, and or take actions based on them. Thus, approximate and ambiguous are the key terms here. Unfortunately the term 'Fuzzy' is selected to describe them. We say unfortunate, because when combined with the words logic and theory, leading to fuzzy logic theory, it gives a bad or funny feeling about the whole area3 and raises issues such as how can a theory be fuzzy etc. This is perhaps one major reason that the acceptance of fuzzy logic has been slow in the western society (where every thing is expected to be crisply defined or when it comes to decisions, they have to be binary outcomes; a case in point at the time of writing this chapter in the wake of the Oklahoma city bombing is the talk about and outright denial by others of conspiracy theory of governments, corporations, and different ethnic groups, trying to control the society. Anyone who has had experience with the politics at the work place will agree that the binary logic of true or false alone is insufficient to deal with the real events taking place in this complex world. Fuzzy logic got its lift from the Japanese researchers and since then a cult has sprung in this country as well. In addition to the use of the continuous and discrete signals (seen in the classical set theory) with a range of values or domain {in a universe of discourse} and their specific values at any time, fuzzy logic allows for a new category of signals known as fuzzy variables. In defining a fuzzy signal, the entire range of values of a variable is divided into smaller (five to seven), meaningful, mostly overlapping regions, denoted by corresponding linguistic terms. For example, the steering angle which has been restricted to the range 30 to +30 degrees may be divided into seven smaller regions {−30 ° to − 15° , 25° to − 5° , etc. as shown in Table 16.14} or sets and denoted by linguistic terms such as negativezero {for values in the range 1 to 0} to describe them. This division can thus be considered as coarse (or macrolevel) quantization of the entire range as opposed to digital conversion where we use large number of quantization levels. The degreeofbelonging of a specific numeric value within the entire range of values to the sets is denoted by a functional relationship known as a membership function that is considered as a feature of the sets. By definition, the membership function has to lie within the range zero to one; the value zero implies that a particular numerical value doesn't belong to a given set at all whereas the value one implies that a particular value completely belongs or represented by that set and any value between zero to one indicates partial belonging to that set. From this description, we can also 3
In fact, early researchers in this area have encountered jokes and tongueincheek comments about the term fuzzy logic from nontechnical as well technical people. 4 We show only the sets corresponding to the input variables x and φ and the output θ since the fuzzy controller will make use of these two inputs only and produce as output the steering angle.
infer that most membership functions have to be continuous or one with no abrupt changes (if a value x 0 belongs to a particular set with a membership function of one, we can expect in practice the value x 0 ± ∆x 0 where ∆x0 is small, to belong to that set with a membership function value close to one and not close to zero). Commonly used membership functions are triangular, trapezoidal, and Gaussian. In Fig. 16.2, we show the division of the expected living age for human beings into six overlapping sets and their membership functions. A number of things are obvious from this figure. We have divided the entire range into six sets, some of which are overlapping. The need for different shapes for the membership functions is also obvious from this example. We may use a square membership function for the fuzzy set ‘teen’. On the other hand, the set 'overthehill' may use a smoothly changing function. The definition of this set may vary from person to person and one society to other. Also note that a particular person may belong to more than one set. For example, a nineteen year old will be classified as belonging to the teen with a membership function of one and to the set 'adult' with a membership function of 0.5 based on the chosen membership functions. The sets (of values in the classical set theory sense) combined with their respective membership functions lead to what is known as fuzzy sets. Note that fuzzy sets, by definition, include sets defined in classical set theory as special cases, as is the case with the definition for the set, teen, here. Further, there is room for variations in the number of sets, the definitions of sets and their membership functions even with in a specific problem domain. For example, it is quite possible for some one else to come up with five (or perhaps seven) equally meaningful fuzzy sets for the variable, age. These features make fuzzy logic very robust. As example, consider the set ‘Young’. which may be defined as ages between 0 to 35 in the classical or regular expert system domain, whereas it will be defined with a membership function as shown in Fig. 16.2 under fuzzy expert systems. We can see what will happen in the case of the regular expert system when the actual age is supposed to be 34 and 1/2 but due to operator or some error gets entered as 35 and 1/2, Vs. the effect of the same error in the case of the fuzzy expert system. In the former, the person is no longer considered as belonging to the set, ‘young’, whereas in the latter, the person will still belong to the set, ‘young’, with a membership function value of say 0.45 rather than say 0.55. As we have been arguing again and again in this book, a system (with suitable coding for inputs and outputs) performs simply the task I/O mapping. Using this line of thinking, fuzzy logic can handle all nine possibilities arising from a combination of the three possibilities for the input and the output signals: 1) analog or continuos (nonfuzzy) signal; 2) digital (including binary) signal (nonfuzzy); and 3) fuzzy signal.
φ
In real world applications, we may start with input information that is already in the form of fuzzy signals for application of the fuzzy logic theory, or start with crisp values and convert them to fuzzy signals. The latter will be the case in any controller implementation. In the implementation of the controller for backing up a truck, we may define fuzzy sets for the inputs and the output as shown in Fig. 16.3. The sensors will provide the values of the input variables that exist at any time. Denoting these values as x(t 0 ), Φ(t 0 ) as indicated in Fig. 16.3, the membership function values for all the fuzzy sets corresponding to these values can be obtained from the definitions of the fuzzy sets. For x = x(t 0 ) as shown in Fig. 16.3, we will have:
θ
x
RB Right Below
LE
Left
NB
Negative Big
RU
Right Upper
LC
Left Center
NM
Negative Medium
RV
Right
CE
Center
NS
Negative Small
Vertical
RC
Right Center ZE
Zero
VE Vertical
RI
Right
PS
Positive Small
LV Left Vertical
PM
Positive Medium
LU Left Upper
PB
Positive Big
x(t) t= t
LB Left Below Table 161. Fuzzy sets for the variables φ, x, and θ of the truck backer
0
set set = x(t 0 ) ∈ set set set
LE LC CE RC RI
with with with with with
membership membership membership membership membership
function function function function function
value value value value value
0.0 0.0 0.2 (16.2) 0.9 0.0
Thus, in addition to one numerical value x(t 0 ) , we have the data corresponding to the five fuzzy sets of x(t). A similar statement applies to the other inputs. Fuzzy sets as defined above have a number of important properties. They can be operated upon using well defined logical operators such as minimum, maximum etc. They can be combined in the form of a rulebase to indicate the cause and effect relationship between inputs and outputs expressed in the form of fuzzy sets. Thus, for the truck backerupper problem, we can have statements of the form:
upper problem.
µ(Age)
IF {x(t) is CE} AND {y(t) is LV} AND { Φ(t) is LV} THEN {θ(t) is NS} IF {x(t) is CE} AND {y(t) is LV} AND { Φ(t) is LV} THEN { θ(t) is MS} (16.3)
1
µ Kid (Age)
0.5
µ Infant (Age)
µ Adult(Age)
µ Over −the −hill (Age)
µ Toddler (Age) µ Teenager (Age)
µ Young(Age)
0 1
2
5
13
18
20
30
35
40
Figure 162. Fuzzy sets for the variable, age.
45
100
Age
The first rule states that if x(t) belongs to the fuzzy set CE (center),y(t) belongs to the fuzzy set LV (large value), and Φ(t) belongs to the fuzzy set LV, then the steering angle θ(t) will belong to the fuzzy set NS (negative small). Similarly for the second rule. We can also use the union (OR) operator in forming the rules. Thus, we have rules that connect fuzzy sets of inputs with the fuzzy sets of outputs. A collection of all the rules is known as a fuzzy rule base or fuzzy associative memory (FAM). The latter term is used since fuzzy rules simply indicate the association between input fuzzy sets and output fuzzy sets. Again, using the term fuzzy along with associative memory is perhaps a poor choice, as there is no fuzziness in the association.
Fuzzy sets of the TBU Problem Angle φ
x position
Steering Angle θ
RB: Right Below RU: Right Upper RV: Right Vertical VE: Vertical LV: Left Vertical LU: Left Upper LB: Left Below
LE: Left LC: Left Center CE: Center RC: Right Center RI: Right
NB: Negative Big NM: Negative Medium NS: Negative Small ZE: Zero PS: Positive Small PM: Positive Medium PB: Positive Big
A comparison of fuzzy rules with the rules used in classical expert systems should indicate the superiority of the fuzzy logic. For example, in a classical rule base we will have rules such as: IF X, then Y
(16.4)
IF X, then Y with CF (confidence factor) = 0.8
(16.5)
or
m(φ) RU RV VE LV
1
0
90
LU
LB
180
RB
270
360
φ (degrees)
m(x) LE
1 0.9
LC
CE
RC
RI
0.2 x (feet)
0
50 x(t 0 )
100
m(θ) 1
NB
NM
NS ZE PS
PM
PB
θ (degrees)
0 30
20
10
0
10
20
30
Figure 163. Fuzzy sets and the corresponding membership functions for the variables φ, x and θ of the truck backerupper problem.
In these rules, we use a membership function of one or zero with all the possible causes and effects. That is, the conjectures are formed such that they are either true or false and none in between. The addition of the confidence factor simply adds information associated with the probability of that outcome being true. One effect of this kind of representation (yes or no) is the number of rules will be enormously large. In fuzzy set theory, we normally incorporate membership functions (that vary smoothly) which lead to a reduction in the number of rules. In general, for a fuzzy expert system with M inputs, N outputs, m i fuzzy sets for the ith input (i = 1 to M) and n j fuzzy sets for the outputs (j = 1 to N), we will have N fuzzy rulebase (one for each output) with each rule base having m1 × m2 ×. . . × m M rules and each rule pointing to one of the n j possible fuzzy sets of the outputs. Thus, the number of rules increases considerably, even for fuzzy expert systems, as the number of inputs increases. For example, a three input, two output system with 7 fuzzy sets for each input will lead to a rule base with 2 × 73 = 686 rules. Also, the human experts, on whose knowledge the concept of fuzzy systems is based, are also not capable of handling many inputs at the same time. Proponents of fuzzy systems will indicate that such situations do not occur in real life, or a solution to overcome this rule explosion is to combine only the fuzzy sets of the inputs that interact to form the rulebase and omit other fuzzy sets that have minimal impact. It can be argued that the resulting system will not be an optimal one; however, such techniques are commonly used in engineering to reduce the complexity and cost of systems, and fuzzy expert systems are no exceptions to this rule. Later in this chapter, we will discuss a new method which takes care of this problem in a rather simple manner and leads to what one may call fuzzy expert systems with memory. In the case of the truck backerupper problem, we will have a rule base consisting of 175 ( 5 × 5 × 7) rules per output variable if we use all the three input variables as inputs to the controller. We can neglect the input variable y(t) if we make the assumption that the truck will always start from a reasonable distance. This will lead to 35 (5 × 7) rules/output variable. Similarly, we can assume that only θ(t) will be generated by the controller leading to just one rule base. The rule base chosen is shown in Table 16.2. We can note that at any given time and the corresponding input values, only certain number of rules will
be fired depending upon the way the fuzzy sets are defined. The more the number of overlapping fuzzy sets (for any input variable), the more the number of fuzzy sets to which any given value can belong and hence the rules that will be fired. Looking at Fig. 16.3, we can notice that a maximum of two fuzzy sets overlap for any given values of x(t) and Φ(t). Thus, either one, two, or four rules will be fired for any combination of the inputs.
X LE
LC
CE
RC
RI
PB
PS
PM
PM
PB
PB
RU
NS
PS
PM
PB
PB
RV
NM
NS
PS
PM
PB
VE
NM
NM
ZE
PM
PM
LV
NB
NM
NS
PS
PM
LU
NB
NB
NM
NS
PS
LB
NB
NB
NM
NM
NS
fuzzification process and can be illustrated with the help of Fig. 16.4. In that figure, we assume that the input values x(t) and Φ(t) are such that two rules are fired. The first rule states that If Φ(t) is RV AND x(t) is CE, THEN θ(t) is PS. The second rule states that If Φ(t) is VE and x(t) is CE, THEN θ(t) is ZE. We consider the input fuzzy sets that triggered each rule and draw a vertical line from the input values existing at that time to intersect the membership function waveforms and obtain two values for the membership functions (which will be in the range 0.0 to 1.0). We need to convert this information into a single number. Use of the minimum of these two values (MIN) is one common technique. A horizontal line is drawn from this minimum value to slice the membership function of the selected output fuzzy set. This results in an area that is bounded by this horizontal line, the x axis and the membership waveform and is also shown in figure 16.4. We go through a similar procedure for the second rule fired. We need to use these two areas (or other information from the clipped membership functions) to obtain a crisp output value. In one approach, we simply use the maximum ( MAX) of the heights of the two clipped membership functions as a scaled version of the output, leading to MINMAX Defuzzification Method. An alternate approach to obtain a crisp output value is through a centroid calculation of the two clipped output membership functions (in the general case, the clipped membership functions of output fuzzy sets selected by the various rules that got fired). This approach is known as Centroid Defuzzification Method. If we denote by mˆ s (θ) clipped membership functions of outputs fuzzy sets that got selected by the fuzzy rulebase, the centroid calculation is given by:
∑ ∫ mˆ (θ) θ dθ s
Table 162. A fuzzy rule base for the truck backerupper problem.
θ centroid =
s θ
∑ ∫ mˆ (θ) s
s
Note that the fuzzy rule base uses the information as to whether an input falls in the range of a fuzzy set or not, and not the degree of belonging or the membership function value corresponding to the input value. Similarly, it gives information about the output only in terms of the fuzzy sets (to which it belongs) and not specific output values. In some applications, this information may be sufficient where as in others such as the truck backerupper problem we would like to get exact values for the output. For the latter, we will use the membership functions corresponding to the output fuzzy sets that got selected, and the membership function values of the sets of the inputs to which the inputs belong to obtain a crisp value for the output(s). This process is known as the de
dθ
(16.6)
θ
This crisp value for the steering angle is the final output of the fuzzy expert system or the fuzzy controller and will become the input to the truck. The complete steps involved in the implementation of a general fuzzy expert system is shown in Fig. 16.5 as a block diagram. Note the presence of three subblocks corresponding to three welldefined steps that we take: 1) crisp input values (from the sensors) existing at any given time to input fuzzy set selection and the associated membership values; 2) Output fuzzy sets selection using the fuzzy rulebase; 3) obtaining crisp output values from output fuzzy sets selected and the input membership function values. We will use this block diagram in section 16.3 to obtain new architectures for fuzzy expert systems.
RV
VE
Input φ(t)
CE
CE
In summary, there are five attributes associated with fuzzy expert systems: 1) Input variables, 2) Output variables, 3) Subsets of the inputs and the outputs and the membership functions corresponding to the various subsets leading to fuzzy sets, 4) Rules connecting the input fuzzy subsets and the output fuzzy subsets and 5) Procedure (or methodology) for defuzzification of the output(s). As indicated earlier, the fuzzy sets can be considered as extensions of sets as defined in classical set theory, and their definition dramatically reduces the number of rules needed in a rule base. The definition of fuzzy sets and the selection of the fuzzy rule base can be accomplished through good knowledge about the problem or through experts in that particular field. Also, the approximation or ambiguity involved and the variations in defining the fuzzy sets and the fuzzy rule base lead to robustness in problem areas where fuzzy logic or fuzzy expert systems can be used.
PS
ZE
Input x(t)
Example: R12: If φ(t) is RV And x(t) is CE then θ(t) is PS R17: If φ(t) is VE And x(t) is CE then θ(t) is ZE
16.2.1 Results of Fuzzy Controller for Truck backerUpper Problem Output θ(t)
Figure 164. Crisp output from a fuzzy expert system using the Centroid approach.
Pointers to input fuzzy sets selected Inputs
Input fuzzy sets identification Membership function values of the fuzzy sets selected
Fuzzy Associative Memory
Defuzzification procedure
Pointers to output fuzzy sets selected & their membership functions
Figure 165. Three subsystems of a fuzzy expert system.
Outputs
We identified the input and output variables, the fuzzy sets of the inputs and the outputs, and the rule base for the truck backerupper problem. As indicated earlier, we will assume that the fuzzy controller will output only the steering angle, and the truck will be moved in a discrete manner for each control signal θ(t) at a fixed speed. That is, from its initial position x in, yin, Φ in , it will move by a fixed distance (say 1 foot) with the steering angle set at a value specified by the controller given the input values x in, yin, and Φ in ,. Once the truck has moved to a new location, the new x, y, and φ values will be input to the controller which will then produce a new steering angle θ . This process will continue until the truck reaches the loading dock (Final condition: x=50; y=100; φ =90). Denoting the speed of the truck by s and the distance moved per each control signal by r, the truck movement is given by the following equations: dx = s cos[ φ(t) +θ (t) ] dt dy = s sin[ φ(t) + θ(t) ] dt from which the truck position after each move can be written as:
(16.7a)
x(n +1 T) = x(nT) + r cos[ φ + θ ]
y(n + 1 T) = y(nT) + r sin [φ +θ ]
(50, 100)
(16.7b)
We can use these equations as the truck model and simulate backing up the truck with the fuzzy controller for various starting values. The resulting trajectories are shown in Fig. 16.6. We can observe that the chosen fuzzy expert system does a good job of backing up the truck to the dock. We should compare the design of the fuzzy controller with the steps involved in designing a controller using the classical control approach. This particular problem falls under the category known as a Final Value problem, since we know only the final (end) values for the truck position. We need to assume a model for the controller (in addition to the model for the truck5), which is really not needed using the fuzzy control approach, a mathematical model for the trajectory (spline functions, for example) connecting the starting point to the final point, a suitable error function, and optimize the error function to arrive at the controller parameters. Thus, the design becomes very complicated if a classical control design approach is used. In contrast, we can handle such problems rather easily using fuzzy logic.
(100, 100)
y
(50, 100)
(100, 100)
y
x
(0, 0)
(a)
(50, 100)
(100, 100)
y
(0, 0)
x
(c)
Figure 166. Contd.
(0, 0)
(b)
Figure 166. Truck trajectories for some initial positions using the fuzzy controller: a) For x in = 20' , y in = 20' and φ in = 30 o ; b) For
x in = 30 , y in = 10 and φ in = 220 ; x in = 30 ' , y in = 40' and φ in = −10 o . '
'
o
c)
For
16.3 Fuzzy Expert Systems as Controllers.
16.3.1 Systems for Nonlinear Mapping/Transformation
5
Note that the model for the truck has been used for simulation purposes only and not in defining/building the fuzzy controller.
From a systems' perspective, a fuzzy expert system simply performs the task of I/O mapping or transformation from the input domain to the output domain. For example, the fuzzy controller for the truck backerupper problem, implements the mapping θ[ Φ, x] given any value of the inputs Φ and x as shown in figure 16.7. Viewed as a digital controller, with perhaps 10 bits of resolution for each of the input variables Φ and x and 8 bits of resolution for the output θ , this
fuzzy controller can be implemented as a 2 20 × 8 bit (10+10 address bits corresponding to the inputs; 8 bit output) ROM lookuptable if the values of θ[ Φ, x] are known for each and every input combinations. We do not really have to go through the steps involved in implementing a fuzzy expert system. So what is the real purpose of the fuzzy controller?
something which is not feasible in real life. On the other hand, we can fill in the 2 20 memory locations with randomly generated 8bit numbers to arrive at the most complex mapping. But the controller may do a lousy job of controlling the truck if it works at all! The fuzzy controller falls in between these two kinds of mappings, in general a nonlinear mapping, that gets the job done nicely. Further, we may obtain two rule bases (based perhaps on entirely different fuzzy sets) that may vary from one to another from two experts, use them as fuzzy controllers and find that each of them does a good job (assuming the experts know what they are talking about!). That is, we can have more than one nearly optimal nonlinear controller (as opposed to just one linear controller) and the fuzzy logic simply enables us to define/obtain those nonlinear mappings using experts' knowledge and well defined steps. This, in spite of the fact that we have lot of ambiguities in various intermediate steps such as the definitions for fuzzy sets, their membership functions and so on. Thus, a major contribution of fuzzy logic is how to describe/obtain nonlinear mappings for problems of practical importance without having to spend enormous amounts of time and energy in their design. This is especially important in applications involving a large number of inputs. This important practical aspect has been underemphasized even by the promoters of fuzzy logic.
16.3.2 Limitations of Classical Fuzzy Controllers
Figure 167. The mapping θ[ Φ, x] obtained from the fuzzy expert system for the truck backerupper problem. We can note that the mapping is monotonenonlinear, saturates for large magnitudes of either of the two input variables (as the steering value should be), and has discontinuities (an undesirable feature).
The ROM lookuptable could have been constructed by constraining the mapping as proportional to the input variables (the errors, to be exact). That is: θ[e Φ , e x ] = k1p e Φ + k 2p e x
(16.8)
where of course we need to come up with a design procedure to estimate the values of the two parameters k1p , k 2p . This task itself is not very simple and the resulting mapping is still a restricted one: a linear mapping. The linearity implies a large steering angle when the magnitude of the error(s) is (are) large,
Looking at the mapping θ[ Φ, x] resulting from the use of the fuzzy expert system for the truck backerupper problem shown in Fig. 16.7, we can notice discontinuities in the mapping. That is, we find the value for the steering angle, the command to the plant, changes abruptly as the input values are changed by very small values and is a property of the present generation fuzzy controllers (use of triangular and trapezoidal membership functions and the procedure for defuzzification contribute to this). We can ask ourselves if such abrupt changes in the control inputs are really permissible? We find that in applications where the signal is multivalued, mostly smooth control signals are needed. In the case of steering, we really cannot have jerky movements. Thus, we need to choose smooth membership functions and defuzzification procedures that will lead to mappings that are continuous. From the I/O mapping perspective, it should be clear that fuzzy expert systems and fuzzy controllers are static devices. That is, the output(s) at any particular time depends only on the input values at that time and not on the past values of the inputs or outputs (which are readily available). The static nature of the mapping also contribute to the discontinuous nature of the output(s). The output(s) can be made much smoother by incorporating past inputs and or past outputs as inputs to the fuzzy controller. We will learn in section 16.5 how this can be accomplished. In the case of multiinput systems (with large number of inputs), implementation based on decomposing the system into a number of subsystems
is possible if and only if the mapping can be decomposed properly. That is, the mapping becomes what is known as a separable mapping. It appears that many practical problems belong to this category. Alternately, we can try to zoomin or zoomout at various regions and write down separate fuzzy sets and rulebase to take care of complex mappings. Again, this is not an easy or a good solution. We provide a better approach in section 16.5. Finally, stability is a major issue in fuzzy expert systems used as controllers. We will discuss that problem now.
stability analysis of the whole system with an arbitrary nonlinear feedback function φ[ • ] is much more difficult." That is, we run into difficulty even under such a seemingly simple scenario. Thus, the implications for complex situations are obvious.
y d (t)
16.3.3 Stability of Closed Loop Systems using Fuzzy Controllers Fuzzy expert systems and fuzzy controllers that we encountered so far are feedforward, memoryless systems. Thus, they are inherently stable from a systems' perspective. However, when used with dynamic systems in feedback as shown Fig. 16.1b, we end up with a closedloop system. The stability of the closedloop system, which consists of the plant (which can be linear or nonlinear, timeinvariant or variant, openloop stable or unstable) and the memoryless nonlinear device (fuzzy controller in our case), has to be established beyond doubt before fuzzy controllers find widespread applications where stability is a major issue. Unfortunately, there appears to be no mathematical approach through which the stability can be established beyond doubt. We describe two well known results from the classical control theory literature to illustrate the problem in proving the stability of such systems.
u(t) = φ[ e(t)]
SISO LTI system with a transfer function H(s) = c(sI − A) −1 b φ[ e(t) ]
+
y(t) 
∑ e(t)
φ[ • ]
Figure 168. A closedloop nonlinear system with a stable LTI system and a memoryless nonlinearity.
16.3.3.1 Some Results from Classical Nonlinear Control Theory φ[e(t)]
16.3.3.1.1 Sector Condition and Aizerman's Conjecture Consider Fig. 16.8 where we show a simple one input {u(t)}, one output {y(t)}, linear timeinvariant system with a memoryless nonlinearity φ[e(t) ≡ y d (t) − y(t)]. That is, the nonlinearity is a single input, single output (SISO) mapping, a much simpler case than the fuzzy controller for the truck backerupper problem (two input and one output). Further, the openloop system is assumed to be stable (the matrix A is strictly Hurwitz). Now one can ask if the closedloop system with this simple but general SISO nonlinearity φ[e(t)] is absolutely stable. In a book on nonlinear control published not long ago the authors state []: "If the feedback path simply contains a constant gain, i.e., if φ[e(t)] = α e(t) , then the stability of the whole system, a linear feedback system, can be simply determined by examining the eigen values of the closedloop system matrix A −α bc 6. However, the
6
Here, b & c are the vectors associated with the state space representation of the linear
Straight line with slope k1 φ[e(t)]
Straight line with slope k2
Figure 169. A restricted mapping for the static nonlinearity in fig. 8.
timeinvariant system.
e(t)
We may ask next if the stability can be established if the nonlinear mapping function is constrained (though it may reduce the use of the mapping in practical applications). Thus, we may restrict φ[ • ] such that: k1 ≤ φ[e(t)]≤ k 2 for e(t) ≠ 0,
k1 , k 2 > 0
(16.9)
That is, the mapping is constrained to a sector in the first and third quadrants and passes through the origin as shown in Fig. 16.9. We can note that the mapping selected is constrained to a subset of voltagecurrent mappings of nonlinear passive resistors that we have seen in earlier chapters (However, the interconnection here is based on flowgraph theory and not at the element level). The reasoning behind this choice is if the mapping falls between two linear feedback mappings (that lead to stable closed loop systems), the resulting system will perhaps be stable as well. A conjecture along these lines dating back to 1949 has been made by a Soviet Scientist, M.A. Aizerman, as follows: “If the matrix A − k bc is stable for all values of k, k1 ≤ k ≤ k 2 , then the nonlinear system is globally asymptotically stable.” Unfortunately, this conjecture was proved to be false through counterexamples. Later Popov imposed additional constraints as given below to arrive at a sufficient condition for asymptotic stability:
16.3.3.1.2 Popov's Criterion Let the linear timeinvariant system as defined in Fig. 16.8 is such that: 1) the matrix A is Hurwitz and the pair [A, b] is controllable; 2) the nonlinearity is constrained as given in (16.9) with k1 = 0, k 2 = k > 0 ; 3) there exists a strictly positive constant α such that for an arbitrarily 1 small ε > 0 , Real (1 + jαω )H ( jω ) + ≥ ε for all ω , k Then the origin, the equilibrium point of the closedloop system, is globally, asymptotically stable. Another criterion which is a direct generalization of the Nyquist criterion known as Circle Criterion and which goes somewhat beyond Popov's criterion also exists and can be found in the literature. We will not go into the details of them here. However, we should note here that these techniques are analytically motivated, take their lead from linear system theory tools such as Nyquist criterion, lead mostly to sufficiency conditions and not necessary conditions, and add constraints to the extent that the results are almost unusable in practice. All
[
]
these problems are of course due to the complex nature of nonlinear systems and the methodology adopted to deal with such systems. In summary, present generation fuzzy controllers are simple (from a mappings' perspective) nonlinear static devices, and their use in feedback control can lead to questions about the stability of the resulting closedloop systems. Available analytical techniques fail miserably to provide a solution to this problem. A technique that addresses this problem along with the ability to extend the mapping from static to dynamic will be of tremendous use. In section 16.5 we describe one such approach obtained from the building block and reverse engineering approach of this book.
16.4 Fuzzy Expert Systems & Neural Nets: Compare, Contrast & Merge It should be obvious from the descriptions in the previous chapter on neural networks (specifically feedforward networks) and the descriptions on fuzzy expert systems in this chapter that there is very little difference (if any) between the two types of systems from an outcome perspective. Both systems perform the same task of functional mapping given some input(s). It is true that they were developed independently, the driving forces behind their developments were different, they use different approaches for the design and implementation, and so on. But the fact remains that if considered as black boxes with access only to the inputs and outputs, we will not be able to see any difference to identify them exactly. Therefore, we may ask if we can analyze these systems further with the goal of merging or fusing together their unique features to arrive at hybrid architectures. We present some material along those lines in this section.
16.4.1 Digital Architecture of FESs & FCs for RealTime Applications In this section, we will closely examine the steps involved in a digital implementation of fuzzy expert systems and fuzzy controllers. From that we will show how a fuzzy expert system can be cast in the form of a neural architecture (implementation involving nonlinearities, multiplication and addition). The approach taken here will lead to a new architecture that is useful for realtime applications where the speed is critical. It will also show how we can develop neurofuzzy architectures with the important features of both neural networks (ability to learn specific I/O mappings from large I/O data possibly corrupted by noise without requiring any apriori information, and the ability to adapt or continue learning) and fuzzy expert systems (ability to use experts' knowledge and deal with fuzzy information and or incomplete/imprecise data in a structured, logical way).
worth noting here that one earlier demonstration of neural networks was implementing a two input, one output XOR binary mapping. The third and the final step in implementing a fuzzy expert system, that of defuzzification, makes use of the OFSPs, the membership function values of the inputs m j [x i (t)] , and the membership functions of the output fuzzy sets that are selected and produces the exact output values (third block of figure 16.10) and in general involves nonlinear mappings. Though a simple digital logic circuit for this operation cannot be identified, this block can be represented as a threelayer feedforward neural network with the appropriate number of inputs and outputs and trained appropriately.
total of l = ∑ i=1 l i bits) such that a particular bit gets turned on if and only if L
the input value falls under the range of values for that fuzzy set. we can call these as input fuzzy set pointers ( IFSP i,l , i = 1 to L , for a total of l pointers). The logic circuit for conversion from the input (encoded in distributed representation) to the l pointers can be seen to be a collection of multiinput OR gates (l i gates for the ith input) as shown in Fig. 16.10. The number of inputs going into the OR gates will depend upon the number of quantization levels that fall under the range for that input fuzzy set pointer. Denoting the membership functions' values of the fuzzy sets corresponding to the actual values of the various inputs by m j [x i (t)](i = 1to L; j = 1 to l i ) , we can implement this mapping from x i (t) to m j [x i (t)] as ROM lookup tables ( l ROMs in all) (omitted in the figure). The second step in the implementation of a fuzzy expert system is the identification of the output fuzzy sets that get activated for any combination of input fuzzy sets and is given by the fuzzy rules or fuzzy associative memory (FAM). This step can be implemented in digital hardware by assigning bits to identify if a particular output fuzzy set is activated or not and the conditions for N their activation. We will have n = ∑ i=1 n i output fuzzy set pointers, or OFSPs i
for short. Therefore, a FAM operation simply corresponds to that of the operation of an associative memory which, given the l bits (the IFSPs), produces the corresponding nbits (OFSPs). We therefore have a binary to binary mapping and nothing really fuzzy here. In elementary digital logic design, we have learnt that any binary to binary mapping can be represented (and realized) using twolevel sumofproduct or productofsum logic (using AND , OR gates) or three levels (if we consider the operation of obtaining logical "negative" of the inputs as one level). Thus, the transformation from IFSPs to OFSPs can be realized using digital logic as shown in the figure. It is
IFSP1,1 toIFSP 1,l
1
B x1
B x2
B to Q = 2
B
line decoder
B to Q = 2
B
line decoder
l1 OR gates.
l1
l2 OR gates.
l2
(
n = ∑in i
)
n2
Sum of products logic circuits.
B xL
B to Q = 2 B
lL
line decoder
OR gates.
B
n1
nN lL
y1
Defuzzification
Let us consider the general case of an L input, N output fuzzy expert system implementing a mapping f: x → y . Let l i (i = 1 to L) be the number of fuzzy sets for the input i and n j (j = 1 to N) the number of fuzzy sets for the output j. Let the original inputs be represented in a weighted, fixedpoint binary scheme using Bbits per input. These inputs can be converted to an unweighted binary representation or distributed encoding (as defined in neural networks) with Q = 2 B binary lines for each input (for a total of Q t = L × Q input bits and only one bit 'on or one' for any input at any given time) as they become input to the fuzzy expert system (Fig. 16.10). The first step in the implementation of a fuzzy expert system (subblock # 1 of Fig. 16.5) is to use the inputs x1 (t)to xL (t) to identify the input fuzzy sets under which these input values fall and the membership function values corresponding to the fuzzy sets selected. In a digital implementation, this step can be implemented by associating one bit to each fuzzy set of each input ( l i bits for the ith input for a
B y2
B yN
IFSP L,1 toIFSP L,l
L
Input values, input fuzzy set membership functions values and output fuzzy set membership functions.
Figure 1610. A digital implementation of the three specific steps in a fuzzy expert system leading to a neurofuzzy architecture.
7
This is in contrast to a narrow interpretation (by some) of the neural network paradigm in which it is assumed that no knowledge is available, or even if available, they will not be used, and training will take care of everything. The approach presented here makes sense from the major thrust of neural networks, that of learning, and imitating the adaptive behavior of the human brain.
OFSP1,1 (as enable signal) Intermediate outputs
Subnet # 1,1 OFSP1,1 to IFSP1,n
1
OFSP1,n
B
1
n1 OFSP2,1 to IFSP 2,n
y1
Subnet # 1,n 1
2
N combining Networks
What do we gain from all this? The three subblocks in the architecture of Fig. 16.10 perform distinctive functions. The first block converts the inputs' values into fuzzy sets. The information needed to implement this block is relatively easy to obtain. Anyone with some knowledge about the problem that is being solved can come up with meaningful fuzzy sets. The second block corresponding to FAM can also be obtained from experts, and used in any implementation of fuzzy expert systems. If complete FAM information is unavailable, we can represent this block as a neural network and resort to training. The third block corresponding to defuzzification is comparatively complex. And we may ask if the two currently used approaches for defuzzification, MinMax and Centroid approach, are suitable for all applications ? The answer is definitely a no. Thus, we can instead denote the third block as a feedforward neural network and train it using I/O data and information obtained from experts and hence avoid using a prespecified defuzzification procedure. The total architecture therefore corresponds to a new neurofuzzy architecture in which we make use of information such as fuzzy sets, membership functions etc.7 and at the same time use the strength of neural networks, that of learning from examples. The given architecture can also be used as an alternative to a software based architecture (which implements the fuzzy logic expressions etc.) for realtime applications where the speed is very critical. The steps involved in implementing a fuzzy expert system is the well known (in engineering design) 'divide and conquer' approach. Instead of representing a whole system (a controller in our case) by a twolayer neural net and training that network, we represent the system as a number of subsystems and reserve the training to one (or two simpler subsystems). The beauty of this approach is that we can carry this process further, especially with respect to the third block. Note that for the ith output, we have n i (5 to 9 in practice) fuzzy sets and only a certain number (1, 2, or 4) of them are activated for any given input combination. Therefore, we can replace the third subblock by a number of subnets, one corresponding to each output fuzzy set, use the OFSPs as select or enable signals (from a digital systems perspective) for these subnets, and train these networks separately. A clear advantage of such an approach is the data that needs to be learnt becomes smaller and correspondingly the mapping expected from each network simpler. A detailed representation of the third block is shown in Fig. 16.11. As shown there, the results from the subnets corresponding to the individual OFSPs have to be combined together to form the final output(s). The networks (N in all) for this operation can be simple networks performing averaging etc.
n2 OFSPN,1
Subnet # N,1 OFSPN,1 to IFSPN,n
B y2
N
nN
OFSPN,n
N
B
yN Subnet # N,n N
Values of the inputs and the input membership function values for those input values.
Figure 1611. A detailed network representation of the third process, that of defuzzification process, in a fuzzy expert system implementation.
The discussions and the architecture given here indicate that a fuzzy expert system can be considered equivalent to a number of multilayer feedforward networks with structured interconnections between them8. Further, information (however fuzzy they may be) that is readily available and a divide and conquer approach (that simplifies the design) are used in a fuzzy expert system implementation. Therefore, it is quite likely that a fuzzy expert system can provide superior performance for functional mapping, compared to a single,
8
We will also discuss a neural network architecture known as CMAC in the next section and show that it's implementation resembles that of a fuzzy expert system.
two or threelayer network9. Other researchers have arrived at similar conclusions through simulations comparing the performance of fuzzy expert systems and neural networks. In summary, we have identified a new architecture we call "NeuroFuzzy Architecture" with the following properties: ∗ A structure consisting of smaller networks that can be trained easily and faster (a desirable property of neural networks); ∗ A structure in which available information can be incorporated (a desirable property of fuzzy expert systems); ∗ A structure that can be adapted using available I/O data (property of neural networks); ∗ Since there is an onetoone correspondence between the various blocks in the architecture and the tasks in a fuzzy expert system implementation, when the fuzzy rules are not available we can train the subnet corresponding to FAM and extract the rules; ∗ An architecture that is suitable for hardware implementation. That is, rather than using a fuzzy language based processing (with the associated MFLOPS or mega fuzzy logic operations per second rating), we can use the new architecture as a digital or hardwired implementation of a fuzzy expert system. Such an implementation will have a tremendous edge in realtime applications since the number of rules increase exponentially with a linear increase in the number of inputs. For example, if we assume that there are five fuzzy sets per input, the number of rules will be 3125, and for a ten input system, we will have 9,765,625 rules. Perhaps due to this problem, fuzzy expert systems considered in the literature are mostly two input systems, or input separability is assumed when there are more than two inputs. ∗ Easy of modeling of complex systems: By modeling the block corresponding to the rulebase by a three layer feedforward neural net and the defuzzification block by a large number of neural nets, we will be able to model more complex systems than is possible using other approaches.
16.4.1.1 Results Using the Trainable NeuroFuzzy Architecture In this section, we present simulation results based on the new trainable neurofuzzy architecture. We use the same truckbackerupper problem (designing the controller given the truck model) as this problem has been solved earlier using classical fuzzy expert systems (as explained before), and twolayer (with 26 nodes in the hidden layer) neural network architecture. We assume that the 9
Theoretical results are available in the literature indicating that two or threelayer neural networks can approximate any nonlinear mapping. However, they do not really consider the errors introduced by such approximation.
range of values for the fuzzy sets of the inputs and the outputs, and the fuzzy rules are known. Thus, there is no need to train the first two subblocks of the neurofuzzy architecture, and only the subnetworks corresponding to the third subblock have to be trained. The desired outputs corresponding to a set of inputs are generated using the centroid defuzzification approach and used as data for training the networks. We used two different approaches for training. In the first approach, data corresponding to the inputs x, φ , and the IFSPs (for this we need to know only the range for the fuzzy sets and not the actual membership functions) are used as the inputs for training and the values of the steering angle θ generated by the fuzzy controller as the desired output. Thus, the membership functions of both the inputs and the outputs are not used in the training. As more accurate results are needed when the truck is in or near the center , we selected more samples for the xposition around the value 50, and less number of samples for xvalues near the ends (0 and 100 feet). The sampling for φ is carried out similarly. This led to 34 quantization levels for xposition, and 72 quantization levels for φ leading to 2448 I/O samples. The yposition was not used by the controller (as was the case in the fuzzy controller as well), thus simplifying the training process. There are seven networks corresponding to the seven output fuzzy sets. The I/O training set was divided into 7 subgroups based on the output classification (to which output fuzzy set the output belongs). The largest group contained 826 training samples and the smallest one 271 samples. Some I/O samples are used in more than one group due to the overlap of the output fuzzy sets. This brought the total number of training samples for all the groups to 3624. The training samples were normalized to the range 0.5 to 0.5. We used a twolayer architecture with 10 hidden layers for the seven networks, and the backpropagation algorithm for the training. The desired limit on the error (average squared error per sample) for convergence was set at 5.0 ×10 −4 for the inputs near the center and at 1.5 × 10− 3 otherwise. The training converged in few hundred iterations (for groups with small number of I/O samples) to few thousands (for groups with large number of I/O samples). A truck trajectory produced using the trained neurofuzzy architecture is shown in Fig. 16.12a. We can note that the resulting trajectory is very smooth. In the second approach, x, φ and the corresponding input membership function values were used as inputs, and the steering angle θ as the desired outputs. The training was performed as explained for the first approach with similar results. A truck trajectory produced using this controller is shown in Fig. 16.12b. For comparison, we have reproduced the resulting trajectories based on a twolayer neural network architecture for the whole controller as Fig. 16.12c. We can observe that the new architecture produces much smoother trajectories. Also, the trajectories produced by the new controller are very similar to the ones produced by the original fuzzy controller, the teacher (Fig. 16.12d).
drive behind that work. This architecture has recently been revived as a better alternative to multilayer feedforward neural network architectures.
(A)
(C)
(B)
(D)
Figure 1612. Trajectory of the truck using: a) Neurofuzzy controller trained using input fuzzy pointers; b) Neurofuzzy controller trained using membership functions; c) using a twolayer neural net controller; d) Using the fuzzy controller (used as a teacher for the neural controllers).
16.4.2 Cerebellar Model Articulation Controller (CMAC) Neural Network Vs Fuzzy Expert Systems In this section, we describe another feedforward neural network architecture known as CMAC and show how the architecture looks similar to a fuzzy expert system. The CMAC neural network was developed independently in the early 1970's and the name (Cerebellar model) clearly illustrates the motivation and the
True to its origin, CMAC definitions and descriptions include terms such as input sensors, receptive fields, input generalizations, state space detectors, multiple field detectors, etc. Considering Fig. 16.13, where we show a two input CMAC architecture, we start with the twodimensional input space in R 2 (N dimensional space in the general case) and divide this space into a number of overlapping subspaces. For example, if a digital representation is assumed with 256 quantization levels for the entire range of each input variable, the subspaces may span 16 × 16 points in that space (16 quantization levels on each input side) and a total of 31× 31 = 961 subspaces (assuming an overlap of 8 bits). Thirty one sensors will be used for each input with each sensor producing a binary output of ON if the input falls with in the 16 quantization levels covered by that sensor and an output of OFF otherwise. The input range covered by those 16 quantization levels is called the receptive field of that sensor and the value 16 is the width of the receptive field. The width of the receptive field produces what is termed as input generalization while the offset between the adjacent fields (8 bits in our example) produces input quantization. The ratio of generalization width to quantization width denoted as C (2 in our case) will normally be in the range 32 to 256 for typical implementations and is also equal to the number of input sensors excited by each quantization level of each input variable. The binary outputs of the input sensors are combined in a series of threshold logic units (called state space detectors) with the thresholds adjusted to produce logical AND functions (output ON only if all inputs are ON). Each of these units receives one input from the group of sensors for each input variable, and thus its input receptive field is the interior of the Ndimensional subspace. The number of state space detectors would be very large if N is large (as will be the case in problems of practical importance), and we go in for full interconnection (961 in our example). Therefore, the input sensor outputs will be connected to the state space detectors in a sparse and regular fashion as follows: We assume there are C subsets of state space detectors (with the total number much less than value needed for full interconnection). The receptive fields of the units in each of these subsets are organized so as to span the input space without overlap. Each input excites one state space detector of each subset, leading to each input exciting exactly C state space detectors. Even under this constraint, there are many ways to arrange the receptive fields of the individual subsets. One possibility is to make each of the subsets of state space detectors identical in organization, and offset each subset (relative to others) by, say, the quantization width, along hyper diagonals (along the diagonal in the N =2 case) in the input hyper space. The organization as described above guarantees that a fixed number C of detectors is excited by any input. However, the total number of state space detectors can still be large for many practical problems. Thus, the outputs of the
statespace detectors are connected randomly to a smaller set of threshold logic units, called multiple field detectors, with the thresholds adjusted such that the output will be ON if any input is ON (a logical OR function). Since exactly C statespace detectors are excited by any input, at most C multiple field detectors will be excited by any input. The convergence connections between the large set of statespace detectors and the smaller set of multiple field detectors are refereed to as "collisions." In practice, the converging connections are implemented by assigning a virtual address to each of the statespace detectors, and passing the addresses of the active statespace detectors through a random hashing function.
Receptive field of input sensor # 1,1
State space detectors
Input # 1 range Multiple field detectors
w1 w2
∑
Receptive field of input sensor # 2,1
wN Input # 2 range
Input sensors
Figure 1613. A simple example of a two input, one output CMAC neural network.
Finally, the output of each multiple field detector is connected, through an adaptive weight, to an output summing unit. Thus, the output for a given input is the sum of the weights selected by the excited multiple field detectors (since the outputs of multiple field detectors are zero or one). While the number of input sensors and statespace detectors is determined by the number of inputs, their dynamic ranges, the level of quantization, and the degree of generalization, the number of multiple field detectors (and hence the number of adaptive weights) is an independent design parameter. This size (equivalent to the memory size for storing the weights) is related to the size of the subset of the input space that is likely to be visited in a particular problem (i.e., the mapping from the inputs to the output) rather than the total size of the inputs' subspace. Thus, the simple problems in a many dimensional input space (N very large) will require only small weight memories. The network is trained based on observed training data pairs s 0 (input vector) and f 0 (output vector) using a supervised learning technique such as the least mean squares (LMS) algorithm. Since the learning is confined to the last stage with linear adaptive elements, CMAC training will take fewer iterations than backpropagation applied to a multilayer neural network. Now let us identify the similarities between CMAC networks and fuzzy expert systems. The process of going from exact input values to input sensor outputs (on or off) corresponds to using fuzzy sets with rectangular membership functions (value one if inside the region and zero otherwise). Thus, the input sensors’ outputs correspond to input fuzzy set pointers that we defined before. The differences are: 1) the fuzzy sets are uniformly placed and 2) the number of fuzzy sets are comparatively large. The merger of the various input sensor outputs through state space detectors (AND gates) and multiple field detectors (OR gates) is akin to the implementation of a fuzzy rulebase. Thus, the outputs of the multiple field detectors are the output fuzzy set pointers. Again, the differences are: 1) CMAC doesn’t use logical complement of the input sensors. Thus, the logical sum of products expressions that get implemented by the CMAC are not as general as that of a fuzzy expert system; 2) The number of rules are in general large and 3) A large number of input fuzzy sets interact to produce output fuzzy set pointers. Thus, one can argue that the last two will compensate for any deficiencies caused by the first. The final outputs are generated from the output fuzzy set pointers based on a trained linear network in CMAC, whereas defuzzification based on centroid method, a more complex nonlinear process, is used in fuzzy expert systems. In a recent paper on extensions to CMAC, it is indicated that a triangular weighting be used for the output of the input sensors. Thus, the authors have used some of the better features of fuzzy expert systems in their modified CMAC neural networks.
16.5 Design of Stable Feedback Fuzzy Expert Systems and Stable closed Loop Systems with Feedback Fuzzy Controllers In previous sections, we learnt that present generation fuzzy expert systems and fuzzy controllers are simply static nonlinear mapping devices. Thus, the output(s) (in temporal dimension) may not be continuous as a) the inputs may change abruptly (as in a step input), and b) the fuzzy mapping process itself may be discontinuous. However, in problems such as control, we would like to have smooth outputs from the controllers. Further, as noted earlier, the use of fuzzy expert systems as controllers lead to closed loop systems with unknown stability properties. In this section, we will describe approaches to overcome these two problems using the building block approach seen in the earlier chapters.
16.5.1 Design of Stable Feedback Fuzzy Expert Systems
A firstorder lowpass filter u1 (t) u 2 (t) u L (t)
x˙ (t) = f [ x(t),y FES (t)]
y out (t) = g[ x(t),y FES (t)] (16.10)
y FES (t)
∑
1 s
y out(t)
a
Static Nonlinear System
Dynamic Linear System (a)
u1 (t) u 2 (t) u L (t)
Assuming an Ninput, oneoutput fuzzy expert system, an obvious and simple approach to obtain a final output that is not just a function of the present inputs but also past inputs and outputs (thereby making the output continuous) is to pass the output of the expert system through a smoothing filter. This leads to what is known as a cascade architecture. An example of this architecture is shown in Fig. 16.14a where we have a firstorder lowpass filter as a smoothing filter. The filter output is a function of the present value of the output from the expert system as well as its past values. The parameter ‘a’ of this filter can be chosen appropriately to emphasize the present value more than the past (impulse response of short duration leading shorter memory or equivalently, a filter with a wider bandwidth) or alternatively to emphasize the past values more than the present value (impulse response of longer duration or larger memory or a filter with a smaller bandwidth). Of course, we don't have to restrict ourselves to a firstorder filter or continuousdomain filter. We can use higher order continuousdomain filters or discretedomain filters (FIR or IIR) as the applications demand (Fig. 16.14b). However, the concept remains the same as long as the filter used is linear and timeinvariant. We can use nonlinear and time varying filters in place of the linear filter if the problem so demands. For example, in control applications, we may require the controller output not only continuous (in time) but also bounded. A general description of such a filter will be:
Fuzzy Expert System
Fuzzy Expert System
y FES (t)
A higherorder LTI y out (t) or yout (nT) continuous or discrete domain filter
(b)
Figure 1614. A dynamic fuzzy expert system (one with memory) formed as a cascade of classical (static) expert systems and LTI filters.
where x is the state vector of size M, f [ • ] is a vector of nonlinear functions of the state and the input y FES (t) , y out (t) is the final output and g[ •] is a nonlinear function such that − y max ≤ y(t) ≤ y max . In figure 16.15a, we depict the general architecture corresponding to the above equations. We have seen in previous chapters how such filters with guaranteed stability property can be designed. In Fig. 16.15b, we show an example of a nonlinear and timevarying filter based on the ladder architecture. The architecture (the placement of the inductor and capacitors) leads to a lowpass or smoothing filter; the nonlinear resistor at the output end with the characteristics shown in Fig. 16.15c constrains the output within the specified bounds; the nature of the reactive elements (Fig. 16.15d) prevents much of the oscillations (and discontinuity) in the input reaching the output; the saturating nonlinear characteristics of the reactive elements basically increases their filtering ability when the input signal is at the extreme levels; and finally, the timevarying resistor helps to clip (so to speak) the input signal especially when it is constant (DC). It is necessary since the inductive elements become a short and the capacitor a open for DC input signal forcing all of the input signal to appear across the timevarying resistor and the voltage that can
appear across the nonlinear resistor is limited. The dynamics corresponding to this architecture is given by: φ˙ 1 −R in (t) ≥ 0 1 q˙ 1 = φ˙ 2 0
−1 0 i L1 [φ 1 ] 0 0 −1 vc1 [q 1 ] − 0 1 0 i L2 [φ 2 ] v R2 i L2 [ φ 2 ]
[
y FES (t) + 0 (16.11) 0
]
u1 (t) u 2 (t)
Fuzzy Expert System
u L (t)
y FES(t)
f[•]
1 I s
x
y out(t)
g[•]
where R in (t) ≥ 0 and yout (t) + R in (t)i DC = y FES
will be used to fix the value of the timevarying resistor. Thus, we can see that the building block approach proposed in this book allows us to easily mix radically different paradigms, such as the rulebased fuzzy expert systems. Again, we should point out that the architecture is shown in the continuous domain as the building block concept is based on power and energy principles, but can be changed to discrete form in actual implementation. We can contrast the above approach with the approach based on flowgraph technique where the N outputs will be fed back to the input end. Since the fuzzy exert system is a static, instantaneous device, a differentiator or an integrator (the later preferred due to its low sensitivity property to noise) will be introduced in the feedback for a continuous domain implementation or a delay element for a discretedomain implementation as shown in Fig. 16.16. The feedback leads to an increase in the number of inputs to the fuzzy mapping and hence the complexity. Also, we have to ask if the experts will be able to come up with the rules when certain inputs are past outputs. A more serious problem is that the presence of feedback can make the system unstable. Considering the continuous case, we can write the dynamics as: y˙ out (t) = yˆ FES [ u(t), y out (nT) ]
Static Nonlinear System
(16.12)
(a) R in (t)
i L1[φ1 ]
i L2 [φ2 ]
y FES (t) +
Buffer

+ + v c1 [q1 ] 

iR + y out(t) = v R 
(b) y Max
vR
i L [φ]{vc [q]}
φ{q}
iR
− yMax
(16.13) (c)
where u is the input vector of size L and yˆ FES [ •] represents the N new mappings from the new fuzzy expert system with (L+N) inputs. As we learnt in chapter 4, it is not easy to constrain the mappings so that the expected equilibrium points (in the case of constant inputs) or the expected trajectories (in the case of timevarying inputs) of the outputs are stable. The severity of the problem can be appreciated by considering a simple oneinput, oneoutput system (L = N = 1). The resulting system is a firstorder system. If the expected output from this system is y d (t) when the input is u(t), in order the ascertain the stability of the output we need to consider the system dynamics in the error domain. From (16.13), we can write:
Dynamic Noninear System
(d)
Figure 1615. A dynamic fuzzy expert system formed by cascading a classical (static) fuzzy expert system with a nonlinear filter. a) General architecture; b) Based on a ladder architecture for the nonlinear filter.
u 1(t) u 2 (t)
yˆ FES (t) Fuzzy Expert System with L+N inputs & N outputs
u L (t)
N
1 I s
a simple SISO system, the implications for complex systems are obvious. Therefore, the general architecture shown in Fig. 16.15 (based on the network principles) is superior to this architecture (which is based on flowgraph concepts). Further, the network based architecture has the advantage of retaining the original fuzzy expert system (that depends on the inputs only) derived from the experts, without any modification.
y out (t )
N
16.5.2 Design of Stable closed Loop Systems with Feedback Fuzzy Controllers (a)
u 1(nT) u 2 (nT)
yˆ FES (nT) Fuzzy Expert System with L+N inputs & N outputs
u L (nT)
−1
In this section, we discuss a new approach for the design of fuzzy expert systems with memory (or feedback fuzzy expert systems, also known as recurrent fuzzy controllers, especially when implemented in discrete domain) for use as controllers. The method is based on the building block approach advanced in this book and guarantees the stability of the closed loop system consisting of the plant and the fuzzy controller. We will try to keep the description concise, easy to understand by nonelectrical engineers, and some what self contained; use plants that can be described by first and secondorder LTI models, and later the truck model, to describe the approach. Additional details can be found in the chapters on control. Let us first consider a plant described by a firstorder LTI model given by:
y out (nT)
z I N
N
(b)
x˙ (t) + ax(t) = au(t)
Figure 1616. Flowgraph based approach for building fuzzy expert systems with memory: a) Continuous feedback fuzzy expert system; b) Discrete feedback (or recurrent) fuzzy expert system.
where u(t) is the input, x(t) is the output, and ‘a’ is one parameter associated with the plant. In the Laplace domain, the plant is described by the system transfer function: T(s) =
y˙ out (t) − ˙yd (t) ≡ ˙e (t) = yˆ FES [ u(t), y out (nT)] − y˙ d (t)
(16.14)
= yˆ FES [ u(t),e(t) − y˙ d (t)] − y˙ d (t) where e(t) is the error between the actual output and the desired output. We find that the system dynamics in the error domain is nonlinear and timevarying, and it is not easy to constrain the mapping yˆ FES [ •] for any given y d (t) {or equivalently, u(t)} such that this NLTV dynamics is stable. If this is the case for
(16.15)
X(s) a = U(s) s + a
(16.16)
and we can note that the plant will be stable if a > 0, and unstable if a < 0. Being a firstorder system, the only signal that we can measure and use in control is the output, x(t). The task of the feedback controller is to stabilize the plant (if it were unstable) and improve the performance (mostly, in the timedomain) of the plant. If the desired output, x d (t) , is a constant and if we expect the plant output to reach that value in a reasonable amount of time and stay there even if some disturbances are present in the system, we have what is known as a asymptotic stabilization and setpoint control. On the other hand, if x d (t) is a smoothly varying function with finite, higherorder derivatives, and we expect the plant to follow the desired trajectory, we have a tracking control, a more complex
problem 10. Considering the latter, the architecture for control will be as shown in Fig. 16.17a where we 1) Use a controller which acts on the difference between the actual plant output x(t) and the desired signal x d (t) {the error signal e(t) = x(t) − x d (t) } to stabilize and control the plant; 2) Use a filtered (by the inverse of the plant model) version of the desired signal x d (t) as additional input to achieve perfect tracking. For example, with a proportional control, the dynamics of the closed loop system corresponding to this figure will be:
stable equilibrium points if control or tracking has to be possible with any arbitrary starting value. The application of the classical fuzzy controller to this firstorder plant will lead to a nonlinear mapping f FES [ e ] of the error function e(t) and the dynamics in the error domain: e˙ (t) = − ( a − a 1 ) e(t) + f FES [e(t)]
(16.20)
x˙ (t) = −ax(t) + au(t) = −ax(t) + a
˙xd (t) + ax d (t) a1 e(t) + a a ← for control →→ for tracking →
(16.17) Preshaping Filter for Tracking Input H f (s) = Hp−1(s)
x d (t)
or x˙ (t) − x˙ d (t) = e˙ (t)
= − ( a − a 1 ) e(t)
u t (t)
(16.18) 
∑
Proportional Controller
u t (t)
+
∑ +
+
LTI System a H p (s) = s +a
x(t)
Equation (16.17) can be rewritten as: x˙ (t) + (a − a1 )x d (t) x˙ (t) = −(a − a 1 )x(t) + a d a
(a)
(16.19) which points to a slightly different architecture for tracking as shown in Fig. 16.17b. According to this figure, we add the feedback a 1x(t) a to stabilize and / or move the poles to desired locations and add a filtered (by the inverse model of the closed loop system) version of x d (t) to achieve tracking. For LTI plants and LTI controllers, both architectures are equivalent, whereas it is not so for nonlinear plants and / or nonlinear control. The first architecture has to be used for nonlinear control as: 1) we express the function of a fuzzy controller based on the error (and its derivatives) and 2) as we learnt in the chapter on nonlinear control, to achieve stability or setpoint control or perfect tracking, the closedloop system dynamics (plant plus the controller) expressed in terms of the error state (and not the system state) should correspond to a dynamics with the origin as the stable equilibrium point. Further, the dynamics should not have any other 10
The truck backer upper problem is in a sense setpoint control as we expect the plant to reach the dock. However, it is a much more complex problem as we also expect the trajectory taken by the truck to be smooth and we do not per say define the trajectory as we will have number of starting points and a number of acceptable trajectories for each starting point.
x d (t)
Preshaping Filter u (t) t ∑ for Tracking Input + −1 + H f (s) = Hcls (s) u c (t)
LTI System a H p (s) = s+a
Feedback
←
H cls(s)
x(t)
→
(b)
Figure 1617. Two different architectures for tracking control (using LTI controllers) of a firstorder LTI system.
and the control input given by: u(t) =
1 1 a 1e(t) + f FES [e(t)]} + {x˙ d (t) + ax d (t)} { a a ← for control → ← for tracking →
(16.21)
It is easy to see that the closed loop system will be stable if the combined mapping(a − a 1 )e − f FES [e ] of the independent variable e(t) is confined to the first and thirdquadrant and passes through the origin11. Thus, stability is a not a big issue here. But the fuzzy mapping, f[e], is a static mapping and may have discontinuities. To design the new dynamic controller, we first associate a new state variable, k(t), with the fuzzy expert system and modify the control law to: u(t) =
{
}
1 1 a 1e(t) + ( k(t) − k ∞ ) f FES [e(t)] + {x˙ d (t) + ax d (t)} a a (16.22) ← for control → ← for tracking →
where k∞ is some predetermined value that k(t) is expected to take as e(t) → 0 . That is, the new fuzzy controller output is given by ( k(t) − k ∞ ) f FES [e(t)] a . The multiplication by the new state variable k(t) introduces memory into the new fuzzy controller output or makes the fuzzy controller mapping a dynamic one. This particular form (and others given below) for the new fuzzy controller is (are) obtained from an understanding of the dynamics that result from networks made of various passive nonlinear elements. The dynamics of the firstorder plant with the new control law will change to: e˙ (t) = −(a − a 1 )e(t) + ( k(t) − k ∞ ) f FES [e(t)]
(16.23)
The next task is to choose the dynamics for the control state variable k(t). Obviously, we need to make k(t) change, based on the error and perhaps based on its past value. More importantly, the combined dynamics, that of the plant with the new control law and that of the control state variable, should have the origin {e = k = 0} as a globally, absolutely stable equilibrium point. In this particular case, the closed loop system has two state variables, e(t) and k(t), and when we say that the origin should be absolutely stable it implies that this dynamics has to correspond to the dynamics of a passive nonlinear (and perhaps timevarying) network with two reactive elements (linear, nonlinear, or timevarying) with the origin as the origin as the relaxation point. Further, global 11
The control signal, a 1e(t) a , could easily be made a part of the fuzzy controller output or mapping. We keep it separately for reasons that will become obvious soon.
stability implies that there should not be any other relaxation point, as well as points where the stored energy becomes a minimum. Using this paradigm, and some experience with dynamics that come from such networks, we can write a general form of the closed loop dynamics as: a − a1 − f FES [ e(t) ] e(t) a − a 1 > 0 e˙ (t) (16.24) k(t) − k ; k˙ (t) = − f [e(t)] b b>0 FES ∞ This dynamics corresponds to the passive network shown in Fig. 16.18a and involves LTI dynamic elements and resistors, a nonlinear lossless gyrator, and a strategically placed voltage source (The description of the various elements can be found in the earlier chapters). The secondrow basically gives the update law for k(t). The passive nature of the circuit implies that e(t) → 0 {or x(t) → x d (t)} and k(t) → k ∞ as t → ∞ . That is, we now have a dynamic fuzzy controller that uses the classical fuzzy controller as a subsystem and a closedloop dynamics that is absolutely stable. By making the passive resistor associated with the secondport nonlinear (Fig. 16.18b), we can obtain another closedloop dynamics as: 0 a − a1 − f FES [ e(t) ] e(t) e˙ (t) − k˙ (t) = − f [e(t)] 0 FES k(t) − k ∞ iR [ k(t) − k ∞ ]
(16.25)
where i R [• ] is a mapping confined to the first and thirdquadrant and passes through the origin. This dynamics uses the same control law but has a different update equation for k(t) and hence will lead to a different performance. We can use power and energy concepts to define / optimize this mapping, as we will see later. A more general dynamics is possible by changing the capacitor associated with the state variable k(t) to a nonlinear one (Fig. 16.18c). With this change, k(t) will be the charge in that nonlinear capacitor, ˙k(t) the current and v c [ k(t) ] the voltage which is a mapping confined to the first and the thirdquadrant. If we expect the state variable k(t) → k ∞ as t → ∞ a certain current source also has to be connected as discussed in earlier chapters to keep the total circuit passive and as shown in the figure. The resulting closedloop dynamics is: e˙ (t) −f FES [e(t)] e(t) 0 a −a 1 dvc ˙ = − − k (t) 0 fFES [e(t)] v c [ k(t)] − v c [ k ∞ ] i R v c [k(t)] −v c [ k∞ ] dk
[
]
(16.26)
−(k − k ∞ )f FES[ e] +
+ (a − a 1) e˙ (t) mho
e(t) C=1 F 
ef FES[ e]
+
Lossless Nonlinear Gyrator 0 −fFES [e ] YG = 0 fFES[ e]
{
+ k(t)
+ C=1
k − k∞
b mho
k∞



+
(a) −(k − k ∞ )f FES[ e] + (a − a 1) e˙ (t) mho
+ e(t)
C=1 F 
ef FES[ e]
+ k(t)
C=1 + +
−fFES [e ] YG = fFES[ e] 0 0
k˙ (t)
+
Lossless Nonlinear Gyrator
i R [ •]

k − k∞
and a different update law for k(t). From the update equation, we can note that dv c dk has to have the same sign and should not be equal to zero for all values of k. That is, v c [• ] has to be a monotonically increasing function. We can summarize the procedure with the aid of the block diagram shown in Fig. 16.19. For a given plant (subblock # 1), we add the stabilizing and or tracking control input (subblock # 2). On top of this, we add the dynamic fuzzy control law (subblock # 3). The dynamic fuzzy control law is simply a modulation (or product) of the classical fuzzy control law by a new state variable or a proper mapping of that state variable. Finally, the dynamics of the control law state variables (subblock # 4) is chosen such that the total system (block # 5) or to be exact, the dynamics of the total system, corresponds to the dynamics of a properly connected nonlinear passive network formed of well defined nonlinear elements. We will discuss the advantages and disadvantages (if any) of such an approach after we present few more concrete examples.
k∞



+
(b) −(k − k ∞ )f FES[ e]
A twoterminal lossless unit ef FES[ e]
k˙ (t)
Plant 1
+ + Lossless Nonlinear + + + i R [ •] (a − a 1) e˙ (t) Gyrator + mho YG = e(t) k − k∞ C=1 

}
which leads to a new fuzzy controller output vc [ k(t)] − v c [ k ∞ ] f FES [ e(t) ] a
k˙ (t)
0 −f FES[ e] f FES[ e] 0


2
v c [k]
dvc −1 k˙ dk
Stabilizing & Tracking Control Input
Dynamic Fuzzy Controller (Nonlinear Dynamic Controller) 3
Dynamics of the Fuzzy Controller Variable(s)
v c [k∞ ] +
4
(c)
Figure 1618. Three network architectures that lead to three different dynamic fuzzy controllers to control a firstorder LTI plant. Note that the classical (static) fuzzy expert system is used as a subsystem within the architecture.
Figure 1619. A block diagrammatic representation of the dynamic fuzzy controller design.
Let us now consider a plant represented by a secondorder LTI model: ˙x˙ (t) + b ˙x(t) + ax(t) = au(t)
(16.27)
or
x d (t), x˙ d (t) x d (t)
u t (t) + +

1 x(t) 0 ˙x(t) 0 x˙ (t) = −a − b x (t) + au(t) 1 1
∑ (16.28)
+ x(t), x˙ (t)
e(t), e˙ (t) Proportional, Derivative a 1e + b1 e˙ Controller a Classical Fuzzy Controller
where the coefficients, a and b, must be positive for the plant to be stable. Therefore, we have two state variables, x(t) and x1 (t) = ˙x(t) , with their desired values given by x d (t) and x1d (t) = x˙ d (t). Based on the classical fuzzy controller design approach, we will use the two error functions e(t) and e 1 (t) = ˙e (t) and a mapping of these two functions, f FES [ e, e˙ ] , obtained from a fuzzy expert system to write the control law as: u(t) =
1 {a e(t) + b1 ˙e(t) + f FES [e, e˙ ]} + 1a {x˙˙d (t) + b x˙ d (t) + ax d (t)} a 1 (16.29) ← for control → → for tracking →
0 1 0 ˙e(t) e(t) ˙e (t) = −(a − a ) −(b − b ) e (t) + f [e, e˙ ] 1 1 1 1 FES
with the corresponding closed loop system as shown in Fig. 16. 20a. However, as we discussed earlier in this chapter, it is very difficult to show the stability of this system. Using the new approach, similar to the firstorder plant control, we will change the control law to:
{
x d (t), x˙ d (t) x d (t)
}
1 1 a e(t) + b1 ˙e(t) + (k(t) − k∞ ) f FES[e, e˙ ] + { x˙˙d (t) + b x˙ d(t) + a xd (t)} a 1 a ← for control → → for tracking → (16.31)
with k(t) a state variable associated with the controller and write the dynamics for k(t) to make the closed loop dynamics mimic that of a passive network. One possible closed loop dynamics is given by:
LTI System x(t), x˙ (t) a + H p (s) = 2 s + bs + a
fFES [e,˙e ] a
Preshaping Filter for Tracking Input H f (s) = Hp−1(s) u t (t) + +
+ x(t), x˙ (t)
(16.30)
∑
(a)
∑
leading to the closed loop dynamics:
u(t) =
Preshaping Filter for Tracking Input −1 H f (s) = Hp (s)
e(t), e˙ (t) Proportional,
Derivative Controller Classical Fuzzy Controller
a 1e + b1 e˙ a fFES [e,e˙ ] a ×
∑
+
Dynamic Fuzzy Controller
fˆ[e,˙e,k,k ∞ ] k˙ (t)
LTI System x(t), x˙ (t) a H p (s) = 2 s + bs + a
1 s
+∑ 
k∞
(b)
Figure 1620. Flowgraph representation of the tracking control architecture for a secondorder LTI plant; a) Using classical fuzzy control; b) Using dynamic fuzzy control obtained using the building block approach.
+ e(t) 
(a − a 1) F
e(t) 
+
a1 − a 0 0 Y G = a − a1 0 −f FES f FES 0 0
e˙ (t) 
1F
v c [k ∞ ]
i R [ •]
dvc −1 k˙ dk
(16.33)
(b)
(a − a 1) F
+ e(t) 
Lossless Nonlinear Gyrator 0 Y G = a− a 1 0
+
v c [k ] i R [ •]
+
a1 − a 0 0 −f FES f FES 0
e˙ (t) 
+
f1[ •]
1F 
v c [k ∞ ]
+
(a − a 1)e˙
 
where k1 ≤ 1 and fˆ (t) > 0 for al t. In control applications, we will make fˆ (t) a function of the error state. Referring back to equation (16.32) and the corresponding figure 16.21a we can make some important observations about this approach. We do not have to know the exact values of the plant parameters a and b. Based on some knowledge about their minimum and maximum values, we can select the values of the coefficients a 1 and b 1 such that the conditions (a − a 1 ) and (b − b1 ) > 0 are satisfied. A deviation in the plant parameter ‘a’ from the assumed nominal value will simply change the value of the capacitor, and a deviation in the parameter ‘b’ will change the value of the resistor in the equivalent network and their effect on the system performance can be easily explained from network considerations. Basically, they will have some effect on the rise and fall time of the response.
(b − b1 ) mho
1F
(a)
Lossless Nonlinear Gyrator
v c [k ]
˙e( t ) 0 1 0 e 0 ˙e ( t ) = −(a − a ) ˆf (t) ˆf (t) e − ˙ −(b − b )− f [e, e ]+ k 0 1 1 FES 1 1 1 ˙k (t) k − k ∞ i R [k −k ∞ ] 0 −f FES [e, ˙e ]+ k 1ˆf (t) − fˆ (t)

k∞
C=1 i R [ •] +
e˙ (t)
k − k∞ k˙ (t)
+
(a − a 1)e˙
+
0 a1 − a 0 Y G = a − a1 0 −f FES 0 f FES 0
+
(a − a 1) F
Lossless Nonlinear Gyrator
+
with the corresponding flowgraph representation as shown in Fig. 16.20b. This closed loop system dynamics corresponds to the passive network of Fig. 16.21a if (a − a 1 ) and (b − b1 ) are greater than zero. The equivalent circuit has three state variables (three reactive elements), a threeport nonlinear lossless gyrator and other elements. Similar to the firstorder plant example, we can make the capacitor associated with the control state variable k(t) nonlinear (Fig. 16.21b) or the linear derivative feedback b 1˙e(t) into a nonlinear feedback term b 1˙e(t) + f 1[ e˙ (t)] (Fig. 16.21c). We can also force the dynamics to have time varying terms that correspond to timevarying passive resistors. For example, equation (16.32) can be modified to:
(a − a 1)e˙
 
˙e(t) 0 1 0 e(t) 0 ˙e (t) = a − a ˙ b1 − b f FES [e, e ] e1 (t) − 0 (16.32) 1 1 k˙ (t) 0 k(t) − k∞ i R [ k(t) − k ∞ ] − f FES [e, e˙ ] 0
dvc − 1 k˙ dk (c)
Figure 1621. Three network architectures leading to three different dynamic fuzzy controllers for the secondorder LTI plant. The classical (static) fuzzy expert system and other nonlinear blocks are used as a subsystems within the architecture. The nature of the various mappings will be determined by the elements that they represent.
Let us now consider how this approach can be applied to complex systems and situations where we have a large number of error variables to be monitored and used in control. We will arrive at general conclusions by considering a specific system that is fairly complex. In figure 1622, we show the network equivalent of a fourthorder system with two inputs that can be used for the control. The openloop system will be lossy (and hence stable) if the resistances G 1 and R 2 are lossy (doesn’t matter if linear, nonlinear, or timevarying). On the other hand, if either G 1 or R 2 is active, the system can become unstable. Thus, the equivalent network representation (as opposed to an arbitrary mathematical model) shows clearly the element(s) that can lead to instability. The openloop system is described by a fourthorder dynamics given by: L 1˙iL1 0 −1 c 2v˙ c2 = 1 −G 1 L 3˙iL3 0 1 c 4v˙ c4 0 G 1
→
(16.35b) where a 1 , a 2 and a 3 are three LTI control parameters chosen to stabilize the plant and or place the poles at the desired locations. Based on this control law and the network approach, and observing: (16.36)
we can write the error dynamics for the closedloop system as:
[
]
vs (t) = −a 1 (i L1 − iL1d ) + k 1 (t)f FES_1,2 [e 1 ,e 2 ] + k2 (t)f FES_1,3[e 1 ,e 3 ]
← tracking →
inputfor tracking
→
(16.34)
i = 1 to 3, j = i + 1 to 4 than obtaining the single mapping, f FES [ e1 ,e 2 ,e 3 ,e 4 ] , and in fact, that is what we do when we assume that the interactions will be limited to certain variables when implementing a fuzzy expert system with large number of inputs. Using the network approach, we will use two (or more) state variables, k1 (t) and k 2 (t), for the control law leading to the following expressions for the inputs, v s (t)and i s (t), as:
c2d
←
= −c 4 v˙ c4d + G1v c2d + iL3d − (G 1 + G 2 )v c4d
We can see the second input, i s (t), directly affects the two state equations. Let the desired values of the four state variables be i L1d , v c2d , iL3d and vc4d with the corresponding errors defined as e 1 = i L1 − i L1d , e 2 = v c2 − vc2d , e 3 = iL3 − iL3d and e 4 = v c4 − vc4d . If we were to use the classical fuzzy controller approach, we would have to design a fuzzy expert system that leads to an optimal mapping of the four error variables, f FES [ e1 ,e 2 ,e 3 ,e 4 ] , which is not an easy task. Further, the control function is still static, and it is difficult to establish the stability of the closedloop system. It will be much easier to generate a number of mappings, f FES_i,j e i ,e j ,
1 L1d
← input for control + c2 ˙v c2d − i L1d + G1 v c2d + i L3d − G1 vc4d
i s_Steady_state = c 2 ˙vc2d − i L1d + G1v c2d + i L3d − G 1vc4d
0 0 i L1 vs v i −1 G1 c2 + s 0 −1 i L3 0 1 −G 1 − G 2 vc4 −is
← Input for control → → stabilizing / ← Nonlinear, dynamic fuzzy control → pole placement +L ˙i + v
i s (t) = −a2 (v c2 − v c2d ) + a 3 (v c4 − vc4d ) + (k 1 − k1d ) f FES_1,4[ e1 ,e 4 ] + ( k 2 − k 2d ) fFES_2,3[ e2 ,e 3 ]
(16.35a)
(
)
(
)
L i˙ − ˙i L1d 1 L1 ˙ ˙ c ( v − v 2 c2 c2d L3 ˙i L3 − ˙i L3d c4 ( v˙ c4 − v˙ c4d k − ˙k 1 1d ˙ k 2 − k 2d
L1e˙1 ) c 2e˙ 2 L 3e˙3 = ) c 4e˙ 4 e˙ 5 e˙ 6
−a 1 −1 −G1 − a 2 1 0 1 = G1 + a 2 0 −f FES_1,2 −f FES_1,4 −f FES_1,3 −f FES_2,3
f FES_1,3 [e 1 ,e 3 ] e 1 0 0 f FES_1,2[ e1 ,e 2 ] −1 G1 + a 3 f FES_1,4[ e1 ,e 4 ] f FES_2,3 [e 2 ,e 3 ] e 2 e 3 0 −1 0 0 1 −G1 − G 2 −a 3 −f FES_1,4 [ e 1,e 4 ] −f FES_2,3 [ e 2, e 3 ] e 4 e 5 0 f FES_1,4 0 0 e 0 f FES_2,3 0 0 6
(16.37) where k1d and k2d are the desired values for the control state. The last two equations provide the update law for k1 (t) and k 2 (t). By including the controller state variables, k1 (t) and k 2 (t) in the control law, we have indeed made the control nonlinear as well as dynamic. Though the mappings f FES_3,4 [ e 3 ,e 4 ], f FES_2,4 [e 2 ,e 4 ] are not used in the above dynamics, we could have easily inserted them by adding more controller state variables. For example, if we decide to incorporate all combinations of the fuzzy error mappings into the expression for v s (t) , the resulting expression will be:
v s (t) = −a 1(i L1 − i L1d ) + L1˙i L1d + vc2d +
v c4 (t)
(16.38)
12
13
A key argument in the area of neural networks is that by increasing the connectivity (or equivalently the coupling between various nodes) which leads to improved interactions among various signals we make the system robust. We will soon show how this approach can be applied to the truck backerupper problem.
+
+ k4 (t)f FES_2,3[ e 2 ,e 3 ] + k 5 (t)f FES_2,4 [ e 2 ,e 4 ] + k 6 (t)f FES_3,4 [ e 3 ,e 4 ] Similarly for the other control input i s (t). Thus, we are able to generate a nonlinear mapping of a large number of inputs through the use of mappings of just two variables. Also, as the controller state changes, based on the plant and the controller error state, we get not only a static mapping of a large number of inputs, but one which changes (or adapts) based on the system dynamics. The analogy with the passive network ensures that the adaptation will proceed in the proper direction. Another key point worth noting, is that through the dynamic controller approach we have increased the coupling between various state variables in the system which can help to improve the system performance12. This has to be contrasted to attempts in control design where we try to decouple the system as much as is possible (aircraft control is a classical example). The variables that are involved in the update law for the controller state are i L1 (t), vc2 (t)and v c4 (t) {or i L1 (t) and v c2 (t) − vc4 (t) }, respectively the current drawn from the voltage source v s (t) and the voltage across the current source i s (t). Together they define the power delivered by the control sources to the plant and should be available in realworld systems. The examples given above are LTI systems 13. However, the same concept can be applied to nonlinear and / or timevarying systems as discussed in the chapters on control. Of course, it cannot be applied to arbitrarily chosen models of nonlinear systems. But again, a key message of this book is that a real world system has a built in structure that carry information as to its constituent elements and the interconnections which is not included in an arbitrarily written mathematical model.

i s (t)
i s (t)
R1
L1
+
i L1 (t)
v s (t)

+
L3
i L3 (t)
v c2 (t)

+
k 1(t)f FES_1,2[ e 1,e 2 ] + k2 (t)f FES_1,3[ e 1,e 3 ] + k 3 (t)f FES_1,4[ e1 ,e 4 ]
v c2 (t)
+
+ R2
v c4 (t) c2

(a)
c4

+
i L1 (t)
v s (t)

(b)
Figure 1622. a) The network analog of a fourthorder LTI plant; b) A black box representation with the variables needed for nonlinear dynamic control.
16.5.2.1 Simulation Results In this section, we present some simulation results and compare them with the results obtained using the classical fuzzy controller. We first consider a secondorder plant, as given in (16.27) and (16.28) with both the coefficients, a, b, set to one. The plant is therefore stable with an impulse response, h(t) = e − 0.5t cos[ 0.866t ] . Since the system is LTI, this represents the general form of the response. That is, the system is an underdamped one with a timeconstant of 2 seconds, which may not be acceptable. We can use the classical fuzzy controller to improve the performance. We show the fuzzy matrix linguistic definitions and the fuzzy rulebase developed by Macvicar and Whelan and used in the simulation, in table 16.3. This fuzzy linguistic code is converted to numerical values using the conversion values shown in table 16.4. The corresponding fuzzy control matrix used in simulation is shown in table 16.5. The simulation result for some initial value x(0) ≠ 0 and x desired = 0 is shown in Fig. 16.23a. We can see a good improvement in the transient performance (no oscillation) and a much reduced time constant. The same plant controlled by a nonlinear dynamic controller with one controller state variable will have a dynamics as shown in (16.32) and repeated below.
˙e(t) 0 1 0 e(t) 0 ˙e (t) = a − a ˙ b1 − b f FES [e, e ] e1 (t) − 0 (16.39) 1 1 k˙ (t) 0 k(t) − k∞ i R [ k(t) − k ∞ ] − f FES [e, e˙ ] 0 where a = b = 1 and we assumed a 1 = b 1 = 0 (no change to openloop poles). For one simulation, we assumed i R [ k(t)] = 5k(t) , a linear mapping, and k∞ = 10. The simulation result is shown in Fig. 16.23b. We can observe some improvement in the performance. But the important point is the performance will remain almost the same even if the plant parameters change (robustness). In figures 16.23c and d, we show simulation results when 1) i R [ k(t)] = ( 4 π ) tan −1 k(t) , a nonlinear function, and 2) i R [ k(t)] = k(t) + ( 4 π ) tan − 1 k(t) . Again, we find some improvement in the performance. Next, we consider the application of this approach to the truck backerupper problem. The continuous domain model for the truck as used by other researchers is given in (16.7) and can be rewritten in a matrix form to conform to the network based approach as given below. Sincex desired = 50 , y desired = 100 , φ desired = 90 o , we will use the error variables e x (t) = x(t) − xdesired , e y (t) = y(t) − φdesired and e φ (t) = φ(t) − φdesired , and a new state variable k(t) with
[
]
a desired final value of zero in our representation. If θ = θ FES e x (t),e φ (t) is the output from the classical fuzzy controller, the dynamics is: ˙ex (t) 0 0 ˙ey (t) 0 0 ˙eφ (t) = s.sin[ φ] −s. cos[θ ] − sin e φ (t) + φ desired e˙ φ −s.cos [ φ] −s.sin[ θ] ˙k(t) 0 0
[
]
sin cos
e x (t) e y (t) eφ + φ desired
[ [e
φ + φdesired k(t)
] ]
0 −s. sin[φ ] s.cos [φ ] s.cos[ θ] s.sin [ θ] 0 0 0 g1 (t) × 0 0 g 2 (t) −g 1(t) −g2 (t) −A
O S
Zero Small
L 
Large Negative Change
M
Medium
+
Positive Change
e\∆ e
−L
−M
−S
−O
+O
+S
+M
+L
−L
+O
+S
−M
−L
−L
−L
−L
−L
−M
+S
−O
−S
−M
−M
−M
−L
−L
−S
+M
+S
−O
−S
−S
−S
−M
−L
−O
+M
+M
+S
+O
−O
−S
−M
−M
+O
+M
+M
+S
+O
−O
−S
−M
−M
+S
+L
+M
+S
+S
+S
+O
−S
−S
+M
+L
+L
+M
+M
+M
+S
+O
+O
+L
+L
+L
+L
+L
+L
+M
+O
+O
Table 163. MacvicarWhelan Fuzzy Matrix Linguistic Definition and the corresponding fuzzy matrix.
+
positive change
0
1
Extrasmall
4
big 4
negative change 2
small
5
small 5
zero
medium
6
extralarge 6
(16.40) 3
Table 164. Fuzzy control linguistic code.
x(t)
e \ ∆e
6
5
4
3
2
1
0
+0
+1
+2
+3
+4
+5
+6
6
+6
+6
+5
+5
+4
+4 +3
+3
+2
+2
+1
+1
0
0
5
+6
+5
+5
+4
+4
+3 +3
+2
+2
+1
+1
0
0
0
4
+5
+5
+4
+4
+3
+3 +2
+2
+1
+1
0
0
0
1
3
+5
+4
+4
+3
+3
+2 +2
+1
+1
0
0
0
1
1
2
+4
+4
+3
+3
+2
+2 +1
+1
0
0
0
1
1
2
+3 +3
+2
+2
+1 +1
0
0
0
1
1
2
2
x(t)
t (msec.)
1
+4
0
+3
+3
+2
+2
+1
+1
0
0
0
1
1
2
2
3
+0
+3
+2
+2
+1
+1
0
0
0
1
1
2
2
3
3
t (msec.)
(a)
(b)
x(t) x(t)
+1
+2
+2
+1
+1
0
0
0
1
1
2
2
3
3
4
+2
+2
+1
+1
0
0
0
1
1
2
2
3
3
4
4
+3
+1
+1
0
0
0
1
1
2
2
3
3
4
4
5
+4
0
0
0
0
1
1
2
2
3
3
4
4
5
5
+5
0
0
0
1
1
2
2
3
3
4
4
5
5
6
+6
0
0
1
1
2
2
3
3
4
4
5
5
6
6
Table 165. Fuzzy control matrix used in simulation.
t (msec.)
t (msec.)
(c)
(d)
Figure 1623. Response of a secondorder plant controlled by: a) classical fuzzy expert system; b) dynamic fuzzy controller with a linear feedback term in the controller dynamics; c) dynamic fuzzy controller with a nonlinear feedback term; d) dynamic fuzzy controller with linear plus nonlinear feedback term.
Here the first two rows correspond to the plant dynamics x˙ (t) and y˙ (t) written to bring them in the particular form necessary for identification with network dynamics. The third row basically corresponds to the plant dynamics φ˙ (t) = θ if we calculate g1 (t) from: g1 ( t ) k ( t ) = θ− s.e x (t)sin [ φ] + s.e x (t)cos [ θ]
(16.41)
The left hand side of fourth row is simply the differential of the fourth state variable cos e φ + φ desired and the term g 2 (t) is simply introduced to reconcile
[
]
this equation with that of the third equation. That is,
[
]
− sin e φ (t) +φ desired e˙ φ
[
= − sin e φ (t) + φdesired
] {s.sin[ θ ] e (t) − s.cos[θ ] e (t) + g (t) k(t)} x
y
←
1
→ (16.42)
From third row
= −s.cos[ θ] e x (t) − s.sin[ θ ] e y (t) + g2 (t) k(t) ←
→
From fourth row
Finally, k(t) is updated using the equation in fifth row. The closedloop dynamics may reach the desired state e x (t) = e φ (t) = k(t) = 0 if we let g1 (t) → 0 when we solve for its value using (16.41). Notice we have said the dynamics may (and not will) reach the desired state. The reason is that the dynamics doesn’t really correspond to a complete passive network, since the third state variable is e φ (t) and the corresponding
[
]
[
]
transformed variable sin e φ (t) +φ desired {and not sin e φ (t) } do not correspond to a lossless element. This problem is due to the plant dynamics used, which implies y˙ (t) = s as the dock is reached. That is, the truck will ram through the dock, unless the driver slams the brake as and when the dock is reached. This problem can be solved by using a proper model for the plant in which the speed is a function of the plant state or s(t) = s e x (t),e y (t) with s[0,0 ] = 0 ; that is,
[
]
making s(t) a new state variable that varies based on e x (t), e y (t) . Using the network approach alone (that is, no fuzzy expert system is involved), we can write a stable closedloop dynamics as: ˙e x (t) 0 0 cos[φ +θ ] 0 0 e x (t) ˙e (t) 0 0 sin [ φ + θ ] 0 0 e y (t) y s˙(t) = − cos [φ +θ ] − sin[ φ+ θ] −A 0 g(t) s(t) ˙e (t) 0 0 0 −B f(t) e φ (t) φ 0 0 −g(t) −f(t) −C k(t) k˙ (t) (16.43) where A, B and C are positive constants, θ = −Be φ (t) − f(t)k(t) is the steering angle, and f(t) and g(t) are real functions of time or more appropriately, functions of the error state. This dynamics corresponds to a fully passive network with the origin as the only stable equilibrium point and hence we can be
certain that e x (t) , e y (t) , s(t), e φ (t) and k(t) will go to zero as time progresses from any initial condition. With the above dynamics, we still face many problems. The speed, being a state variable, can become very large. By varying the function f(t) properly or using other techniques, we can prevent this from happening. Also, the speed can become positive as well as negative before the truck reaches the dock, implying a number of forward and reverse movements of the truck which is of course unacceptable. One possible solution for this problem is to make the speed an even power of a state variable. Assuming speed = s2 (t) , the system dynamics in (16.43) will change to: ˙e x (t) 0 ˙e (t) 0 y s˙(t) = −s(t)cos [ φ + θ] ˙e (t) 0 φ ˙ 0 k(t)
0 0 −s(t)sin [ φ +θ ]
s(t)cos[ φ + θ ] s(t)sin[ φ + θ ] −A
0 0
0 −g(t)
0 e x(t) e (t) 0 y 0 g(t) s(t) − B f(t) e φ(t) −f (t) −C k(t) 0 0
(16.44) Unfortunately with this change, the origin is no longer the only equilibrium point. The values, s(t) = e φ (t) = k(t) = 0, and e x (t), e y (t) arbitrary, as well become the equilibrium points of the new dynamics. We cannot overcome this problem completely for the given plant dynamics. However, we will shortly discuss a solution that seems to solve the problem for all practical purposes. We should also realize that the system state may wander all over before it reaches the origin. That is, the truck may enter the dock (!) before it pulls back and perhaps do so a couple of times. We need to adjust the parameters A, B and C and the functions f(t) and g(t), so this doesn’t happen for any reasonable initial condition. Alternatively we can use intelligent techniques such as fuzzy expert systems as part of the dynamics as we will see now. Another problem is the large dynamic range of the state variables { e x (t) ∈−50 to + 50;e y (t) ∈−100 to 0 } and its effect on the system derivatives. This can make it difficult to optimize the performance with the parameters available. Nonlinear mappings selected based on network principles can help to overcome this and other problems. A solution for the truck backer upper problem that uses network concepts, fuzzy logic and other intelligent techniques will be presented now. We retained e x e y s e φ k as the state. However,
[
[
( )
we used transformed state, tanh( e x ) tanh e y
]
( )
tanh( s) tanh e φ
]
tanh ( k ) ,
whose values are limited to the range 1 to 1, and a valid mapping from a networks’ perspective, in defining the derivatives of the state variables. This solves the large dynamic range problem nicely. Letting θ FES e x ,e φ as the
[
]
original steering angle obtained from the fuzzy expert system, in our controller
[
]
the actual steering angle is defined as θ = C θ FES e x ,e φ tanh [ k(t)] where C is a constant. Letting d(t) = e (t) + e (t), the square of the distance from the dock, D 0 ( t ) = d( t) (1 + d (t )) a positive function that is almost a constant (equal to one for large values of the distance and small to zero as the truck reaches the dock14), the speed is selected as: 2 x
2 y
(
)
speed = D1 tanh (s( t )) = 4D 0 tanh ( 256 s( t) ) + D0 tanh ( s(t )) (16.45) The multiplication by the function D 0 ( t ) makes sure that the speed is reduced as the truck moves closer to the dock and becomes zero when the dock is reached. The term tanh ( 256 s( t) ) + D 0 rather than a function of s(t) alone is selected to avoid the problem of unwanted equilibrium points mentioned before and the steep mapping provided by tanh ( 256 s( t) ) along with a large positive initial value for s(t) eliminates the possibility for the speed to change sign in practical situations. With these choices and based on network principles, we can write down a closedloop dynamics as: 0 0 D 1 cos[φ +θ ] 0 0 ˙e x (t) ˙e (t) 0 0 D sin φ + θ 0 0 [ ] 1 y 0 0 × s˙(t) = − D1 cos[ φ + θ ] −D 1 sin [ φ+ θ] −A e x ,e y ˙e (t) 0 0 0 0 C θ FES φ k˙ (t) 0 0 0 −C θ FES −B
[
]
tanh[ e x (t)] tanh e (t) y tanh[s(t)] tanh e (t) φ tanh[ k(t)]
[
]
[
]
(16.46)
[
]
where A e x ,e y = 8 ( 2 + d( t) ) (1+ 2d ( t) ) is selected as a distancedependent damper (A = 4 when the distance is large; A = 8 when the distance is one; A = 16 when the distance is zero) to control the state variable s(t) associated with the speed and B is a positive constant. The above dynamics may look like two uncoupled subsystems, the first involving the first three state variables and the second involving the last two state variables. However, there is good coupling or interaction between the two subsystems, since the distance that comes from the two state variables affect the damping variable A associated with the fourth state 14
In fact, in our simulations, we made D 0 (t) = 0 when d(t) became sufficiently small.
equation, and the steering angle coming from the fourth equation affects the first three equations. Also, the readers may notice that the origin is only one of many t stable equilibrium points given by e x ey s eφ k =
[
]
[arbitrary 0 0 0 0] which seems to be unavoidable given the plant model. We will discuss later discuss how this problem gets eliminated by the use of the fuzzy expert system. We implemented the classical fuzzy expert system producing the mapping θ FES e x ,e φ as a lookuptable as shown in table 16.6. As indicated in the table, t
[
]
the error in x is quantized to 15 levels and the error in the truck angle to 17 levels leading to a 17 × 15 matrix representation for θ FES e x ,e φ . The entries
[
]
into this matrix are made somewhat arbitrarily by (literally) staring at the fuzzy sets as we have lost the program that implements the fuzzy expert system, and didn’t feel it necessary to implement it exactly (The use of proper dynamics as obtained from network considerations compensates for it). We show the results of simulation for four initial conditions in Fig. 16.24. In Fig. 16.24a, we show the values of e x (t) and e y (t) as time progresses. We can note that both the variables reach the value zero. In Fig. 16.24b, we show e x (t) and e y (t) in a phaseplane plot. Though we show the truck at any time as just a dot, the angle the truck makes at any given time and the nice way it turns so the back of the truck faces the dock, are obvious from the plots. In Fig. 16.24c, we show the state variable s(t) associated with the speed and the actual speed. We can see that the speed is nicely maintained at 8 feet/sec, the value that we selected, doesn’t become negative (once it drops, but recovers quickly), and becomes zero as the truck reaches the dock. Finally, in Fig. 16.24d, we show the truck error angle, e φ (t) , and the state variable k(t). We can see that e φ (t) becomes a smoothly varying function (unlike the case when only a classical fuzzy expert system is used) tends to zero as the truck moves to the dock. As indicated earlier, the origin is only one of many (in fact, infinite) equilibrium points for the dynamics. However, the fuzzy expert system provides proper direction for the truck to move which along with the nonlinear dynamics forces e x (t) and e φ (t) to decrease in magnitude. Thus, when e x (t) and e φ (t) become zero, the remaining dynamics forces e y (t) and s(t) to become zero. We also simulated the dynamics in (16.46) after replacing the function θ FES e x ,e φ provided by the fuzzy expert system by an arbitrary constant. Since
[
]
the origin is only one of many stable equilibrium points, the lack of good steering direction (coming out of the fuzzy expert system) makes the truck go to and settle at some value e x ≠ 0 with all other variables becoming zero. Thus, we find that, by mixing different paradigms properly, we achieve superior results. The fuzzy expert system paradigm leads to a good mapping of the steering angle as a function of the xdistance and the truck angle. The stable nonlinear
dynamics using network principles uses the fuzzy expert system as a subsystem and leads to a stable dynamics. 40
e x (t) 0 x(t) 30
45
46
47
48
49 49.8 50.2
51
52
53
54
55
70
100
φ(t)
5
15
15
16
25
25
24 23
25
25
24
25
16
17
18
19
20
21
21
22
23
24
25
20
19
18
17
16 15 15
12
10
8
6
5
5
270 22 21
20 20
40
t 0
180 23 21
19
17
15 14
15 14
13
12
11
10
8
4
2
1
1
3
5
15
24
14 13
12
11 10
9
5
3
2
1
2
4
6
1
e y (t)
23
13
12
11
10
9
6
4
3
2
2
3
5
7
17
40
22
12
11
10
9
7
5
4
1
2
2
4
6
8
18
21
11
10
9
7
6
4
1
1
1
3
5
7
9
19
20
10
9
8
6
4
2
1
0
2
4
6
8
10
20
20
10
9
7
5
3
1
0
1
3
5
7
9
10
20
20
10
8
6
4
2
0
1
2
4
6
8
9
10
20
19
9
7
5
3
1
1
1
4
6
7
9
10
11
21
18
8
6
4
2
2
1
4
5
7
9
10
11
12
22
17
7
5
3
2
2
3
4
6
9
10
11
12
13
23
16
6
4
2
1
2
3
5
9
10
11
12
13
14
24
15
5
3
1
1
2
4
8
10
11
12
13
14
15
25
5
5
6
8
10
12
14
15
17
19
21
23
24
25
25
4
8
12
16
20
135 0
95 94 93 92 80 t
91 90.1 89.9 89 88 87 86 85 45 0
[
Table 166. The original steering angle θ FES e x ,e φ system and expressed as a lookuptable.
]
coming from a fuzzy expert
0
4
8
12
16
20
(a) Figure 1624. Results of simulation of backing up the truck using a nonlinear dynamics fuzzy controller. a) The values e x (t) and e y (t) as time progresses. b) e x (t) and e y (t) in a phaseplane plot. The angle that the truck makes at any given time and the nice way it turns so that the back of the truck faces the dock are obvious from the plots. c) State variable s(t) that controls the speed and the actual speed. We can see that the speed is nicely maintained at 8 feet/sec, the value that we selected, doesn’t become negative (once it drops, but recovers quickly), and becomes zero as the truck reaches the dock; d) Truck error angle, e φ (t) , and the state variable k(t). We can see that e φ (t) becomes a smoothly varying function (unlike the case when only a classical fuzzy expert system is used) tends to zero as the truck moves to the dock.
0
e y (t)
8
20
e φ (t)
4
0
40
t 4 60
0
20
4
8
12
16
20
k(t)
80
e x (t) 100
40
0
10
40
(b)
t 0 0
s(t)
4
8
12
16
20
80
(d) Figure 16.24. Contd. 40
t 0
8
4
8
12
16
20
16.6 Summary
20
In this chapter, we considered another emerging/hot area in intelligent systems that of fuzzy logic (FL), fuzzy expert systems (FESs) and fuzzy controllers (FCs), mainly from the perspective of nonlinear systems. We first provided a simple and concise introduction to this area. We provided only the salient details about functional and implementational aspects of fuzzy expert systems and fuzzy controllers and omitted mathematical details as much as possible. We argued that the fuzzy logic casts in an analytical mode the approaches taken by human beings in dealing with daytoday problems which are nonlinear by nature and the resulting solutions and fuzzy logic and fuzzy expert systems are excellent vehicles for specifying multiinput / multioutput (MIMO) static mappings. The beauty of fuzzy logic lies in the relatively simple and easy approach with which MIMO nonlinear functional mappings of practical relevance can be described and implemented.
speed(t)
4
0
t 4
8
12
(c) Figure 16.24 Contd.
16
The use of fuzzy logic in control applications is considered in section 16.3. We gave some examples that illustrate how fuzzy logic can be used to design control laws and discuss the performance of systems controlled by fuzzy controllers. We found from the examples that fuzzy controllers (based on some appropriate knowledge) can indeed do a good job. Perhaps the important point to learn is that since the controller is in general nonlinear, better performance can be obtained from different fuzzy controllers based on the knowledge from different experts. That is, the nonlinearity by itself makes it possible to have more than one nearoptimal control law and leads to control laws that are robust. However, The nonlinear nature of the control law makes the closedloop system nonlinear even if the openloop system is LTI and it is very difficult to prove the stability of such nonlinear systems. We presented some results from classical control theory to show the efforts that went into proving the stability of such systems and the difficulties encountered. As indicated earlier, fuzzy logic leads to static (memoryless) control laws with abrupt changes that may not be acceptable in practice. Also, when the number of inputs is large, the design complexity also increases. Then, there is the question of adaptability or learning in fuzzy expert systems. In sections 16.4 and 16.5, we provided some solutions to these problems. In section 16.4, we showed how fuzzy logic can be combined with neural nets to retain the best of both worlds: use of experts’ knowledge when available and adapt further based on observed data. We also discussed a neural network architecture known as Cerebellar Model Articulation Controllers (CMAC) Neural Network which was proposed independently some twenty five years ago and its similarity to fuzzy expert systems. In section 16.5, we showed how the building block concept can be used to overcome the stability problem, introduce memory into otherwise static fuzzy expert systems and provide the ability to deal with large number of input variables. The network approach thus leads to the next generation of fuzzy controllers called feedback or recurrent fuzzy controllers and can find use in a number of applications. We provided results of simulation for the truck backerupper problem using the new nonlinear dynamic fuzzy controller. We found that the controller moves the truck to the dock from any reasonable initial condition even though the plant model used leads to a dynamic system with essentially infinite number of equilibrium points.