textfiles/programming/FUZZYLOGIC/fuzzwash.txt

221 lines
9.5 KiB
Plaintext

INTRODUCTION
When you use a washing machine, you generally select the length
of wash time based on the amount of clothes you wish to wash and
the type and degree of dirt you have. To automate this process,
we use sensors to detect these parameters (i.e. volume of
clothes, degree and type of dirt). The wash time is then
determined from this data. Unfortunately, there is no easy way
to formulate a precise mathematical relationship between volume
of clothes and dirt and the length of wash time required.
Consequently, this problem has remained unsolved until very
recently. People simply set wash times by hand and from
personal trial and error experience. Washing machines were not
as automatic as they could be.
To build a more fully automatic washing machine with self
determining wash times, we are going to focus on two subsystems
of the machine: (1) the sensor mechanism and (2) the controller
unit. The sensor system provides external input signals into the
machine from which decisions can be made. It is the controller's
responsibility to make the decisions and to signal the outside
world by some form of output. Because the input/output
relationship is not clear, the design of a washing machine
controller has not in the past lent itself to traditional
methods of control design. We address this design problem using
fuzzy logic and Fide.
FUZZY CONTROLLER
Objective: Design a washing machine controller which gives the
correct wash time even though a precise model of the input/output
relationship is not available.
Input/Output of Controller: Figure 1 shows a diagram of
the fuzzy logic controller. There are two inputs: (1) one for the
degree of dirt on the clothes and (2) one for the type of dirt on
the clothes. These two inputs can be obtained from a single
optical sensor. The degree of dirt is determined by the
transparency of the wash water. The dirtier the clothes, the
lower the transparency for a fixed amount of water. On the
other hand, the type of dirt is determined from the saturation
time, the time it takes to reach saturation. Saturation is the
point at which the change in water transparency is close to zero
(below a given number). Greasy clothes, for example, take longer
for water transparency to reach saturation because grease is less
water soluble than other forms of dirt. Thus a fairly
straightforward sensor system can provide the necessary inputs
for our fuzzy controller.
Definition of Input/Output Variables: Before designing the
controller, we must determine the range of possible values for
the input and output variables. These are the membership
functions used to translate real world values to fuzzy values and
back. Figure 2 shows the labels of input and output
variables and their associated membership functions. Values
for the input variables dirtiness and type_of_dirt are
normalized (range of 0 to 100) over the domain of optical
sensor values.
Note that wash_time membership functions are singletons (crisp
numbers) in this example. We can use fuzzy sets or singletons
for output variables. Singletons are simpler than fuzzy sets.
They need less memory space and work faster. If we could not be
satisfied by the result when output values are given by singletons
we could change them into fuzzy sets. Remember that when we use
TVFI method for inference we can only use singltons as values of
outputs. We should use Mandani's method for inference if we want
to define output values as fuzzy sets. Details about TVFI and
Mandani's method can be found in the FIDE User's Manual.
Rules: The decision making capabilities of a fuzzy controller
are codified in a set of rules. In general, the rules are
intuitive and easy to understand, since they are qualitative
statements written in English like if-then sentences. Rules for
our washing machine controller are derived from common sense,
data taken from typical home use, and experimentation in a
controlled environment. A typical intuitive rule is as follows:
If saturation time is long and transparency is bad, then
wash time should be long.
From different combinations of these and other conditions, we
write the rules necessary to build our washing machine
controller.
FIU source code: FIU stands for Fuzzy Inference Unit. This is
the fundamental unit in which FIDE encodes controller
information. The FIU includes input and output variable
definitions and the rules of the application. The following is a
listing of the FIU source for a possible washing machine fuzzy
logic controller. Figure 3 shows the response surface of the
input-output relation as determined by this FIU. FIU language
syntax and the response function are fully explained in FIDE's
User and Reference Manuals.
------ FIU source code begins here ------
$ FILENAME: washmach\wash1.fil $ DATE: July 23, 1992
$ UPDATE: July 29, 1992
$ CONTROLLER for Washing Machine: Two
$ inputs, one output, open-loop control
$ INPUT(S): dirtiness_of_clothes, type_of_dirt
$ OUTPUT(S): wash_time
$ FIU HEADER
fiu tvfi (min max) *8;
$ DEFINITION OF INPUT VARIABLE(S)
invar dirtiness_of_clothes "degree" : 0 () 100 [
Large (@50, 0, @100, 1),
Medium (@0, 0, @50, 1, @100, 0),
Small (@0, 1, @50, 0)
];
invar type_of_dirt "degree" : 0 () 100 [
Greasy (@50, 0, @100, 1),
Medium (@0, 0, @50, 1, @100, 0),
NotGreasy (@0, 1, @50, 0)
];
$ DEFINITION OF OUTPUT VARIABLE(S)
outvar wash_time "minute" : 0 () 60 * (
VeryLong = 60,
Long = 40,
Medium = 20,
Short = 12,
VeryShort = 8
);
$ RULES
if dirtiness_of_clothes is Large and type_of_dirt is Greasy
then wash_time is VeryLong;
if dirtiness_of_clothes is Medium and type_of_dirt is Greasy
then wash_time is Long;
if dirtiness_of_clothes is Small and type_of_dirt is Greasy
then wash_time is Long;
if dirtiness_of_clothes is Large and type_of_dirt is Medium
then wash_time is Long;
if dirtiness_of_clothes is Medium and type_of_dirt is Medium
then wash_time is Medium;
if dirtiness_of_clothes is Small and type_of_dirt is Medium
then wash_time is Medium;
if dirtiness_of_clothes is Large and type_of_dirt is NotGreasy
then wash_time is Medium;
if dirtiness_of_clothes is Medium and type_of_dirt is NotGreasy
then wash_time is Short;
if dirtiness_of_clothes is Small and type_of_dirt is NotGreasy
then wash_time is VeryShort
end
------ FIU source code ends here ------
CONCLUSION
A more fully automatic washing machine is straightforward to
design using fuzzy logic technology. Moreover, the design
process mimics human intuition, which adds to the ease of
development and future maintenance. Although this particular
example controls only the wash time of a washing machine, the
design process can be extended without undue complications to
other control variables such as water level and spin speed. The
formulation and implementation of membership functions and rules
is similar to that shown for wash time.
(Weijing Zhang, Applications Engineer, Aptronix Inc.)
NEXT ISSUE: Automatic Focusing System Uses fuzzy inference to
determine object distance from three measures for automatic
focusing system in a camera.
For Further Information Please Contact:
Aptronix Incorporated
2150 North First Street #300
San Jose, CA 95131
Tel (408) 428-1888
Fax (408) 428-1884
FuzzyNet (408) 428-1883 data 8/N/1
Aptronix Company Overview
Headquartered in San Jose, California, Aptronix develops and
markets fuzzy logic-based software, systems and development
tools for a complete range of commercial applications. The
company was founded in 1989 and has been responsible for a
number of important innovations in fuzzy technology.
Aptronix's product Fide (Fuzzy Inference Development
Environment) -- is a complete environment for the development of
fuzzy logic-based systems. Fide provides system engineers with
the most effective fuzzy tools in the industry and runs in
MS-Windows(TM) on 386/486 hardware. The price for Fide is $1495 and
can be ordered from any authorized Motorola distributor. For a
list of authorized distributors or more information, please
call Aptronix. The software package comes with complete
documentation on how to develop fuzzy logic based applications,
free telephone support for 90 days and access to the Aptronix
FuzzyNet information exchange.
Washing Machine
FIDE Application Note 001-270792
Aptronix Inc., 1992