Fuzzy Logic Control What is Fuzzy Logic ? Logic and Fuzzy Logic Fuzzy sets Fuzzy logic operators Fuzzy logic controller
What is Fuzzy Logic ? General Control problem Fuzzy Logic Control e.g. Temperature Controller Set point = 25 Deg.C Controller rule If T>25.5 Deg.C then (turn heater off) If T<24.5 Deg.C then (turn heater on) Fuzzy Logic Control If (too hot) then (turn heater off) If (too cold) then (turn heater on)
Logic and Fuzzy Logic Logic - There are only two choices : 0 or 1, yes or no, right or wrong, etc. - and, or, nand, nor, not, xor Fuzzy logic - More choices between 0 and 1, yes and no, young and old, etc. e.g. a bit young, very young, not young at all... - fuzzy and, fuzzy or, fuzzy not
Fuzzy Sets Set of young people, A - A=[0,20] : age from 0 to 20 years old. - more than 20 years old = not young. Fuzzy set of young people - 0-20 years old = 100% young. - 21 years old = 90% young. - .... - 25 years old= 60% young. - 30 years old = 0% young
Fuzzy Sets (Example) Fuzzy set of young people - Young =1 - Not young=0 Young Not Young 10 20 30 40 50 1
Operations in Fuzzy Sets Fuzzy AND - 1 AND 0 = 0 - 1 AND 0.6=0.6 - 0.5 AND 0.7=0.5 a AND b = min(a,b) Fuzzy OR - 1 OR 0 = 1 - 1 OR 0.6=1 - 0.5 OR 0.7=0.7 a OR b = max(a,b) Fuzzy NOT - NOT 1 = 0 - NOT 0.6=0.4 - NOT 0.1 =0.9 NOT a = 1 - a
Fuzzy Logic Controller 𝐺 𝐶 𝑠 𝐺 𝑃 𝑠 𝐻𝑠 + _ Input Compensator Plant Output R(s) E(s) C(s) r(t) e(t) c(t) Sensor Input Compensator Plant Output R(s) + E(s) C(s) Fuzzy Logic Controller 𝐺 𝑃 𝑠 r(t) _ e(t) c(t) Sensor 𝐻𝑠
Fuzzy Logic Controller Fuzzifier Fuzzy Operations based on Fuzzy rule sets Defuzzifier Fuzzifier Combinations of AND, OR, NOT Defuzzifier LP MP S MN LN
Fuzzification - Fuzzifier Degree of membership : 0 ~ 1 Linguistic variables LN : Large Negative very cold MN : Medium Negative cold S : Small just fine MP : Medium Positive hot LP : Large Positive very hot Membership function Triangular, bell, trapezoidal, haversine, Gaussian, exponential Haversine : The function (1-cos(x))/2. It is written hav(x), and is equal to half the versine of x.
Membership Function - Triangular Input (error) membership Degree of LN MN S MP LP Set point cold hot
Membership Function - Triangular Member of Speed : {Slow, Moderate, Fast} Membership functions 0.5 1 Slow Moderate Fast 0.65 0.35 60 40 70 100 km/s Speed=60 km/s Degree of membership slow=0.35, moderate=0.65, fast=0.00
Fuzzy Rule Sets If LN then (turn heater on) If MN then (turn heater on) If S then (do nothing) If MP then (turn heater off) If LP then (turn heater off) If error LN then (turn heater on) If error MN then (turn heater on) If error S then (do nothing) If error MP then (turn heater off) If error LP then (turn heater off)
Combinations of AND, OR, NOT Fuzzy Logic Controller (Example) Temperature control Fuzzy rule sets Combinations of AND, OR, NOT Fuzzifier LP MP S MN LN Defuzzifier error slope heater
Fuzzy Rule Sets If error LN then (heater LP) If error MN AND slope LN then (heater LP) If error MN AND slope MN then (heater MP) If error MN AND slope S then (heater MP) If error MN AND slope MP then (heater MP) If error MN AND slope LP then (heater MP) If error S AND slope LN then (heater LP) If error S AND slope MN then (heater MP) If error S AND slope S then (heater S) If error S AND slope MP then (heater S) If error S AND slope LP then (heater S) If error MP then (heater S) If error LP then (heater S)
Fuzzy Rule Sets & Rule Matrix If error LN then (heater LP) If error MN AND slope LN then (heater LP) If error MN AND slope MN then (heater MP) If error MN AND slope S then (heater MP) If error MN AND slope MP then (heater MP) If error MN AND slope LP then (heater MP) If error S AND slope LN then (heater LP) If error S AND slope MN then (heater MP) If error S AND slope S then (heater S) If error S AND slope MP then (heater S) If error S AND slope LP then (heater S) If error MP then (heater S) If error LP then (heater S)
Fuzzy Inference MAX-MIN (Mamdani Fuzzy Rules) MAX-DOT or MAX-PRODUCT AVERAGING ROOT SUM SQUARE (RSS) Takagi-Sugeno Fuzzy Rules
Defuzzification - Defuzzifier Center of Area or Center of Mass or Centroid of Area Center of Gravity Method for Singletons Bisector of Area Mean of Maxima Leftmost Maxima and Rightmost Maxima
Fuzzy Logic Controller Design (Example) Water heating system Boiler TempSensor LevelSensor 10 125 ํC HeatKnob Water inlet Water outlet Steam exhaust
Combinations of AND, OR, NOT Fuzzy Logic Controller Design (Example) 1. Define inputs and outputs for Fuzzy Logic Controller and Fuzzy Variables. Fuzzy rule sets Combinations of AND, OR, NOT Fuzzifier XL L M S XS Defuzzifier F Level [0,10] Temp [0, 125] Heatknob
Fuzzy Logic Controller Design (Example) 2. Assign Membership Values to Fuzzy Variables. 0.5 1 XS S M L XL 10 20 30 40 50 60 70 80 90 100 110 120 Temp
Fuzzy Logic Controller Design (Example) 2. Assign Membership Values to Fuzzy Variables. 0.5 1 XS S M L XL 1 2 3 4 5 6 7 8 9 10 Level
Fuzzy Logic Controller Design (Example) 2. Assign Membership Values to Fuzzy Variables. 0.5 1 XS S F M L 1 2 3 4 5 6 7 8 9 10 HeatKnob
Fuzzy Logic Controller Design (Example) 3. Create a Rule Base and Decision Table. IF Temp is Small and Level is Medium THEN set HeatKnob to Medium. IF Temp is VerySmall and Level is Large THEN set HeatKnob to Large.
Fuzzy Logic Controller Design (Example) 4. Fuzzify inputs to FLC and Determine which Rules Fire. Temp = 65 ˚ C and Level =6.5 Temp {M} = 0.45 and Temp {L} = 0.28 Level {M} =0.25 and Level {L} = 0.38
Fuzzy Logic Controller Design (Example) 5. Infer the Output Recommended by Each Rule. Temp = 65 ˚ C and Level =6.5 Temp {M} = 0.45 and Temp {L} = 0.28 Level {M} =0.25 and Level {L} = 0.38
Fuzzy Logic Controller Design (Example) 5. Infer the Output Recommended by Each Rule. 0.5 1 XS S F M L 1 2 3 4 5 6 7 8 9 10 HeatKnob
Fuzzy Logic Controller Design (Example) 6. Defuzzify the Aggregated Fuzzy Set to form a Crisp Output. 0.5 1 XS S F M L 1 2 3 4 5 6 7 8 9 10 HeatKnob 4.66
Fuzzy Logic Controller Design (Example) 7. Implement the Designed Controller. Implement as Hardware Implement as Software
Fuzzy Logic Controller Design (Example) Desgin ABS Control Crane Control AC Room Temperature Control