Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Table of Contents

........................................................................................................................................ 1
Initatiation of optimazation with lower and upper bounds. Here optimazation is done with Teacher
Learner Based optimazation method ....................................................................................... 1
Parameter settings ............................................................................................................... 1
Starting of optimazation ....................................................................................................... 1
Iteration ............................................................................................................................. 2
Teacher phase ..................................................................................................................... 2
Learner phase ..................................................................................................................... 2
Model pridicted values ......................................................................................................... 2
Concentration of lumps as weigth percent. .............................................................................. 3
Experimental Data input ....................................................................................................... 3
Data as predicted by Model .................................................................................................. 3
Plot between experimental data and model predicted data ........................................................... 4
parity chart ......................................................................................................................... 4
Goodness of fit i.e Coefficient of determination ....................................................................... 5
END ................................................................................................................................. 5

clear;clc;% RB_VR model parameter file


close all;% five lump parameter is fitted at 400 degC

Initatiation of optimazation with lower and up-


per bounds. Here optimazation is done with
Teacher Learner Based optimazation method
lb=[0 0 0 0 0 0 0 0 0 0]; % lower bound
ub=[0.7 4 5 2 8 10^-4 10^-5 10^-6 10^-5 10^-6]*10^-3; % upper bound
prob=@fivelumpRB_VR400; % fitness of function

Parameter settings
Np=10; % number of populations
T=50; % number of iterations

Starting of optimazation
f=NaN(Np,1); % vector to store fitness of all initatial populations
D=length(lb);% number of decision varialbe i.e number of rate
constants to be optimized.
P=repmat(lb,Np,1)+repmat((ub-lb),Np,1).*rand(Np,D);
for p=1:Np
f(p)=prob(P(p,:)); % evaluating fitness of function for initial
population.
end

1
Iteration
for t=1:T
for i=1:Np

Teacher phase
Xmean=mean(P); % determine the mean of population
[~,ind]=min(f);% Determione location of teacher
Xbest=P(ind,:);% Copiny the solution as teacher
TF=randi([1,2],1,1);
Xnew=P(i,:)+rand(1,D).*(Xbest-TF*Xmean);
Xnew=min(ub,Xnew);
Xnew=max(lb,Xnew);
fnew=prob(Xnew);
if(fnew<f(i))
P(i,:)=Xnew;
f(i)=fnew;
end

Learner phase
p=randi([1 Np],1,1);
while i==p
p=randi([1 Np],1,1);
end
if f(i)<f(p)
Xnew=P(i,:)+rand(1,D).*(P(i,:)-P(p,:));
else
Xnew=P(i,:)-rand(1,D).*(P(i,:)-P(p,:));
end
Xnew=min(ub,Xnew);
Xnew=max(lb,Xnew);
fnew=prob(Xnew);
if (fnew<f(i))
P(i,:)=Xnew;
f(i)=fnew;
end

end
end
[bestfitness,ind]=min(f);
bestsol=P(ind,:); % Best values of fitted parameters.

Model pridicted values


x=bestsol; %rate constants k12,k13,k13,k14,k15,k23,k24,k25,k34,k45
k12=x(1);k13=x(2);k14=x(3);k15=x(4);k23=x(5);k24=x(6);k25=x(7);k34=x(8);k35=x(9);k4
constants values
kA=k12+k13+k14+k15;kB=k23+k24+k25;kC=k34+k35; %Combine rate constant
values

2
alpha1=k12/(kB-kA);alpha2=(k13+alpha1*k23)/(kC-kA);
beta2=alpha1*k23/(kC-kB);alpha3=(k14+alpha1*k24+alpha2*k34)/(k45-
kA);beta3=(beta2*k34+alpha1*k24)/(k45-kB);
delta3=(beta2-alpha2)*k34/(k45-
kC);alpha4=(k15+alpha1*k25+alpha2*k35+alpha3*k45)/kA;
beta4=(alpha1*k25+beta2*k35+beta3*k45)/kB;
delta4=((beta2-alpha2)*k35+delta3*k45)/kC;
C10=1-0.2598;
t=[0 30 50 60]'; % cracking time in minute

Concentration of lumps as weigth percent.


C1=C10*exp(-kA.*t);
C2=C10*alpha1*(exp(-kA.*t)-exp(-kB.*t));
C3=C10*(alpha2*exp(-kA.*t)-beta2*exp(-kB.*t)+(beta2-alpha2)*exp(-
kC.*t));
C4=C10*(alpha3*exp(-kA.*t)-beta3*exp(-kB.*t)+delta3*exp(-kC.*t)-
(alpha3-beta3+delta3)*exp(-k45.*t));
C5=C10*(alpha4*(1-exp(-kA.*t))-beta4*(1-exp(-kB.*t))+delta4*(1-exp(-
kC.*t))-(alpha3-beta3+delta3)*(1-exp(-k45.*t)));

Experimental Data input


C1exp=[0.7402 .5725 .4713 .4399];
C2exp=[0 .0082 .0136 .0147];
C3exp=[0 0.0574 .1033 .1183];
C4exp=[0 .079 .1179 .1267];
C5exp=[0 .0231 .0342 .0407];

Data as predicted by Model


time=t;
Data=table(time,C1,C2,C3,C4,C5);
fprintf('Following table shows the model predicted values of weigth
fraction of lumps\n')
disp(Data); % Displays the model predicted values of weigth fraction
of lumps

Following table shows the model predicted values of weigth fraction of


lumps
time C1 C2 C3 C4 C5
____ _______ _________ ________ ________ ________

0 0.7402 0 0 0 0
30 0.56881 0.0087509 0.064989 0.074828 0.022817
50 0.47722 0.012394 0.10076 0.11482 0.035012
60 0.43711 0.01371 0.1167 0.13233 0.040352

3
Plot between experimental data and model pre-
dicted data
plot(t,C1,'r')
hold on
plot(t,C2,'b')
plot(t,C3,'g')
plot(t,C4,'k')
plot(t,C5,'m')
plot(t,C1exp,'r*')
plot(t,C2exp,'b^')
plot(t,C3exp,'go')
plot(t,C4exp,'k*')
plot(t,C5exp,'m^')
xlabel('time(min)')
ylabel('weigth fraction of lumps')
legend('C1','C2','C3','C4','C5','C1exp','C2exp','C3exp','C4exp','C5exp')
grid on
title('Weigth fraction plot')

parity chart
figure()
plot(C1,C1exp,'*')

4
hold on
plot([0 1],[0 1])
plot(C2,C2exp,'g.')
plot(C3,C3exp,'b^')
plot(C4,C4exp,'ko')
plot(C5,C5exp,'r*')
xlabel('Model predicted values')
ylabel('Experimental values')
legend('C1','Diagonal line','C2','C3','C4','C5')
grid on
title('Parity plot')

Goodness of fit i.e Coefficient of determination


SSE=bestfitness;
SST=sum((-C1+mean(C1exp)).^2+(-C2+mean(C2exp)).^2+(-
C3+mean(C3exp)).^2+(-C4+mean(C4exp)).^2+(-C5+mean(C5exp)).^2);
R_square=(SST-SSE)/SST;
fprintf('The coefficient of detemination is\n R^2=')
disp(R_square)

The coefficient of detemination is


R^2= 0.9975

END
Published with MATLAB® R2021a

You might also like