Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

11/22/21, 9:31 AM fuzzyLogic_001

Fuzzy Logic
Is a method of reasoning that resembles human reasoning. This aproach is similar to how humans perform
decision making. And it involves all intermediate possibilities between YES and NO.

Certainly yes
Posibbly yes
Cannot say
Possibly no
Certainly no

Figure 1. Fuzzy logic diagram.

localhost:8888/nbconvert/html/Jupyter Notebooks/fuzzyLogic_001.ipynb?download=false 1/7


11/22/21, 9:31 AM fuzzyLogic_001

Crisp sets are those number arrays that represents the data.

Fuzzification is the process where the input crisp set is transformed into a fuzzy set according to the
membership functions.

Membership functions are made to process the data into information with imprecision and uncertaninty.

Fuzzy sets (1) are the arrays that were transformed from crisp sets.

Inference Engine is the step where the input fuzzy set is reinterpreted to a new fuzzy set, based on the rule
base.

Rule base are rules that sets possible outcomes based on input crisp sets; suppervised by an expert.

Fuzzy sets (2) are the arrays that were transformed after applying rule base.

Defuzzifier is the process were the fuzzy set (2) pass through another membership functions to translate it into a
crisp set.

Fuzzy inference systems:


A fuzzy interference system is an intelligent system wich has the capability to compute with words to inference

General algorithm: Mamdani (Ebrahim Mamdani)


1. Define the input and output linguistic variables (as their domain).
2. Construct base rules that represents inference engine.
3. Fuzzify input values: Find the *membership degree* and evaluate each rule base.
4. Apply inferenece to evaluate wich rule base was activated.
5. Composition
6. Defuzzify using gravity centroid method.

localhost:8888/nbconvert/html/Jupyter Notebooks/fuzzyLogic_001.ipynb?download=false 2/7


11/22/21, 9:31 AM fuzzyLogic_001

Spray ("Atomizado")

1) Linguistic variables:

Input (Dust humydity):


Dry
Ok [6.6 to 7.6 %]floor or [6.3 to 7.3 %] wall
Damp (húmedo)
Output (bomb presure, burner damper, set point):
Bomb pressure [from Δ 1bar to Δ 3bar]:
Increase
Decrease
Burner damper [from Δ 1% to Δ 5%]:
Open
Close
Set point [Unkown]:
Increase
Decrease

Input (Dust humydity):


Dry
Ok [6.6 to 7.6 %]floor or [6.3 to 7.3 %] wall
Damp (húmedo)
Output (bomb presure, burner damper, set point):
Bomb pressure [from Δ 1bar to Δ 3bar]:
Increase
Decrease
Burner damper [from Δ 1% to Δ 5%]:
Open
Close
Set point [Unkown]:
Increase
Decrease

2) Base rules:

IF humidity IS dry THEN increase bomb pressure OR close burner damper OR decrease set point.
IF humidity IS dry THEN increase bomb pressure AND close burner damper OR decrease set point.
IF humidity IS wet THEN decrease bomb pressure OR open burner damper OR increase set point.
IF humidity IS wet THEN decrease bomb pressure AND open burner damper OR increase set point.

localhost:8888/nbconvert/html/Jupyter Notebooks/fuzzyLogic_001.ipynb?download=false 3/7


11/22/21, 9:31 AM fuzzyLogic_001

Humidity Bomb Presure Burner Damper Set Point

Dry Increase Close Decrease

--- --- --- ---

Ok N/A N/A N/A

--- --- --- ---

Wet Decrease Open Increase

3.1) Values:
import numpy as np
import matplotlib.pyplot as plt

###################################################
############################## - Linguistic values
###################################################

floor_dry_humidity = [0, 6.1, 6.6]


floor_ok_humidity = [6.1, 6.6, 7.6, 8.1] #There is a +- 0.5% humidity error that ha
s to be considered.
floor_wet_humidity = [7.6, 8.1, 10]

wall_dry_humidity = [0, 5.8, 6.3]


wall_ok_humidity = [5.8, 6.3, 7.3, 7.8] #There is a +- 0.5% humidity error that has
to be considered.
wall_wet_humidity = [7.3, 7.8, 10]

dry_membership_degree = [1, 1, 0]
ok_membership_degree = [0, 1, 1, 0]
wet_membership_degree = [0, 1, 1]

localhost:8888/nbconvert/html/Jupyter Notebooks/fuzzyLogic_001.ipynb?download=false 4/7


11/22/21, 9:31 AM fuzzyLogic_001

3.2) Membership functions:


x_ticks = np.linspace(0, 10, 11)

###################################################
###################### - Input Membership functions
###################################################

fig, (floor, wall) = plt.subplots(1, 2, figsize =(20,4))

#Plot membership functions (floor).


floor.plot(floor_dry_humidity, dry_membership_degree, label = 'dry') #trapezoidal
floor.plot(floor_ok_humidity, ok_membership_degree, label = 'ok') #trapezoidal
floor.plot(floor_wet_humidity, wet_membership_degree, label = 'wet') #trapezoidal
#Cuztomize labels and ticks.
floor.legend(loc='lower left')
floor.set(xlabel = "Dust humidity (%)", xticks = x_ticks, title = 'Floor values')
floor.set(ylabel="Membership degree (u(x))")

#Plot membership functions(wall).


wall.plot(wall_dry_humidity, dry_membership_degree, label = 'dry') #trapezoidal
wall.plot(wall_ok_humidity, ok_membership_degree, label = 'ok') #trapezoidal
wall.plot(wall_wet_humidity, wet_membership_degree, label = 'wet') #trapezoidal
#Cuztomize labels and ticks.
wall.legend(loc = 'lower left')
wall.set(xlabel = "Dust humidity (%)", xticks = x_ticks, title = 'Wall values')
wall.set(ylabel = "Membership degree (u(x))")

plt.show()

localhost:8888/nbconvert/html/Jupyter Notebooks/fuzzyLogic_001.ipynb?download=false 5/7

You might also like