You are on page 1of 8

Almoanna Mahmoud 152012

Simulation and Optimization

TUT_five’s_homework
Problem (1) :

Basis: 100 lb-mole/hr of methane in stream 6 = 45.36 kmol/hr

1. DF Table for the whole process:

Stream Variables 24
R 1
T 10
Given T 6
Q 6
MB 16
EB 6
Given Q 4
Composition 3
Given relation 1
Splitter relation: _
Composition 3
temperature 1

Basis 1
DF =0

1
Almoanna Mahmoud 152012

2. Number of Independent Equations:

Stream No. 1 2 3 4 5 6 7 8 9 10 Total


Flow Rates 3 4 4 _ _ 1 4 1 3 _ 20+1
Temperatur _ 1 _ _ 1 _ 1 _ _ 1 4+2
e
Selection C1 C2 C3 T5 H6 C7 W8 C9 T10 r
H1 H2 H3 H7 H9 Q1
M1 M2 M3 M7 M9 Q2
W2 W3 W7
T2 T7
M= methane , H= hydrogen , W= water , C= carbon monoxide

Total number of independent unknowns = 27

M.B=16

E.B=6

Splittar relation =3

Splitter temperature =1

Ratio =1

Total Number of eq. =27

D.F= Total number of independent unknowns- Total Number of eq.

3. Code:

Function file:

function f=Mu3nnaHW5(x)
C1=x(1); H1=x(2); M1=x(3); C2=x(4); H2=x(5); M2=x(6); W2=x(7);
C3=x(8); H3=x(9); M3=x(10); W3=x(11); H6=x(12); C7=x(13);
H7=x(14); M7=x(15); W7=x(16); W8=x(17); C9=x(18); H9=x(19);
M9=x(20); r=x(21); T2=x(22); T5=x(23); T7=x(24); T10=x(25);
Q1=x(26); Q2=x(27);

%Material Balances Equations:

%MIXER MB
f(1)=C1+C9-C2;
f(2)=H1+H9-H2;
f(3)=M1+M9-M2;

2
Almoanna Mahmoud 152012

f(4)=(1./99)*(C9+H9+M9)-W2;
%REACTOR MB
f(5)=C2-r-C3;
f(6)=H2-3*r-H3;
f(7)=M2+r-M3;
f(8)=W2+r-W3;

%SPLITTER MB :
f(9)=C3-0.12*45.36-C7;
f(10)=H3-H6-H7;
f(11)=M3-0.5*45.36-M7;
f(12)=W3-(45.36-(0.12*45.36)-H6-(0.5*45.36))-W7;
%SEPARATOR MB:
f(13)=C7-C9;
f(14)=H7-H9;
f(15)=M7-M9;
f(16)=W7-W8-(1./99)*(C9+H9+M9);

%HEAT OF REACTION :

Hrs= 1000*(-110.525+-74.9+110);

%RELATIONS :
f(17)=3*CO2-H2;
%ENERGY BALANCES :
cpC=29;cpH=14.48;cpM=40.5;cpW=37.47;cpWL=75.327
%MIXER :
%Tref=93.33C
f(18)=C2*cpC*(T2-93.33) + H2*cpH*(T2-93.33) + M2*cpM*(T2-
93.33) + W2*cpW*(T2-93.33)- C9*cpC*(T10-93.33) - H9*cpH*(T10-
93.33) - M9*cpM*(T10-93.33) - (1./99)*(C9+H9+M9)*cpWL*(T10-
93.33) - 0;
%REACTOR :
%Tref=537.7C
Hr= Hrs + (cpM+cpW)*(537.7-25) - (cpC+3*cpH)*(537.7-25);
f(19)= r*Hr - C2*cpC*(T2-537.7) - H2*cpH*(T2-537.7) - 0;
%HEAT EXCHANGER 1 :
%Tref=537.7 C
f(20)=C3*cpC*(260-537.7) + H3*cpH*(260-537.7) + M3*cpM*(260-
537.7) + W3*cpW*(260-537.7) - Q1;
%HEAT EXCHANGER 2 :
%Tref=260 C
Hv=37281.53; % @100psia and boiling point = 163.71C
f(21)=C3*cpC*(T5-260) + H3*cpH*(T5-260) +M3*cpM*(T5-260) +
W3*(cpWL*(T5-163.71)-Hv+cpC*(163.71-260))+ C9*cpC*(T10-260) +
H9*cpH*(T10-260) + M9*cpM*(T10-260) +
(1./99)*(C9+H9+M9)*cpW*(T10-260) - C9*cpC*(37.7-260) -
H9*cpH*(37.7-260) - M9*cpM*(37.7-260) -
(1./99)*(C9+H9+M9)*cpW*(37.7-260) - 0;
%SPLITTER :
%Tref=93.33 C

3
Almoanna Mahmoud 152012

f(22)=C7*cpC*(T7-93.33) + H7*cpH*(T7-93.33) + M7*cpM*(T7-


93.33) + W7*cpWL*(T7-93.33)- C3*cpC*(T5-93.33) - H3*cpH*(T5-
93.33) - M3*cpM*(T5-93.33) - W3*cpWL*(T5-93.33)- 0;
%Sperator:
%Tref=T7
f(23)= C9*cpC*(37.7-T7) + H9*cpH*(37.7-T7) + M9*cpM*(37.7-T7)
+ (1./99)*(C9+H9+M9)*cpW*(37.7-T7)+ W8*cpWL*(37.7-T7)- Q2;
%Splitter Relations:
%Composition:
f(24)= .12 - (C7./(C7+H7+M7+W7));
f(25)= (H6./(45.36)) - (H7./(C7+H7+M7+W7));
f(26)= .5 - (M7./(C7+H7+M7+W7));
%Temperature:
f(27)= 93.33 - T7;
end

4
Almoanna Mahmoud 152012

Script file:

x0=10*ones(1,27);
x= fsolve(@Mu3nnaHW5,x0);
flowrate1= x(1)+x(2)+x(3);
flowrate2= x(4)+x(5)+x(6)+x(7);
flowrate3= x(8)+x(9)+x(10)+x(11);
flowrate6= 45.36;
flowrate7= flowrate3 - flowrate6;
flowrate8= x(17);
flowrate9= flowrate7 - flowrate8;
T2=x(22);
T5=x(23);
T7=x(24);
T10=x(25);
fprintf(' flowrate_6= %6.2f \n',flowrate1)
fprintf(flowrate_2= %6.2f \n',flowrate2)
fprintf(flowrate_3= %6.2f \n',flowrate3)
fprintf(' flowrate_4= %6.2f \n',flowrate3)
fprintf(' flowrate_5= %6.2f \n',flowrate3)
fprintf(' flowrate_7= %6.2f \n',flowrate7)
fprintf(' flowrate_8= %6.2f \n',flowrate8)
fprintf(' flowrate_9= %6.2f \n',flowrate9)
fprintf(' flowrate_10= %6.2f \n',flowrate9)
fprintf('Temperature_2= %6.2f C\n',T2)
fprintf('Temperature_6= %6.2f C\n',T5)
fprintf('Temperature_7= %6.2f C\n',T7)
fprintf('Temperature_10= %6.2f C\n',T10)

5
Almoanna Mahmoud 152012

Problem(2):

DF table for the whole process:

Number of stream variables


8
Reaction
2
Temperature
3
Q
1
sum
14
Number of independent material balance equations
5

Conversion
1
Energy balance
1
Temperature
3
Q
1
Relation
1
Given specification
2
sum
14
DF
0

6
Almoanna Mahmoud 152012

1- Number of Independent Equations:

streams 1 2 3 Ind.var
unknowns 0 1 5 6+2
M3, W3, H3, CO3
Selection - S ,C3 R1,R2

2- Coding:
function f=mu3nna_p2(x)
M3=x(1); W3=x(2); H3=x(3); CO3=x(4); C3=x(5); R1 =x(6);R2=x(7); S =x(8);
%Material Balance:
f(1)=1 - M3 - R1;
f(2)=0.3 - CO3 - R1;
f(3)=2*R1 - C3 - R2;
f(4)=2*R1 - H3 - R2;
f(5)=R2 - W3 ;
%Relation:
f(7)=W3 - (2.2 * C3);
%Conversion:
f(6)=1 - M3 - 0.8;

%Energy Balance:
Q = ((179*1) + (179 *0.3));
CpH = 14.48;
CpW = 75.325;
CpM = 40.5;
CpCO = 36.94;
CpC = 29;
Tref = 922;
Hr1=(2* -110.5)-(-393.5-74.8);

Hr2=(-110.5-241.8)-(-393.5);
HH1 = Hr1 + ((2 * CpH)+(2*CpC)) * (922 -25) - ((CpM + CpCO) * (922 -
25));
HH2 = Hr2 +( (CpC + CpW) *(922 - 25)) - ((CpCO +CpH ) * ( 922 - 25));
f(8)= R1*HH1 + R2 * HH2 - (( 1 *CpM *(533- 922)) + (0.3 * CpCO*(533- 922)))
- (S * CpW *(755 - 922))-Q;
end

7
Almoanna Mahmoud 152012

Script file :
x0=8*ones(1,8);
x=fsolve(@mu3nna_p2,x0);
steamfeed=x(8);
fprintf('the flow of the steam feed =%5.2f\n', steamfeed)

You might also like