F UZZY L OGIC A LGORITHMS

F UZZY L OGIC A LGORITHMS

Fuzzy logic modules work with other modules to input and output process information according to fuzzy control algorithms. These algorithms are based on user-programmed rules, which are formed by IF conditions and THEN actions . A fuzzy module analyzes its inputs according to the IF conditions and then outputs control data according to the corresponding THEN action. For example, the temperature-sensing fuzzy logic algorithm shown in Figure 8-38 might have a rule stating that IF the input temperature is 75 °

F, THEN its level of acceptability is 0.5, so turn the output’s controlling element (e.g., a servo valve) a little clockwise (perhaps 10 degrees to the right). The fuzzy algorithm determines how much the “little” amount is when the output is generated.

IF the temperature equals 75˚F

THEN turn the output’s controlling element a little clockwise Figure 8-38. Example of a fuzzy logic algorithm.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

Fuzzy logic control is even more practical when multiple rules exist. For example, a fuzzy I/O module may receive data from a field device measuring the input process temperature, as well as from a field device measuring the outside environmental temperature. In this case, the module could combine two rules to determine a more precise acceptability level, resulting in a more precise output action. For example, IF the input temperature is 75 ° F and IF the outside environmental temperature is 70 °

F, THEN the acceptability level is 0.63, so turn the control element a little less (perhaps 8 degrees) clockwise.

To provide reasoned control of a field device, a fuzzy logic module analyzes its rules according to its graphic function and then assigns each rule a grade to form what are known as membership functions. Membership functions classify input data and group the data into sets of values called fuzzy sets. A rule’s grade indicates how well it fits into the membership function. The number of membership functions depends on the complexity of the control task and the number of inputs to the module.

Each membership function has labels associated with it. For instance, the membership function shown in Figure 8-39 has three labels: cool, nice, and hot. Thus, the rule “IF the temperature equals 65 ° F” has a grade of 0.5 cool and 0.5 nice, indicating that it is not totally nice but that it is not totally cool either. The same applies to the temperature 75 °

F, except that it is half nice and half hot. These grades are part of the control algorithm’s fuzzy set, which is used to determine the control output. As we will explain in Chapter 17, a fuzzy set composed of several membership function may use up to seven labels to implement its rules.

Not Nice

Grade 0.5 Cool

60˚F 65˚F 70˚F

80˚F 90˚F

Temperature ˚F (Input)

A reading of 65˚F will have a grade of 0.5 nice temperature (50%) and 0.5 cool temperature (50%).

Figure 8-39. Membership functions used to create a grade.

Fuzzy logic interfaces allow the user to program the criteria for membership functions and fuzzy sets inside the module according to the control task requirements. A fuzzy module can be programmed through its serial port RS- 232C serial port via a personal computer with specialized, manufacturer- provided fuzzy logic programming software.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

F UZZY L OGIC AND

I /O I NTERACTION

Figure 8-40 shows Omron Electronics’s Fuzzy Logic Unit (FLU), a fuzzy logic interface that can read process data from up to 8 input devices and write data to up to 4 output devices. This interface can perform up to 128 rules, each with a maximum of eight IF conditions and two THEN actions. The FLU, which works independently of the processor, can implement all of its fuzzy logic computations in 6 msec or less, thus providing fast implementation of fuzzy logic control.

Figure 8-40. Omron Electronics’s Fuzzy Logic Unit (FLU) in a C200H PLC system.

As shown in Table 8-2, Omron’s Fuzzy Logic Unit uses 10 words or registers of the programmable controller’s data table to store its control parameters. The rack position of the FLU module determines the registers’ addresses. Assuming that the placement of the module takes addresses 110 through 119, the module will use the addresses as follows:

• The first four bits (0–3) of the first word (word 110) contain, in BCD, the number of inputs that will be used with the FLU module. Bit 15 of this word turns on the fuzzy processing.

• The second word (word 111) specifies where the input data to be analyzed is stored in the PLC’s memory. It indicates the starting register address, with the length of the data block being the BCD number from word 110.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

( e . g . , a d d r e s s = 1 3 0 ) W o r d 1 1 4 : u s e d f o r f l a g s a n d s e t t i n g s W o r d s 1 1 5 – 1 1 9 : a v a li a b l e a s w o r k i n g w o r d a d d r e s s e s

Table 8-2. Omron’s FLU space requirements.

• Like the first word, the first four bits (0–3) of the third word (word

112) contain the number of outputs in BCD. • The fourth word (word 113) contains the starting address for the

storage of the output data, which is the result of the fuzzy logic computations. The length of the data block is the BCD number from word 112.

Because fuzzy logic modules work through other I/O interfaces, their input/ output data must be transferred from/to the word address locations of the I/O modules working with them. Figure 8-41 illustrates the memory addresses (words) used by the Omron FLU in the previous example, along with the register locations of the corresponding I/O devices’ input and output data.

8 Inputs

Fuzzy Unit

4 Outputs

Input data

bit 15 = 0 fuzzy processing OFF

Output data

to fuzzy unit

bit 15 = 1 fuzzy processing ON

from fuzzy unit

starting input

starting output

124 fuzzy logic

flags and setting

Contents of words

130–133 will contain

output results from fuzzy computing if word

112 contains 4 in BCD

Contents of words

120–127 will be used

as inputs for fuzzy computing if word 110 contains 8 in BCD

Figure 8-41. Memory addresses used by example FLU.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

Block transfer instructions can be used to transfer data between the I/O modules and the fuzzy module (see Figure 8-42). Chapter 17 explains more about fuzzy logic control.

8 Analog Input Module

4 Analog Output Module

Input Configuration Output

4 words max

Analog output

information of 4 channels is stored

8 words max Analog input information of 8 channels is stored

Figure 8-42. Data transfer between I/O modules and fuzzy module.