You are on page 1of 8

Simulation and Optimization

Mohamed Alkhatim-Tutorial (4)


Problem2:
solution
1. DoF:
No. of Variables 4
r 1
Q 1
T 2
MBs 3
Basis 1
Given Relations 1
Given Q 1
Given T 1
EBs 1
DoF 8-8=0

2. Selection of independent variables:


Stream Stream 1 Stream 2 No. of independent
variables
No. ind. - 5 5
variables
Selected F, H, M2,
variable T2, r
3. Material balance equations:
M2: 1000-M2-r=0
F: r-F=0
H: r-H=0
Conversion:
((1000-M2)/1000)-0.25=0
Energy balance:
(20830*r)+(M2*((42.93*(10^-3)*(T2-25)))+((8.301*(10^-
5)/2)*((T2^2)-(25^2)))-((1.87*(10^-8)/3)*((T2^3)-(25^3)))-
((8.03*(10^-12)/4)*((T2^4)-(25^4))))+(H*((28.84*(10^-
3)*(T2-25)))+((0.00765*(10^-5)/2)*((T2^2)-(25^2)))-
((0.3288*(10^-8)/3)*((T2^3)-(25^3)))-((0.8694*(10^-
12)/4)*((T2^4)-(25^4)))) +(F*((34.28*(10^-3)*(T2-
25)))+((40268*(10^-5)/2)*((T2^2)-(25^2)))-((8.69*(10^-
12)/4)*((T2^4)-(25^4))))-(44.455)=0
Function file:
function f=tut4_2(x)
%variables
M2=x(1); F=x(2); H=x(3);
T2=x(4); r=x(5);
%equatins
f(1)=1000-M2-r;
f(2)=r-F;
f(3)=r-H;
f(4)=((1000-M2)/1000)-0.25;
f(5)=(20830*r)+(M2*((42.93*(10^-3)*(T2-25)))+((8.301*(10^-5)/2)*((T2^2)-
(25^2)))-((1.87*(10^-8)/3)*((T2^3)-(25^3)))-((8.03*(10^-12)/4)*((T2^4)-
(25^4))))+(H*((28.84*(10^-3)*(T2-25)))+((0.00765*(10^-5)/2)*((T2^2)-
(25^2)))-((0.3288*(10^-8)/3)*((T2^3)-(25^3)))-((0.8694*(10^-12)/4)*((T2^4)-
(25^4)))) +(F*((34.28*(10^-3)*(T2-25)))+((40268*(10^-5)/2)*((T2^2)-
(25^2)))-((8.69*(10^-12)/4)*((T2^4)-(25^4))))-(44.455);
end

Script file:
%Intial value
x0=10*ones(1,5);
x=fsolve(@tut4_2,x0);
fprintf('The temp of gases leaving the reactor = %7.4f\n C',x(4))

Problem (3)
(a)

Solution:
D.F table:
No. of variables 8
R 1
Q 1
T 3
MB 5
Basis 2
Relations 1
Give q 0
EB 1
GIVEN IND. COMP 1
GIVEN TEMPS 3
D.F 0

Selection table
Streams 1 2 3
No. of independed 0 0 5+r+Q
variables
Selection - - O,A3,Q,N,W,C,r

Equations:
MB:
(0.21*2.4)-5r-O=0
(0.79*2.4)-C=0
1-4r-A3=0
4r-N=0
6r-W=0
Conversion:
(1-A3)-0.9=0
Energy balance:
(-
903.6*103*r)+(71671.6*A3)+(67411.4*W)+(26062.4*C)+(2672
4.7*N)+(26295.1*O)-Q=0

Matlab Code:
Function file:
function f=problem3_4(x)
%Variables
A3=x(1); r=x(2); Q=x(3); N=x(4); W=x(5); O=x(6);
C=x(7);
%Equations
f(1)=(2.4)-(5*r)-O;
f(2)=(2.4+N-(0.79*N))-C;
f(3)=1-(4*r)-A3;
f(4)=(4*r)-N;
f(5)=(6*r)-W;
f(6)=(1-A3)-0.9;
f(7)=(-
903.6*(10^3)*r)+(71671.6*A3)+(67411.4*W)+(26062.4*C)+(26724.7*N)+(26295.1*O
)-Q;

end
script file:
%Intial value
x0=10*ones(1,7);
x=fsolve(@problem3_4,x0);
fprintf('the required rate of heat = %7.4f\n',x(3))

command window:
the required rate of heat = 19916.5861

Problem4:

D.F Table:

Number of variables 8
Temperatures 2
Heat transfer rate 1
Extent of reaction 3
MB 6
EB 1
Given temperatures 2
Heat transfer rate 0
Independent compositions 4
Flow rate 1
Relations 0
DF 0

Independent variables and selection:


Stream number 1 2
No. Ind. Variables 0 3+3rs+Q
Selection - W2,C2,H2,r1,r2,r3,Q
Equations:
MB:
For CO:
0.05-r1-r2-r3=0
For H2:
0.75-2r1-3r2+r3-H2=0
For CH3OH:
r1-8=0
For CH4:
r2-0.01=0
For H2O:
r2-r3-W2=0
For CO2:
r3-C2=0
EB:
Q=(-22r1-50r2-10r3)+((0.2*0.8*(700-25)+(0.01*0.9*(700-
25))+(W2*0.8*(700-25))+(C2*0.45*(700-25))+(H2*0.4*(700-
25)))-((0.25*6.9*(550-25))+(0.75*0.4*(550-25)))
MATLAB code:
Function:
function f = tut4_4(x)
W2=x(1); C2=x(2); H2=x(3); r1=x(4); r2=x(5); r3=x(6); Q=x(7);
f(1)=0.05-r1-r2-r3;
f(2)=0.75-2*r1-3*r2+r3-H2;
f(3)=r1-8;
f(4)=r2-0.01;
f(5)=r2-r3-W2;
f(6)=r3-C2;
f(7)=(-22*r1-50*r2-10*r3)+((0.2*0.8*(700-25)+(0.01*0.9*(700-
25))+(W2*0.8*(700-25))+(C2*0.45*(700-25))+(H2*0.4*(700-25)))-
((0.25*6.9*(550-25))+(0.75*0.4*(550-25))))-Q;
end

Script:
W2=x(1); C2=x(2); H2=x(3); r1=x(4); r2=x(5); r3=x(6);
x0=10*ones(1,7);
x=fsolve(@tut4_4,x0);
T=550:30:700;
Q=(-22*r1-50*r2-10*r3)+((0.2*0.8*(700-25)+(0.01*0.9*(700-25))+(W2*0.8*(700-
25))+(C2*0.45*(700-25))+(H2*0.4*(700-25)))-((0.25*6.9*(550-
25))+(0.75*0.4*(550-25))));
plot(T,Q)
title('T vs Q')
xlabel('T')
ylabel('Q')
legend('T')
grid on
fprintf('Heat transfer rate is=%7.3f\n',Q)

Command window:
Heat transfer rate is=-5434.8

You might also like