Uncertain System Control: An Engineering Approach Stanisław H. Żak School of Electrical and Computer Engineering ECE 680 Fall 207
Fuzzy Logic Control---Another Tool in Our Control Toolbox to Cope with Uncertainties 2
Fuzzy Logic=Computing With Words The term Fuzzy Set introduced by Lotfi A. Zadeh in his paper Fuzzy Sets published in Information and Control, Vol. 8, No. 3, pp. 338-- 353, June 965 The motivation for the notion of a fuzzy set---to provide a framework for a natural way of dealing with problems in which the source of imprecision is the absence of sharply defined criteria of class membership rather than the presence of random variables. 3
What is a Set? A set is a collection of objects. An element belongs to the set or it does not Example X { : > 6 } = x x If x greater than 6, then x belongs to the set X, otherwise x does not belong to the set Unambiguous set boundary 4
Characteristic Function Characteristic function of a set---if an element belongs to the set, then the function value is, if an element does not belong to the set, then the function is 0 Can represent a set X, using its characteristic function, as a set of ordered pairs (x,0) or (x,), where (x,0) means while (x,) means x X x X An ordinary set can be represented as a collection of ordered pairs 5
Crisp Set Crisp set ( ordinary set)---a collection of objects. An element is a member of the set or it is not An example of a crisp set---fast cars 6
Zadeh s Definition of Fuzzy Set A fuzzy set is a class of objects with a continuum of grades of membership. Such a set is characterized by a membership (characteristic) function which assigns to each object a grade membership ranging between zero and one. ---L.A. Zadeh, 965, p. 338 7
Example of Fuzzy Set Fuzzy sets allow for partial membership in a set Example of a fuzzy set---fast cars 8
Crisp versus Fuzzy Notation: ---collection of objects, universe µ Crisp set U ---membership function µ : U { 0,} Fuzzy set µ : U [ 0,] 9
Formal Definition of Fuzzy Set u Denote a generic element of the universe U F U A fuzzy set in is a set of ordered pairs: {( u, µ ( u )) u U } F = : F 0
Fuzzy Set Example Discrete universe U = { 4,5,6,7,8} Fuzzy set--- a number close to 6 {( 4,0.0),( 5,0.5),( 6,.0 ), ( 7,0.5),( 8,0.0) }
Possible Membership Functions.2 (a) Trianguler MF.2 (b) Trapezoidal MF Membership Grades 0.8 0.6 0.4 0.2 Membership Grades 0.8 0.6 0.4 0.2 0 0 20 40 60 80 00 0 0 20 40 60 80 00.2 (c) Gaussian MF.2 (d) Generalized Bell MF Membership Grades 0.8 0.6 0.4 0.2 Membership Grades 0.8 0.6 0.4 0.2 0 0 20 40 60 80 00 0 0 20 40 60 80 00 2
Special Types of Fuzzy Sets A fuzzy set F is convex if for any x, y from the universe X and for any we have λ [ 0, ] ( x + ( ) y) min( ( x) ( y) ) µ λ λ µ, µ F F F 3
Convex and Nonconvex Fuzzy Sets.2 (a) Two Convex Fuzzy Sets.2 (b) A Nonconvex Fuzzy Set Membership Grades 0.8 0.6 0.4 0.2 Membership Grades 0.8 0.6 0.4 0.2 0 0 4
Normal Fuzzy Set and Fuzzy Number F A fuzzy set is normal if there is a point in X the universe such that x µ F ( x ) = A fuzzy number is a fuzzy set that is both normal and convex 5
Linguistic Variable Linguistics variable---a variable whose values are fuzzy numbers Examples of linguistic variables: (i) SPEED---it can take its values from set of fuzzy numbers {very slow, slow, medium, fast, very fast} (ii) TEMPERATURE---possible values {cold, cool, warm, hot} the 6
More Examples of Linguistic Variables ERROR {LN, SN, ZE, SP, LP} LN---large negative SN---small negative ZE---zero SP---small positive LP---large positive 7
Another Example of a Linguistic Variable CHANGE-IN-ERROR {LN, SN, ZE, SP, LP} LN---large negative SN---small negative ZE---zero SP---small positive LP---large positive 8
Fuzzy Rules A fuzzy IF-THEN rule IF x is A THEN y is B Examples: (i) IF speed is low THEN brake is zero (ii) IF error is large negative THEN control action is large positive 9
Linguistic Description of Control Action Instead of a math model of the plant we may have available fuzzy IF-THEN rules: RULE : IF error is ZE and change-in-error is SP then u is SN RULE 2: If error is SN and change-in-error is SN THEN u is SP Use the given linguistic description in the form of the IF-THEN rules to design a controller 20
Defuzzification: Moving From Fuzzy Rules to Numbers Computing with words--- Convert the given fuzzy IF-THEN rules into controller action Inference engine, or defuzzifier, uses fuzzy rules to generate crisp numbers Center average defuzzifier (product inference rule) u M l= M = µ l= A l µ ( e) µ ( e) A l B l ( e) µ ( e) B l θ l c 2
Center average defuzzifier (product inference rule) Rule µ µ µ F F2 Fu product ξ 2 µ F 2 µ F2 product µ Fu θ Rule 2 ξ 2 θ 2 e Input variables e Control action Center average defuzzification ξθ + ξ2θ 2 u = ξ + ξ 2 22
Defuzzifier for q Inputs Center average defuzzification for q input controller u m q q µ l ( v m = = j) θl µ l ( v l j A = j = j= A j m q m q µ ( v ) l µ =θ T ξ j = l l ( v l= j= A j = j= A j l j j ) ) θ l where θ= [ ] [ ] T θ θ θ T, ξ = ξ ξ ξ, q is the number of inputs m is the number of fuzzy rules 2 m 2 m 23
Center-of-Gravity Defuzzifier u M = l= M min l= { ( ) ( )} µ e, µ e } Al Bl { ( ) ( )} µ e, µ e min A l B l θ l c 24
Center-of-Gravity Defuzzifier µ µ µ F F2 Fu min Rule ξ 2 µ F 2 µ F2 min µ Fu θ Rule 2 ξ 2 e e Input variables Control action θ 2 Center-of-gravity defuzzification u = ξθ + ξ2θ 2 ξ + ξ 2 25
Computing With Words---Example Our example uses data from the paper by Y.F. Li and C.C. Lau, Development of fuzzy algorithms for servo systems, IEEE Control Systems Magazine, pp. 65--72, April 989 Rule #: IF the error is ZE and the error change is SP THEN the control is SN Rule #2: IF the error is ZE and the error change is ZE THEN the control is ZE Rule #3: IF the error is SN and the error change is SN THEN the control is SP Rule #4: IF the error is SN and the error change is ZE THEN the control is LP 26
Defuzzification: Moving From Fuzzy Rules to Numbers Contribution of Rule # Center-of-gravity---0.6 (-2) Center average defuzzifier--- 0.6 0.8 (-2) 27
Defuzzification: Contribution of Rule #2 Center-of-gravity---0.2 0 Center average defuzzifier--- 0.6 0.2 0 28
Defuzzification: Contribution of Rule #3 Center-of-gravity---0 2 Center average defuzzifier--- 0.6 0 2 29
Defuzzification: Contribution of Rule #4 Center-of-gravity---0.2 4 Center average defuzzifier--- 0.6 0.2 4 30
Combining All Contributions Together Center-of-gravity 0.6 ( 2) + 0.2 0 + 0 2 + u = 0.6 + 0.2 + 0 + 0.2 0.2 4 = 0.4 Center average defuzzifier (product inference rule) u = 0.48 ( 2) + 0.2 0 + 0 2 + 0.48 + 0.2 + 0 + 0.2 0.2 4 = 0.67 3
Designing a Fuzzy Logic Controller for DC Motor---Control Objective Design a controller that forces the closed loop system output x(t) to track a given reference signal x d (t) Force the tracking error e(t) = x x d asymptotically decay to 0 to 32
Fuzzy Logic Controller (FLC) in the Loop η Disturbance Reference signal x d e Fuzzy Logic Controller u Plant x 33
FLC Design Algorithm Identify ranges of the controller inputs Identify ranges of the controller output Create fuzzy sets for each input and output Translate the interaction of the inputs and outputs into IF-THEN rules, and then form the rules matrix Decide on the defuzzifier, and then use it to generate the control surface Implement the controller, test it, and modify it if necessary 34
Fuzzy Logic Tracking Control of a DC Motor DC motor schematic 35
More On the Control Objective and the Plant DC motor--- Electro-Craft Corporation MOTOMATIC system Control objective---design a simple fuzzy logic tracking controller, simulate the dynamical behavior of the closed-loop and test the design in the lab Math model of the DC motor needed for simulations 36
Tracking Error Fuzzy Sets ERROR fuzzy sets Membership 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 0.2 0.5 0. 0.05 0 0.05 0. 0.5 Universe 37
CHANGE-IN-ERROR Fuzzy Sets CHANGE IN ERROR fuzzy sets Membership 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 0.0 0.005 0 0.005 0.0 Universe 38
Control Action Fuzzy Sets CONTROL fuzzy sets Members ship 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 200 50 00 50 0 50 00 50 200 Universe 39
Rules Matrix Change-in-error LN N ZE P LP Error Large Negative (LN) LN LN LN N ZE Negative (N) LN LN N ZE P Zero (ZE) N N ZE P P Positive (P) N ZE P LP LP Large Positive (LP) ZE P LP LP LP 40
Center Average Inference System Rule µ µ µ F F2 Fu product ξ 2 µ F 2 µ F2 product µ Fu θ Rule 2 ξ 2 θ 2 e Input variables e Control action Center average defuzzification u = ξθ + ξ2θ 2 ξ + ξ 2 4
Defuzzifier Center average defuzzifier for a two-input controller u M ( e) µ ( e) µ l = Al Bl M = µ µ l Bl = θ ( e ) ( e ) µ l A l c l θ c where is the centroid of the control action fuzzy set and is the number of fuzzy rules M 42
Control Surface 50 00 50 control 0 50 00 50 200 0.2 0. 0 change in error 0. 0.2 0.0 0.005 0 error 0.005 0.0 43
FLC in SIMULINK 44
Simulation Results 45
Improving the Performance of FLC Excessive overshoot Fine tune the controller Good results when changed the error range of the tracking error from to [ 0.5,0.5] [ 0.,0.] 46
New Tracking Error Fuzzy Sets ERROR fuzzy sets Membership 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 0. 0.05 0 0.05 0. Universe 47
FLC Improved Performance 48
Summary Fuzzy Logic Control: incorporates linguistic description of the controller action, rather than a mathematical plant model, to compute the control action--- computing with words different ways to achieve high controller performance---use a two-range controller consisting of coarse and fine parts to regulate the large tracking error and small tracking error use more fuzzy sets, this in turn requires more fuzzy rules 49