Example of a Fuzzy Logic System

Let us consider an air conditioning system with 5-level fuzzy logic system. This system adjusts the temperature of air conditioner by comparing the room temperature and the target temperature value.

Fuzzy Logic AC System

Algorithm

      Define linguistic variables and terms.

      Construct membership functions for them.

      Construct knowledge base of rules.

      Convert crisp data into fuzzy data sets using membership functions. (fuzzification)

      Evaluate rules in the rule base. (Inference Engine)

      Combine results from each rule. (Inference Engine)

      Convert output data into non-fuzzy values. (defuzzification)

Logic Development                                                     

Step 1: Define linguistic variables and terms

Linguistic variables are input and output variables in the form of simple words or sentences. For room temperature, cold, warm, hot, etc., are linguistic terms.

Temperature (t) = {very-cold, cold, warm, very-warm, hot}

Every member of this set is a linguistic term and it can cover some portion of overall temperature values.

Step 2: Construct membership functions for them

The membership functions of temperature variable are as shown −

MF of AC System

Step3: Construct knowledge base rules

Create a matrix of room temperature values versus target temperature values that an air conditioning system is expected to provide.

RoomTemp. /Target

Very_Cold

Cold

Warm

Hot

Very_Hot

Very_Cold

No_Change

Heat

Heat

Heat

Heat

Cold

Cool

No_Change

Heat

Heat

Heat

Warm

Cool

Cool

No_Change

Heat

Heat

Hot

Cool

Cool

Cool

No_Change

Heat

Very_Hot

Cool

Cool

Cool

Cool

No_Change

Build a set of rules into the knowledge base in the form of IF-THEN-ELSE structures.

Sr. No.

Condition

Action

1

IF temperature=(Cold OR Very_Cold) AND target=Warm THEN

Heat

2

IF temperature=(Hot OR Very_Hot) AND target=Warm THEN

Cool

3

IF (temperature=Warm) AND (target=Warm) THEN

No_Change

Step 4: Obtain fuzzy value

Fuzzy set operations perform evaluation of rules. The operations used for OR and AND are Max and Min respectively. Combine all results of evaluation to form a final result. This result is a fuzzy value.

Step 5: Perform defuzzification

Defuzzification is then performed according to membership function for output variable.

DeFuzzied Value