FT5

March 29, 2018 | Author: drthuhan | Category: Fuzzy Logic, Logic, Applied Mathematics, Cybernetics, Physics & Mathematics


Comments



Description

5.Fuzzy Logic • Introduced by Lotfi Zadeh, UC Berkeley • Process data allowed partial set membership instead of “crisp membership” • Deals with noisy, imprecise,vague, ambiguous data • Higher reliability • “People also do not require precise numerical input” • These slides are based on “Fuzzy Logic Tutorial” by Encoder Newsletter of the Seattle Robotics Society Bräunl 2003 1 Fuzzy Logic • Empirical model • Simple rule-based approach: IF x THEN y Here no numbers but fuzzy set memberships, e.g.: IF (temp is too_cool) AND (time is progressed) THEN (cool fast) • • • • Imprecise, but descriptive Mimic human control logic Robust, requires little tuning Can model non-linear systems that are mathematically very difficult (or impossible) to model 2 Bräunl 2003 5.1 Fuzzy Logic Guide • Consider inputs, outputs, system control, failure modes • Determine input/output relationships • Use minimum number of input variables, e.g. – error (control difference) – change-of-error (error derivative) Fuzzy Logic Example Fuzzy logic temperature control of a physical process Heater Cooler • Set up system as a number of IF-THEN rules • Create membership functions, giving meaning to input/output terms • Create pre-/post-processing terms • Test system, evaluate, tune, and test again Bräunl 2003 3 Target temp. Fuzzy Logic Physical Process Feedback temperature Bräunl 2003 source: Encoder, Seattle Robotics Soc. 4 7 Bräunl 2003 Bräunl 2003 . zero (Z).2 Linguistic Rules Set up linguistic rules: IF-THEN (antecedent and consequent blocks) Example: IF too_hot AND getting_hotter THEN cool Linguistic Rules 1. 9. zero (Z). zero. “–” = do nothing. or “do nothing” Error = target – feedback (P = too cold. 5. negative (N) heat (H). Z = just right. 3. cool (C) • • • • Target input: Error feedback: Error-dot feedback: Fuzzy logic output: temperature negative. 6. 4. output = C IF too_hot AND getting_colder THEN ?? IF just_right AND getting_colder THEN ?? IF too_cold AND getting_colder THEN ?? IF too_hot AND no_change THEN ?? IF just_right AND no_change THEN ?? IF too_cold AND no_change THEN ?? IF too_hot AND getting_hotter THEN ?? IF just_right AND getting_hotter THEN ?? IF too_ cold AND getting_hotter THEN ?? 8 target-feedback=N d(target-feedback)/dt=N 7. N = getting hotter) Output H = activate heater. N = too hot) ErrorDot = d Error / dt (P = getting colder. C = activate cooler 5 Bräunl 2003 6 Bräunl 2003 5. do_nothing (–). positive negative. Z = no change. zero. 8. positive heat. negative (N) “error-dot”: positive (P). 2.Fuzzy Logic Example Fuzzy Logic Heater Cooler Physical Process Linguistic Variables Introduction of linguistic variables: • Input 1: • Input 2: • Output: “error”: positive (P). cool. 4. 3. cool IF too_hot AND getting_colder THEN IF just_right AND getting_colder THEN heat IF too_cold AND getting_colder THEN heat IF too_hot AND no_change THEN IF just_right AND no_change THEN IF too_cold AND no_change THEN cool do_nothing heat Rule Matrix Build rule matrix from linguistic rules too cold getting colder no change getting hotter cool cool cool just right heat do nothing cool too hot heat heat heat cool IF too_hot AND getting_hotter THEN IF just_right AND getting_hotter THEN cool IF too_ cold AND getting_hotter THEN heat 9 Bräunl 2003 Bräunl 2003 source: Encoder. 5. 8..3 Membership Functions • Membership function is a graphical representation of “magnitude of participation” of each input • Associates weighting with each input • Defines overlaps between inputs • Determines output response • Fuzzification: • Defuzzification: Translating input values to fuzzy set memberships Translating fuzzy output back to crisp system output (e.Linguistic Rules 1. 2. 10 5. 7. 6. 9. a number) 11 Membership Functions • Shape of membership function is usually triangle (but could also be trapezoidal or other) • Height usually normalized to 1 (so in total: [0. Seattle Robotics Soc.1]) • Width of the base of function depends on number of functions • Shouldering is used to lock height in an outer function (leftmost and rightmost functions evaluate to 1 to the outsides) • Center points of functions evaluate to 1 • Overlap is usually 50% at base of function Bräunl 2003 Bräunl 2003 12 .g. here: for error (temperature difference in deg.5 h&r 0.0 -10 -5 0 nc & gc +5 +10 Error_dot in degrees Celsius / minute 16 Bräunl 2003 Bräunl 2003 .0 Membership Functions • Add values.0 -4 -2 0 r&c +2 +4 Error in degrees Celsius 15 gh & nc 0. Celsius) 1. Celsius / minute) 1.5 0. here for error_dot (temperature change in deg.0 Degree of Membership too hot (shoulder) too hot just right too cold too cold (shoulder) Degree of Membership getting hotter (shoulder) getting hotter no change getting colder getting colder (shoulder) 0.Membership Functions Membership Functions • Add shoulders too hot (shoulder) height too cold (shoulder) too hot just right too cold too hot just right too cold h&r r&c width Bräunl 2003 13 Bräunl 2003 14 Membership Functions • Add values. 0 Degree of Membership 0. false or 1.0 = 1.Membership Functions Degree of Membership 1. 0) • Now we have continuous membership values [0.0 • Different value range for different input variables (e.0 = 0.5 = 0.1] • Build logical sums using membership values in combination with rule matrix • Use minimum of all antecedent values (AND-part) for output Bräunl 2003 19 Bräunl 2003 20 .0 0.0 Example • Error = –1 ⇒ Membership(too_hot) ⇒ Membership(just_right) ⇒ Membership(too_cold) Bräunl 2003 = 0. error and error_dot) • Membership values (antecedents) are evaluated for the produced conclusion (consequent) 5.4 Inferences • Deviation from Boolean logic (true.0 17 Example • Error = +5 ⇒ Membership(too_hot) ⇒ Membership(just_right) ⇒ Membership(too_cold) Bräunl 2003 = 0.g.0 18 Membership Functions Note • Sum of all membership values for a certain input value is always 1.5 too hot just right too cold h&r -4 -2 0 r&c +2 +4 Error in degrees Celsius Membership Functions 1..5 too hot just right too cold h&r -4 -2 0 r&c +2 +4 Error in degrees Celsius 0.5 = 0.0 0. IF too_hot AND getting_colder THEN cool IF just_right AND getting_ colder THEN heat IF too_cold AND getting_ colder THEN heat IF too_hot AND no_change THEN cool 0. getting_colder = 0.0 • • too_hot = 0.5.0 Membership error_dot getting_hotter = 0.0 0.5 = 0.5.5.5 IF too_cold AND no_change THEN heat IF too_hot AND getting_hotter THEN cool IF just_right AND getting_hotter THEN cool IF too_ cold AND getting_hotter THEN heat 0. 4.5.5 = 0.5 & 0.0 IF too_hot AND getting_hotter THEN cool IF just_right AND getting_hotter THEN cool IF too_ cold AND getting_hotter THEN heat 0.5.0 getting_hotter = 0. no_change = 0. 3.5 & 0.5 IF just_right AND no_change THEN do_nothing 0. 6.5. 8.5 IF just_right AND no_change THEN do_nothing 0.5 0.5 = 0.5. too_cold = 0.5 Inferences • • too_hot = 0. 6.0 = 0. just_right = 0. 9. 8.0 getting_hotter = 0.Inferences Example: error error_dot = –1 = –2.5 & 0.5 & 0.5.5 & 0. 8. 4.0 & 0.5.5.5.5 = 0.0 0. no_change = 0. 9. 4.5 = 0. getting_colder = 0. 5. 21 IF too_hot AND getting_colder THEN cool IF just_right AND getting_ colder THEN heat IF too_cold AND getting_ colder THEN heat IF too_hot AND no_change THEN cool IF just_right AND no_change THEN do_nothing IF too_cold AND no_change THEN heat IF too_hot AND getting_hotter THEN cool IF just_right AND getting_hotter THEN cool IF too_ cold AND getting_hotter THEN heat 22 Membership error: too_hot = 0.5 24 IF too_hot AND no_change THEN cool 0.5 = 0.0 = 0. just_right = 0.0 23 Bräunl 2003 Bräunl 2003 . just_right = 0. 3.0 Bräunl 2003 Bräunl 2003 Inferences • • too_hot = 0.5 & 0.5 = 0. 2.0 Inferences use minimum 0.5. 9.5.0 getting_hotter = 0.5 & 0.5 0. getting_colder = 0.5 0.0 = 0.5. 6. 7.5 use minimum 1. 2. no_change = 0.5 & 0.0 & 0. too_cold = 0. too_cold = 0.0 & 0. IF too_hot AND getting_colder THEN cool IF just_right AND getting_ colder THEN heat IF too_cold AND getting_ colder THEN heat 1. 5. 2.5 IF too_cold AND no_change THEN heat 0. getting_colder = 0.5 = 0.5 = 0. 7. 5. 3.0 1.5 = 0. 7.5 & 0. no_change = 0. too_cold = 0. just_right = 0.0.5.5 & 0. 3.5 IF just_right AND no_change THEN do_nothing 0.75 = 0. Note: This method prodruces a smooth. 6.52 +0.866 Bräunl 2003 28 .52) = √0. Note: This method gives a good weighted influence to all firing rules. continuous output combining all active rules Bräunl 2003 26 Bräunl 2003 Output Combination AVERAGING • Each function is clipped at the average value and the fuzzy centroid of the composite area is computer Note: This method does not give increased weight if multiple rules generate the same output member! ROOT-SUM-SQUARE • Combination of several approaches: Scale functions to respective magnitudes with root of sum of squares. Bräunl 2003 27 Output Combination 1.5 0 Output membership functions: “cool” = √(rule12 + rule42 + rule72 + rule82 ) = √(0 + 0. 5.5 IF too_cold AND no_change THEN heat 0 IF too_hot AND getting_hotter THEN cool IF just_right AND getting_hotter THEN cool IF too_ cold AND getting_hotter THEN heat 0. 8.52 + 0. 2. 9. 4. IF too_hot AND getting_colder THEN cool IF just_right AND getting_ colder THEN heat IF too_cold AND getting_ colder THEN heat 0 0 0 IF too_hot AND no_change THEN cool 0. take the horizontal coordinate of the fuzzy centroid of the composite area as output. 7.5 Output Combination • Find out “firing strength” of each rule • Combine logical outputs for each rule must be combined before defuzzification • Combining rule outputs – – – – MAX-MIN MAX-DOT (MAX-PRODUCT) AVERAGING ROOT-SUM-SQUARE 25 Output Combination MAX-MIN • Test magnitude of all rules – select highest one Use horizontal coordinate of “fuzzy centroid” as output Note: This method does not combine individual results! MAX-DOT • Scale each member function to fit under its peak value. This shrinks all member functions to their peaks equal the magnitude of the respective function. compute fuzzy centroid of composite area.5.5 0. 8.5 0.-1 cooling.5 IF too_cold AND no_change THEN heat 0 IF too_hot AND getting_hotter THEN cool IF just_right AND getting_hotter THEN cool IF too_ cold AND getting_hotter THEN heat 0. IF too_hot AND getting_colder THEN cool IF just_right AND getting_ colder THEN heat IF too_cold AND getting_ colder THEN heat 0 0 0 IF too_hot AND no_change THEN cool 0.5 0. 5. 3. 6.5 IF just_right AND no_change THEN do_nothing 0.5 Bräunl 2003 29 Output membership functions: “heat” = √(rule22 + rule32 + rule62 + rule92) = √(0 + 0 + 0 + 0) = 0.0 Bräunl 2003 30 5.5 IF just_right AND no_change THEN do_nothing 0.Output Combination 1. +1.0 -100 -50 0 n&h +50 +100 Percent output (-100. 4. Defuzzification of combined results of inference process Result will be a crisp (numeric) output Calculation of “fuzzy centroid”: Multiply the weighted strength of each output member function by the respective member function center points Add these values Divide area by the sum of the weighted member function strength Defuzzification • Output Membership Function (action to be taken) cool Degree of Membership 1.0 do_nothing heat 0. 3.5 IF too_cold AND no_change THEN heat 0 IF too_hot AND getting_hotter THEN cool IF just_right AND getting_hotter THEN cool IF too_ cold AND getting_hotter THEN heat 0. 8. 2. 6... 9. 4.5 c&n 0. 2. 7.6 Defuzzification • • • 1. 2. 7.+100 heating) 32 Bräunl 2003 31 Bräunl 2003 . IF too_hot AND getting_colder THEN cool IF just_right AND getting_ colder THEN heat IF too_cold AND getting_ colder THEN heat 0 0 0 IF too_hot AND no_change THEN cool 0. 5. 9. 3.5 0 Output Combination 1.52) = 0.5 0 Output membership functions: “do_nothing” = √(rule52) = √(0. .5 heat = 0. +1. +1.4% Output = ∑ (center ⋅ strength ) i =1 i i N “Moment” N is number of output members (here: 3) ∑ strengthi i =1 N Bräunl 2003 35 Bräunl 2003 36 .866 do_nothing = 0.5 heat = 0.87 Combined rule results cool = 0.87 Combined rule results cool = 0..+100 heating) 34 0.-1 cooling.-1 cooling.Defuzzification • Output Membership Function (action to be taken) cool Degree of Membership 1.0 do_nothing heat 0.0 do_nothing heat Defuzzification • Output Membership Function (action to be taken) cool Degree of Membership 1.5 Calculate fuzzy centroid 0.5 Defuzzification • How to calculate centroid – graphically: intuitively – numerically: see formula below • Output: – activate cooling at 63.866 do_nothing = 0.4 0 +50 +100 Percent output (-100.0 0.0 0.0 -100 Bräunl 2003 -50 0 +50 +100 Percent output (-100.+100 heating) 33 Bräunl 2003 Defuzzification • Input: – error = –1 – error_dot = –2..5 0..0 -100 -50 -63. 0 0.866 + 0 ⋅ 0.87 1. low_pos.4 0.5 with shoulders: 1.0 0.87 Defuzzification 0.1. low_neg.0 -100 -50 0 +50 +100 -50 0 +50 +100 0.5 + 100 ⋅ 0 = −63.0 0.866 + 0.0 0.4% 0.0 0.0 -100 -50 0 +50 +100 37 Bräunl 2003 38 ∑ strength i =1 N i 5.5 0.0 -100 Output = without shoulders: simple formula Output = Bräunl 2003 ∑ (center ⋅ strength ) i =1 i i N Result: Activate cooling at 63.87 -50 0 +50 +100 0.0 -100 0.87 Defuzzification 1.g. positive → additional rules 5.7 Tuning Tuning of a fuzzy system can be accomplished by: • Changing rule antecedents • Changing rule conclusions • Changing centers of the input/output membership functions • Adding additional membership functions e.5 adjust formula by moving centers Output = centercool ⋅ strengthcool + centernothing ⋅ strengthnothing + centerheat ⋅ strengthheat strengthcool + strengthnothing + strengthheat − 100 ⋅ 0.5 + 0. zero. negative.5 0.8 Applications Fuzzy control can be applied to a number of control problems for example: • Motor control • Driving • Balancing • Walking • … Bräunl 2003 40 Bräunl 2003 39 .
Copyright © 2024 DOKUMEN.SITE Inc.