Upload
vothuan
View
216
Download
0
Embed Size (px)
Citation preview
Computer & Electronic Systems
Year 2, Semester 4
Industrial Automation
Fuzzy Control
Fuzzy Control 2
Preview
• Crisp Logic
• Crisp Sets / Fuzzy Sets
• Membership Functions
• Washing Machine Example: Fuzzification, Fuzzy Inference, Defuzzification
• MATLAB Fuzzy Logic Toolbox
• Applications
Fuzzy Control 3
Introduction
• Fuzzy Control is a way of developing control systems which is based on Fuzzy Logic
• Fuzzy Logic invented in 1965 by Prof Lotfi Zateh of the Univ of California at Berkeley
• Objective of Fuzzy Logic is to make computers think like people and respond to vague human concepts like hot, cold, large, small
Fuzzy Control 4
Applications
• Most applications of fuzzy logic are in control systems
• Japanese domestic appliances have been developed with fuzzy logic controllers for many years
• Washing Machines (Hitachi, Matsushita, Sanyo)Air Conditioners (Mitsubishi)Microwave Ovens (Hitachi, Sanyo, Sharp)
Fuzzy Control 5
Crisp Logic
• Crisp Logic = Boolean Logic
• Formal logic that has been used for centuries
• Basis of operation of most computers
• 2-valued logic, Binary Logic
• Everything is either true or false, 1 or 0
• “IF the temperature is below 15°C THEN switch on the heater”
Fuzzy Control 6
Crisp Logic
• Like Boolean logic, the operation of a computer is binary
• Bits are 0 or 1Voltages are Low or HighTemperatures are either less than 15°C or NOT less than 15°C
• In between 0 and 1 do not exist and have no meaning
Fuzzy Control 7
Crisp Sets
• Set A of room temperatures less than 15°C is defined as follows:A={5,6,7,8,9,10,11,12,13,14}
• Set B of room temperatures equal to or greater than 15°C is defined as follows:B={15,16,17,...,39,40}
• Any given room temperature falls into set A or set B
Fuzzy Control 8
Membership Function of Crisp Set
• Membership Function has a rectangular form
• Outline of the area defines the Membership Function. Vertical sides to the function
• Membership Function shows that each of the integers 5 to 14 is a member of the set
• Each member has a Membership Degree of 1 (i.e. it is True that it belongs to the set)
• All other temperatures have a Membership Degree of 0 (i.e. it is False that they belong to the set)
Fuzzy Control 9
Fuzzy Sets
• Variables associated with real-world control situations are measurable values, e.g. 63mph, 15°C., but fuzzy systems are based on ideas such as ‘fast’ speed, ‘comfortable’ temperature
• A fuzzy set is a set where degrees of membership between 1 and 0 are allowed
Fuzzy Control 10
Membership Function of Fuzzy Set
• A membership function with sides that are not vertical.
• Such a function can represent a set of temperatures that are described as ‘comfortable’ (a fuzzy set)
• Membership function shows 25°C to have a membership degree of 1 and 23°C to have a membership degree of 0.6
• 23°C ‘comfortable’ but not as ‘comfortable’ as 25°C
Fuzzy Control 11
Membership Function of Fuzzy Set
• In Boolean logic, a temperature is either
comfortable (1) or it is not (0).
• In Fuzzy logic we can rate the comfortableness
of 23°C as 0.6 on a scale from 0 to 1
• The fuzzy set comprises temperatures ranging
from 20°C to 30°C in which the members belong
to the set to differing degrees. The further from
25°C, the smaller the membership degree
Fuzzy Control 12
Triangular Membership Function
• Often chosen for working with fuzzy sets
• The triangle need not be symmetrical
Fuzzy Control 13
Trapesoidal Membership Function
• Members in the middle range are all full members of the set.
• Those members at the extremes have lower membership indices
Fuzzy Control 14
Room Temperature Example
• It is possible to think of a series of fuzzy sets for temperatures spanning the range from Arctic cold to Tropical heat
• Each set has a name which can be a descriptive name and those names can be used as variables (linguistic variables)
• Cold, Coolish, Comfortable, Warmish, Too Hot – these are used to define the room temperature
Fuzzy Control 15
Fuzzy Logic
• Fuzzy logic is multivalued, not binary. Each member of a set has a membership degree (between 0 and 1). The pattern of membership degrees determines the membership function of the set
• Fuzzy sets have fuzzy boundaries which may overlap with other fuzzy sets
• Fuzzy sets are usually referred to by using linguistc variables
Fuzzy Control 16
Fuzzy Logic vs Crisp Logic
• Crisp logic is binary and Fuzzy logic is not
• Crisp logic and digital computers have binary
operation in common
• Crisp/Binary systems do not accord with many
aspects of everyday life, it is rare that things can
be classified as black or white. There are almost
always in-betweens.
• Human brain does not operate in a crisp/binary
way
Fuzzy Control 17
Example: Washing Machine
• Using a washing machine as an example application, we will look at how the control system for the washing machine is designed using fuzzy logic.
• The input to the control system is the dirtiness of the load
• The output from the control system is the amount of agitation required to wash the clothes
Fuzzy Control 18
System Input - Dirtiness
• The washing machine has a sensor that measures the dirtiness of the load
• Done by sensing the opacity of the washing water a few minutes after the wash cycle has begun
• The sensor reading is from 0 to 100
• Such a sensor is an example of an optical sensor
• The sensor reading has a precise value, it is crisp
Fuzzy Control 19
Fuzzification
• When the fuzzy logic controller receives a crisp input, the first step is to fuzzify the input
• Fuzzification consists of assigning the input value to one or more fuzzy input sets
• The range 0 to 100 is divided into 5 fuzzy sets named by linguistic variables (almost clean, slightly soiled, dirty, filthy, caked)
Fuzzy Control 20
Fuzzification
• If the sensor reading is 36, it is a member of 2 sets - ‘slightly soiled’ and ‘dirty’ – but has a different membership degree for each
• 0.66 Slightly Soiled0.29 Dirty
Fuzzy Control 21
System Output - Agitation
• Washing machine can deliver a variable amount of agitation ranging from 0 to 5
• Agitation is divided into 7 fuzzy sets from ‘very light’ to ‘extreme’
• very light, light, normal, active, vigorous, extra vigorous, extreme
• Higher levels of agitation are only used if the load is very dirty since this causes undue wear of the fabrics
Fuzzy Control 22
Fuzzy Rules
• Fuzzy rules govern the fuzzy logic controller
• Rules are of the IF...THEN... type
• 5 rules, one for each level of input variable
Fuzzy Control 23
Fuzzy Rules
• 1) IF dirtiness is ‘almost clean’, THEN agitation is ‘very light’2) IF dirtiness is ‘slightly soiled’, THEN agitation is ‘light’3) IF dirtiness is ‘dirty’, THEN agitation is ‘normal’4) IF dirtiness is ‘filthy’, THEN agitation is ‘vigorous’5) IF dirtiness is ‘caked’, THEN agitation is ‘extreme’
Fuzzy Control 24
Fuzzy Rules
• Can use the fuzzy rules to get a picture of the relationship between dirtiness and agitation
• Each of the rectangular patches represents a range of crisp input values and the corresponding range of crisp output values as defined by the fuzzy rules
• In general, the dirtier the load, the stronger the agitation
Fuzzy Control 25
Fuzzy Inference
• Once the crisp input has been fuzzified, the fuzzy rules are then ‘fired’ (fuzzy inference)
• For a dirtiness input of 36, rules (2) and (3) are ‘fired’ because 36 is a member of the input sets ‘slightly soiled’ and ‘dirty’
• 2) IF dirtiness is ‘slightly soiled’, THEN agitation is ‘light’3) IF dirtiness is ‘dirty’, THEN agitation is ‘normal’
• Rules 1, 4 and 5 are not ‘fired’ since 36 is not a member of any other input set
Fuzzy Control 26
Fuzzy Inference
• For Rule 2, a vertical line through dirtiness 36 cuts the ‘slightly soiled’ curve at membership degree 0.66
• For Rule 3, a vertical line through dirtiness 36 cuts the ‘dirty’ curve at membership degree 0.29
• More a member of Rule 2 than Rule 3 but both rules must be applied
Fuzzy Control 27
Fuzzy Inference
• Rule 2 has an applicability of 0.66 so its output set (‘light’) is truncated at 0.66
• Rule 3 has an applicability of 0.29 so its output set (‘normal’) is truncated at 0.29
• Fuzzy output of the system consists of the sets for ‘light’ and ‘normal’ agitation with each being represented in the same proportion as the corresponding input sets
Fuzzy Control 28
Defuzzification
• Defuzzification: obtaining a crisp output from the fuzzy output
• Centre of Gravity technique
• In our case, the centre of gravity lies on the vertical line at agitation 1.22
• Therefore, 1.22 is the crisp output (agitation) when the crisp input (dirtiness) is 36
Fuzzy Control 29
Summary
• The stages in Fuzzy Control are:- Crisp Input- Calculate Fuzzy Input (Fuzzification)- Fuzzy Inference- Fuzzy Output- Calculate Crisp Output (Defuzzification)
Fuzzy Control 30
Additional Controller Inputs
• In practice, the washing machine controller will
have additional inputs apart from dirtiness:
- Oiliness of dirt in the load
- Thickness of fabric
- Type of washing powder
• e.g. the Oiliness of the dirt in the load, this can
be estimated by measuring the rate at which the
opacity of the washing water increases at the
beginning of the wash. The oilier the load, the
more slowly the dirt is put into suspension.
Fuzzy Control 31
Additional Controller Inputs
• In the case of 2 inputs, the fuzzy rules will have the following structure:IF A AND B THEN Ce.g. IF dirtiness is ‘almost clean’ AND oiliness is ‘minimal’ THEN agitation is ‘very light’
Fuzzy Control 32
Additional Controller Outputs
• In practice, the washing machine controller will have additional outputs apart from agitation:- Length of wash time- Temperature of water
Fuzzy Control 33
MATLAB – Fuzzy Logic Toolbox
• Tools for designing systems using fuzzy logic
• GUIs to guide you through the design of a fuzzy logic control system:- Build the set of Fuzzy Rules- Define the Membership Functions- Analyse the behaviour of a fuzzy logic control system
Fuzzy Control 34
MATLAB – Fuzzy Logic Toolbox
Fuzzy Control 35
Why use Fuzzy Logic Control?
• Conventional control systems work perfectly well
provided there is a reliable mathematical model
of the system to be controlled
• However, in the case that the model of the
system is not known (or is only partially known)
then fuzzy logic control can be used.
• Problem is modelled with words rather than
maths
Fuzzy Control 36
Why use Fuzzy Logic Control?
• No mathematical model can describe the action
of a ship coming from some undefined point at
sea, into a dock area and coming to rest at a
precise position.
• Humans and fuzzy logic can perform this action
accurately, e.g. if the wind blows a little harder or
another ship hampers a particular docking
maneuver, this is sensed and unrelated but
effective action is taken
Fuzzy Control 37
Applications of Fuzzy Logic Control
• Washing Machines
• Air Conditioners
• Automobile Engine Management
• Microwave Ovens
• TV Sets
• Camcorders
• Lifts
• Traffic Control
• Subway Control
Fuzzy Control 38
Washing Machines
• Adjust washing strategy according to dirtiness, fabric type, load size and water level
• Outputs of the controller are quantity of water used, water flow speed, washing time, rinsing time and spin time.
• Machines wash more quickly with savings in the electricity used
Fuzzy Control 39
Air Conditioners
• Greater stability both as coolers and heaters, less fluctuation in room temperature than with conventional control
• Uses less electricity than a conventional air conditioner
Fuzzy Control 40
Lifts
• Fuzzy controllers cut average waiting times to 50%
• Input to the controller includes an estimate of sizes of groups waiting for the lift, time of day and distance lift has to travel
Fuzzy Control 41
Review
• Crisp Logic
• Crisp Sets / Fuzzy Sets
• Membership Functions
• Washing Machine Example: Fuzzification, Fuzzy Inference, Defuzzification
• MATLAB Fuzzy Logic Toolbox
• Applications