**3. Adaptive PID controller**

150 Frontiers of Model Predictive Control

If *A(k)* and *B(k)* are defined as expressed in equation 8, the final discrete transfer function is

( ( )) <sup>1</sup> ( ) <sup>1</sup>

*tk Ak tk Bk f pk dk* ( 1) ( ) ( ) ( ) ( ( ))

For validation of the presented discrete physical model, it is necessary to have open loop data of the real system. This data has been chosen to respect two important requirements: frequency and amplitude spectrum wide enough (Psichogios & Ungar, 1992). Respecting the necessary presupposes, the collect data is made via RS232 connection to the PC. The

Figure 4 shows the physical model error signal *e(k)*, which is equal to the difference between delta and estimated delta water temperature *e(k)= Δt(k)- Δtestimated(k)*. It can be seen from this signal, that the proposed model achieved very good results with a mean square error

0 200 400 600 800 1000 1200 1400 1600

0 200 400 600 800 1000 1200 1400 1600

0 200 400 600 800 1000 1200 1400 1600

0 200 400 600 800 1000 1200 1400 1600

Time(seconds)

2

(8)

(9)

*wf k d k*

2

*B k e M wf k d k Ce*

( ( ))

*wf k d k*

( )

*Ak e M*

2

( ( ))

validation data and the physical model error are illustrated in figure 4.

given as defined in equation 9.

**2.3 Physical model validation** 

0

> -5 0 5

Fig. 4. Open loop data used to validate the model.

50

100

(MSE) of 1,32ºC2 for the all test set (1 to 1600).

The first control loop tested is the adaptive proportional integral derivative control algorithm. Adaptive because we know that gain and time constant of the system changes with the input water flow. First it is described the control structure and its parameters and second the real control results are showed.

#### **3.1 Adaptive PID control structure**

This is a very simple and well known control strategy that has two control parameters *Kp* and *Kd* that are multiplied by the water flow, as illustrated in figure 6. The applied control signal is expressed in equation 10:

$$\begin{aligned} f\left(p(k)\right) &= f\left(p(k-1)\right) + wf(k)K\_p e(k) \\ &+ wf(k)K\_d(e(k) - e(k-1)) \end{aligned} \tag{10}$$

The P block gives the error proportional contribution, the *D* block gives the error derivative contribution and the *I* block gives the control signal integral contribution.

The three control parameters were adjusted after several experimental tests in controlling the real system. This algorithm has some problems dealing with time constant and time delay variations of the system. With this control loop it is not possible to define a close loop

Adaptable PID Versus Smith Predictive Control Applied to an Electric Water Heater System 153

As it was predicted the results have shown some problems in water flow variations because

The evaluation control criterion used is the mean square error (MSE). The MSE in the all test

The second control loop tested is the Smith predictive control algorithm. This control strategy is particularly used to control systems with time delay. First it is described the

The Smith predictive controller is based in the internal model controller architecture that uses the physical model presented in section II, as illustrated in figure 8. It uses two physical direct models one with time delay for the prediction loop and another with out the time


*Z -d (k)*

The Smith predictive control structure has a special configuration, because the systems has two inputs with two deferent time delays so it uses two direct models, one model with time delay for compensate its negative effect and another with out time delay needed for the

Electric Water Heater

*f(p(k-1)) hwt(k)*

*Z -1*

Physical Direct Model

*Z -1*

Physical Direct Model

Filter



control structure and its parameters and second the control results are showed.

Algorithm MSE Test Set APID 5,97

the controller just reacts when it feels an error signal different from zero.

Table 1. Mean square errors of the control results.

**4. Smith predictive controller** 

**4.1 Smith predictive control structure** 

*r(k) +*

*wf(k-1)*

Fig. 8. SPC constituent blocks.

internal model control structure.

*cwt(k)*

delay for the internal model control structure.

*t(k)-e(k)*

*e(k)* Model


Physical Inverse

Time Delay Function

*Z -d2 (k)*

is presented in table 1.

Fig. 6. APID controller constituent blocks.

system with a fixed time constant. The time delay is also a problem that is not solved with this control algorithm.

It was define a reference signal *r(t)* that is the desired hot water temperature and a water flow *wf(t)* with several step variations similar to the ones used in real applications. The cold water temperature was almost constant around 13,0 ºC.

For testing the controllers it can be seen that error signal *e(t)=r(t)-hwt(t)* is around zero excepted in the input transitions. In reference step variations it can be seen that the overshoots for the different water flows are similar but the rise times are clearly different, for small water flows the controller presets bigger rise times. In water flow variations the control loop have some problems because of the variable time delay. This control loop only reacted when error appears.

#### **3.2 Adaptive PID control results**

With the proposed tests signals, the tuned adaptive PID control structure was tested in controlling the electric water heater. The APID control results are shown in figure 7.

Fig. 7. Adaptive PID control results.

As it was predicted the results have shown some problems in water flow variations because the controller just reacts when it feels an error signal different from zero.

The evaluation control criterion used is the mean square error (MSE). The MSE in the all test is presented in table 1.


Table 1. Mean square errors of the control results.
