**8. Simulation of fuzzy temperature control**

Normally, before proceeding with the implementation of the controller, a simulation is performed to evaluate its performance. The results of the simulation can aid in improving the design of the fuzzy controller and in verifying that it will work correctly when it is implemented. Such a simulation is shown below, implemented using Matlab (Sivanandam et al., 2007), specifically Simulink to simulate the control loop and fuzzy toolbox to implement the fuzzy controller.

The controller designed earlier is defined using the fuzzy toolbox in Matlab, yielding the fuzzy system shown in Figure 10. The fuzzy partition of the inputs and output is shown in Figure 11. As for the output surface, it is shown in Figure 12.

With this tool, we can see how the inference process is carried out, Figure 13.

The next step is to carry out a simulation with the temperature system to check the control system's performance. To do this, we will use the simulation tool Simulink, which allows us to implement the control loop in blocks and to use the fuzzy system made with the fuzzy toolbox as the controller. The diagram of the control system, then, is as shown in Figure 14.

equal their measured value. We also avoid the calculations that would be required if another membership function were used, such as Gaussian fuzzification, which requires constructing a Gaussian-shaped membership function to represent the exact value being

In order to define the inference mechanism, we have to determine how to carry out the basic operations. Since we are using Mandani's model, we have decided to implement the T-norm

The last step is to define the defuzzification process. For this temperature control case, we

Normally, before proceeding with the implementation of the controller, a simulation is performed to evaluate its performance. The results of the simulation can aid in improving the design of the fuzzy controller and in verifying that it will work correctly when it is implemented. Such a simulation is shown below, implemented using Matlab (Sivanandam et al., 2007), specifically Simulink to simulate the control loop and fuzzy toolbox to

The controller designed earlier is defined using the fuzzy toolbox in Matlab, yielding the fuzzy system shown in Figure 10. The fuzzy partition of the inputs and output is shown in

The next step is to carry out a simulation with the temperature system to check the control system's performance. To do this, we will use the simulation tool Simulink, which allows us to implement the control loop in blocks and to use the fuzzy system made with the fuzzy toolbox as the controller. The diagram of the control system, then, is as shown in Figure 14.

Fig. 9. Fuzzification process for the controller's input variable.

as the minimum and the S-norm as the maximum.

**8. Simulation of fuzzy temperature control** 

Figure 11. As for the output surface, it is shown in Figure 12.

With this tool, we can see how the inference process is carried out, Figure 13.

will use the center of gravity.

implement the fuzzy controller.

provided by the sensor.

Fig. 10. Fuzzy controller for the temperature system.

Fig. 11. Fuzzy partition of the fuzzy controller inputs (error and error-variation) and output (increase command).

Control Application Using Fuzzy Logic: Design of a Fuzzy Temperature Controller 393

A prerequisite step to studying the results of the fuzzy controller is to adjust its parameters. In other words, we used fuzzy partitions that were normalized between -1 and 1, and yet the error, the error variation and the commanded increase have to take on values within a different range. To do this, we use gains that scale these variables within the design range of the fuzzy controller, adjusting these gains to achieve the desired specifications. These gains

2. If gs > 1, then the membership functions are uniformly contracted by a factor of 1/gs. 3. If gs < 1, then the membership functions are uniformly expanded by a factor of 1/gs.

Fig. 14. Fuzzy temperature control.

are called gains of scale (gs) and their effect is as follows:

Fig. 15. Output of fuzzy temperature controller.

1. If gs = 1, there is no effect on the membership functions.

Fig. 12. Control surface.


Fig. 13. Inference process for LP error (0.9) and LN error-variation (-0.8).

Fig. 14. Fuzzy temperature control.

Fig. 13. Inference process for LP error (0.9) and LN error-variation (-0.8).

Fig. 12. Control surface.

A prerequisite step to studying the results of the fuzzy controller is to adjust its parameters. In other words, we used fuzzy partitions that were normalized between -1 and 1, and yet the error, the error variation and the commanded increase have to take on values within a different range. To do this, we use gains that scale these variables within the design range of the fuzzy controller, adjusting these gains to achieve the desired specifications. These gains are called gains of scale (gs) and their effect is as follows:


Fig. 15. Output of fuzzy temperature controller.

Control Application Using Fuzzy Logic: Design of a Fuzzy Temperature Controller 395

In this chapter we have presented the steps required to implement fuzzy controllers. Such controllers, when integrated into systems that handle precise values, require a translation process before and after the reasoning method is applied. Hence the three-step structure of

The different stages were explained using an example involving temperature control. This is a trivial, academic problem that can be solved using many techniques, such as with a classical PI controller; in this chapter, however, we used this example to illustrate the design

Babuška R. (1998). *Fuzzy Modeling for Control*, Kluwer Academic Publishers, ISBN 978-0-

Cai X.-Z. (1997). Intelligent Control: Principles, Techniques and Applications, World Scientific Publishing Company, ISBN 978-9810225643, Singapore-New Jersey Chen G. & Joo Y. H. (2009). Introduction to Fuzzy Control Systems, In: *Encyclopedia of* 

Horváth L. & Rudas I. J. (2004). *Modeling and Problem Solving Methods for Engineers*, Elsevier,

Jang J. S. R., Sun C. T. & Mizutani E. (1997). *Neuro-Fuzzy and Soft Computing*, Prentice Hall,

Li H. X. & Tong S.C. (2003). A hybrid adaptive fuzzy control for a class of nonlinear mimo

Passino K. M. & Yurkovich S. (1998). *Fuzzy Control*, Addison Wesley Longman, Inc., ISBN

Pedrycz W. (1993). *Fuzzy Control and Fuzzy Systems*, Research Studies. Press/John Wiley,

Sala A., Guerra T. M. & Babuška R. (2005). Perspectives of Fuzzy Systems and Control.

Sala J., Picó J. & Bondia J. (2000) Tratamiento de la incertidumbre en modelado y control

Sivanandam S.N., Sumathi S. & Deepa S.N. (2007). *Introduction to Fuzzy Logic using* 

Tanaka K. & Sugeno M. (1992). Stability Analysis and Design of Fuzzy Control Systems,

Tanaka K. & Wang H. O. (2001). *Fuzzy control systems design and analysis. A linear matrix inequality approach*, John Wiley & Sons, ISBN 978-0471323242, New York

*MATLAB*, Ed. Springer, ISBN 978-3540357803, Berlín, New York

systems. *IEEE Trans. Fuzzy Systems*, Vol.11, No.1, (February 2003), pp. 24–34, ISSN

*Fuzzy Sets and Systems*, Vol.156, No.3, (December 2005), pp. 432-444, ISSN 0165-

borrosos, *Revista Iberoamericana de Inteligencia Artificial*. Vol.4, No 10, (Summer

*Fuzzy Sets and Systems*, Vol.45, No.2, (January 2002), pp. 135-156, ISSN 0165-0114,

Jantzen J. (2007). *Foundations of Fuzzy Control,* Wiley, ISBN 978-0470029633, New York Klir G. & Yuan B. (1995). *Fuzzy Sets and Fuzzy Logic*, Prentice Hall, ISBN 978-0131011717,

*Artificial Intelligence*, J. R. Rabul, J. Dorado, and A. Pazos (Eds.), 688-695, Hersh,

fuzzy controllers: fuzzification, inference and defuzzification.

of a fuzzy controller, as well as its mode of operation.

ISBN 9781599048499, La Coruña, España

ISBN 978-0132610667, New York

Upper Saddle River, NJ

0114, North-Holland

North-Holland

0–201–18074–X, California

ISBN O-471-93475-5, Taunton, New York

2000), pp. 119-126, ISSN 1137-3601, España

1063-6706

Academic Press, ISBN 978-0126022506, New York

7923-8154-9, Boston, USA

**10. References** 

For the temperature controller, we have selected a gain of scale for the controller's error input of Ke=0.0238, of Kev=1 for the error variation and of Kci=5000 for the command increase. The values Ke and Kev are needed to keep the error and the error variation bounded in the same margins. The Kci value is used to match up the maximum command to the maximum value of resistance (2000 watts). The values used in the gains of scale have been selected through an adaptive method based on the results of successive simulations.

The results yielded by this system are as shown in Figure 15. By applying the maximum command (2000 watts), we can reach the setpoint value in 1000 seconds. The rules that are applied at first (trigger force equal to 0 is shown in black, with the brightness increasing to white as we progress to a trigger force equal to 1) correspond to rules 27-31, which involve LP. Then the 20-22 group takes over, these rules controlling MP errors and small error variations. Next to activate are those rules for dealing with SP errors. Lastly, rule 7, with trigger force 1, is activated for dealing with ZE error and ZE error variation.

If the setpoint is changed at t=2,200 seconds, the result is as shown in Figure 16. When the setpoint is changed, a new command is output since the MP and SP error rules are activated.

Fig. 16. Output of fuzzy temperature controller with change at t=2200 seconds.

#### **9. Conclusions**

Fuzzy logic is based on the method of reasoning that is typically used by experts to handle all kinds of systems, from the simplest to the very complex. This method (control) can be formulated with rules of the type if-then applied to inexact magnitudes such as "many", "fast", "cold", etc. Implementing this method of reasoning requires a representation of these vague magnitudes and an associated logic. These are the Theory of Diffuse Groups and Diffuse Logic, respectively.

In this chapter we have presented the steps required to implement fuzzy controllers. Such controllers, when integrated into systems that handle precise values, require a translation process before and after the reasoning method is applied. Hence the three-step structure of fuzzy controllers: fuzzification, inference and defuzzification.

The different stages were explained using an example involving temperature control. This is a trivial, academic problem that can be solved using many techniques, such as with a classical PI controller; in this chapter, however, we used this example to illustrate the design of a fuzzy controller, as well as its mode of operation.

#### **10. References**

394 Fuzzy Inference System – Theory and Applications

For the temperature controller, we have selected a gain of scale for the controller's error input of Ke=0.0238, of Kev=1 for the error variation and of Kci=5000 for the command increase. The values Ke and Kev are needed to keep the error and the error variation bounded in the same margins. The Kci value is used to match up the maximum command to the maximum value of resistance (2000 watts). The values used in the gains of scale have been

The results yielded by this system are as shown in Figure 15. By applying the maximum command (2000 watts), we can reach the setpoint value in 1000 seconds. The rules that are applied at first (trigger force equal to 0 is shown in black, with the brightness increasing to white as we progress to a trigger force equal to 1) correspond to rules 27-31, which involve LP. Then the 20-22 group takes over, these rules controlling MP errors and small error variations. Next to activate are those rules for dealing with SP errors. Lastly, rule 7, with

If the setpoint is changed at t=2,200 seconds, the result is as shown in Figure 16. When the setpoint is changed, a new command is output since the MP and SP error rules are activated.

selected through an adaptive method based on the results of successive simulations.

trigger force 1, is activated for dealing with ZE error and ZE error variation.

Fig. 16. Output of fuzzy temperature controller with change at t=2200 seconds.

Fuzzy logic is based on the method of reasoning that is typically used by experts to handle all kinds of systems, from the simplest to the very complex. This method (control) can be formulated with rules of the type if-then applied to inexact magnitudes such as "many", "fast", "cold", etc. Implementing this method of reasoning requires a representation of these vague magnitudes and an associated logic. These are the Theory of Diffuse Groups and

**9. Conclusions** 

Diffuse Logic, respectively.


**19** 

*Brazil* 

**An Evolutionary Fuzzy Hybrid System for** 

Carlos Henrique Valério de Moraes3 and Germano Lambert-Torres3

When the Fuzzy Set Theory was proposed by Lotfi Zadeh in a seminal paper published in 1965, he noted that the technological resources available until then were not able to automate the activities related to industrial, biological or chemical problems. These activities use typically analog data which are inappropriate to be handled in a digital computer that

Using this idea, Fuzzy Logic can be defined as a way to use data from typical analog processes that move through a continuous track in a digital computer that works with discrete values. The use of Fuzzy Logic for solving control problems has tremendously increased over the last few years. Recently the Fuzzy Logic has been used in industrial process control electronic equipment, entertainment devices, diagnose systems and even to control appliances. Thus, the teaching of fuzzy control in engineering courses is becoming a necessity. In a previous work, it has been presented a computational package for students' self-training on fuzzy control theory. The package contains all required instructions for the users to gain the understanding of fuzzy control principles. The training instructions are

Although this approach has proven to be convenient in giving to students an opportunity to appreciate real life like situations, it suffers a serious disadvantage: the type of learning. In fact, students often go through a "trial-and-error" method to select an appropriate control action, such as rule definitions or membership fitting. The problem of this type of learning is a tendency from students to get the erroneous concept that corrective actions are much a matter of guess. The purpose of this chapter is to present a strategy for an automatic membership function fitting using three different evolutionary algorithms, namely: modified genetic algorithms (MGA), particle swarm optimization (PSO) and hybrid particle

The proposed strategies are applied in a computational package for fuzzy logic learning. This computer program was developed for self-training in engineering students in the

works with well-defined numerical data, i.e. , discrete values.

**1. Introduction** 

presented via a practical example.

swarm optimization (HPSO).

Ahmed Ali Abadalla Esmin1, Marcos Alberto de Carvalho2,

**Educational Purposes** 

*1Lavras Federal University* 

*3Itajuba Federal University* 

*2José do Rosário Vellano University* 

