32
Soft computing Lecture 5 Using of fuzzy logic in control systems

Soft computing Lecture 5

  • Upload
    huela

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

Soft computing Lecture 5. Using of fuzzy logic in control systems. Fuzzy inference. Mini-operation rule (Mamdani implication): Product-operation rule (Larsen implication):. Example of fuzzy inference. Example of linguistic variable. - PowerPoint PPT Presentation

Citation preview

Page 1: Soft computing Lecture 5

Soft computingLecture 5

Using of fuzzy logic in control systems

Page 2: Soft computing Lecture 5

Fuzzy inference

• Mini-operation rule (Mamdani implication):

• Product-operation rule (Larsen implication):

Page 3: Soft computing Lecture 5
Page 4: Soft computing Lecture 5
Page 5: Soft computing Lecture 5

Example of fuzzy inference

Page 6: Soft computing Lecture 5

Example of linguistic variable

Page 7: Soft computing Lecture 5

A hedge is an operation which modifies the meaning of the term:

Page 8: Soft computing Lecture 5

During inference it is needed to execute two operations:

1.FuzzificationTransformation from number to symbol value of linguistic variable and corresponding value of membershipfunction

2. DefuzzificationTransformation from symbol value to number

Page 9: Soft computing Lecture 5

Methods of defuzzification

Page 10: Soft computing Lecture 5

Features of fuzzy logic

• In fuzzy logic, exact reasoning is viewed as a limiting case of approximate reasoning

• In fuzzy logic, everything is a matter of degree• In fuzzy logic, knowledge is interpreted a

collection of elastic or, equivalently, fuzzy constraint on a collection of variables

• Inference is viewed as a process of propagation of elastic constraints

• Any logical system can be fuzzified

Page 11: Soft computing Lecture 5

Advantages of fuzzy logic (systems)

• Fuzzy systems are suitable for uncertain or approximate reasoning, especially for the system with a mathematical model that is difficult to derive.

• Fuzzy logic allows decision making with estimated values under incomplete or uncertain information.

Page 12: Soft computing Lecture 5

HOW IS FL DIFFERENT FROM

CONVENTIONAL CONTROL METHODS?

FL incorporates a simple, rule-based IF X AND Y THEN Z approach to a solving control problem rather than attempting to model a system mathematically.The FL model is empirically-based, relying on an operator's experience rather than their technical understanding of the system. For example, rather than dealing with temperature control in terms such as "SP =500F", "T <1000F", or "210C <TEMP <220C", terms like "IF (process is too cool) AND (process is getting colder) THEN (add heat to the process)" or "IF (process is too hot) AND (process is heating rapidly) THEN (cool the process quickly)" are used. These terms are imprecise and yet very descriptive of what must actuallyhappen. Consider what you do in the shower if the temperature is too cold: you will make the water comfortable very quickly with little trouble. FL is capable of mimicking this type of behavior but at very high rate.

Page 13: Soft computing Lecture 5

HOW DOES FL WORK? FL requires some numerical parameters in order to operate such as what is considered significant error and significant rate-of-change-of-error,but exact values of these numbers are usually not critical unless veryresponsive performance is required in which case empirical tuning would determine them. For example, a simple temperature control system could use a single temperature feedback sensor whose data is subtracted from the command signal to compute "error" and then time-differentiated to yieldthe error slope or rate-of-change-of-error, hereafter called "error-dot". Error might have units of degs F and a small error considered to be 2F while a large error is 5F. The "error-dot" might then have units of degs/min with a small error-dot being 5F/min and a large one being 15F/min.These values don't have to be symmetrical and can be "tweaked" once the system is operating in order to optimize performance. Generally, FL is so forgiving that the system will probably work the first time without any tweaking.

Page 14: Soft computing Lecture 5

The World's First Fuzzy Logic ControllerIn England in 1973 at the University of London, a professor and student were trying to stabilize the speed of a small steam engine the student had built.   They had a lot going for them, sophisticated equipment like a PDP-8 minicomputer and conventional digital control equipment.   But, they could not control the engine as well as they wanted.   Engine speed would either overshoot the target speed and arriveat the target speed after a series of oscillations, or the speed control would be too sluggish, taking too long for the speed to arrive at the desired setting, as in Figure 1, below.

Page 15: Soft computing Lecture 5

Professor Mamdani and the student, S. Assilian, decided to give fuzzy logic a try.   They spent a weekend setting their steam engine up with the world's first ever fuzzy logic control system ....... and went directly into the history books by harnessing the power of a force in use by humans for 3 million years, but never before defined and used for the control of machines. The controller worked right away, and worked better than anything they had done with any other method.   The steam engine speed control graph using the fuzzy logic controller appeared as in Figure 2, below.

Page 16: Soft computing Lecture 5
Page 17: Soft computing Lecture 5

To create a personal computer based fuzzy logic control system, we:

1. Determine the inputs.2. Describe the cause and effect action of the system with

"fuzzy rules" stated in plain English words.3. Write a computer program to act on the inputs and

determine the output, considering each input separately.   The rules become "If-Then" statements in the program.   (As will be seen below, where feedback loop control is involved, use of graphical triangles can help visualize and compute this input-output action.)

4. In the program, use a weighted average to merge the various actions called for by the individual inputs into one crisp output acting on the controlled system.   (In the event there is only one output, then merging is not necessary, only scaling the output as needed.)

Page 18: Soft computing Lecture 5

Following is a system diagram, Figure 3, for a "getting acquainted with fuzzy“ project that provides speed control and regulation for a DC motor.   The motor maintains "set point" speed, controlled by a stand-alone converter-controller, directed by a BASIC fuzzy logic control program in a personal computer.

Page 19: Soft computing Lecture 5

Parts List

1. IBM or compatible personal computer equipped to run Microsoft Quick BASIC.   IBM is a registered trademark of IBM Corporation.   Microsoft and Quick BASIC are registered trademarks of Microsoft, Inc.

2. 8 channel input; 8 bit, analog/digital converter with 8 on-off, digital output channels and one 8 bit digital/analog output channel.

3. Signal conditioner (transistor amplifier to adjust levels as needed)

4. Transistor - 2N3053.5. DC motor, 1.5 V to 3.0 V, 100 ma., 1100 Rpm to 3300

Rpm.

Page 20: Soft computing Lecture 5

The steps in building our system are:1. Determine the control system input.   Examples:   The temperature is

the input for your home air conditioner control system.   Speed of the car is the input for your cruise control. In our case, input is the speed in Rpm of the DC motor, for which we are going to regulate the speed.   See Figure 3 above.   Speed error between the speed measured and the target speed of 2,420 Rpm is determined in the program.   Speed error may be positive or negative.   We measure the DC output voltage from the generator.   This voltage is proportional to speed.   This speed-proportional voltage is applied to an analog input channel of our fuzzy logic controller, where it is measured by the analog to digital converter and the pesonal computer, including appropriate software.

2. Determine the control system output.   For a home air conditioner, the output is the opening and closing of the switch that turns the fan and compressor on and off.   For a car's cruise control, the output is the adjustment of the throttle that causes the car to return to the target speed. In our case, we have just one control output.   This is the voltage connected to the input of the transistor controlling the motor.   See Figure 3.

3. 3.   Determine the target set point value, for example 70 degrees F for your home temperature, or 60 Miles per hour for your car. In our case, the target set point is 2,420 Rpm.

4. Choose word descriptions for the status of input and output.

Page 21: Soft computing Lecture 5

For the steam engine project, Professor Mamdani used the following for input:•Positive Big•Positive Medium•Positive Small•Almost No Error•Negative Small•Negative Medium•Negative BigOur system is much less complicated, so let us select only three conditions for input:Input Status Word Descriptions•Too slow•About right•Too fastAnd, for output:•Output Action Word Descriptions•Speed up•Not much change needed•Slow down

RULES:Rule 1: If the motor is running too slow, then speed it up.Rule 2: If motor speed is about right, then not much change is needed.Rule 3: If motor speed is to fast, then slow it down.

Page 22: Soft computing Lecture 5

5.   Associate the above inputs and outputs as causes and effect with a Rules Chart, as in Figure 4, below.   The chart is made with triangles,the use of which will be explained.   Triangles are used, but other shapes, such as bell curves, could also be used.   Triangles work just fine and are easy to work with.   Width of the triangles can vary.   Narrow triangles provide tight control when operating conditions are in their area.   Wide triangles provide looser control.   Narrow triangles are usually used in the center, at the set point (the target speed).   For our example, there are three triangles, as can be seen in Figure 4 (three rules, hence three triangles).

Page 23: Soft computing Lecture 5
Page 24: Soft computing Lecture 5

6.   Figure 4 (above) is derived from the previously discussed Rules and results in the following regarding voltage to the speed controller:

a.   If speed is About right then Not much change needed in voltage to the speed controller.

b.   If speed is Too slow then increase voltage to the speed controller to Speed up.

c.   If speed is Too fast then decrease voltage to the speed controller to Slow down.

7.   Determine the output, that is the voltage that will be sent from the controller/signal conditioner/transistor to the speed controlled motor.   This calculation is time consuming when done by hand, as we will do below, but this calculation takes only thousandths of a second when done by a computer.

Page 25: Soft computing Lecture 5

Assume something changes in the system causing the speed to increase from the target speed of 2,420 Rpm to 2,437.4 Rpm, 17.4 Rpm above the'set point." Action is needed to "pull" the speed back to 2,420 Rpm.   Intuitively we know we need to reduce the voltage to the motor a little.   The "cause" chart and vertical speed line appear as follows, see Figure 5 below:      

                                                                                                                                                                       

The vertical line intersects the About right triangle at .4 and the Too fast triangle at .3.   This is determined by the ratio of sides of congruent triangles from Plane Geometry:Intersect point / 1 = 11.6/29 = .4Intersect point / 1 = 17.4/58 = .3

Page 26: Soft computing Lecture 5

The next step is to draw "effect" (output determining) triangles with theirheight "h" determined by the values obtained in Step 7, above.   The trianglesto be drawn are determined by the rules in Step 6.   Since the vertical 2,437.4 Rpm speed line does not intersect the Too slow triangle, we do not draw the Speedup triangle.   We draw the Not much change and the Slow down triangles because the vertical speed line intersects the About right and Too fast triangles.  These "effect" triangles will be used to determine controller output, that is the voltage to send to the speed control transistor.   The result is affected by the widths we have given the triangles and will be calculated.   See Figure 6, below.   The Not much change triangle has a height of .4 and the Slow downtriangle has a height of .3, because these were the intersect points for their matching "cause" triangles; see Figure 4, above.                                      

Page 27: Soft computing Lecture 5

The output, as seen in Figure 6 (above), is determined by calculating the point at which a fulcrum would balance the two triangles, as follows:The Area of the Not much change triangle is:1/2 X Base X Height = .5 X .04 X .4 = .008.   Area of the Slow down triangle is .5 X .08 X .3 = .012.Compute the controller output voltage by finding the point on the output voltage, Vdc, axis where the "weight" (area) of the triangles will balance.   Assume all the weight of the Not much change triangle is at 2.40 Vdc and all the weight of the Slow down triangle is at 2.36 Vdc.   We are looking for the balance point.Find the position of the controller output voltage (the balance point) with the following calculation:(Eq.   1)   .008 X D1 = .012 X D2(D1 is the fulcrum distance from 2.4 V. D2 is the fulcrum distance from 2.36 V.)(Eq.   2)  D1 + D2 = .04 (from Figure 6)D1 = .04 - D2Solving the above by substituting (.04-D2) for D1 in Equation 1 givesD2 = .016 and D1 = .024, therefore the balance point is a voltage of 2.376 Vdc, and this is the voltage which we have determined should be applied to return speed to the target value.   See Figure 6, above.

Page 28: Soft computing Lecture 5

The portion of the program for the above system which examines the input and performs the "triangle" calculations to arrive at a crisp output follows:910 IF MS = 2420 THEN MIV = 2.4 : GOTO 5000 'MS-MEASURED SPEED, MIV-MOTOR INPUT VOLTAGE920 IF MS < 2420 THEN 2000 ELSE 10001000 ' LINES 1010-1110; GREATER THAN 2420 RPM, SLOW DOWN1010 IF MS > 2449 THEN MIV = 2.36 : GOTO 50001020 ' COMPUTE INTERSECT POINT, IPA, FOR 'ABOUT RIGHT' TRIANGLE1030 IPA = (2449-MS) / 291040 IF IPA =< 0 THEN IPA = .00011050 ' COMPUTE INTERSECT POINT, IPS, FOR 'SLOW DOWN' TRIANGLE1060 IPS = (MS-2420) / 581070 ' COMPUTE MOTOR (TRANSISTOR) INPUT VOLTAGE (MIV)1080 AAR = .5 * .04 * IPA 'AAR - AREA OF 'ABOUT RIGHT' TRIANGLE1090 ASD = .5 * .08 * IPS 'ASD - AREA OF 'SLOW DOWN' TRIANGLE1100 D1 = .04 * (ASD / (ASD+AAR))1110 MIV = 2.4 - D1 : GOTO 50002000 ' LINES 2010-2110; LESS THAN 2420 RPM, SPEED UP2010 IF MS < 2362 THEN MIV = 2.44 : GOTO 50002020 ' COMPUTE INTERSECT POINT, IPA, FOR 'ABOUT RIGHT 'TRIANGLE2030 IPA = (MS-2391) / 292040 IF IPA =< 0 THEN IPA = .00012050 ' COMPUTE INTERSECT POINT, IPF, FOR 'SPEED UP' TRIANGLE2060 IPF = (2420-MS) / 58 2070 ' COMPUTE MOTOR INPUT VOLTAGE (MIV)2080 AAR = .5 * .04 * IPA 'AAR - AREA OF 'ABOUT RIGHT 'TRIANGLE2090 ASU = .5 * .08 * IPF 'ASU - AREA OF 'SPEED UP' TRIANGLE2100 D1 = .04 * (ASU / (ASU+AAR))2110 MIV = 2.4 + D15000 '

Page 29: Soft computing Lecture 5

Applications

Page 30: Soft computing Lecture 5
Page 31: Soft computing Lecture 5
Page 32: Soft computing Lecture 5