Warm and Fuzzy Binary Logic

A Heater Control Application Helps Demonstrate Its Effectiveness

By Ernst Dummermuth

1 of 3 < 1 | 2 | 3 View on one page

We celebrated our 15th anniversary last year by republishing some of our more timeless content. It was really well received, so we decided to do it again from time to time. Here's a tutorial article that we first published in November 2003. This is one of several that Ernst Dummermuth wrote for us that generated a large number of views on ControlDesign.com for years after we first posted it, and which still draws attention today.

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

SEE ALSO: Algebraic Solution Beats Fuzzy Logic

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.

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.

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 it's explained below.

1 of 3 < 1 | 2 | 3 View on one page
Show Comments
Hide Comments

Join the discussion

We welcome your thoughtful comments.
All comments will display your user name.

Want to participate in the discussion?

Register for free

Log in for complete access.

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments