Showing posts with label Fuzzy Logic. Show all posts
Showing posts with label Fuzzy Logic. Show all posts

Monday, July 22, 2013

Easy Way to Understand Defuzzification Method

As explained in the previous discussion, defuzzification is a process to convert linguistic values (Fuzzy values) into numerical values (real values). There are some methods of defuzzification technique:
1. Maximum Defuzzification Method
  
Fuzzification VHDL
    
  

 
2. Centroid Defuzzification Method (Center of Maximum Method)
Fuzzy Logic Control



3. Weighted Average Defuzzification Method
Fuzzification VHDL








Where,
  • x* is the defuzzified output, 
  • µi(x) is the aggregated membership function and 
  • x is the output variable. 
  • mi is the membership of the output of each rule, and  
  • wi is the weight associated with each rule.
We will not be going to discuss more detail about these techniques, and we suggest you to read books or papers on Fuzzy Logic for more detail discussion of this topic.

As discussed in previous discussion, Fuzzy Inference results of the system are;
  • #18:IF Angle = zero (0.2) AND Distance = medium (0.9) THEN Power = zero (0.2)
  • #19:IF Angle = pos_small (0.8) AND Distance = medium (0.9) THEN Power = pos_med (0.8)
  • #23:IF Angle= zero (0.2) AND Distance = far (0.1) THEN Power = pos_med (0.1)
  • #24:IFAngle= pos_small (0.8) AND Distance = far (0.1) THEN Power= pos_med (0.1)
Result for the Linguistic Variable “Power” are:
                   zero with the degree 0.2
                   pos_med with the degree 0.8 and 0.1


Since pos_med has 2 values, select the maximum of the values i.e. 0.8 (MIN-MAX theory).
                  
Finally, result for the Linguistic Variable “Power” are:
                   zero with the degree 0.2

                   pos_med with the degree 0.8 


Sunday, May 26, 2013

Easy Way to Understand Fuzzy Inference - 2


As discussed on easy-way-to-understand-fuzzy-inference-1 in previous, fuzzification of Input Variable Angle (4°) provides 2 membership functions:
  • zero = 0.2
  • pos_small = 0.8
and Distance (12 m) provides 2 membership functions:

  • medium = 0.9
  • far = 0.1
Below is the fuzzification' results of input variables into IF-THEN rules:  
#18: IF Angle = zero (0.2) AND Distance = medium (0.9) THEN Power = zero
#19: IF Angle = pos_small (0.8) AND Distance = medium (0.9) THEN Power = pos_med
#23: IF Angle = zero (0.2) AND Distance = far (0.1) THEN Power = pos_med
#24: IF Angle = pos_small (0.8) AND Distance = far (0.1) THEN Power = pos_med


    
Fuzzification VHDL
 

Wednesday, May 22, 2013

Easy Way to Understand Fuzzy Inference - 1


Fuzzy Inference is the brain of fuzzy logic system. In this stage, skills & experiences of an expert control engineer are needed to design behavior of the system. As mentioned in the previous discussion, input variable Angle has 5 membership functions (linguistic variables); neg_big, neg_small, zero, pos_small & pos_big, input variable Distance also has 5 membership functions; neg_close, zero, close, medium & far, and output variable Power has 5 membership functions i.e. pos_high, pos_medium, zero, neg_medium and neg_high.
Fuzzification VHDL

The following table is summary of fuzzy inference of the system that comprises 2 inputs (Angle, Distance) and 1 output (Power) with 5 membership functions:

neg_big
neg_small
zero
pos_small
pos_big
neg_close
neg_high
neg_med
neg_med
pos_med
zero
zero
neg_med
neg_med
zero
pos_med
pos_med
close
neg_med
zero
zero
zero
pos_med
medium
neg_med
neg_med
zero
pos_med
pos_med
far
zero
neg_med
pos_med
pos_med
pos_high

Saturday, May 11, 2013

Easy Way to Understand Fuzzification in Fuzzy Logic System

Fuzzification is a process to convert numerical values (real values) of variable inputs into Linguistic values (Fuzzy values). Fuzzy values have value range “0” to “1” where “0” is minimum value and “1” is maximum value. There are 2 input variables i.e. Angle and Distance in the container crane controller as shown in the figure below.

fuzzification VHDL


Input variable Angle has 5 membership functions (linguistic variables); neg_big, neg_small, zero, pos_small & pos_big, while input variable Distance also has 5 membership functions; neg_close, zero, close, medium & far. In addition, output variable Power has 5 membership functions i.e. pos_high, pos_medium, zero, neg_medium and neg_high.

Based on input variable Angle in the figure above, Angle with real value 4° has 2 linguistic values i.e. zero (0.2) and pos_small (0.8). And input variable Distance with real value 12 m also has 2 linguistic variables; medium (0.9) and far (0.1).

Fuzzification of Input Variables:
  1. Angle (4°) has 2 membership functions:
  • zero = 0.2
  • pos_small = 0.8
  1. Distance (12 m) has 2 membership functions:
  • medium = 0.9
  • far = 0.1


Source of figures: Industrial Application of Fuzzy Logic Control (slide presentations), Inform Software Corporation, 20001 Midwest Rd., Oak Brook, IL 60521, U. S. A.

Monday, May 6, 2013

Easy Way to Understand Basic Elements of Fuzzy Logic System


Basically, Fuzzy Logic concept consists of 3 stages i.e.:

1.       Fuzzification
2.       Fuzzy Inference
3.       Defuzzification 

Fuzzification VHDL

Fuzzification is a process to convert numerical values (real values) into Linguistic values (Fuzzy values). Defuzzification is vice versa of Fuzzification that converts Linguistic values (Fuzzy value) into numerical values (real values), and Fuzzy Inference is located between Fuzzification and Defuzzification. Fuzzy Inference is the brain of Fuzzy system that connects Fuzzification to Defuzzification. Fuzzy Inference usually uses IF-THEN rules to connect Fuzzification to Defuzzification. More detail explanation on Fuzzification, Fuzzy Inference, and Defuzzification will be discussed later.


Fuzzification VHDL

In order to understand Fuzzy Logic concept easier, a controller application using Fuzzy Logic algorithm is usually used. Figure beside is an application of Fuzzy Logic to control a container crane from trailer to ship. Overlapping of membership functions in Fuzzy Logic will give a smooth control system to put a container to the ship properly with very small error correction.

Monday, April 29, 2013

Understanding Linguistic Variable in Fuzzy Logic

One of the beauties of Fuzzy Logic is Linguistic Variable. Fuzzy Logic can define mathematical values in Linguistic variables with range of values. It is usually named as Membership Function. Based on the figure below, room_temperaturevariable has 4 membership functions i.e. low_temp,normal,raised_temperatureand strong_fever

Fuzzification VHDL

Membership function low_temp(yellow color) has range of real temperature values 0 °C to 37 °C, normal (green color) has range of real temperature values 36 °C to 37.25 °C, and raised_temperature (blue color) has value range 37 °C to 39.25 °C. More detail about value range of all membership functions can be seen in the table below.


No
Membership Function
Color
Range of Real Temp. Values
1.
low_temp
Yellow

0 °C to 37 °C
2.
normal
Green

36 °C to 37.25 °C
3.
raised_temperature
Blue

37 °C to 39.25 °C
4.
strong_fever
Purple

37.5 °C to 43 °C

Saturday, April 27, 2013

A Simple Way to Understand Fuzzy Set Theory


Designing a fuzzy logic system is different from conventional system since within conventional logic, terms can be only "true" or "false", "low" or "High", or "1" of "0". Fuzzy logic allows a generalization of conventional logic which it provides terms between "true" and "false" like "almost true" or "partially false". 

Fuzzy Logic Control

In this discussion we will define values range of Strong_Fever which is a part of variable room_temperature. As shown in figures above, conventional set theory defines a condition (state) in only 2 parts; Strong_Fever (black colour), and another values are excluded will be considered as Not_Strong_Fever (white colour). We can assume that if room_temperature more than 39 °C, it will be Strong_Fever, and if room_temperature less than 39 °C, then it will be Not Strong Fever. There are no values in the border between Strong_Fever and Not Strong Fever. All values are divided only in the 2 groups whether becoming member of Strong_Fever or Not Strong Fever.

In the Fuzzy set theory, there are blur area that has values. The blur area is located in the border between Strong_Fever and Not Strong Fever variables. We can add and determine variables such as Low Temperature, Normal and Raised Temperature with certain values in that blur area. These variables are linguistic variables and named as Membership Functions of variable room_temperature.

Wednesday, April 17, 2013

Fuzzy Logic Control vs Conventional Control


Fuzzy logic is a methodology for operational states of a system with the expression of language, rather than mathematical equations. In other words, fuzzy logic-based control system is an expert system that utilizes fuzzy logic algorithm to manipulate qualitative variables. Many systems are too complex to be accurately modeled, albeit with a complex mathematical equation. In such a case, the expression language used in the fuzzy logic can help define the operational characteristics of the system better. Expression language for the characteristics of the system are usually expressed in the form of logical implications, such as the rule IF - THEN :

IF room_temperature WARM, THEN fan_speed MEDIUM

MEDIUM and WARM in this example above are the actual expression of the values' set which is known as as a membership function. By choosing a range of values ​​and not the values ​​explicitly to define the input variables "room_temperature", can be controlled output variable "fan_speed" is more accurate. Fuzzy logic controllers can improve the performance of the control system to suppress the emergence of the functions of the wild fluctuations in output caused by the input variables [1].

Conventional approaches
To illustrate the differences between fuzzy logic approach to conventional approaches, the following examples of issues discussed in a control system. Suppose, for the following logic statement will explain how the controllers 'firm' handle.
    IF room_temperature  > = 70_Fahrenheit, THEN set fan_speed on "1000 rpm"
    IF room_temperature <70_Fahrenheit, THEN set fan_speed on "100 rpm"
In the conventional control system - which is often referred to as 'firm control' -, the controller relies on the decision points on the basis of firm values. In this system, the input must reach a certain definite value before the control system to react in a certain way. Even very small variations in the input values ​​can cause output to react very differently. For example, if the room temperature reaches 70 ° F or more, then use the first rule that the fan speed is set at 1000 rpm. If the temperature changes very small to below 70 ° F, then apply the second rule i.e. fan speed set at 100 rpm. In chart form, controlling the firm value is shown in Figure 1 below:

Friday, April 12, 2013

Introduction: Simple Way To Understand Fuzzy Logic Concept


Before we discuss on application of Fuzzy Logic for control system using Verilog HDL, we will try to understand Fuzzy Logic concept through a simple way, not using mathematical with its complexity. 


What is Fuzzy Logic?
Fuzzy Logic is a methodology to describe operational statement of a system with the expression language (not using mathematics operation).  

Many systems especially very large systems are too complex to be modeled with mathematical equation accurately. Fuzzy Logic uses the expression language approaches to define the operational characteristics of the system, therefore Fuzzy Logic becomes a better & easier solution. The expression language for system characteristics are usually expressed in terms of logical implications: IFTHEN.

History of Fuzzy Logic
History of Fuzzy Logic was started in 1965 where Prof. Lotfi Zadeh (A Professor in Electrical Engineering Faculty, U.C. Berkeley, USA) set the foundation of the "Fuzzy Set Theory and introduced the theory during in seminar paper on "Fuzzy Logic". 

Professor Lotfi Zadeh, the inventor of fuzzy logic, contends that a computer cannot solve problems as well as human experts unless it is able to think in the characteristic manner of a human being. As humans, we often rely on imprecise expressions like "usually", "expensive", or "far". But the comprehension of a computer is limited to a black-white, everything-or-nothing, or true-false mode of thinking. In this context, Lotfi Zadeh emphasizes the fact that we easily let ourselves be dragged along by a desire to attain the highest possible precision without paying attention to the imprecise character of reality [2].