Design of a Simple Fuzzy Logic Control for Food Processing

The main objectives of the food process control are to maintain food safety, quality assurance, less processing time, and high production at minimum cost (Linko And Linko (1998). In the food industry, end-products must achieve a compromise between several properties, including sensory, sanitary and technological properties. Among the latter, sensory and sanitary properties are essential because they influence consumer choice and preference. Advanced process control techniques have been widely applied in the chemical, petrochemical and forest-based industries, after the apparently first computer-aided process control system was installed in 1959 in an oil refinery in Port Arthur, Texas (Johnson (1996), Anderson et al. 1994). In general, computerized control systems in the food industry have been recently comprehensively discussed Mittal (1997). There is no doubt that advanced, intelligent control techniques such as model-based, expert, neuro-fuzzy and hybrid control systems would offer particular advantages also in food and allied processes (Caro and Morgan(1991). Investments in automation, robotics, and advanced control techniques are likely to result in marked savings in costs, increased productivity, improved and more consistent product quality, and increased safety8. (Linko And Linko (1998).


Introduction
The main objectives of the food process control are to maintain food safety, quality assurance, less processing time, and high production at minimum cost (Linko And Linko (1998). In the food industry, end-products must achieve a compromise between several properties, including sensory, sanitary and technological properties. Among the latter, sensory and sanitary properties are essential because they influence consumer choice and preference. Advanced process control techniques have been widely applied in the chemical, petrochemical and forest-based industries, after the apparently first computer-aided process control system was installed in 1959 in an oil refinery in Port Arthur, Texas (Johnson (1996), Anderson et al. 1994). In general, computerized control systems in the food industry have been recently comprehensively discussed Mittal (1997). There is no doubt that advanced, intelligent control techniques such as model-based, expert, neuro-fuzzy and hybrid control systems would offer particular advantages also in food and allied processes (Caro and Morgan(1991). Investments in automation, robotics, and advanced control techniques are likely to result in marked savings in costs, increased productivity, improved and more consistent product quality, and increased safety8. (Linko And Linko (1998).

Fuzzy logic control for food processing
There is a collection of papers that are written in the topic of "fuzzy logic and the quality control of the food" classified by Perrot et al. (2006) . Only forty of which are on the subject of Supervision Decision help system control. Most of them are classical applications of the Takagi-Sugeno controller, such as Linko et al. (1992) for extrusion cooking, Zhang and Litchfield (1993) for drying, Norback (1994) for cheese-making, Alvarez et al. (1999) for controlling isomerizes hop pellet production, Honda et al. (1998) for controlling the sake brewing process, and O' Connor et al. (2002)for controlling the brewing process. Guillaume et al. (2001) optimized a fuzzy rule basis using a genetic algorithm to establish a decision support system for the cheese-making process. Davidson et al.(1999) developed a fuzzy control system for continuous cross flow in which he used a fuzzy arithmetic that estimates the browning of peanut roasting. Perrot et al. ( 2000) proposes a fuzzy logic approach to control the quality of the biscuits in an industrial tunnel oven, Voos et al. ( 1998)develops a fuzzy control of a drying process in the sugar industry based on operator experience, and www.intechopen.com Curt et al. (2002) develops five Takagi-Sugeno modules to control the quality of the sausage during ripening. It is also used to perform supervisory tasks such as Acosta-Lazo et al. (2001)for the supervision of a sugar factory. Perrot et al. (2004) developed a decision help system to control the cheese ripening process, integrating the uncertainty of human measurements. Petermeier et al. (2002) used a hybrid approach to develop a model of the fouling behavior of an arbitrary heat treatment device for milk. This is developed by combining deterministic differential equations with cognitive elements for the unknown parts of the knowledge model. These authors emphasize the relevance of this open field of research in the context of food processes and the interest of fuzzy symbolic representation of expert reasoning. Nevertheless, they call into question the optimality of the approaches developed on the basis of imperfect and incomplete expert knowledge.
More papers emphasized on the application of control techniques such as Kupongsak and Tan (2006) who applied fuzzy set and neural network techniques to determine food process control set points for producing products of certain desirable sensory quality. The results demonstrated a great potential of the fuzzy set concept and neural network techniques in sensory quality-based food process control. Soares et al. (2010) applied high performance nonlinear fuzzy controllers for a soft real-time operation of a drying machine. All the criteria evaluation used for controller's performance analysis for several steps tracking tasks has showed much better performance of the fuzzy logic controller. The absolute errors were lower than 8,85 % for Fuzzy Logic Controller, about three times lower than the experimental results. Omid (2011) Designed an expert system for sorting pistachio nuts through decision tree and fuzzy logic classifier The correct classification rate and root mean square error RMSE for the training set were 99.52% and 0.07, and for the test set were 95.56% and 0.21, respectively. These encouraging results as well as the robustness of the FIS based expert system makes the approach ideal for automated inspection systems. A prototype-automated system for visual inspection of muffins was developed by Zaid et al. (2000). The automated system was able to correctly classify 96% of regarded and 79% of ungraded muffins. The algorithm procedure classified muffins to an accuracy of greater than 88%, compared with 20_30% variations in quality decisions amongst inspectors. Podržaj and Jenko (2010) found out that temperature control based on fuzzy logic is suitable for processes in which a high degree of precision is required. Research conducted by Venayagamoorthy et al. (2003) has shown that the fuzzy logic controller augmenting the conventional P and PI controller does control more efficiently the industrial food processing plant with respect to set point tracking and disturbance rejection. Turing a predictive fuzzy logic controller for resin manufacturing the predictive FLC scheme is found to be highly useful and satisfactory in controlling an exothermic process. Nagarajan et al. (1998).

Food processing control
Some unique aspects of food processing problems: Managing the properties of food starting from the input stage with the aim of controlling them is not an easy task for several reasons (Perrot et al. (2006), Welti et al. 2002):


There are many parameters in food industry that must be taken into consideration in parallel. A single sensory property like color or texture can be linked individually to several dimensions recorded by the human brain.


The food industry works with non-uniform, variable raw materials that, when processed, should shaped into a product that satisfies a fixed standard.  The process control of foods are highly non-linear and variables are coupled.  Little data are available in traditional manufacturing plants that produce, for example, sausage or cheese and this situation is applies to most food processing industry.  In addition to the temperature changes during a heating or cooling process, there are biochemical (nutrient, color, flavor, etc.) or microbial changes that should be considered.  The moisture in food is constantly fluctuating either loss or gain throughout the process which can affect the flavor, texture, nutrients concentration and other properties.  Other properties of foods such as density, thermal and electrical conductivity, specific heat, viscosity, permeability, and effective moisture diffusivity are often a function of composition, temperature, and moisture content, and therefore keep changing during the process.


The system is also quite non-homogeneous. Such detailed input data are not available.  Often, irregular shapes are present.

Design of fuzzy logic control system
In most process control problems, it is relatively easy to design a PID controller, merging fuzzy rules into the system produces many extra design alternatives, and despite the availability of publications on fuzzy control on food processing, there are few general guidelines for setting the parameters of a simple and practical fuzzy controller.
The approach here is based on a three step design procedure, that builds on PID control Jantzen (1998): 1. Start with a PID controller. 2. Insert an equivalent, linear fuzzy controller. 3. Make it gradually nonlinear.

Start with a PID controller
The term control in engineering refers to a discipline whose main interest is to solve problems of regulating and controlling the behavior of physical system. In food process, both an open and close loop control configuration are applied. A bottle washing machine performing predefined sequence of operations without any information "with no concern" regarding the results of its operation is an example of an open loop control system. The bottle washing machine mentioned above as an open-loop system would operate in a closeloop mode if it were equipped with a measuring device capable of generating signal related to the degree of cleanness of the bottles being washed.
For decades, food process engineers have adopted control strategies that have been introduced by control engineering. The control engineering is based on the foundation of feedback and feed forward theory and linear system analysis. It is basically an interconnection of components forming a system configuration that will provide a desired system response (Dorf and Bishop, 2010). The feedback control acts when a deviation from www.intechopen.com the set point occurs. It uses the difference of the controlled variable between the set point and the actual one to control the actuators of the process in the following four modes (Kreider and Rabl, 1994): Derivative.
The distinct advantage of the feedback control system is the ability to adjust the transient response and steady-state performance. A schematic diagram of the feedback theory is depicted in figure 1 Fig. 1. A schematic drawing of PID control system

On/Off controller
The two-positions control applies to an actuator or a relay that is either fully open or fully closed. When the controlled variable drops below the lower decided limit, the actuator opens fully and remains open until the controlled variable reaches the upper limit. The upper and lower limits are sometimes adjustable. The two-position control is the least expensive method of automatic control and convenient for the use in systems with large time constants (Kreider and Rabl, 1994).

Design of PID controller
The Proportional, Integral, and Derivative are usually used in a variety of combinations with one another to achieve the right control process. A schematic drawing of a process feedback system with a PID controller is depicted in figure1.
The proportional control corrects the controlled variable in proportion to the difference between the controlled variables and the set point. The error is calculated as follow: set sensed e T T  (1) Integral control is often added to proportional control to eliminate the error inherent in proportional-only control. The integral component has the effect of continuing to increase or decrease the output as long as any offset continues to exist (Smith and Corripio, 1997;Kreider and Rabl, 1994).
Derivative control is often called the rate action, or pre-act and is used to anticipate where the process is heading by looking at the time rate of change of the error, and its derivative.
In other words, it gives the controller the capability to "look ahead" by calculating the derivative of the error (Smith and Corripio, 1997).

Measuring device (sensors)
The use of advanced instrumentation and sensors in the food industry has led to continuing improvement in food quality control, safety and process optimization. Some of the basic measurement devices used in process control of foods are pressure, temperature level, and flow sensors. Other measurement devices are used such as color vision, speed of sound, viscometers texture sensors, chemo-sensors, biosensors, immune-sensors, electronic noses and tongues, sensors for food flavor and freshness: electric Noses, tongues and testers In situ freshness monitor of frying oil (resonant viscosity probe) , knife-type meat freshness tester (glucose profiling biosensor). Figure 3 shows an overall diagram of food process control systems that illustrates some of the possible variables, parameters, actuators, sensors. ( Kress-Rogers and Brimelow (2002)) In most food process control applications, standard "off-the-shelf" devices are used to obtain the desires system performance. These devices commonly called industrial controllers. The manner in which the controller produces the control signal in response to the controller error is referred to as a control algorithm or control law. The most common control algorithms implemented in industrial controllers are the two position or on/off control , proportional Integral derivative control (PID), and fuzzy logic control. PID controllers are affordable, robust, fairly easy to use, tune and maintain, and generally commercially available. Figure2 Shows an overall diagram of food process control systems that illustrates some of the possible variables, parameters, actuators, sensors.

Insert an equivalent, linear fuzzy controller
Fuzzy logic deals with uncertainty. This technique which uses the mathematical theory of fuzzy sets simulates the process of normal human reasoning by allowing computer to behave less precisely and logically than conventional computers do. Some of the drawback, however, of the on/off switching system used in food process engineering are; they are incapable to maintain a set point temperatures accurately due to the non-linearity of this system and it is hard to design a controller to maintain a fixed process variable. Whereas the weakness of the Proportional Integral Derivative (PID) controller is its inability to implement human thinking. Most food related processes are multivariable, time-varying www.intechopen.com and non-linear. Non-linear processes are difficult to predict with conventional control systems designed for linear processes but cases involving several process variables have been generally dealt with by multi-loop controllers running several independent PID-loops concurrently (Linko And Linko (1998). However, the advantages of the fuzzy logic control systems are its easiness to use and maintain and its affordability. Fuzzy logic can be used for controlling a process that is too nonlinear or too ill-understood to use conventional control design. Also fuzzy logic enables control engineers to easily implement control strategies used by human operators. Other advanced control system are the hybrid systems that encompasses decision tree, neural networks(NN), evolutionary algorithms, and expert systems. Omid (2011) Fig. 2. An overall diagram of food process control systems that illustrates some of the possible variables, parameters, actuators, sensors.

www.intechopen.com
On the other hand, fuzzy logic is simple to use if incorporated with analog-to-digital (D/A) converters, and micro controllers. This can easily be upgraded by changing rules to improve performance or add new features to the system . In many cases, fuzzy control can be used to improve existing controller systems by adding an extra layer of intelligence to the current control method. Although fuzzy logic control systems are still young in the food process engineering, the fields of applications of fuzzy systems are very broad. Those applications include: Pattern recognition and classification, modeling of classification control systems fault diagnosis operation research, decision support systems Omid (2011). Therefore, more precise systems are needed for the many applications in the field. Furthermore, fuzzy logic systems could be used as an alternative controller for the most food process plants. With the fast growing computer applications in food engineering, there is a need to test and evaluate more advance controllers to reach the best and most affordable food process control systems.
Fuzzy logic is basically a multi-valued logic that allows transitional values to be between the normal two valued evaluations like Yes/No, True/False, and Black/White. Instead, phrases like "very light" or "pretty heavy " can be formulated mathematically and dealt with by computers. Fuzzy controllers have three transitional steps; an input step, a processing step, and an output step. The input step, which is fuzzy matching, maps sensor output or the error or other inputs to the proper membership functions by calculating the degree of membership; the processing step triggers each appropriate rule and produce a result for each, then join the results of the rules together; and finally a crisp control value of the result is obtained through the output step (Bauer et al. 1998;Yen and Langari, 1999).
The control system block from figure1 is further detailed as follows to include the fuzzy logic control system in figure3.

Fig. 3. A schematic drawing of feedback control system with fuzzy logic controller
A block diagram of a fuzzy control system is shown in Figure3. The fuzzy controller is composed of the following three elements: a. A fuzzification interface, which converts controller inputs into information that the inference mechanism can easily use to activate and apply rules. shapes of membership www.intechopen.com functions are the triangular, trapezoidal and bell, but the shape is generally less important than the number of curves and placement. From 3 to 7 curves are generally enough to cover the intended range of an input value (the "universe of discourse") (Bauer et al. 1998;Yen and Langari, 1999). b. A rule-base (a set of If-Then rules), which contains a fuzzy logic quantification of the expert's linguistic description of how to achieve good control. In other word, the rule base is derived from an "inference engine" or "fuzzy inference" module, which emulates the expert's decision making in interpreting and applying knowledge about how best to control the plant.
The processing stage is basically a group of logic rules in the form of IF-THEN statements, where the IF part is called the "antecedent" and the THEN part is called the "consequent"(Yen and Langari, 1999). For example the rule of a thermostat works as follow: IF the temperature is "cold" THEN turn the heater to "high" This rule basically implements the truth-value of the temperature input, which is cold to create a result in the fuzzy set to switch the heater to high. The results of all the rules are joined together using one of the defuzzification methods to finally come up with the crisp composite output. Sometimes, membership functions are formulated by "hedges". Examples of hedges include "more", "less", "about", "close to", "approximately", "very", "slightly", "too", "extremely", and "somewhat". These phrases may have precise definitions and mathematical representation. For example, "very", squares membership functions and since the membership magnitudes are always below 1, this reduces the membership function (Bauer et al. 1998;Yen and Langari, 1999 "Extremely" cubes the values to give more reduction: and "somewhat" broadens the function by taking the square root; Membership functions can be joined together using a number of logical operators. For example, AND (conjunction) uses the minimum value of all the antecedents. However, the OR and NOT use the maximum value and the complementary value respectively. There are other different operators used to define the result of a rule, however, the most commonly used method to calculate the output is the "max-min" inference method (Yen and Langari, 1999;Bauer et al. 1998).Those rules can be implemented using hardware or in software. Jantzen (1998) has suggested some sources of control rules : www.intechopen.com  Expert Experience and Control Engineering Knowledge: The most common approach to establishing such a collection of rules of thumb, is to question experts or operators using a carefully organized questionnaire.  Based on the Operator and Control Action: Fuzzy-if then rules can be deduced from observations of an operator's control actions or a log book. The rules express inputoutput relationships.  Based on A fuzzy model of the Process A linguistic rule base may be viewed as an inverse model of the controlled process. Thus the fuzzy control rules might be obtained by inverting a fuzzy model of the process. This method is restricted to relatively low order systems, but it provides an explicit solution assuming that fuzzy models of the open and closed loop systems are available. Another approach is a fuzzy Identification or fuzzy model-based control.  Based on Learning The self-organizing controller is an example of a controller that finds the rules itself. Neural networks is another possibility  A defuzzification interface, which converts the conclusions reached by the inference mechanism into the inputs to the plant. In other words, results of the fuzzy rules are defuzzified using one of the defuzzification techniques to give a final crisp value to be sent as the control parameter. Among the defuzzification techniques are (Bauer et al. 1998;Yen and Langari, 1999):  In recent years, many efforts have been directed to the optimization and efficient control of food processing. Most bioprocesses have highly nonlinear dynamics, and constraints are frequently present on both the state and the control variables. Thus, efficient and robust dynamic optimization methods are needed in order to successfully obtain their optimal operating policies. Balsa et al. (1998) Optimization can be defined as the process of finding the conditions that give the optimum (maximum or minimum) value of a function of certain decision variables subject to restrictions or constraints that are imposed (Edgar and Himmelblau. (1989)). Optimization may be the process of maximizing a desired quantity or minimizing an undesired one. The conditions (values of the processing variables) that produce the desired optimum value are called optimum conditions while the best of all feasible designs is called optimal design. In its most general meaning, optimization is the effort and process of making a decision, a design, or a system as perfect, effective, or functional as possible. Optimization for a system may mean the design of system parameters or the modification of its structure to minimize the total cost of the system's products under boundary conditions associated with available materials, financial resources, protection of the environment, and governmental regulation, taking into account the safety, operability, reliability, availability, and maintainability of the system. Optimizers or decision makers use optimization in the design of systems and processes, in the production and in systems www.intechopen.com operation. Some examples of the optimization use are: selection of processes or size of equipment, equipment items and their arrangement, operation conditions (temperature, pressure, flow rate, chemical composition of each stream in the system), equipment combination in specific processes to increase the overall system availability, etc. ( Tzia and Liadakis ( 2003). In order to determine the control parameters whether PID or fuzzy logic parameters a method of optimization should be applied to shorten time and get the best output (Edwards and Canning, 1997). Some simple tuning methods have been used for this optimization such as, Ziegler-Nichols method. This method uses small amount of information about the process to tune the system (Chipperfield and Fleming, 1993). Several general performance indices exist in the literature. These indices use the error as an indicator of the system deviation. The system is considered to have achieved the optimum output, when these indices reach the minimum value (Dorf and Bishop, 2010).

General indices
Integral of square of error: This criterion is suitable for computer simulation.
Other general performance indices are also used for optimization such as ITAE, and ITSE (Dorf and Bishop, 2010). During pistachio classification, Omid (2011) compared root mean square error (RMSE), Mean absolute error (MAE), relative absolute error (RAE) and correct classification rate (CCR) as Performance indices. Balsa et al. (1998) Evaluated and compared the solution of the dynamic optimization of three bioprocesses, including a hybrid stochasticdeterministic method, where they found a significant advantages over other approaches.

Make it gradually nonlinear
Linear processes have the important property of superposition whereas nonlinear models do not. Superposition means that the response of the system to a sum of inputs is the same as the sum of responses to the individual inputs .These properties do not hold for nonlinear models . In this respect, it is important to recognize the fact that most food process systems are nonlinear.
There are three sources of nonlinearity in a fuzzy controller.
i. The Rule Base: The position, shape and number of fuzzy sets as well as nonlinear input scaling cause nonlinear transformations. The rules often express a nonlinear control strategy. ii. The inference Engine :If the connectives AND and OR are implemented as for example MIN and MAX respectively, they are nonlinear. iii. The defuzzification: Several defuzzification methods are nonlinear.
With these design choices the control surface degenerates to diagonal plane. A flexible fuzzy controller, that allows these choices, is two controllers in one. When linear it has transfer function and the usual methods regarding tuning and stability of the closed loop system apply.
It is possible to construct Aa rule base with linear input-output mapping (siler & Ying, 1989;Mizumoto, 1992;Qiao & Mizumoto; the following checklist summarizes the general design choices for achieving a fuzzy rule base equivalent to summation:


Use triangular input sets that cross at µ=0.5;  Use the algebraic product (*) for the end connective.  The rule base must be the complete and combination of all input families;  Use output singletons, positions determined by the sum of the peak positions of the input sets;  Use Center Of Gravity Method for Singleton (COGS) defuzzification. www.intechopen.com

Summary
In this paper, the basics of the design of fuzzy logic control for food processing have been introduced. Due to its simplicity, it is a powerful method for managing the properties of food and solve its problems such as single sensory property like color or texture , nonuniformity, variability of raw materials, non-linearity, coupling of its variables continuous temperature and moisture change during a heating or cooling process, biochemical or microbial changes, density, thermal and electrical conductivity, specific heat, viscosity, permeability, effective moisture diffusivity.
Review of papers written in fuzzy logic control for food processing as well as steps for designing simple fuzzy logic control were introduced. It seems reasonable to start the controller design with PID controller; then tune a PID controller; replace it with a linear fuzzy controller; transfer gains; make the fuzzy controller nonlinear; then fine-tune it after the following steps have been achieved: