Login | Register
Print page
Email page

Home » Warm and Fuzzy

Warm and Fuzzy

Ernst Dummermuth

Fuzzy logic can be an effective way to extend traditional binary logic. A heater control application helps demonstrate the method

 

Programmable logic controllers (PLCs) and ladder logic programming have enjoyed wide acceptance in the discrete manufacturing and process industries since their introduction during the '70s.

Perhaps less-well-known is the manner by which ladder logic can be transitioned to fuzzy logic. There often are clear benefits to using fuzzy logic instead of more conventional methods of control. Like ladder logic, fuzzy logic is also a type of rule-form logic. It has been developed to solve problems that are difficult to define or model with ladder logic.

Each rung in a ladder logic program represents a discrete or binary logic equation. On the far right side of each rung is a symbol indicating the output condition. This condition is set depending on the outcome of the "IF" conditions represented by all of ladder logic symbols to the left of the output symbol. Thus the far right side symbol signifies the "THEN" result generated by combining all of the left side IF symbols.

ADVERTISEMENT

With fuzzy logic structure, membership functions are used to describe how much "truth" a given input has in a condition statement. The amount of truth is expressed as a value from 0 to 1. IF-THEN rules are used to determine final output values.

Fuzzy logic is a natural extension to binary logic for industrial controls, but to use it properly requires an understanding of practical control considerations, fuzzy logic design tools, and how the control system behaves under various conditions.

Binary Thinking

Binary logic is limited to the two on-off states of 0 and 1, but it is still quite easy to write logic equations to implement control of a three-stage heater, as shown in Figure 1. In this example, the heater has three settings: NO POWER TO HEATER, SOME POWER TO HEATER, and FULL POWER TO HEATER. This is shown using the variable names HEATER.COLD, HEATER.WARM and HEATER.HOT. Each of these settings corresponds to an output coil in a rung of ladder logic and has an associated variable name as shown. Note that the word HEATER is used in the names of the three output variables to indicate that each output variable controls a degree of heating.

The ladder program in Figure 1 describes control of a three-stage heater with sensor feedback inputs of pressure (PRESS) and temperature (TEMP). Note that the output variable HEATER can assume three discrete levels: COLD, WARM, and HOT.

Figure 1: Control By The Rungs

A three-stage heater control with pressure and temperature

feedback inputs is described via three rungs in ladder logic.

Rung 1 of Figure 1 shows there is no power to the heater (HEATER.COLD is true) if either the pressure is high or the temperature is high. If both pressure and temperature are high there is also no power to the heater. If we associate a 1 with a true condition and a 0 with a false condition, then Rung 1 can be expressed as the Binary OR truth table shown in Figure 2.

In a similar manner, Rungs 2 and 3 can be expressed as logical AND statements and represented by the truth table labeled Binary AND, shown in Figure 2. Note that in the OR logic statement the variable with the largest value (maximum) controls the output, while in the AND logic statement the variable with the smallest value (minimum) controls the output.

Analog Thinking

Referring again to Figure 1, the binary parallel contacts PRESS.HIGH and TEMP.HIGH in Rung 1 could be replaced by analog sensor inputs connected in parallel as shown in Rule 1 of Figure 3. Rung 1 in Figure 1 is converted to Rule 1 in Figure 3 because ladder logic rungs are similar to fuzzy logic rules.

In Figure 1, if the pressure is HIGH or if the temperature is HIGH, then the output is fully energized and there is no power provided to the heater. If we use analog sensor inputs as shown in Figure 3, the temperature and pressure can now be expressed as analog values. In this example, the temperature high test provides a value of 0.8 and the pressure high test provides a value of 0.0.

Note that the raw analog values provided by the sensors have to be mapped against the defined membership functions of the fuzzy controller. The result of this mapping then yields the input values for the fuzzy rules. This mapping process is called fuzzification, and is explained below.

Figure 2: The Truth Is In The Table

Binary and fuzzy logic truth tables describe the conditions

depicted in Figure 1.

The output value for Rule 1 of Figure 3 is generated from the Fuzzy OR table in Figure 2. As with a Binary OR table, the larger of the input values in the Fuzzy OR table equals the output value, so the output value is 0.8. This truth table result is shown as the output value of Rule 1 in Figure 3.

The digital values in rungs 2 and 3 of Figure 1 can also be replaced by analog values as shown in rules 2 and 3 in Figure 3. These analog values can then be inserted in a Fuzzy AND table as shown in Figure 2.

Note that serial inputs are solved by an AND truth table, while parallel inputs are solved by an OR truth table. This is true for both ladder logic rungs and fuzzy logic rules.

In the Binary AND truth table as well as in the Fuzzy AND truth table, the smallest of the input values equals the output value, so the output value is 0.2 for Rule 2 and 0.0 for Rule 3. These truth table results are shown as the Rule 2 and Rule 3 outputs in Figure 3.


More content on this topic:

Free Subscriptions

Control Design Digital Edition

Access the entire print issue on-line and be notified each month via e-mail when your new issue is ready for you. Subscribe today.