**4.2. Digital control design**

The control algorithm designed through the Smith Predictor may be described in a digital form, using the Z-Transform representation. The MATLAB script code below represents this transfer function.

% Digital Smith Predictor

clc clear all close all 

s=tf('s')

Kp=2; Ti=15; G=Kp\*(1+(1/(Ti\*s)));

T=0.1;

```
Gz=c2d(G,T,'tustin')
```
n=3/T;

z=tf('z',0.1)

Hz=c2d(0.26/(26\*s+1),T,'tustin') Gcz=feedback(Gz,series(Hz,1-z^(-n))

The G transfer function represents the Proportional Integral algorithm and Gz is its discrete form using the Bilinear (Tustin) approximation. The sample time was adjusted in 0.1 s, since the dimension of time delay is about 30 times greater than this value. The time delay verified at the system may be easily modelled measuring how many samples the system measure along the total time delay. This measurement is represented at n=3/T.

The digital controller designed is represented by:

Transfer function:

2.007 z^32 – 3.992 z^31 + 1.986 z^30

 --------------------------------------------------------------------------------------------------------- 1.001 z^32 – 1.996 z^31 + 0.9952 z^30 – 0.001001 z^2 – 6.654e-006 z + 0.0009948

Sampling time: 0.1

The result presented above may be used to generate the difference equation:

$$\begin{aligned} u(k) &= 2.007e(k) - 3.992e(k-1) + 1.986e(k-2) + 1.996u(k-1) - 0.9952u(k-2) + \dots \\ &\dots 0.001u(k-30) + 0.000006u(k-31) - 0.00099u(k-32) \end{aligned} \tag{12}$$

This equation implements the control algorithm at the digital system. The control algorithm designed to the temperature plant may also be described in a digital form, using the Z-Transform representation. At the next mathscript code this design procedure was applied, but at this case the sample frequency was adjusted to 1Hz, since the time response of the temperature system is very larger than the pressure system.

% Digital Smith Predictor - Temperature

G=Kp\*(1+(1/(Ti\*s)));

T=1;

16 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

saturation of the actuators.

transfer function.

G=Kp\*(1+(1/(Ti\*s)));

Gz=c2d(G,T,'tustin')

Transfer function:

Sampling time: 0.1

Hz=c2d(0.26/(26\*s+1),T,'tustin') Gcz=feedback(Gz,series(Hz,1-z^(-n))

The digital controller designed is represented by:

2.007 z^32 – 3.992 z^31 + 1.986 z^30

z=tf('z',0.1)

 clc clear all close all

 s=tf('s') Kp=2; Ti=15;

 T=0.1; 

 n=3/T; 

% Digital Smith Predictor

**4.2. Digital control design** 

The output of the controller must be verified after the control system design to avoid the

The control algorithm designed through the Smith Predictor may be described in a digital form, using the Z-Transform representation. The MATLAB script code below represents this

The G transfer function represents the Proportional Integral algorithm and Gz is its discrete form using the Bilinear (Tustin) approximation. The sample time was adjusted in 0.1 s, since the dimension of time delay is about 30 times greater than this value. The time delay verified at the system may be easily modelled measuring how many samples the system

measure along the total time delay. This measurement is represented at n=3/T.

 --------------------------------------------------------------------------------------------------------- 1.001 z^32 – 1.996 z^31 + 0.9952 z^30 – 0.001001 z^2 – 6.654e-006 z + 0.0009948

Gz=c2d(G,T,'tustin')

n=85/T;

z=tf('z',T)

Hz=c2d(-0.133/(174\*s+1),T,'tustin') Gcz=feedback(Gz,series(Hz,1-z^(-n))

Better results also were obtained using the Smith Predictor structure applied to the temperature loop control.
