Fuzzy Logics Presentation

Embed Size (px)

Citation preview

  • 8/13/2019 Fuzzy Logics Presentation

    1/33

    Introduction toIntroduction to

    Fuzzy LogicFuzzy Logic

    Created by Eli Hait to help people in understanding Fuzzy Logic principle, methodology and possible applicationsCreated by Eli Hait to help people in understanding Fuzzy Logic principle, methodology and possible applications

    Contact: 0525!0"#$#Contact: 0525!0"#$#

  • 8/13/2019 Fuzzy Logics Presentation

    2/33

    INTRODUCTIONINTRODUCTION

  • 8/13/2019 Fuzzy Logics Presentation

    3/33

    Eastern Culture VS WesternEastern Culture VS WesternBuddha, who lived in India about 500 BC founded areligion called Buddhism. His philosophy was basedon the thought that the world is filled withcontradictions, that almost everything containssome of its opposite, or in other words, that things

    can be A and notA at the same time. Here we cansee a clear connection between Buddha!sphilosophy and modern fu""y logic.

    About #00 years later, the $ree% scholar Aristotledeveloped binary logic. In contrary to Buddha,

    Aristotle thought that the world was made up ofopposites, for e&ample male versus female, hotversus cold, dry versus wet, active versus passive.'verything has to be A or notA, it can!t be both.

  • 8/13/2019 Fuzzy Logics Presentation

    4/33

    Eastern Culture VS WesternEastern Culture VS Western(ver the centuries, these two philosophies developed and spreadindependently. Buddhism e&panded as the religion of India andsurrounding states. Aristotle!s logic, however, was accepted by the$ree% scholars and later got spread all over 'urope.

    Aristotle!s binary logic became the base of science) if somethinggot proven with logic, it was and still is accepted as scientificallycorrect.

  • 8/13/2019 Fuzzy Logics Presentation

    5/33

    *he concept of +u""y ogic -+ was first conceived by otfi /adeh, aprofessor at the niversity of California at Ber%ley, and presented not asa control methodology, but as a way of processing data by allowingpartial set membership rather than crisp set membership or nonmembership.

    Brief history of FLBrief history of FL The BeginningThe Beginning

    *his approach to set theory was not applied to control systems until the10!s due to insufficient smallcomputer capability prior to that time.nfortunately, .2. manufacturers have not been so 3uic% to embrace thistechnology while the 'uropeans and 4apanese have been aggressivelybuilding real products around it.

    rofessor /adeh reasoned that people do not re3uireprecise, numerical information input, and yet they arecapable of highly adaptive control. If feedbac%controllers could be programmed to accept noisy,imprecise input, they would be much more effective andperhaps easier to implement.

  • 8/13/2019 Fuzzy Logics Presentation

    6/33

    In the year 6781, the first subway system was built which wor%ed with a

    fu""y logicbased automatic train operation control system in 4apan. Itwas a big success and resulted in a fu""y boom.

    +or a long time, a lot of 9estern scientists have been reluctant to usefu""y logic because they felt that it threatened the integrity of scientificthought. *he term :fu""y; also didn;t helped to spread the new approach.

    *oday, +u""y ogic concept used widely in many implementations li%eautomobile engine < automatic gear control systems, air conditioners,automatic focus control, video enhancement in *= sets, washing

    machines, behaviourbased mobile robots, sorting and handling data,Information 2ystems ->B?2, Info. @etrieval, attern @ecognition-Image rocessing, ?achine =ision, motion control systems, decisionsupport -Adaptive H?I, 2ensor +usion, traffic control systems andmany, many others.

    Brief history of FLBrief history of FL The OutbreaThe Outbrea

  • 8/13/2019 Fuzzy Logics Presentation

    7/33

    So! "hat is all about#So! "hat is all about#+u""y logic ma%es use of human common sense. It lets novices buildcontrol systems that wor% in places where even the bestmathematicians and engineers, using conventional approaches tocontrol, cannot define and solve the problem.

    +u""y ogic approach is mostly useful in solving cases where nodeterministic algorithm available or it is simply too difficult to defineor to implement, while some intuitive %nowledge about the behaviouris present.

    *he initial motivation for that was create a methodology to dealwithissues which can;t be answered ust by *@' or +A2' li%e Howmany grains of sand ma%e up a pile

  • 8/13/2019 Fuzzy Logics Presentation

    8/33

    So! "hat is all about#So! "hat is all about#FL incorporates a simple, rule-based IF X AND Y THEN Z approach to asolin! control problem rather than attemptin! to model a s"stemmathematicall"# The FL model is empiricall"-based, rel"in! on an operator$se%perience rather than their technical understandin! o& the s"stem# Fore%ample, rather than dealin! 'ith temperature control in terms such as(

    )*+ ..F), )T /0...F), or )10.2 /TE3+ /11.2),)*+ ..F), )T /0...F), or )10.2 /TE3+ /11.2),The terms used are li4e(

    )IF 5process is too cool6 AND 5process is !ettin! colder6

    THEN 5add heat to the process6)

    or(

    )IF 5process is too hot6 AND 5process is heatin! rapidl"6

    THEN 5cool the process 7uic4l"6)#

    These terms are imprecise and "et er" descriptie o& 'hat must actuall"happen#

  • 8/13/2019 Fuzzy Logics Presentation

    9/33

    So! "hat is all about#So! "hat is all about#

    + re3uires some numerical parameters in order to operate such aswhat is considered significant error and significant rateofchangeoferror, but e&act values of these numbers are usually not critical unlessvery responsive performance is re3uired in which case empirical

    tuning would determine them.$enerally, + is so forgiving that the system will probably wor% thefirst time without any twea%ing.

  • 8/13/2019 Fuzzy Logics Presentation

    10/33

    FL is a better alternati$e to linear %ontrolFL is a better alternati$e to linear %ontrol

    A linear appro&imation techni3ue is relatively simple, however it tends to

    limit control performance and may be costly to implement.iecewise linear techni3ue wor%s better, although it is tedious toimplement because it often re3uires the design of several linear controllers.

    A loo%up table techni3ue may help improve control performance, but it isdifficult to debug and tune. +urthermore in comple& systems where multipleinputs e&ist, a loo%up table becomes impractical due to its large memoryre3uirements

    ?ost real life physical systems are actually nonlinear systems. Conventionaldesign approaches use different appro&imation methods to handle nonlinearity. 2ome typical choices are, linear, piecewise linear, and loo%up tableappro&imations to trade off factors of comple&ity, cost, and systemperformance

    +u""y logic provides an alternative solution to nonlinear control because it iscloser to the real world. Donlinearity is handled by rules, membershipfunctions, and the inference process which results in improved performance,simpler implementation, and reduced design costs.

  • 8/13/2019 Fuzzy Logics Presentation

    11/33

    &BOUT FU''( LO)IC&BOUT FU''( LO)IC

  • 8/13/2019 Fuzzy Logics Presentation

    12/33

    Crisp logic needs harddecisions. i%e in this chart. Inthis e&ample, anyone lower than615 cm considered as short, andbehind 615 considered as high.

    2omeone whose height is 680 ispart of *A group, e&actly li%esomeone whose height is 670

    +u""y ogic deals with Emembership in groupF functions. In thise&ample, someone whose height is 680, is a member in both groups.

    2ince his membership in group of *A is 0.5 while in group of 2H(@*only 0.6, it may be seen that he is much more *A than 2H(@*.

    Cris* Set $s Fu++y SetCris* Set $s Fu++y Set

  • 8/13/2019 Fuzzy Logics Presentation

    13/33

    Cris* Set $s Fu++y SetCris* Set $s Fu++y Set

    Another way to loo% at the fu""y Emembership in groupFG each circlerepresents a group. As closer to center to particular circle -group,the membership in that group is EstrongerF.

    In this e&ample, a valid value may be member of $roup 6, $roup #,both or neither.

  • 8/13/2019 Fuzzy Logics Presentation

    14/33

    Fu++y O*erationsFu++y O*erations

    Crisp logic is a subset of+u""y ogic

  • 8/13/2019 Fuzzy Logics Presentation

    15/33

    FU''( LO)IC CONTROL S(STE, DESI)NFU''( LO)IC CONTROL S(STE, DESI)N

  • 8/13/2019 Fuzzy Logics Presentation

    16/33

    *he first step in implementing + is to decide e&actly what is to becontrolled and how. +or e&ample, suppose we want to design a simpleproportional temperature controller with an electric heating element anda variablespeed cooling fan. A positive signal output calls for 0600percent heat while a negative signal output calls for 0600 percentcooling. Control is achieved through proper balance and control ofthese two active devicesG

    Starting the *ro%ess-Starting the *ro%ess-

  • 8/13/2019 Fuzzy Logics Presentation

    17/33

    Starting the *ro%essStarting the *ro%ess ./0./0It is necessary to establish a meaningful system for representing thelinguistic variables in the matri&. +or this e&ample, the following will beusedG

    D negative error or errordot input level

    / "ero error or errordot input level

    positive error or errordot input level H Heat output response

    ED Do Change to current output

    CE Cool output response

    >efine the minimum number of possible input product combinationsand corresponding output response conclusions using these terms. +ora threebythree matri& with heating and cooling output responses, allnine rules will need to be defined. *he conclusions to the rules with thelinguistic variables associated with the output response for each ruleare transferred to the matri&.

  • 8/13/2019 Fuzzy Logics Presentation

    18/33

    Ty*i%al %ontrol syste1 res*onseTy*i%al %ontrol syste1 res*onse*he figure shows what command and error loo% li%e in a typical controlsystem relative to the command setpoint as the system hunts for stability.

    *he steps are mandatory for each control functionG

    6. Current 2tatus Ac3uirement#. Current 2tatus vs 2etpoint

    -@e3uired 2tatusrocessing

    . @evealing the Control@esponse -CorrectiveAction.

  • 8/13/2019 Fuzzy Logics Presentation

    19/33

    FL Control Syste1 in 2 ste*s-FL Control Syste1 in 2 ste*s-

    +u""ificationG converting the crisp inputs to membership functionswhich comply to intuitive perception of system status.

    @ules rocessingG calculating the response from system status inputs

    according to the predefined rules matri& -control algorythmimplementation.

    >e+u""ificationG converting the @ules rocessing results to crispoutputJs to feed into the control devices.

    *ypical +u""y ogic control implementation involving stepsG

  • 8/13/2019 Fuzzy Logics Presentation

    20/33

    Fu++yfi%ation- ,e1bershi* Fun%tionsFu++yfi%ation- ,e1bershi* Fun%tions*he membership function is a graphical representation of the magnitudeof participation of each input. It associates a weighting with each of theinputs that are processed, define functional overlap between inputs, andultimately determines an output response.

    Bell, trape"oidal, haversine and, e&ponential shapes may be used but thetriangular shape is common, good enough in most of cases and e&tremely

    simple and cheap to implement by H9 or 29.

  • 8/13/2019 Fuzzy Logics Presentation

    21/33

    *he degree of membership ->(? is determined by plugging the selectedinput parameter -error or errordot into the hori"ontal a&is and proectingvertically to the upper boundary of the membership function-s.

    ,e1bershi* Fun%tions,e1bershi* Fun%tions .e3a1*le 4esign0.e3a1*le 4esign0

    '&ampleG consider an error of 6.0 and an errordot of K#.5. *hedegree of membership would beG

    L 'rror 6.5 M Degative0.1 /ero0.#5 ositive0

    L 'rrdot K# M Degative0 /ero0.N ositive0.

    .

  • 8/13/2019 Fuzzy Logics Presentation

    22/33

    Rules E$aluationRules E$aluation

    *he @ule ?atri& summari"e the %nowledge about how the controloutput should behave in response to relevant inputs. It is a matri&presentation of e&pected behavior of control -algorithm implementation.

    *he minimum si"e for practical @? is & -7 rules, but so small matrics

    can represent only very simple system behavior. sually, the @?;s aremuch more complicated.

    9hen more than one control outputs needed or the number of inputs toeach table, it may be splitted into few different tables.

    *he 3uality of the whole control function depends on precision andcoverage of the rule matri&.

  • 8/13/2019 Fuzzy Logics Presentation

    23/33

    *he rules use the input membership values as weighting factors todetermine their influence on the fu""y output sets of the final outputconclusion.

    The Rule ,atri3The Rule ,atri3 .e3a1*le 4esign0.e3a1*le 4esign0

    6. I+ 'rrorD and 'rrordotD then (utputH

    #. I+ 'rror/ and 'rrordotD then (utputH

    . I+ 'rror and 'rrordotD then (utputCO. I+ 'rrorD and 'rrordot/ then (utputH

    5. I+ 'rror/ and 'rrordot/ then (utputD

    N. I+ 'rror and 'rrordot/ then (utputC

    1. I+ 'rrorD and 'rrordot then (utputC

    8. I+ 'rror/ and 'rrordot then (utputC

    7. I+ 'rror and 'rrordot then (utputC

    Dote that the AD> functionis Efu""y AD>F, i.e. the resultis ?ID function between theinputs.

    *he following table describesthe basic behavior oftemperature control system.>ecide appropriate outputresponse conclusions, andload these into the rule matri&.

    *he same 7 rules representedin linguistic termsG

  • 8/13/2019 Fuzzy Logics Presentation

    24/33

    In our e&ample, when the fu""y inputs are 'rr6.5 and 'rrdotK#, themembership function -fu""ification result isG'rror 6.5 M D0.1 /0.#5 0

    'rrdot K# M D 0 /0.N 0.

    Dow we calculate the strength for each rule by selecting the ?ID value of eachof the variables contained in its AD> functionG

    N. I+ 'rrorD and 'rrordotD then (utputH M 2trength minP0.1, 0Q 0

    1. I+ 'rror/ and 'rrordotD then (utputH M 2trength minP0.#5, 0Q 0

    8. I+ 'rror and 'rrordotD then (utputC M 2trength minP0, 0Q 0

    7. I+ 'rrorD and 'rrordot/ then (utputH M 2trength minP0.1, 0.NQ 0.N Heat

    60. I+ 'rror/ and 'rrordot/ then (utputD M 2trength minP0.#5, 0.NQ 0.#5 Dothing

    66. I+ 'rror and 'rrordot/ then (utputC M 2trength minP0, 0.NQ 06#. I+ 'rrorD and 'rrordot then (utputC M 2trength minP0.1, 0.Q 0. Cool

    6. I+ 'rror/ and 'rrordot then (utputC M 2trength minP0.#5, 0.Q 0.#5 Cool

    6O. I+ 'rror and 'rrordot then (utputC M 2trength minP0, 0.Q 0

    Rule strength e$aluationRule strength e$aluation

    Dote that only rules O,5,1 and 8 get strength higher than 0, only theserules would EfireF the output.

  • 8/13/2019 Fuzzy Logics Presentation

    25/33

    ,erging the rules strengths,erging the rules strengths

    But there might also be few rules producing different strengthvalues for the same conclusion -li%e rules R1 and R8 in thee&ample, so a single cumulative strength value should beevaluated before defu""ification -composition.

    In some cases, the +u""y (@ function may be used -select thema&imum strength output for each conclusion, but the mostcommon and precise method used called @22 S @oot 2um23uare.

    As could be seen in the e&ample,different fu""y rules might have differentconclusions. *o consider all rules the(utput ?embership +unction should beinvolved, and somehow the compositeconclusion should be evaluated from this

    membership function according toEconclusion driving rules strengthsF

  • 8/13/2019 Fuzzy Logics Presentation

    26/33

    *he @22 ?ethod defined asG TTTTTTTTTTTTTTTTTTTTTTT

    U -@6# K @##K @#K V K @n#

    9here @6, @#, @V. @n are strength values of different ruleswhich share the same conclusion.

    ,erging the rules strengths,erging the rules strengths.RSS 1etho40.RSS 1etho40

    In our e&ample, the cumulative strengths calculated as followsG

    2H'A* U 0.N# 0.N

    2D(*HID$ U 0.#5# 0.#5

    2C(( U -0.#K 0.#5# U -0.07 K 0.0N#5 0.7

    *hese values would be applied to the output membershipfunction for composition.

  • 8/13/2019 Fuzzy Logics Presentation

    27/33

    Defu++ifi%ation 1etho4s5Defu++ifi%ation 1etho4s5

    Combines all fu""y conclusions obtained by inference into a singleconclusion. 2ince different fu""y rules might have different conclusions,consider all rules.

    (nce the functions are inferred, scaled, and combined, they should bedefu""ified into a crisp output which drives the system.

    *here are few methods of >efu""ication, but all of them apply the E@ules

    Cumulative 2trengthF values on the E(utput ?embership +unctionF.

    +or e&ample, output membershipfunction for the e&ample may besomething li%e this

    *he cumulative strengths calculatedin the e&ample areG

    2H'A*0.N 2D(*HID$0.#5 2C((0.7

  • 8/13/2019 Fuzzy Logics Presentation

    28/33

    'ach response membership graph is clipped to calculated strength value,then fu""y (@ applied and finally the ECenter (f $ravityF point is calculatedfor the cumulative polygon. *he W a&is value of the C($ point is the crispcontrol output to drive the system,

    Defu++ifi%ationDefu++ifi%ation Fu++y Centroi4 &lgorith1Fu++y Centroi4 &lgorith1

    +or our e&ample, the crisp output

    calculation as followsG

    CcoolX2coolK CnoopX2noopK CheatX2heat

    2coolK 2noopK 2heat

    9here C is for EcentroidF, i.e. ma&imumvalue.

    -600X0.7 K 0X0.#5 K 600X0.N J -0.7K0.#5K0.N K#8.##N

    (utput

  • 8/13/2019 Fuzzy Logics Presentation

    29/33

    2caling the output membership graph instead of clipping is little bit moreprecise because when clipping the membership function some information islost.

    Defu++ifi%ationDefu++ifi%ation s%aling instea4 of %li**ings%aling instea4 of %li**ing

    However, the scaling method involvesmuch more and comple& arithmetic

    calculations while the precisionbenefits are negligible.

    In most implementations the clippingmethod is preferred for practical use.

  • 8/13/2019 Fuzzy Logics Presentation

    30/33

    >ifferent %ind of tools for implementation, simulation and visuali"ation of+u""y ogic designs been created. *he most common to this moment areG

    Design Tools for Fl i1*le1entationDesign Tools for Fl i1*le1entation

    ?ath9or%s +u""y ogic *oolbo& for ?A*AB

    fu""y*'CH %ernels for embedded microcontrollers, >2;s < C.2peciali"ed + design environment tools integrated into uC ande&pert design tools.

    Analog fu""y >esign tools and tool%its

  • 8/13/2019 Fuzzy Logics Presentation

    31/33

    TUNNING THE FL CONTROL SYSTEMTUNNING THE FL CONTROL SYSTEM

  • 8/13/2019 Fuzzy Logics Presentation

    32/33

    Tuning the FL %ontrol fun%tionTuning the FL %ontrol fun%tion*he simple graphical and intuitive representation of membershipfunctions allows simple and intuitive tuning of + control functionwhile it wor%s.

    *he rules usually represent the hard system response while themembership functions affect on when and how strong the reaction

    would be.*he tuning and adaptation of + control function usually performedby changing the shape parameters of membership curves and theoverlap between them.

    *he tuning functionality may be made in the development stage or tobe inherently assimilated in the design to perform automotive

    adaptation during operation.

  • 8/13/2019 Fuzzy Logics Presentation

    33/33

    Tuning the FL %ontrol fun%tionTuning the FL %ontrol fun%tion*he Control behavior erformance 'valuation module may be a DeuralDetwor% function or a human operator.

    *his functionality may be temporary -only while the system is in tuningor ElearningF phase or permanent -in adaptive control systems.