end

count

#### end

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

At the end of the execution, the minimum Kp obtained was equal to 17.3 and the minimum Ti was 23, and IAE equal 6.35. This is a better result than that presented at (Santos, 2010).

MATLAB program uses a Transfer Function representation for the Dead Time and for the plant. Both are associated in series through a specific MATLAB function and a unitary feedback loop is calculated to analyses the system response to several pairs of Kp and Ti

plant = (0.26\*((1-(T/2)\*s+((T\*s)^2)/12)/(1+(T/2)\*s+((T\*s)^2)/12)))/(23\*s+1)

**Figure 4.** Piping and instrumentation diagram.

values.

t=0:0.1:1000; tam=length(t);

% Plant - Transfer Function

for j = 1:tamTi,

Kc = 12.00:0.01:18.00; Ti = 22.00:0.01:25.00; tamKp = length(Kp); tamTi = length(Ti);

clc close all s = tf('s')

T = 3;

count = 1; for i = 1:tamKc,

```
% Search for minimum Kc and minimum Ti 
tam = length(result) 
minimumIAE = 1000 
for i=1:tam(1), 
       if minimumIAE > result(i,4) 
 minimumIAE = result(i,4); 
 minimumKp = result(i,1); 
 minimumTi = result(i,2); 
       end
end 
minimumIAE 
minimumKp
```

```
minimumTi
```
At the program listed above, two other functions were developed: *Calcul\_Mp* and *IAE\_U\_Step*.

These functions are listed below:

```
function [MP] = CalculMP(output) 
 tam = length(output); 
 MP = (max(output)-output(tam))/output(tam)*100;
```
end

At the function CalculMP the output length is obtained to take the last value of the output variable to the step response. It is used to calculate the overshoot of the system.

At the next function the Integral Absolute Error (IAE) is numerically obtained using the output generated at the main mathscript code.

function [IAE\_Value] = IAE\_U\_Step(output,int\_T) Tam = length(output); IAE\_Value = 0;

```
for i=1:Tam, 
 if output(i) < 1 
 IAE_Value = IAE_Value + (1-output(i))*int_T; 
 else
 IAE_Value = IAE_Value + (1-output(i))*(-1)*int_T ; 
 end
     end
```
#### end

The closed loop system model with a PI control was built at SIMULINK as represented at figure 5.

**Figure 5.** Closed loop Pressure Control with Pade approximation.

Applying a step function from 51 bar to 85 bar at the input of the system presented at figure 5, the output is presented at figure 6 for the tuning parameters obtained at the exhaustive search algorithm.

**Figure 6.** Step response of the closed loop pressure control system.

The step response presented at Figure 6 represents a fast response with low overshoot than that presented at (Santos, 2010). It is possible to verify the delay time at the output signal.

The same procedure was used to design the control algorithm to the temperature loop and best results were obtained when compared with those presented at (Santos, 2010). In both closed loops the exhaustive search for the best response was executed near the initial solution obtained through the experimental tuning procedure.
