Fuzzy Neural Control Systems — Explained
While engineers in the controls community have been busy migrating from traditional electromechanical and analog electronic control technologies to digital mechatronic control systems incorporating computerized analysis and decision-making algorithms, novel computer technologies have appeared on the horizon that may change things even more.
While engineers in the controls community have been busy migrating from traditional electromechanical and analog electronic control technologies to digital mechatronic control systems incorporating computerized analysis and decision-making algorithms, novel computer technologies have appeared on the horizon that may change things even more. Neural networks and fuzzy logic are already being applied, and may soon revolutionize how machine control systems are designed and programmed.
Traditional computers have von Neumann architecture, which is based on sequential processing and execution of explicit instructions. Artificial neural networks (ANNs), on the other hand, rely on a non-Von Neumann architecture. They are made up of extremely simple processing units combined in a massively parallel system following implicit instructions based on recognizing patterns in data inputs from external sources.
Fuzzy logic similarly turns conventional wisdom on its head. Instead of information consisting of precise measurements quantifying position along uniquely defined dimensions (such as a “temperature of 23
Computers (or, more accurately “inference engines”) using these concepts are proving agile at conquering control-system challenges that leave conventional systems helpless.
Artificial neural network (ANN) is, according to Wikipedia, “an interconnected group of artificial 'neurons’ that uses a mathematical model or computational model for information processing based on a connectionist approach to computation.”
In most cases, an ANN is an adaptive system that changes its structure based on external or internal information that flows through the network. Most usefully, ANNs model complex relationships between inputs and outputs or find patterns in data, rather than producing numerical results based on numerical inputs.
Simple nodes (called variously “neurons,” “neurodes,” “processing elements,” or “units”) are connected together to form a network of nodes. Their usefulness derives from their ability to embody inferential algorithms that alter the strengths or weights of the network connections to produce a desired signal flow.
Most interesting is the possibility of learning, which in practice means optimizing some quantity, often called the “cost,” that represents the appropriateness of the result given the problem context.
For example, the cost in the classic traveling salesman problem is the time required to make a complete circuit of the sales territory, making stops at all the required locations and arriving at the starting point. A shorter route provides a better solution.
To solve this problem, Von Neumann computers must identify all possible routes, then separately follow each route in turn, adding the time delays to determine the sum for that route. After calculating the totals for all possible routes, the computer simply picks the shortest one.
In this example artificial neural network, the variable, h, a three-dimensional vector, depends on x, the input variable. Then g, a two-dimensional vector variable, depends on h, and finally, f, the output variable, depends on g.
ANNs, on the other hand, look at all the routes in parallel to find patterns that minimize the total route time. Applying those patterns then minimizes the resulting route. Learning consists of determining the patterns that experience shows to provide route-optimizing strategies.
Fuzzy logic (again according to Wikipedia) is derived from fuzzy set theory, which deals with reasoning that is approximate rather than precise. Fuzzy truth represents membership in vaguely defined sets. Fuzzy logic can make decisions based on imprecisely defined, but still very important, characteristics. Fuzzy logic allows for set membership values ranging (inclusively) between 0 and 1, and for imprecise concepts like “slightly,” “quite,” and “very.” Specifically, it allows partial membership in a set.
A basic application might characterize subranges of a continuous variable. For instance, a temperature measurement for anti-lock brakes might have several separate membership functions defining particular temperature ranges needed to control the brakes properly. Each function maps the same temperature value to a truth value in the 0 to 1 range. These truth values can then be used to determine how the brakes should be controlled.
An ANN making decisions based on fuzzy logic can create a powerful control system. It is obvious that the two concepts work well together: an inference algorithm with three fuzzy states (cold, warm, hot for example) might be implemented in hardware by using the truth values (0.8, 0.2, 0.0) as inputs into three neurons, each representing one of the three sets. Each neuron would then apply a function to its input value to obtain an output value, which would then be inputs for a second tier of neurons, etc.
A neural network image processor, for example, can free applications from numerous constraints in terms of video acquisition, lighting and hardware settings. This degree of freedom is possible because a neural network lets you build an engine by learning examples. As a result, it can be trained to recognize good or bad parts under bright and dark lighting conditions, positioned in different orientations, etc. The inference engine starts by “evaluating” the lighting conditions (in other words, assigning affinity values for different lighting conditions that the system knows how to deal with), then applying criteria based on those lighting conditions to make judgements about the image content. Because the system treats lighting conditions as fuzzy concepts, the inference engine naturally interpolates between known conditions to deal with novel conditions.
The more examples the system learns, the more expert the engine becomes. It can be quite easy to automate this learning process by, for example, pre-sorting parts into similar-category sets for the purpose of learning to spot similarities and differences. Those observed similarities and differences can then inform an ANN whose task is to sort incoming parts into those categories. The key to success is shifted from the cost of equipment to a number of images necessary to train and build a robust engine.
A neural network image processor is appropriate for applications where diagnostics rely on the experience and expertise of an operator, rather than models and algorithms. The processor can build a recognition engine from simple image annotations made by an operator, then extract characteristics or feature vectors from the annotated objects and send them to the neural network. Feature vectors characterizing visual objects can be as simple as raw pixel values, a histogram or distribution of intensities, intensity profiles, or gradients along relevant axes. More advanced features can include components from wavelet and FFT transforms.
In this image, cold, warm and hot are sets spanning a temperature scale. A point on that scale has three "truth values"--one for each of the three sets--that indicate relative "affinity" for each set. For the particular temperature shown, the three truth values (o.8, 0.2, 0.0) could be interpreted as describing the temperature as, say "fairly cold," "slightly warm," and "not hot."
Once taught with examples, a neural network is capable of generalization and can classify situations never seen before by associating them to similar learned situations. On the other hand, if an engine has the tendency to be too liberal and over-generalize situations, it can be corrected at any time by teaching it counter examples.
From a neural network standpoint, this operation consists of reducing the influence fields of the existing neurons to accommodate new examples that conflict with the existing decision space mapping.
The key to ANN acceptance is unsupervised and adaptive learning. This means that a device must be capable of learning an object with a minimum of, or no, intervention from an operator. Dolls of the future, for example, might have the ability to learn the face of the child unwrapping them for the first time, and to ask the child’s name. Unsupervised learning for a cellular phone might consist of learning the fingerprint of its first-time owner. The owner’s authentication can also be reinforced by combining face, fingerprint and voice recognition on the same device.
In the context of unsupervised learning, the device has to build its own recognition engine that will work best for its operating environment. For example, the intelligent doll has to recognize its first-time owner, whatever her skin and hair color, the location and season of the year.
At first, the engine must use all the feature extraction techniques it knows. It will generate a series of sub-engines, each intended for the identification of the same categories of objects, but based on the observation of different features (color, graininess, contrast, edge density, etc). The global engine can then evaluate the sub-engines, selecting those that give the best throughput and/or accuracy.
Fish sorting example
Pisces VMK manufactures fish processing equipment for on-board and off-shore facilities. Its customers are fish processing ships performing year-around expeditions for a variety of fish species in the North Sea and Atlantic Ocean. These users want to fill their holds as fast as possible with the highest quality catch using minimum personnel.
Typically, fish are brought onboard the boat via nets, and dropped into pockets along a conveyor line that carry them through cleaning, cutting and filleting machines. Anomalies include wrong species, damaged fish, the presence of more than one fish in a pocket, and improper positioning of a fish before it goes to the cutting machine. This type of inspection is not easy to deploy with conventional image processing tools since the size, shape and scales of fish are difficult to model mathematically. Furthermore, their aspect can change depending on the location of the expedition and the season.
Pisces has installed over 20 systems based on the Iris smart camera from Matrox and the CogniSight recognition engine from General Vision. The camera is mounted above the conveyor so that fish pass it just before reaching the filleting machine. It is connected to a Siemens Simatic S7-224 CPU programmable logic controller (PLC) and a local area network (LAN). A strobe light installed next to the camera is triggered each time a new pocket appears in its field of view. The camera connection to the LAN is necessary for three operations: the sensor setup to ensure that the image is focused and well contrasted, training the recognition engine, and access to statistics reporting continuously the number of acceptable and non-acceptable fish.
Sensor setup occurs only once: at the time of camera installation inside its water-proof enclosure. The training operation occurs at the beginning of each new expedition by teaching examples with the first fish caught, or by loading a pre-existing knowledge file.
As soon as the camera has a knowledge base, it can start recognizing fish autonomously, with no connection to a PC. The ANN sorts them into accept, reject, recycle, or empty categories. This signal goes to the PLC, which controls two brushes sending appropriate fish to reject or recycle bins. The PLC is also interfaces to a magnetic sensor which generates an acquisition trigger every time it detects a pocket passing in front of the camera.
Pisces has presently installed over 20 systems on 5 different fleets in Norway, Iceland, Scotland and Denmark. The system inspects 360 conveyor pockets per minute on the herring lines, but can go faster. It achieved 98% accuracy while classifying 16 tons of fish using 80 neurons. The fishermen love it because of its reliability, flexibility and ease of use. Their benefits are shorter expeditions, higher quality catch and revenues shared by fewer fishermen.
In discrete manufacturing environments, neural networks have found application to vehicle control, pattern recognition for radar systems, face identification, object recognition, handwritten text, and recognition of gestures and speech.
Fuzzy logic has already been applied to control automobile and other vehicle subsystems, such as automatic breaking systems (ABS) and cruise control, air conditioners, cameras, digital image processing, video game artificial intelligence, and pattern recognition in remote sensing systems.
Such “soft computing” techniques also have been used to build a reliable battery charger for breathing apparatus (see page XX). In the continuous and batch process industries, fuzzy logic and neural networks are at the heart of some self-tuning controllers. Some microcontrollers and microprocessors are even optimized for fuzzy logic processing, so the systems can run even faster (see “Fast fuzzy logic for real-time control,” below.)
C. G. Masi is senior editor with Control Engineering . He can be reached at firstname.lastname@example.org .
Fast fuzzy logic for real-time control
While any MCU or computer can implement fuzzy logic algorithms in software, this tends to be inefficient on typical digital computers or MCUs—requiring a lot of program space and execution time. Jim Sibigtroth, systems engineer for automotive products in the Microcontroller Division of Freescale Semiconductor’s Transportation and Standard Products Group, says that the company’s HC12 and HCS12 microcontrollers solve this problem by adding four instructions specifically designed to implement the main parts of a fuzzy logic inference engine very efficiently.
“The main program for a general-purpose fuzzy logic inference engine that processes un-weighted rules takes about 57 bytes of object code (about 24 lines of assembly code),” he says.
He points out that a 25 MHz HCS12 can execute a full inference sequence for a 2-input, 1-output system with seven labels for each input and each output in about 20μs. An equivalent program in an 8 MHz MC68HC11 (without the fuzzy-logic instructions) would take about 250 bytes of object code and about 750 μs to execute. Even if the MC68HC11 could run as fast as the HCS12, the fuzzy logic instructions still make the program better than 4 times smaller and 12 times faster. These fast inference times allow fuzzy logic to be used in real time control applications without expensive computing hardware or large programs.