North China Electric Power University
Fuzzy logic control method for the
washing time of the washing machine
Final Project Report
Submitted by: Nay Min Aung (ID-120194200094)
Submitted to: Prof. 张可铭
ABSTRACT
The fuzzy control method is a smart control method that is built on the fuzzy logic
theory. It simply imitates the process of a human being’s decision in behavior. It is very
suitable for complex non-linear systems that it is hard to solve using the traditional
methods. By applying fuzzy logic, you can have a simple continuous output that has
values between [0...1]. This report will focus on the washing time of the washing
machine. Two inputs that may affect the washing process were chosen to build the
experiment on them and by setting up the correct fuzzy rules we can end up with one
output that can optimize the washing times. The MATLAB will be used to simulate the
example.
2
Report Outlines:
- List of Figures
- Introduction to Fuzzy Set and Fuzzy Inference System
- The Characteristic Feature of Membership Function
- The Steps of Fuzzy Controller Design
- Fuzzy Compositional Rule of Inference
- Fuzzification & Defuzzification
- Fuzzy Control in the washing machines
- Simulated example using MATLAB
- Conclusion
- References
3
List of Figures
Figure1. Temperature membership functions …………………………………….. 6
Figure2. Fuzzy Controller …………………………….………………………….. 8
Figure3. The input membership function of Dirt ……………….…………………. 16
used is triangle and trapezium
Figure4. The input membership function of Grease ……………….……………… 17
used is triangle and trapezium
Figure5. The output membership function of Wash Time ……………….…………17
used is triangle and trapezium
Figure6. Rules for Output membership function of Wash Time ……………….…... 18
Figure7. Output membership function of Wash Time ……………….……………..18
used are triangle and trapezium
Figure8. Output membership function of Wash Time ……………….……………..19
used are triangle and trapezium
4
Fuzzy Set
1. A fuzzy set is a class of objects with a conium if grades of membership. Such a
set is characterized by a membership (characteristic) function which assigns to each
object a grade of membership ranging between zero and one. The notions of inclusion,
union, intersection, complement, relation, convexity, etc. are extended to such sets and
various properties of these notions in the context of fuzzy sets are established. In
particular, a separation theorem for convex fuzzy sets is proved without requiring that
the fuzzy sets be disjoint.
Fuzzy Inference System
2. Fuzzy logic (FL), a concept that oft engenders first curiosity, then skepticism, has
become a buzzword in machine control. It is a way of processing data by allowing
partial set membership instead of Boolean membership so that controllers can be built
to handle noisy, imprecise inputs, and still produce good feedback. Fuzzy logic is a way
for the real world to interface with the computer world, where only well-defined discrete
Binary logic exists. A system that takes uses fuzzy membership functions to make a
decision is called a fuzzy inference system (FIS). Something that is “fuzzy” is allowed to
transition from one state to the next by degrees. Consider the example of an antilock
braking system directed by a microcontroller chip. The chip has to make a decision
based on the brake temperature and car speed. For the purpose of modeling the brake
temperature alone, the fuzzy controller in the chip should have several temperature
memberships functions-one for each category of temperature (such as “cold”, “hot”,
etc.). As the temperature is changing, its membership to some categories “weakens” as
its membership to others “strengthens”, while remaining a member of all of the
categories all the time.
5
Cold Warm Hot
Figure1. Temperature membership functions
In this Fig, cold, warm, and hot are functions mapping a temperature scale. A point on
that scale has three "truth values" — one for each of the three functions. For the
particular temperature shown, the three truth values could be interpreted as describing
the temperature as, say, "fairly cold", "slightly warm", and "not hot".
The Characteristic Feature of Membership Function
3. The value of the membership function is a continuous value of a closed interval
(range from zero to one). The value approaches one, the greater will be the RMG of the
element, otherwise, the value approaches zero, the smaller will be.
The membership function is the basic concept of fuzzy mathematics and fully
depicts the fuzzy sets.
Classic Membership Function
4. (1) Triangle Membership Function
The shape of the curve depends on three parameters a, b, c
0
0 x<a.
x-a
a<x<
fA(x) b-a
Triangle(x;a,b,c) b.
=c-x b<x<
c-b c
0 0c<x
a b c x
6
(2) Trapezoid Membership function
The curve depends on four parameters a, b, c, d.
μ(x)
Most likely
interval
1
0
a b c d x
Largest likely interval
(3) S Membership Function
Type S membership function depends on two parameters a and c
1
1-P
0.5
Membership value
P
0
α X1 ᵝ(xm) yh y
Crop yield (kg/mu)
The Steps of Fuzzy Controller Design
5. (1) Determining the structure of the fuzzy controller and parameterize.
(2) Getting the fuzzy knowledge and setting up rules library
7
(3) Selecting the Fuzzification and Defuzzification methods.
(4) Adjusting and improving control performance. The Method of Setting up
Fuzzy rules.
Input Fuzzy Output Fuzzy
Fuzzy
Linguistic Linguistic
Inference
Variable Variable
Rules
Fuzzy
Fuzzification Defuzzification
Controller
Process
Input Crisp Under Output Crisp
Variable Control Variable
Figure2. Fuzzy Controller
Fuzzy Compositional Rule of Inference
6. Fuzzy compositional rule of inference is as follow-
(1) Inductive Method Based on Experience, the method based on experiences
of the human, to sum up, the control experience and intuitive reasoning of
humans to set up the fuzzy rules, it is a huge jump from perceptual to
traditional cognition.
(2) Fuzzy Compositional Rule of Inference in this method, the fuzzy
compositional rule of inference is an effective way to set up the fuzzy rules.
It can build the fuzzy rules by composing fuzzy reasoning depending on the
existing data of input and output.
Fuzzification
7. Fuzzification is well known as the process of decomposing a system input and
output into multiple fuzzy sets. Many types of membership functions can be used (as
mention before), but triangular or trapezoidal membership functions are used the most
8
because they are easier to represent in embedded controllers. Each fuzzy set takes a
specific region of input or output value that is well graphed with the membership. Any
particular input or output is part of this fuzzy set and interpreted as a degree of
membership. The membership functions of the input or the output should overlap to
allow better smooth mapping of the system. This process of fuzzification gives the ability
to the system inputs and outputs to be shown in linguistic terms so that the rules can be
applied easily in a simple way to express a complex or hard system.
Defuzzification
8. After fuzzy logic, we have now a linguistic output variable that has to be
translated into a crisp value again. The target of having a single crisp numeric value that
can best represents the inferred fuzzy values of the linguistic output variable and it is
easier for human and people to understand it easily. Defuzzification as from the word is
the opposite of fuzzification, it mainly works as inverse transformation which simply
converts the output from the fuzzy domain back into the crisp domain. Defuzzification
can work with two methods one method tend to produce an integral output by
considering all the possible elements of the resulting fuzzy set with the right weights.
Other methods take into consideration just the elements corresponding to the maximum
points of the resulting membership functions.
Some of the Defuzzification methods could be:
(1) The Maximum Membership Degree Method
The maximum membership degree method is simplest and it
selects the element having the maximum membership degree as the
output in the fuzzy reasoning set.
(2) COG (center of gravity) Method or Center of Area
To get an accurate controlling amount, the fuzzy method should
well express the results of the membership function. The results of fuzzy
reasoning are the center of gravity of the COG method.
9
(3) Weighted Average Method
The weighted average method is in wide use in the field of
industrial control.
Fuzzy Control in the washing machines
9. The washing machine is one of the main machines in a modern household. In
recent years, users are mainly concerned about the capacity and the energy
consumption of the machine, as it is well knowing that the washing machine is one of
the top power consuming machines that uses a very high amount of electricity, so there
was always the need for trying to optimize and control its performance in an efficient
way. There are many reasons that affect the performance of the washing machine, and
each reason is important to some people respectively. Using the washing machines
every time with the same options and same washing cycle is totally inefficient and can
cause a huge amount of waste in the electricity, the time and even could affect the
clothes itself that might be ruined if it was washing for a long time that it should be and
so on.
Due to the reasons mentioned above the fuzzy logic controller could be very useful for
trying to control the washing machine and improving its performance. Analyzing the
running of the washing machine, we know that the main controlling amounts are the
washing time and the stream competence (motor speed). There was a huge need to try
and get the best of the washing process with higher efficiency and lower power, water,
and time.
In my report, I will focus on trying to estimate the washing time. Due to the
practical conditions of the system that contain a lot of unknown, the controlling process
always depends on the experiences of the users or the companies and it is so hard to
create an efficient mathematical model of the input/output relation, so it is quite difficult
to get high performance with traditional control methods.
Creating the fuzzy control on MATLAB
10. The fuzzy logic application on the MATLAB is quite smart and efficient, by
choosing the right inputs and outputs it is easy then to create the fuzzy system and its
10
fuzzy rules and see a very good output that will make us understand how it works and
visualize the idea behind the system.
- First step is Determining the structure of the fuzzy controller
By selecting the fuzzy controller that has three inputs and two outputs. As
mentioned before the inputs will be: Dirt, Grease, the output will be: washing
time.
- Second, we need to define the inputs and the outputs sets and define their
verbs.
Identify input and output variables and divide descriptors for the same.
- Here inputs are dirt and grease. Assume they are in %.
- The output is “Wash time” measure in a minute.
Description for Input Variable
Dirt
SD - Small Dirt
MD - Medium Dirt
LD - Large Dirt
Grease
NG - No Grease
MG - Medium Grease
LG - Large Grease
Description for Output Variable
Wash Time
VS - Very Short
S - Short
M - Medium
L - Large
VL - Very Large
11
Define membership functions for each of the input and output variables
Membership Function for Dirt;
μ(x)
0 50 100 Dirt in %
50 – x , 0 ≤ x ≤ 50
μSD(x) 50 =
x , 0 ≤ x ≤ 50
μMD(x) 50 =
100-x , 50 ≤ x ≤ 100
50
μLD(x) x – 50 , 50 ≤ x ≤ 100 =
50
Membership function of Grease;
μ(y)
0 50 100 Grease in %
50 – y , 0 ≤ y ≤ 50
μNG(y) =
50
y , 0 ≤ y ≤ 50
50
12
100-y , 50 ≤ y ≤ 100
50
μMG(y) =
y – 50 , 50 ≤ y ≤ 100
μLG(y) =
50
Membership Function for wash Time;
VS S M L VL
μ(z)
0
10 25 40 60 Washing Time in minute
μVS(z) 10 – z , 0 ≤ z ≤ 10 =
10
C
z , 0 ≤ z ≤10
10
μS(z) =
25 - z , 10 ≤ z ≤ 25
15
z - 10 , 10 ≤ z ≤25
15
μM(z) =
40 – z , 25 ≤ z ≤ 40
15
z - 25 , 25 ≤ z ≤ 40
15
μL(z) =
60 – z , 40 ≤ z ≤ 60 13
20
μVL(z) z – 40 , 40 ≤ y ≤ 60 =
20
Formula a rule base
Y
NG MG LG
x
SD VS M L
MD S M L
LD M L VL
Rule Evaluation
Assume Dirt = 60% , Grease = 70%
Dirt = 60% , maps two MFs of Dirt
100 – x x – 50
μMD(x) = μLD(x) =
50 50
C C
Evaluate;
100 – 60 60 – 50
μMD(60) =
50 50
μLD(60) C = C
= 4/5 = 1/5
Grease = 70% maps 2 MFs
100 – y y – 50
50 50
C 14 C
μMG(y) = μLG(y) =
μMG(70) 100 – 70 = μLG(70) 70 – 50 =
50 50
C C
= 3/5
= 2/5
The above 4 equation lead to 4 rules need to evaluate;
- Dirt is medium and Grease is medium
- Dirt is medium and Grease is Large
- Dirt is Large and Grease is Medium
- Dirt is Large and Grease is Large
Since the antecedent part of each of the above rules is connected by an operator
we use “Min” operator to evaluate the strength of each rule.
Strength of rule1 DMGM
S1 = min ( μMD (60), μMG (70))
= min (4/5 , 3/5)
= 3/5
Strength of rule2 DMGL
S2 = min ( μMD (60), μGL (70))
= min (4/5 , 2/5)
= 2/5
Strength of rule3 DLGM
S3 = min ( μLD (60), μMG (70))
= min (1/5 , 3/5)
= 1/5
Strength of rule4 DLGL
S4 = min ( μLD (60), μLD (70))
= min (1/5 , 2/5)
= 1/5
Grease
Dirt NG MG LG
SD x x x 15
MD x M L
LD x L VL
Grease
Dirt NG MG LG
SD x x x
MD x 3/5 2/5
LD x 1/5 1/5
Max Membership Function
Defuzzification
Since we used “Mean of Max” defuzzification technique-
Maximum Strength = Max (S1, S2, S3, S4)
= Max (3/5, 2/5, 1/5, 1/5)
= 3/5
The corresponds to rule1
Dirt is medium and grease is medium has maximum strength (3/5)
To find out the final defuzzied value, we now take average (mean) of
μM(z).
μM(z) = (z-10)/15
3/5 = (z-10)/15
μM(z) = (40-z)/15
3/5 = (40-z)/15
Wash Time
z = 19 z = 31
z = (19+31)/2
z = 25 min
16
Simulated example using MATLAB
11.
Figure3. The input membership function of Dirt used is triangle and trapezium.
SD = [-50 0 50] , MD= [0 50 100], LD=[50 100 150]
Figure4. The input membership function of Grease used is triangle and
trapezium. NG = [-50 0 50] , MG= [0 50 100], LG=[50 100 150]
17
Figure5. The output membership function of Wash Time used is triangle and
trapezium.
VS = [-10 0 10] , S= [0 10 25], M=[10 25 40], L=[25 40 60], VL=[40 60 80]
Figure6. Rules for Output membership function of Wash Time
1. If (Dirt is SD) and (Grease is NG) then (Wash Time is VS)
2. If (Dirt is SD) and (Grease is MG) then (Wash Time is M)
3. If (Dirt is SD) and (Grease is LG) then (Wash Time is L)
4. If (Dirt is MD) and (Grease is NG) then (Wash Time is S)
5. If (Dirt is MD) and (Grease is MG) then (Wash Time is M)
6. If (Dirt is MD) and (Grease is LG) then (Wash Time is L)
7. If (Dirt is LD) and (Grease is NG) then (Wash Time is M)
8. If (Dirt is LD) and (Grease is MG) then (Wash Time is L)
9. If (Dirt is LD) and (Grease is LG) then (Wash Time is VL)
18
Figure7. Output membership function of Wash Time used are triangle and
trapezium (at dirt 60% and Grease 70%) = Washing Time is 33.7 minutes
Figure8. Output membership function of Wash Time used are triangle and
trapezium (at dirt 40% and Grease 30%) = Washing Time is 20.2 minutes
CONCLUSION
Developing fuzzy logic for washing machines can help improve automation
systems in washing machines and reduce electricity, water, and time consumption.
Based on the weight of clothing detected by the weight sensor, while other input
parameters are given externally as well as with related sensors. The parameters can
determine the appropriate washing time. The results of the washing time can enter the
19
next control system to stabilize the motor speed despite any changes in load. Looking at
the surface graph obtained from the combination illustrates the desired operating
achievement. Using a fuzzy logic system is easier to implement into complex systems
than conventional controls.
Reference
[1] Da Ruan and Chongfu Huang, Lotfi A. Zadeh. Fuzzy Sets and Fuzzy Information
Granulation Theory. Beijing Normal University,3-61
[2] Hagar S, and Halase S V 2015 Three Input – One Output Fuzzy logic control of
Washing Machine Int. J. Sci. Res. Eng. Technol. 4 1 2278–882
[3] N Wulandari and A G Abdullah, Design and Simulation of Washing Machine
using Fuzzy Logic Controller (FLC) 2018 IOP Conf. Ser.: Mater. Sci. Eng. 384
012044
[4] Hatagar S, and Halase S V 2015 Three Input – One Output Fuzzy logic control of
Washing Machine Int. J. Sci. Res. Eng. Technol. 4 1 2278–882
[5] Hatagar S S and Halase S S V 2015 Simulating Matlab Rules in Fuzzy Controller
Based Washing Machine Simulating Matlab Rules in Fuzzy Controller Based
Washing Machine International Journal of Emerging Trends in Science and
Technology 2 (07) 2796–2802
[6] Devi K, Singh R, Gautam S and Nagaria D 2015 Speed control of induction
motor using fuzzy logic approach. International Journal 3 (4) 694-697
[7] Russell W 1942 Automatic Control for Washing Machines February, pp 89–92
[8] Spasojevic B 2004 Fuzzy optical sensor for washing machine 7th Semin. Neural
Netw. Appl.Electr. Eng. 2004. NEUREL 2004 237–242
[9] Yu Zhen and Xu Fang; The fuzzy decision and simulation of washer control’ 2011
6th International Conference on Computer Science & Education (ICCSE) Year:
2011
20