Washing eggs with fuzzy logic
18 March 2008
Arriving at a solution sometimes comes from learning a different way to express the problem.
Fuzzy logic has been around for more than forty years, so it isn’t anything new to the controls community.
Egg wash machine. Source: Rockwell Automation
Until recently its use has been primarily in the areas of advanced control or in certain embedded OEM applications, where extra performance is required. For example, most manufacturers of singleloop controllers include fuzzy logic as part of their control algorithms. Today, with the advent of sensors that can measure simple quantities that in the past could only be estimated by human operators, fuzzy logic shows new promise for manufacturing end users to solve common problems on the factory floor. For example, simple machine vision sensors today can give good estimates of how ‘clean’ or ‘dirty’ an incoming batch of eggs is, something that until now only an operator could do. For the most part, fuzzy logic doesn’t take us into a new domain of thinking. It is simply a method of transposing what is intuitively obvious to a human into a set of ‘if – then’ rules that a machine can follow.
It is especially useful when there are two or more uncorrelated activities taking place that together influence an outcome of a process. For example, an outcome such as baking bread might depend on the oven temperature (high, medium, low) and the speed of the conveyor belt (high, medium, low) is moving through the oven. Fuzzy logic introduces a mechanism called fuzzification for deciding how to describe to a machine what is meant by high, medium, and low, and then sets up a table of rules to cover all the possibilities, for example,
* IF (oven is high) and (conv. speed is high)...
* IF (oven is high) and (conv. speed is medium)...
* IF (oven is high) and (conveyor speed is low)...
and then three more possibilities with IF (oven is medium) and still three more with IF (oven is low). The interesting part is when the variables are in between the three possibilities; fuzzy logic has a way of describing these as, for example, 0.2 medium and 0.8 high (the two must sum to 1.0). Fuzzy logic doesn’t work with single values such as 2 metres/min or 70 degrees; it has to be a number that is shared by two or more sets. The challenge is to translate all this into something a PLC will understand.
Fuzzy function blocks
Rockwell Automation program manager Dave Carr and software project manager Jeff Shearer recently published a 45-page white paper exploring fuzzy logic and how it helps engineers solve nonlinear control problems. They present fuzzy logic as an intuitive way to design function blocks for intelligent control systems, advanced fault detection, and other complex applications.
Their paper, entitled Nonlinear Control and Decision Making Using Fuzzy Logic in Logix provides best practices for designing with fuzzy control and examines its benefits compared to conventional control methods. The document outlines the development of fuzzy logic algorithms for programmable controllers, using proprietary Rockwell software, including a ‘FuzzyDesigner’ package with fuzzy logic add-on instructions. The paper provides five case studies showing fuzzy logic solutions for realworld applications. By showing how the engineers translated the applications’ control requirements into fuzzy algorithms, the authors turn what can be a very abstract subject into something readers can apply to their control designs. Of course the final steps in each case show the input of parameters into Rockwell’s software, which is useful only if you have the package.
The first application case detailed in the white paper is the design of a fuzzy supervised egg washing operation. A human operator with a little training would know what to do. As fresh eggs pass by on a conveyor belt, he examines them and if they’re dirty, he washes them. If they’re only partly dirty, then he washes them a lesser amount. Here’s the catch: washing degrades the exterior of the egg shell, so the more washing he does, the more mineral oil he’ll have to spray on the eggs to restore their exteriors. So, he uses as little water as possible, washing them only by the amount that they need to be washed. He has one other thing to do: if the eggs don’t need any washing at all, then increase the conveyor speed to increase production.
For this problem, there are four input variables (the amount of dirt on the eggs, the conveyor speed, the amount of water being sprayed on the eggs, and the amount of mineral oil sprayed on the eggs) and three output, or control variables (conveyor speed change, water rate change, and mineral oil rate change). The output variables—speed and valve changes—can be either positive, negative, or zero. In this example these actual values for the output variables are not shown, but they indicate how to make these calculations in more advanced examples.
An experienced human operator would describe the control strategy by the following rules (the flow rate is for the water, and the position change is for the water valve)
1 IF (egg_dirt IS low) AND (flow_rate IS low) THEN (position_change IS zero)
2 IF (egg_dirt IS low) AND (flow_rate IS high) THEN (position_change IS negative)
3 IF (egg_dirt IS acceptable) THEN (position_change IS zero)
4 IF (egg_dirt IS high) AND (flow_rate IS low) THEN (position_change IS positive)
5 IF (egg_dirt IS high) AND (flow_rate IS high) THEN (position_change IS zero)
Notice that only rules 2 and 4 produce any change in the valve position; rule 2 closes the valve and rule 4 opens it. In the diagram ‘input-output mapping produced by the fuzzy system’ these results are clearly seen. When the flow rate is low and the egg dirt is high, rule 4 is invoked and the result is the high rate of change of the water valve, which is the bright orange peak in the far corner, indicated by ‘rule 4.’ The opposite is when the flow rate is high and the egg dirt is low: the system acts to close the valve, which is rule 2 in the near corner.
To download your copy of Nonlinear Control and Decision Making Using Fuzzy Logic in Logix please visit the White Papers section of the website
- article adapted from material prepared by C.G. Masi, Control Engineering
Contact Details and Archive...
Most Viewed Articles...