Adaptive fuzzy controller: Application to the control of the temperature ...

Report 2 Downloads 112 Views
Fuzzy Sets and Systems 157 (2006) 2241 – 2258 www.elsevier.com/locate/fss

Adaptive fuzzy controller: Application to the control of the temperature of a dynamic room in real time I. Rojas∗ , H. Pomares, J. Gonzalez, L.J. Herrera, A. Guillen, F. Rojas, O. Valenzuela Department of Computer Architecture and Computer Technology, Facultad de Ciencias, Campus Universitario Fuentenueva s/n, E-18071, University of Granada, Spain Received 17 June 2004; received in revised form 4 January 2006; accepted 4 March 2006 Available online 30 March 2006

Abstract This paper presents a direct adaptive fuzzy controller for unknown monotonic nonlinear systems, thus not requiring the system model, but only a little information about it: the plant monotonicity and its delay. Without any off-line pre-training, the algorithm achieves very high control performance through a three-stage algorithm: (1) output scale factor, (2) adaptation of the fuzzy rule consequents and (3) optimization of the position of the membership functions. The design is simple, in the sense that both the membership functions and the rule-base can be initialized from arbitrary values. It can be applied to a large class of monotonic dynamic or static plants, due the fact that the system is able to modify its behaviour in real time, i.e., during the control process. © 2006 Elsevier B.V. All rights reserved. Keywords: Fuzzy control; Adaptive fuzzy controller; Real-time application

1. Introduction Just as fuzzy systems can be described as ‘computing with words rather than numbers’, fuzzy control can be described as ‘control with sentences rather than equations’ [22]. It is more natural to use sentences or rules in, for instance, operator-controlled plants with the control strategy written in terms of if–then clauses [8]. Generally, the model obtained by fuzzy logic systems depends linearly on unknown parameters that lead to the use of a Lyapunovbased learning scheme. It was first applied with success in the domain of neural networks because of their learning ability and universal approximating power. Hence, the combination of learning, adaptivity and uncertainty enabled researchers to derive adaptive (or neuro) fuzzy controllers. These new models ensure the stability of the overall system and the convergence of the plant output towards a given reference signal. If the controller furthermore adjusts the control strategy without human intervention it is adaptive. While non-adaptive fuzzy control has proven its value in some applications, it is sometimes difficult to specify the rule-base for some plants, or the need could arise to tune the rule-base parameters if the plant changes. This provides the motivation for adaptive fuzzy control, where the focus is on the automatic on-line synthesis and tuning of the fuzzy controller parameters i.e., the use of on-line data from which the fuzzy controller can continually ‘learn’, which will ensure that the performance objectives are met. ∗ Corresponding author. Tel.: +34 958 246128; fax: +34 958 248993.

E-mail address: [email protected] (I. Rojas). 0165-0114/$ - see front matter © 2006 Elsevier B.V. All rights reserved. doi:10.1016/j.fss.2006.03.006

2242

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

Research in adaptive control started in the early 1950s. Control engineers have tried to agree on a formal definition of adaptive control, and for example in 1973 a committee under the Institute of Electrical and Electronics Engineers (IEEE) proposed a vocabulary including the terms ‘self-organizing control (SOC) system’ [15], ‘parameter adaptive SOC’, ‘performance adaptive SOC’, and ‘learning control system’ [1]. These terms were never widely accepted, however, but the story does explain why the adaptive fuzzy controller, invented by E. H. Mamdani and his students in the latter half of the 1970s, is called the SOC [15]. Their idea is to try to identify which rule is responsible for the current poor control performance, and then to replace it with a better rule. In most SOC approaches, this dependence is expressed using only the monotonicity sign of the plant, i.e., the sign of the relation between the plant output and the controller output, since the knowledge of the Jacobian matrix is seldom available. SOCs have proved successful in ‘simple’ applications since only the rule consequents are to be tuned. In highly nonlinear plants, SOCs are only capable of a coarse tuning of the controller parameters, and therefore, more sophisticated fuzzy controllers have to be constructed [2–7,9–13,17–21]. For example in [11] a hybrid adaptive fuzzy control is suggested where the nonlinear system is controlled by a state feedback controller and an adaptive fuzzy controller. The main advantage of the proposed approach is that the adaptive fuzzy control law can tune the robust gain of the sliding-mode controller so as to cope with the uncertainties and modelling error of the nonlinear robotic system. In [3] a fuzzy controller is constructed from a fuzzy feedback linearization controller, whose parameters are adjusted indirectly from the estimates of the plant parameters, providing asymptotic tracking of a reference signal for a system with uncertainty or slowly time-varying parameters. The main drawback of this latter approach is that this parallel interaction is not always optimum and that a certain amount of data must be extracted from the plant in real time in order to accomplish global learning. The main focus of this paper is to develop an adaptive fuzzy controller which is capable of modifying the parameter defining the membership functions and the consequents of the rules in real time. The proposed methodology is robust against modification of the parameters of the plant (break-downs). It is important to note, that no initial knowledge about the control policy is required and therefore the fuzzy controller can start with a set of empty rules. 2. Design of an advanced (adaptive and self-organizing) fuzzy controller in real time From the mathematical point of view, the plant to be controlled could be expressed as s(n + d) = f (s(n), . . . , s(n − p), u(n), . . . , u(n − q)),

(1)

where s(n) is the output of the plant at instant n, d is the delay of the plant, f is an unknown continuous and differentiable function and u is the controller output. Time delay is often encountered in various engineering systems, such as electrical networks, turbo jet engines, microwave oscillators, nuclear reactors, etc. Therefore, the problem of stability analysis and robust control for dynamic time-delay systems has attracted considerable attention of a number of researchers over the past years [14,16]. The restriction usually imposed on plants is that they must be controllable, i.e., that there always exists a control policy capable of translating the output to the desired value (within the operation range). This implies that the partial derivative of the plant output w.r.t. the control input must never be zero. Therefore, as the plant is supposed to be continuous, it must have a constant monotonicity, i.e., the relation between the plant output and the controller output must have a constant sign. A fuzzy control system comprises a set of IF–THEN fuzzy rules Ri∗1 i2 ...iN having the following form: iN IF x1 is X1i1 AND x2 is X2i2 AND . . . AND xN is XN THEN y = Ri1 i2 ...iN ,

(2)

where Xviv ∈ {Xv1 , Xv2 , . . . , Xvnv } with nv being the number of membership functions of the input variable Xv . For the output variable, Ri1 i2 ...iN is the numeric consequent of the rule (therefore, singleton fuzzy rules are used in this work). In this paper, the fuzzy inference method uses the product as T-norm and the centroid method with sum–product operator as the defuzzification strategy. Using the above notation, the output of the fuzzy controller can be expressed as follows: nN N n1 n2 k v=1 Xviv (xv )) i1 =1 i2 =1 · · · iN =1 (Ri1 i2 ...iN · k F˜ ( x )= (3) n1 n2 nN N k i1 =1 i2 =1 · · · iN =1 ( v=1 Xiv (xv )) v

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2243

Fig. 1. Advanced fuzzy controller.

where xk is the N-dimensional input vector at instant k. Coupled to the main controller, there will be three auxiliary systems, which are in charge of finding, from the control evolution, suitable values for the parameters of the main controller, and adapt the output scale factor. In the next sub-sections, we are going to explain in detail the behaviour of these auxiliary systems (Fig. 1). 2.1. Adaptation of the output scale factor It is known that the scale factors or gains are real constants which multiply the values of the variables (input or output variables), modifying the limits of their variation range, and therefore have a significant impact on the performance of the resulting fuzzy control system, and hence they are often a convenient parameter for tuning. The modification of the input scale factors has a general effect on the behaviour of the system: increasing input gains implies reducing their universes of discourse, having a direct consequence on control: the response is faster and more oscillatory, reducing the stationary error. It thus improves the transient response by reducing rise time and set-up time, but it does increase the risk of instability with the overshoot increment. On the other size, reducing input gains produces the opposite effects; the wider the membership functions the rougher control can be achieved, which produces a slower response with less overshoot. However, the variation of the output gain has a complex relation with the behaviour of the controller and has not been analysed in depth. In this paper, the output scale factor will not be a constant, but rather a function dependent on the state of the system. Thus, the real output of the controller is obtained by multiplying Eq. (3) by an output scale factor, as follows: nN N n1 n2 k v=1 Xviv (xv )) i1 =1 i2 =1 · · · iN =1 (Ri1 i2 ...iN · k ˜ k k u(k) = ( x )F ( x ) = ( x ) (4) n1 n2 nN N k i1 =1 i2 =1 · · · iN =1 ( v=1 Xiv (xv )) v

where u(k) is the final output generated by the rule-base for the input vector xk . The auxiliary system that modifies the output scale factor of the main controller is also a fuzzy system, but much simpler. This fuzzy system adjusts deficiencies in the current output of the main controller, in order to directly correct the input to the process. The tuning strategy will consist in setting the output scale factor, which depends not only on the state of the plant but also on the time: ( x k , t) = ( x k , t0 ) + (t)Fadapt_output ( x k ),

(5)

x k ) is the output value of the auxiliary fuzzy system for the input vector xk , and (t) is the learning where Fadapt_output ( factor which decreases exponentially with time ((t) = e−t/ ). A typical value for the initial output scale value (at t = t0 ) is 1. Therefore, modification of the output scale factor is of progressively less importance as time increases. This means that when a large number of iterations have been performed (depending on parameter ), the output scale

2244

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

factor will not be changed anymore, and only the rules of the main controller will be modified, using the other auxiliary systems as we will see in the following sections. The reason for modulating the response of the auxiliary fuzzy system Fadapt_output by the learning factor (t) lies in the important effect arising from the alteration of the output scale factor, particularly in the initial iterations (when the control policy has not yet been learned). As the rules of the main controller become more and more correct, the modification of the output scale factor is not so important, and only the fuzzy rules need be learned, with no prejudice to the response of the real plant. This is somehow similar to the concept of the dynamic importance degree given by Yi et al. in [19,20]. 2.2. Adaptation of rules consequents To improve the dynamics of the system not only is it necessary to accomplish a continuous adjustment of the output scale factor, but it is also fundamental to learn which are the rules that lead to the stabilization of the plant in the desired state. Learning occurs when the algorithm alters the parameters (in this case the conclusions of the rules of the main controller) in an attempt to improve its control behaviour. In this case, the system learns in such a way that the acquired knowledge is reflected in the new values of the rules. In order to build an accurate self-organizing controller, the auxiliary system should possess information on how the plant output varies with respect to the control signal for every possible operating region. This entails knowing the Jacobian matrix of the plant function. Unfortunately, this information is normally unavailable in a control task. Thus, it is evident that with the kind of information available from the plant, i.e., its monotonicity sign and its delay, only a relatively coarse control can be applied to the system. In this paper, coarse adaptation of the fuzzy rule consequents is accomplished by evaluating the current state of the plant and proposing a correction of the rules responsible for the existence of such a state, either as a reward or as a penalty, in the following way: Ri1 i2 ...iN (k) = C · i1 i2 ...iN (k − d) · ey (k) = c · i1 i2 ...iN (k − d) · (r(k − d) − y(k)),

(6)

where, as in [16], this modification is proportional to the degree with which the rule was activated in achieving the control output u(k − d) now being evaluated at instant k. In the above expression, d is the delay of the plant, r(k − d) is the set point required of the plant output at instant k − d and y(k) is the current plant output. In order to understand that this modification is always in the direction of a better positioning of the rule consequents, let us assume that the plant output increases with control input. Then if the output at instant k is smaller than the required set point then u(k − d) would have to be made bigger. Then C will have a positive sign and the correction to the rules responsible of having obtained u(k − d) should be changed proportionally to the current plant error. Note that it would be incorrect to use r(k), as the rules that are activated at instant k − d serve to achieve the desired value r(k − d) and not r(k). C is used for normalization purposes, and its absolute value can be determined off-line by: |C| = u/y, where y is the range in which the plant output is going to operate, which must be estimated beforehand from the knowledge about the set points we are going to use, and u is the range of the controller’s actuator. 2.3. Adaptation of the rule antecedents With the previous methodology, only the consequents of the fuzzy rules can be tuned. It is well known that the position and shape of the membership functions have a strong influence on the performance of the control process, making it necessary to optimize them. The idea used in this paper to overcome this problem is based on trying to find a MF configuration which distributes a certain performance criterion homogeneously throughout the operating regions. In this case, the performance criterion is the integral of the square error (ISE). Thus, the more a certain operating region is activated the more frequently this region will contribute to the ISE. The equation for the contribution to the ISE of the operation regions between centres j and j + 1, of input variable Xi is        1 j 2 2   ISEi = 2 e (t) dt  , (7) − e (t) dt  j −1 j j j +1 y ,c ] ] xi (t)∈[c xi (t)∈[c ,c i

j

i

i

i

where ci is the position of the centre of the jth membership function of the ith input variable, and xi is the ith component of the input vector. The first integral calculates the contribution to the ISE if the input is between the (j − 1) centre and the j centre. The second integral calculates the contribution if the input is between the j centre and the (j + 1)

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2245

centre. 2y is the variance of the plant output, and is used as a normalization factor. This equation can be simplified in the discrete, more realistic case, replacing the integral sign by the summation sign. From Eq. (7) if the contribution to the ISE is positive, the error in the left region was bigger than in the right, and because of that the centre has to be moved to the left to compensate this. In the opposite case, if it is negative the centre has to be moved to the right. The order of the membership functions have to be the same every time. The following equation describes how the movement of the centre can be calculated to preserve the order of the centres, and locate them in the suitable places where their contribution to the total ISE can be homogeneously distributed (we have removed the i index for the sake of simplicity): ⎧ j −1 ISEj − cj c ⎪ ⎪ if ISEj 0, ⎨ j j 2 ISE + 1/R j c = (8) |ISEj | cj +1 − cj ⎪ ⎪ j ⎩ if ISE < 0, 2 |ISEj | + 1/R j where parameter R (which can be defined for every centre) sets how far the centre can be moved within the possible limits depending on the membership functions. For high values of R, the centre can move very large distances, while for low R the movement is very small. In the learning process that we will use in this paper, the controller starts with high values for R (100) for every centre and decreases them with time (divided by two every evaluation of the ISE). The sum will be calculated every NISE iterations. At first the consequents are tuned during one learning run without calculating the ISE. In the next run the ISE is calculated, and at the end of the run the placement of the membership function is changed using Eq. (8). Then the output consequents are tuned in the next run without the ISE. After that the ISE is calculated again and so on. Thus, NISE has the size of one learning run and the ISE is calculated every NISE iterations. After NISE iterations of the control process, the ISE is computed again but with a smaller R. 3. Control of the temperature of a dynamic room: model of the plant First, in order to know the behaviour of the real plant to be controlled (Fig. 2), a mathematical model of the plant was created. The parameters of this model can be modified during the simulation, so that the controller works in a dynamic situation, where the room changes in real time. It is possible to change the volume of the room by moving one wall and moreover it is possible to open and close the ceiling. Of course there are no moving walls in reality although, for example, in lecture halls there are sometimes partition walls that can be opened and closed quickly. But our point here is that if the controller can work with every size of a room without problems, it is not necessary that it must be specially programmed depending on the room where it is used. The second possible change is the opening of the ceiling. This situation can be found several times in reality and besides, instead of the ceiling, a window can be used, and this is a very realistic situation. Other parameters of the room are for example the thickness and the material of the walls. With this model a complex description is given for the plant of the temperature controller. The basic equation of the mathematical model of the room is based on the energies and the flows of the energies. This equation is shown below: QRoom = Qheat − Qloss − Qopen ,

(9)

where QRoom is the energy stored in the room, Qheat is the energy produced by the heating, Qloss is the energy lost through the walls, and Qopen is the energy which gets lost through the opening of the ceiling. This equation can be also written with the flows of the energies. The energy flow of the room is: ˙ Room = CT dT , Q dt

(10)

where CT is the thermal capacity and T is the temperature inside the room. The thermal capacity depends on the volume of the room and the substance which is inside the room, in most cases: air. The energy flow of the heating is the power of the heating and a factor which represents it degree of effectiveness (efficiency). Moreover, it is necessary to introduce an element that describes the fact that the heating power is not given immediately to the room and that it takes time until the heating is cold after it is turned off. This effect is described with a filter, which is placed between the temperature

2246

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

Fig. 2. Scale model of a room.

controller and the plant. For increasing the heat flow, it has the shape of a root function and for decreasing, that of an exponential function. The equation of the flow of the energy, which gets lost through the wall, is shown below ˙ loss = Tin − Tout , Q Rin

(11)

where Tin is the temperature inside the room and Tout is the temperature outside. Rth is the thermal resistance and it depends on the material of the walls and the size of the room. The thermal flow through the opening of the ceiling is calculated with a constant for the maximum position of the opening (kopen ), the size of the opening (Aopen ) and the temperature difference inside and outside the room. The change of the volume is described by the movement of one wall with a constant velocity. The same description is used for the ceiling. The equation for the temperature inside the room is then  1 1 Tin − Tout dt. (12) Qheat − + kopen Aopen Tin = CT CT Rth This mathematical model has been designed with SimulinkTM , and different simulations were made with the scale model to tune and verify the model. In fact, the tuned mathematical model was very similar to the real behaviour of the plant to be controlled.

4. Simulations results In this section results of simulations using a classical fuzzy controller and the proposed advanced fuzzy controller are presented. First, a simulation is run where all parameters of the room are constant. This means that neither the wall is moved nor the ceiling is opened. The simulation time is always 400 s, and during that time the target value of the temperature has three different values. Table 1 shows the target values of the temperature of the room for the different time intervals of the experiment. The starting temperature in the room is 16 ◦ C and the temperature outside is always in the simulations 15 ◦ C. Both the classical and the advanced fuzzy controllers have two inputs, one is the error of the temperature and the other one is the first derivative of the error of the temperature. Table 2 shows the rules used for the classical fuzzy controller, which have been obtained and optimized by trial and error for the given plant, and Fig. 3 its input and output membership functions. In our advanced fuzzy controller, for the temperature error seven membership functions are used and for its derivative five. Triangular functions are used and at the beginning of the simulations when the membership functions are homogeneously distributed throughout the whole input range. Both controllers have one output, the change of heating power exerted on the room.

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2247

Table 1 Set temperature Time (s) Set temperature (◦ C)

0 20

200 22

300 18

Table 2 Rule-base for the classical fuzzy system, obtained and tuned by trial and error e

extrem_low very_low low ok high very_high extrem_high

e˙ decr_fast

decr_slow

slow

incr_slow

incr_fast

incr_fast incr_fast incr incr_slow nothing decr decr_fast

incr_fast incr_fast incr_slow nothing nothing decr decr_fast

incr_fast incr_fast incr_slow nothing decr_slow decr_fast decr_fast

incr_fast incr nothing nothing decr_slow decr_fast decr_fast

incr_fast incr nothing decr_slow decr decr_fast decr_fast

Fig. 3. Input and output membership functions for the classical fuzzy controller.

2248

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

Table 3 Rule-base of the auxiliary fuzzy system for the output scale factor (Fadapt_output ) e

Very low Med low Little low Ok Little high Med high Very high

e˙ Very-neg

neg

zero

pos

Very-pos

Strong incr Strong incr Strong incr Incr Nothing Nothing Nothing

Strong incr Strong incr Incr Incr Decr Decr Decr

Strong incr Incr Incr Nothing Decr Decr Strong decr

Incr Incr Nothing Decr Decr Strong decr Strong decr

Nothing Nothing Nothing Decr Strong decr Strong decr Strong decr

Fig. 4. Output membership functions for the auxiliary fuzzy system.

As for our proposed advanced fuzzy controller, no previous information about the rule consequents is supposed to be available, so all the initial rules will have a scalar consequent of 0.0, i.e., no change of the present heating power (which initially is set to 0.5, i.e., 50% of the maximum heating power). Therefore, no pre-training is conducted on our advanced fuzzy system. Table 3 shows a typical rule-base of the fuzzy auxiliary system for the adaptation of the output scale factor. As inputs, this fuzzy system uses the temperature of the room and its variation, with seven evenly distributed triangular functions for the former and five for the latter, forming a triangular partition. As outputs, another triangular partition with five evenly distributed triangular functions have been used (Fig. 4).  = 100 s, i.e., the scale factor correction will be of significance during the first 200–300 s of the simulation. After that period, the other auxiliary systems will be in charge of the adaptation and self-learning of the main fuzzy controller. As for the second auxiliary system, which is in charge of the adaptation of the rule consequents, the only parameter which is needed is the C constant. Since both the actuator output and the plant output have been normalized in the [0, 1] interval, we can choose |C| = 1. Finally, the plant monotonicity is positive, since increasing the output implies increasing the target value. Therefore, C = +1. Finally, for the third auxiliary system, the ISE will be calculated every 400 s, which is enough time to have an evaluation of all the operation regions through which the controller is going to pass more frequently. 4.1. Simulations with a static room The first controller which is simulated is the classical fuzzy controller. Fig. 5 shows the temperature inside the room and Fig. 6 shows the heating power exerted, for every instant of time. In all the simulations, the dashed line is the

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2249

24

TEMPERATURE (°C)

23 22 21 20 19 18 17 16 15 14 13 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 5. Static simulation: evolution of the temperature for the classical fuzzy controller. The dashed line is the desired temperature and the solid line the temperature of the room.

HEATING POWER

1

0.8

0.6

0.4

0.2

0

0

50

100

150

200

250

300

350

400

TIME (S) Fig. 6. Static simulation: evolution of the heating power for the classical fuzzy controller.

desired temperature (set point) and the solid line the actual temperature of the room. The control performance shown in the figures is good; the controller reaches the temperature exactly and without overshoots or undershoots. Of course, as we have pointed out before, the parameters of the classical fuzzy controller have been tuned by a human expert, exactly for the parameters used for the room in this simulation. Taking a look at the heating power figure, we can see that it never reaches its maximum value. Therefore, the controller is not very fast (it could have been faster), but on other hand it reduces the heating costs. The same simulation is now made with the proposed advanced fuzzy controller, with all rules starting at 0.0. Figs. 7 and 8 show the evolution of the room temperature and that of the heating power, respectively, for this initial moment when the advanced fuzzy controller starts its work with such initial rule-base. Although the controller has at the beginning no information, the adaptation of the output scale factor (see Fig. 9) starts working immediately and makes the controller reach the set value of the temperature without an overshoot. The temperature oscillates a little, but this gets better during the simulation. The heating power oscillates much, but we should remember this is the first time of learning for the controller.

2250

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

24 23 TEMPERATURE (°C)

22 21 20 19 18 17 16 15 14 13 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 7. Static simulation: evolution of the temperature for the advanced fuzzy controller. First run.

HEATING POWER

1

0.8

0.6

0.4

0.2

0

0

50

100

150

200

250

300

350

400

TIME (S) Fig. 8. Static simulation: evolution of the heating power for the advanced fuzzy controller. First run.

The evolution of the temperature and the heating power for the second time we present the output target pattern (the next 400 s of simulation) are shown in Figs. 10 and 11, respectively. Already in the second run of the simulation, after only one time of learning, the temperature does not oscillate anymore and the heating oscillates less. The other auxiliary systems have been capable of adapting the rule consequents and the position of the membership functions in order to reach much better values for the rules of the main fuzzy controller. Taking a more detailed look at the values of the room temperature, we can see that the set values are reached faster than with the classical fuzzy controller. This can be easily seen for the temperatures 22 and 18 ◦ C. Figs. 12 and 13 show the temperature and the heating power for the third run. The control performance improves again and keeps on improving with every presentation of the output target pattern. Fig. 14 shows the output surface of the main controller after the third run. With this figure, we can gain an overall view of how the auxiliary systems have contributed to the learning of the whole rule-base of our advanced fuzzy controller. More explicitly, Fig. 15 shows how input membership functions are distributed at that moment and Table 4 contains the rule table, with the scalar output membership functions included in parentheses. It should be noted that not all possible input regions have been reached by the dynamic of the process, so there are some rules which have

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2251

1.4

OUTPUT SCALE FACTOR

1.3 1.2 1.1 1 0.9 0.8 0.7

0

50

100

150

200

250

300

350

400

TIME (S) Fig. 9. Static simulation: evolution of the output scale factor. First run.

24 23 TEMPERATURE (°C)

22 21 20 19 18 17 16 15 14 13 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 10. Static simulation: evolution of the temperature for the advanced fuzzy controller. Second run.

not been activated at all (shaded cells), and others have not been activated enough to reach their reasonable final values yet. After all simulations for the static room were presented and the results were qualitatively compared, a short quantitative comparison is now made in Table 5. For this purpose, the mean-square-error (MSE), calculated with the following equation will be used as a measure of how well the control policy is M 1 2 MSE = Terror , M 1

(13)

2252

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

1

HEATING POWER

0.8

0.6

0.4

0.2

0 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 11. Static simulation: evolution of the heating power for the advanced fuzzy controller. Second run.

24 23 TEMPERATURE (°C)

22 21 20 19 18 17 16 15 14 13 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 12. Static simulation: evolution of the temperature for the advanced fuzzy controller. Third run.

HEATING POWER

1

0.8

0.6

0.4

0.2

0

0

50

100

150

200

250

300

350

400

TIME (S) Fig. 13. Static simulation: evolution of the heating power for the advanced fuzzy controller. Third run.

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2253

0.8 0.6

∆ heat

0.4 0.2 0 -1

-0.2 -0.4 30

-0.5 0 20

10

0 T

e

0.5 -10

-20

-30

t /d e T d

1

Fig. 14. Output surface of the advanced fuzzy controller after the third run.

Fig. 15. Input membership functions after run three.

2254

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

Table 4 Rule consequents after the third run (shaded areas belong to rules never activated yet)

Table 5 Some comparative performance indices for the static simulation (third run)

Classical fuzzy Adaptive fuzzy

MSE

MSE 100–200

Heating costs

1.50 0.72

1.08 × 10−4 2.95 × 10−5

240.2 241.8

24 23

TEMPERATURE (°C)

22 21 20 19

ceiling

18

wall

17 16 15 14 13 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 16. Dynamic simulation: evolution of the temperature for the classical fuzzy controller when the position of the wall and the ceiling is moved.

where Terror is the temperature error and M is the number of elements of the sum. The MSE is calculated for all time steps of the simulation. The second index is also a MSE but now only calculated for the time from 100 to 200 s. With this index it can be compared how exact the controller reaches a set value and also how fast it is for small differences of the actual temperature and the set value. This is possible because from the start until 200 s there is always the same set temperature. The third index represents the costs for the heating. It is calculated as the sum of all values of the heating. From the table, we can see the despite starting with practically no knowledge about the control policy of the plant, the proposed advanced fuzzy controller is much more accurate than the ‘off-line optimized’ classical fuzzy controller with practically the same heating costs.

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2255

24 23 TEMPERATURE (°C)

22 21 20 ceiling

19 18 wall

17 16 15 14 13 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 17. Dynamic simulation: evolution of the temperature for the proposed adaptive fuzzy controller when the position of the wall and the ceiling is moved. First run.

24 23

TEMPERATURE (°C)

22 21 20 ceiling

19 18 wall

17 16 15 14 13 0

50

100

150

200

250

300

350

400

TIME (S) Fig. 18. Dynamic simulation: evolution of the temperature for the proposed adaptive fuzzy controller when the position of the wall and the ceiling is moved. Second run.

4.2. Simulations with a dynamic room Just after the first simulation has been carried out, a dynamic simulation is made. During this second simulation the position of the wall is changed and also the ceiling is opened. The set values of the temperature will be the same as in the first simulation. The wall moves at time 100 s from the position l which is the maximum of the length of the room to the position 0.25l. Thus, the volume of the room is after this movement only a quarter of its initial value. The ceiling is 20% opened at the time 230 s and closed at 270 s. The advanced fuzzy controller starts with the parameters from the simulations in the previous section. The next three figures (Figs. 16–18) show the evolution of the temperature inside the room for both the classical and the advanced fuzzy controllers, and Figs. 19–21 the corresponding evolution of the heating power. From the figures, the aforementioned events clearly influence the control performance of the classical fuzzy controller. Nevertheless, they are practically unnoticed to the naked eye using the proposed advanced fuzzy controller, even for the first run of the simulation.

2256

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

1 0.9

HEATING POWER

0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0

0

50

100

150

200

250

300

350

400

TIME (S) Fig. 19. Dynamic simulation: evolution of the heating power for the classical fuzzy controller.

1 0.9

HEATING POWER

0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0

0

50

100

150

200

250

300

350

400

TIME (S) Fig. 20. Dynamic simulation: evolution of the heating power for the advanced fuzzy controller. First run.

The same comparative performance indices used with the static simulation are also calculated for the dynamic simulation (see Table 6). The table shows again, this time even more clearly, that our advanced fuzzy controller is faster and much more accurate than the classical fuzzy controller. And this is accomplished using just little higher heating costs. Remember that the wall is moved at the time 100 s, so that the MSE100–200 shows how good the controller works with the new situation. In summary, with the dynamic room simulations the superiority of the advanced fuzzy controller proposed in this paper is obvious. The classical fuzzy controller generates big over- and undershoots if the parameters of the room change, however, the advanced fuzzy controllers has no problems with changing the parameters of the room during the simulation. There is no decreasing of the control performance of the advanced fuzzy controller even when the parameters of the room are changed.

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

2257

1 0.9 HEATING POWER

0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0

50

100

150

200

250

300

350

400

450

TIME (S) Fig. 21. Dynamic simulation: evolution of the heating power for the advanced fuzzy controller. Second run.

Table 6 Some comparative performance indices for the dynamic simulation (third run)

Classical fuzzy Adaptive fuzzy

MSE

MSE 100–200

Heating costs

2.44 0.79

0.04 2.83 × 10−5

146.6 150.6

5. Conclusions In this paper an adaptive and self-learning fuzzy controller was presented. Without any off-line pre-training, the algorithm achieves very high control performance through a three-stage algorithm. In the first stage, coarse tuning of the output scale factor is accomplished using a fuzzy auxiliary controller. In the second stage, an adaptation of the fuzzy rule consequents is accomplished by evaluating the current state of the plant and proposing a correction of the rules responsible for the existence of such a state, either as a reward or as a penalty, and finally, in the third stage, the position of the membership functions are optimized in order that the errors of the main controller are homogeneously distributed throughout the operating regions. It has been shown that this controller works much better than ‘off-line optimized’ fuzzy controllers in both static and dynamic situations. Thus, this controller does not need any information about the size of the room or the status of the window. Therefore, it is enough to have a unique advanced fuzzy controller for every situation since there is no need to program it off-line depending on the situation where it is used. Acknowledgements The authors would like to thank anonymous referees for their helpful suggestions and valuable comments. The authors also thank Dr. P. Walaschewski for his work. This work has been partially supported by the Spanish CICYT Project TIN2004-01419. References ˚ [1] K.J. Aström, B. Wittenmark, Adaptive Control, second ed., Addison-Wesley, Reading, MA, 1995. [2] K.S. Boo, H.S. Cho, A self-organizing fuzzy control of weld pool size in GMA welding processes, Control Eng. Practice 2 (6) (1994) 1007–1018. [3] Y.-W. Cho, C.-W. Park, M. Park, An indirect model reference adaptive fuzzy control for SISO Takagi–Sugeno model, Fuzzy Sets and Systems 131 (2) (2002) 197–215.

2258

I. Rojas et al. / Fuzzy Sets and Systems 157 (2006) 2241 – 2258

[4] X. Fan, N. Zhang, S. Teng, Trajectory planning and tracking of ball and plate system using hierarchical fuzzy control scheme, Fuzzy Sets and Systems 144 (2) (2004) 297–312. [5] S. Hayashi, Auto-tuning fuzzy PI controller, Proc. IFSA ‘91, Belgium, Brussels, pp. 41–44. [6] C. Hua, X. Guan, G. Duan, Variable structure adaptive fuzzy control for a class of nonlinear time-delay systems, Fuzzy Sets and Systems 148 (3) (2004) 453–468. [7] J.S.R. Jang, Self-learning fuzzy controllers based on temporal back propagation, IEEE Trans. Neural Networks 3 (5) (1992) 714–723. [8] J. Jantzen, A tutorial on adaptive fuzzy control, EUNITE 2002, pp. 709–719. [9] C.-K. Lin, A reinforcement learning adaptive fuzzy controller for robots, Fuzzy Sets and Systems 137 (3) (2003) 339–352. [10] C.M. Lin, C.F. Hsu, Adaptive fuzzy sliding-mode control for induction servomotor systems, IEEE Trans. Energy Conversion 19 (2) (2004) 362–368. [11] C.M. Lin, Y.J. Mon, Hybrid adaptive fuzzy controllers with application to robotic systems, Fuzzy Sets and Systems 139 (1) (2003) 151–165. [12] C.-W. Park, M. Park, Adaptive parameter estimator based on T–S fuzzy models and its applications to indirect adaptive fuzzy control design, Inform. Sci. 159 (1–2) (2004) 125–139. [13] J.-H. Park, G.-T. Park, S.-H. Kim, C.-J. Moon, Output-feedback control of uncertain nonlinear systems using a self-structuring adaptive fuzzy observer, Fuzzy Sets and Systems 151 (2005) 21–42. [14] H. Pomares, I. Rojas, J. González, F. Rojas, M. Damas, F.J. Fernández, A two-stage approach to self-learning direct fuzzy controllers, Internat. J. Approximate Reasoning 29 (3) (2002) 267–289. [15] T. Procyk, E. Mamdani, A linguistic self-organizing process controller, Automatica 15 (1) (1979) 15–30. [16] I. Rojas, H. Pomares, F.J. Pelayo, M. Anguita, E. Ros, A. Prieto, New methodology for the development of adaptive and self-learning fuzzy controllers in real time, Internat. J. Approximate Reasoning 21 (1999) 109–136. [17] J. Velagic, Z. Vukic, E. Omerdic, Adaptive fuzzy ship autopilot for track-keeping, Control Eng. Practice 11 (2003) 433–443. [18] D. Velez-Diaz, Y. Tang, Adaptive robust fuzzy control of nonlinear systems, IEEE Trans. Systems, Man Cybernetics, Part B 34 (3) (2004) 1596–1601. [19] J. Yi, N. Yubazaki, K. Hirota, A proposal of SIRMs dynamically connected fuzzy inference model for plural input fuzzy control, Fuzzy Sets and Systems 125 (1) (2002) 79–92. [20] J. Yi, N. Yubazaki, K. Hirota, A new fuzzy controller for stabilization of parallel-type double inverted pendulum system, Fuzzy Sets and Systems 126 (1) (2002) 105–119. [21] J-P. Ylin, P. Jutila, Fuzzy self-organising pH control of an ammonia scrubber, Control Eng. Practice 5 (9) (1997) 1233–1242. [22] Z. Zhang, J. Chang, A fuzzy control algorithm with high controlling precision, Fuzzy Sets and Systems 140 (2) (2003) 375–385.