Transcription of Fuzzy Logic Controller
1 Fuzzy Logic ControllerDebasis SamantaIIT Samanta(IIT Kharagpur)Soft Computing / 34 Applications of Fuzzy LogicDebasis Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy Systems : Fuzzy Logic ControllerConcept of Fuzzy theory can be applied in many applications, suchas Fuzzy reasoning, Fuzzy clustering, Fuzzy programming of all these applications, Fuzzy reasoning, also called fuzzylogic Controller (FLC) is an important Logic controllers are special expert systems. In general, aFLC employs a knowledge base expressed in terms of a fuzzyinference rules and a Fuzzy inference engine to solve a use FLC where an exact mathematical formulation of theproblem is not possible or very difficulties are due to non-linearities, time-varying nature ofthe process, large unpredictable environment disturbances Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy Systems : Fuzzy Logic ControllerA general scheme of a Fuzzy Controller is shown in the following rule baseFuzzy inference engineDefuzzification moduleFuzzification moduleProcess to be controlledInputOutputactionsConditionsFu zzy ControllerFigure 1 Debasis Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy Systems : Fuzzy Logic ControllerA general Fuzzy Controller consists of four modules.
2 1a Fuzzy rule base,2a Fuzzy inference engine,3a fuzzification module, and4a defuzzification Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy Systems : Fuzzy Logic ControllerAs shown in Figure 1, a Fuzzy Controller operates by repeating a cycleof the following four steps :1 Measurements (inputs) are taken of all variables that representrelevant condition of Controller measurements are converted into appropriate Fuzzy sets toexpress measurements uncertainties. This step is fuzzified measurements are then used by the inferenceengine to evaluate the control rules stroed in the Fuzzy rule result of this evaluation is a Fuzzy set (or several Fuzzy sets)defined on the universe of possible output Fuzzy set is then converted into a single (crisp) value(or a vector of values). This is the final step called defuzzified values represent actions to be taken by the Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy Systems : Fuzzy Logic ControllerThere are two approaches of FLC approach2 Takagi and sugeno s approachMamdani approach follows linguistic Fuzzy modeling andcharacterized by its high interpretability and low the other hand, Takagi and Sugeno s approach follows precisefuzzy modeling and obtains high accuracy but at the cost of illustrate the above two approaches with two Samanta(IIT Kharagpur)Soft Computing / 34 Mamdani approach : Mobile RobotConsider the control of navigation of a mobile robot in thepresence of a number of moving make the problem simple, consider only four moving objects,each of equal size and moving with the same typical scenario is shown in Figure Samanta(IIT Kharagpur)Soft Computing / 34 Mamdani approach.
3 Mobile Robot 1O2O3O4 ODRSD ebasis Samanta(IIT Kharagpur)Soft Computing / 34 Mamdani approach : Mobile RobotWe consider two parameters :D, the distance from the robot to anobject and the angle of motion of an object with respect to value of these parameters with respect to the most criticalobject will decide an output called deviation( ).We assume the range of values ofDis [ , .. ] in meter and is [-90, .. , 0, .. 90] in identifying the relevant input and output variables of thecontroller and their range of values, the Mamdani approach is toselect some meaningful states called linguistic states for eachvariable and express them by appropriate Fuzzy Samanta(IIT Kharagpur)Soft Computing / 34 Linguistic StatesFor the current example, we consider the following linguistic states forthe three represented using four linguistic states:1VN : Very Near2NR : Near3VF : Very Far4FR : FarAngle(for both angular direction ( ) and deviation ( )) are representedusing five linguistic states:1LT : Left2AL : Ahead Left3AA: Ahead4AR : Ahead Right5RT : RightDebasis Samanta(IIT Kharagpur)Soft Computing / 34 Linguistic StatesThree different Fuzzy sets for the three different parameters are givenbelow (Figure 3).
4 D in Angle in Deviation 90RT in degreeDebasis Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy rule baseOnce the Fuzzy sets of all parameters are worked out, our next step inFLC design is to decide Fuzzy rule base of the rule base for the FLC of mobile robot is shown in the form of atable below. LT AL AA AR RTVNAA AR AL AL AANRAA AA RT AA AAFRAA AA AR AA AAVFAA AA AA AA AA Debasis Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy rule base for the mobile robotNote that this rule base defines 20 rules for all possible rules are simple rules and take in the following 1: If (distance is VN ) and (angle is LT) Then (deviation is AA)..Rule 13: If (distance is FR ) and (angle is AA) Then (deviation isAR)..Rule 20: Rule 1: If (distance is VF ) and (angle is RT) Then(deviation is AA)Debasis Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzification of inputsThe next step is the fuzzification of inputs.
5 Let us consider, at anyinstante, the objectO3is critical to the Mobile Robot and distanceD = m and angle = 30o(see Figure 2).For this input, we are to decide the deviation of the robot the given Fuzzy sets and input parameters values, we saythat the distance D = may be called as either NR (near) orFR (far).Similarly, the input angle = 30ocan be declared as either AA(ahead) or AR(ahead right).Debasis Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzification of inputsHence, we are to determine the membership values corresponding tothese values, which is as NR(x) = FR(x) = AA(y) = AR(y) = Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzification of inputsHint: Use the principle of 1 ,x1= , that is,x= 2 Debasis Samanta(IIT Kharagpur)Soft Computing / 34 Rule strength computationThere are many rules in the rule base and all rules may not the givenx= and =30o, only following four rules out of 20rules are : If (distance is NR) and (angle is AA) Then (deviation is RT)R2: If (distance is NR) and (angle is AR) Then (deviation is AA)R3: If (distance is FR) and (angle is AA) Then (deviation is AR)R4.
6 If (distance is FR) and (angle is AR) Then (deviation is AA)Debasis Samanta(IIT Kharagpur)Soft Computing / 34 Rule strength computationThe strength (also called values) of the firable rules are calculated asfollows. (R1) =min( NR(x), AA(y)) =min( , ) = (R2) =min( NR(x), AR(y)) =min( , ) = (R3) =min( FR(x), AA(y)) =min( , ) = (R4) =min( FR(x), AR(y)) =min( , ) = practice, all rules which are above certain threshold value of rulestrngth are selected for the output Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy outputThe next step is to determine the fuzzified outputs corresponding toeach fired working principle of doing this is first discussed and then weillustrate with the running , only two Fuzzy rules,R1 andR2, for which we are to decidefuzzy : IF (s1isA1) AND (s2isB1) THEN (f isC1)R2: IF (s1isA2) AND (s2isB2) THEN (f isC2)Suppose,s 1ands 2are the inputs for Fuzzy variabless1ands2. A1, A2, B1, B2, C1and C2are the membership values for differentfuzzy Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy outputThe Fuzzy output computation is graphically shows in the 1B 1C 2A 2B 2C *1s*2sC Combine outputDebasis Samanta(IIT Kharagpur)Soft Computing / 34 Fuzzy outputNote:We take min of membership function values for each membership function is obtained by aggregating themembership function of result of each output is nothing but Fuzzy OR of all output of Samanta(IIT Kharagpur)Soft Computing / 34 Illustration : Mobile RobotFor four rules, we find the following = Samanta(IIT Kharagpur)Soft Computing / 34 Illustration : Mobile of all resultsDebasis Samanta(IIT Kharagpur)Soft Computing / 34 DefuzzificationThe Fuzzy output needs to be defuzzified and its crisp value has to bedetermined for the output to take Samanta(IIT Kharagpur)Soft Computing / 34 Illustration.
7 Mobile RobotFrom the combined fuzzified output for all four fired rules, we get thecrisp value using Center of Sum method as 71+25 45+ 0+ + +25+ / 025 / : Therefore, the robot should deviate by degreetowards the right with respect to the line joining to the move of directionto avoid collision with the Samanta(IIT Kharagpur)Soft Computing / 34 Takagi and Sugeno s approachIn this approach, a rule is composed of Fuzzy antecedent andfunctional consequent , any i-th rule, in this approach is represented byIf (x1isAi1) and (x2isAi2) .. and (xnisAin)Then,yi=ai0+ai1x1+ai2x2+..+ainx nwhere,a0,a1,a2, ..anare the weight of i-th rule can be determined for a set of inputsx1,x2,..xnas iA1(x1) iA2(x2) .. iAn(xn)whereA1,A2, .. ,Anindicates membership function distributionsof the linguistic hedges used to represent the input variables and denotes membership function combined action then can be obtained asy= kiwiyi kiwi; wherekdenotes the total number of Samanta(IIT Kharagpur)Soft Computing / 34 Illustration:Consider two inputsI1andI2.
8 These two inputs have the followinglinguistic states :I1:L(low), M(Medium), H(High)I2:NR(Near), FR (Far), VF(Very Far)Note:The rule base of such as system is decided by a maximum of3 3=9 feasible Samanta(IIT Kharagpur)Soft Computing / 34 Illustration:The output of any i-th rule can be expressed by the (I1,I2) =aijI1+bikI2; where, j,k = 1,2, :ai1=1,ai2=2,ai3=3 ifI1=L,MandH, ,bi2=2,bi3=3 ifI2=NR,FR,andVF, have to calculate the output of FLC forI1= andI2= Samanta(IIT Kharagpur)Soft Computing / 34 Illustration:Given the distribution functions forI1andI2as 2I I1I2 Debasis Samanta(IIT Kharagpur)Soft Computing / 34 Solutiona) The inputI1= can be called either L or M. Similarly, the inputI2= can be declared either FR or ) Using the principal of similarity of triangle, we have the following. L(I1) = M(I1) = FR(I2) = VF(I2) = ) For the input set, following four rules can be fired out of all 9 :I1is L andI2is FRR2:I1is L andI2is VFR3:I1is M andI2is FRR4:I1is M andI2is VFDebasis Samanta(IIT Kharagpur)Soft Computing / 34 Solutiond) Now, the weights for each of the above rules can be determined :w1= L FR= :w2= L VF= :w3= M FR= :w4= M VF= ) The functional consequent values for each rules can be calculatedas +2I2= +2 +3I2= +3 +2I2=2 +2 +3I2=2 +3 Samanta(IIT Kharagpur)Soft Computing / 34 Solutionf) Therefore, the outputyof the Controller can be determined +w2y2+w3y3+w4y4w1+w2+w3+w4= Samanta(IIT Kharagpur)Soft Computing / 34 Happy LearningDebasis Samanta(IIT Kharagpur)Soft Computing / 34