Professional Documents
Culture Documents
CHEP 530D1
COMPUTER APPLICATION FOR CHEMICAL ENGINEERING
COMPILATION
SUBMITTED BY:
FRENUZA S. RAMIRO
SUBMITTED TO:
ENGR. CRISPULO MARANAN
DATE OF SUBMISSION:
MARCH 25, 2013
1. To solve simultaneous linear equations using material balances of a steady-state process with no
recycle.
Material Used:
Microsoft Excel software
Discussion:
A mass balance (also called a material balance) is an application of conservation of mass to the analysis of
physical systems. By accounting for material entering and leaving a system, mass flows can be identified
which might have been unknown, or difficult to measure without this technique. The exact conservation
law used in the analysis of the system depends on the context of the problem but all revolve around mass
conservation, i.e. that matter cannot disappear or be created spontaneously.[1]
Therefore, mass balances are used widely in engineering and environmental analyses. For example mass
balance theory is used to design chemical reactors, analyse alternative processes to produce chemicals as
well as in pollution dispersion models and other models of physical systems. Closely related and
complementary analysis techniques include the population balance,energy balance and the somewhat more
complex entropy balance. These techniques are required for thorough design and analysis of systems such as
the refrigeration cycle.
Procedure:
1. To solve the three equations three unknowns, which is:
x + y + 4z = 5
2x + 3y + z = 4
3x + y + 2z = 3
The coefficient matrix is
1
1
4
2
3
1
3
1
2
The unknown matrix is
x
y
z
The right hand side vector is
5
4
3
2. The equation in matrix form is (coefficient matrix) x [unknown vector]=right hand side vector.
[A][x]=[b]
And the solution is
[x] =inv[A]*[b]
3. Indicate the numerical coefficients on the corresponding cells as indicated on the table as shown below:
A
1
B1
1
C1
4
1
A
2
B2
3
C2
1
2
A
3
B3
1
C3
2
3
4. Highlight cell range A5 to C7 and enter the formula =MINVERSE(A1:C3) and hold shift, control and
enter.
5. For the right hand side vector, indicate the numerical coefficients on the corresponding shell on the
table as shown below:
F1
5
F2
4
F3
3
6. Highlight cell range D1:D3 and enter the formula =MMULT(A5:A7,F1:F3) and hold shift, control and
enter. The resulting values are the values of x, y and z.
7. Solve 10 equations in 10 unknowns.
Reduce the original feed flow rate to the first column by first 1% and then 2% and calculate the corresponding
flow rates of D_1, D_2, B_1 and _2. Explain your results. We wont do all four, after all this is a blog and
brevity is the soul of wit.
Determine the molar flow rates and compositions of B and D for part 1.
Xylene, styrene, toluene and benzene are to be separated with the array of distillation columns that is
shown below where F, D, B, D1, B1, D2 and B2 are the molar flow rates in mol/min.
Material balances on individual components on the overall separation train yield the equation set
Xylene: 0.07D1 + 0.18B1 + 0.15D2 + 0.24B2= 0.15 70
Styrene: 0.04D1 + 0.24B1 + 0.10D2 + 0.65B2= 0.25 70
Toluene: 0.54D1 + 0.42B1 + 0.54D2 + 0.10B2= 0.40 70
Benzene: 0.35D1 + 0.16B1 + 0.21D2 + 0.01B2= 0.20 70
Overall balances and individual component balances on column #2 can be used to determine the
molar flow rate and mole fractions from the equation of stream D from
Molar Flow Rates: D = D1 + B1
Xylene: XDxD = 0.07D1 + 0.18B1
Styrene: XDsD = 0.04D1 + 0.24B1
Toluene: XDtD = 0.54D1 + 0.42B1
Benzene: XDbD = 0.35D1 + 0.16B1
where XDx = mole fraction of Xylene, XDs = mole fraction of Styrene, XDt = mole fraction of Toluene,
and XDb = mole fraction of Benzene.
Similarly, overall balances and individual component balances on column #3 can be used to
determine the molar flow rate and mole fractions of stream B from the equation set
Molar Flow Rates: B = D2 + B2
Xylene: XBxB = 0.15D2 + 0.24B2
Styrene: XBsB = 0.10D2 + 0.65B2
Toluene: XBtB = 0.54D2 + 0.10B2
Benzene: XBbB = 0.21D2 + 0.01B2
(a) Calculate the molar flow rates of streams D1, D2, B1 and B2.
(b) Determine the molar flow rates and compositions of streams B and D.
Laboratory Exercise No.2
Steady-State Material Balances on a Separation Train
USING MATLAB:
CREATE A M-FILE:
clc;
disp('FRENUZA S. RAMIRO');
disp('LAB EXERCISE NO.2');
disp('STEADY-STATE MATERIAL BALANCES ON A SEPARATION TRAIN');
disp('The Matrix will display the material balances on individual components');
disp('GIVEN:')
disp('Row Values :');
disp('[0.07 0.18 0.15 0.24;0.04 0.24 0.10 0.65;0.54 0.42 0.54 0.10;0.35 0.16 0.21 0.01]');
disp('Column Values :');
disp('[0.15*70;0.25*70;0.40*70;0.20*70]');
A = input ('Enter the row values inside a bracket : ');
b = input ('Enter the column values inside a bracket : ');
matri=[A b]
disp('x = The Molar Flow Rates for D1, D2, B1, B2 : ');
x = A\b
D1 = x(1);
B1 = x(2);
disp ('
ANSWERS
');
disp ('Solving for the compositions at D')
D=D1+B1
disp ('% mole fraction of xylene at D : ');
X_xD=(0.07*D1+0.18*B1)/D
disp ('% mole fraction of styrene at D: ');
X_sD=(0.04*D1+0.24*B1)/D
disp ('% mole fraction of toluene at D : ');
X_tD=(0.54*D1+0.42*B1)/D
disp ('% mole fraction of benzene at D : ');
X_bD=(0.35*D1+0.16*B1)/D
D2 =x(3);
B2 =x(4);
disp ('Solving for the compositions at B')
B=D2+B2
disp ('% mole fraction of xylene at B : ');
X_xB=(0.15*D2+0.24*B2)/B
disp ('% mole fraction of styrene at B: ');
X_sB=(0.10*D2+0.65*B2)/B
disp ('% mole fraction of toluene at B : ');
X_tB=(0.54*D2+0.10*B2)/B
disp ('% mole fraction of benzene at B : ');
X_bB=(0.21*D2+0.01*B2)/B
FRENUZA S. RAMIRO
LAB EXERCISE NO.2
STEADY-STATE MATERIAL BALANCES ON A SEPARATION TRAIN
The Matrix will display the material balances on individual components
GIVEN:
Row Values :
[0.07 0.18 0.15 0.24;0.04 0.24 0.10 0.65;0.54 0.42 0.54 0.10;0.35 0.16 0.21 0.01]
Column Values :
[0.15*70;0.25*70;0.40*70;0.20*70]
Enter the row values inside a bracket : [0.07 0.18 0.15 0.24;0.04 0.24 0.10 0.65;0.54 0.42 0.54 0.10;0.35 0.16
0.21 0.01]
Enter the column values inside a bracket : [0.15*70;0.25*70;0.40*70;0.20*70]
matri =
0.0700 0.1800 0.1500 0.2400 10.5000
0.0400 0.2400 0.1000 0.6500 17.5000
0.5400 0.4200 0.5400 0.1000 28.0000
0.3500 0.1600 0.2100 0.0100 14.0000
x = The Molar Flow Rates for D1, D2, B1, B2 :
x=
26.2500
17.5000
8.7500
17.5000
ANSWERS
Solving for the compositions at D
D=
43.7500
% mole fraction of xylene at D :
X_xD =
0.1140
% mole fraction of styrene at D:
X_sD =
0.1200
% mole fraction of toluene at D :
X_tD =
0.4920
% mole fraction of benzene at D :
X_bD =
0.2740
Solving for the compositions at B
B=
26.2500
% mole fraction of xylene at B :
X_xB =
0.2100
% mole fraction of styrene at B:
X_sB =
0.4667
% mole fraction of toluene at B :
X_tB =
0.2467
% mole fraction of benzene at B :
X_bB =
0.0767
RAMIRO, FRENUZA S.
CHEP530D1
PROBLEM NO.1
clc;
disp('1.Molar Volume')
disp('2.compressibilty factor')
ANSWER:
1.Molar Volume
2.compressibilty factor
Enter your choice:1
enter the Critical Pressure: 111.3
enter the Critical Temperature: 405.5
enter the Pressure: 56
enter the Temperature: 140
the Molar Volume is 25.44.
1.Molar Volume
2.compressibilty factor
Enter your choice:2
Problem 3b
>> % file Prob_3b.m
>> %To solve part b, insert the data:
>> vp = [ 1 5 10 20 40 60 100 200 400 760]
vp =
1 5 10 20 40 60 100 200 400 760
>> T = [-36.7 -19.6 -11.5 -2.6 7.6 15.4 26.1 42.2 60.6 80.1]
T=
Columns 1 through 7
-36.7000 -19.6000 -11.5000 -2.6000 7.6000 15.4000 26.1000
Columns 8 through 10
42.2000 60.6000 80.1000
>> % create the new variables
>> y = log10(vp);
>> x = 1./(T+273.15);
>> % fit the polynomial
>> p = polyfit(x,y,1)
p=
1.0e+003 *
-2.0353 0.0088
>> %To compute the norm based on the logarithm of the vapor pressure
>> norm(y - polyval(p,x))
ans =
0.2464
Laboratory Exercise 4
Reaction Equilibrium for Multiple Gas-Phase Reactions
PROBLEM NO. 4
%filename Prob_4.m
global Cao CboKciKciiKciiicvector
% define constants
Cao = 1.5; Cbo=1.5; Kci= 1.06; Kcii= 2.63; Kciii= 5;
%set initial conditions
% Initial guess and set tolerance
% remove the % in front of the desired initial guess
cvector=[1.5 1.5 0 0 0 0 0]; %initial guess, part a
%cvector=[-.5 -1.5 -1 1 1 2 1]; %initial guess, part b
%cvector=[-18.5 -28.5 -10 10 10 20 10]; %initial guess, part c
guess=cvector;
%call fsolve
y = fsolve('prob4',guess)
%filename Prob_4NR.m
clear all
clc
global Cao CboKciKciiKciiicvector
% define constants
Cao = 1.5; Cbo=1.5; Kci= 1.06; Kcii= 2.63; Kciii= 5;
% Initial guess and set tolerance
err=1;
iter=0;
% remove the % in front of the desired initial guess
cvector=[1.5 1.5 0 0 0 0 0]; %initial guess, part a
%cvector=[-.5 -1.5 -1 1 1 2 1]; %initial guess, part b
%cvector=[-18.5 -28.5 -10 10 10 20 10]; %initial guess, part c
guess=cvector;
while err > 1e-4 &&iter< 200
x= prob4(cvector);
J= jac4(cvector);
errr= -J\x';
cvector=cvector+errr';
errr=abs(errr);
err= sqrt(sum(errr));
iter=iter+1;
end
disp('guess')
disp(guess)
disp('error')
disp(err)
disp(' A
Z');
disp(cvector);
disp('iter')
disp(iter)
y = Columns 1 through 5
4.2069e-001 2.4290e-001 1.5357e-001 7.0533e-001 1.7779e-001
Columns 6 through 7
5.5177e-001 3.7398e-001
guess
Columns 1 through 5
1.5000e+000 1.5000e+000
0
0
0
Columns 6 through 7
0
0
error 1.4094e-006
A
B
C
D
X
Y
Z
Columns 1 through 5
4.2069e-001 2.4290e-001 1.5357e-001 7.0533e-001 1.7779e-001
Columns 6 through 7
5.5177e-001 3.7398e-001
iter 7
Laboratory Exercise 5
Terminal Velocity of Falling Particles
PROBLEM NO. 5
clc;
disp('Computation for Terminal Velocity');
Laboratory Exercise 6
Heat Exchange In a Series of Tanks
PROBLEM NO.6
function P2_16A
clear, clc, format short g, format compact
tspan = [0 200.]; % Range for the independent variable
T0 = [20.; 20.; 20.]; % Initial values for the dependent variables
disp(' Variable values at the initial point ');
disp([' t = ' num2str(tspan(1))]);
disp('
T
dT/dt
');
disp([T0 ODEfun(tspan(1),T0)]);
[t,T]=ode45(@ODEfun,tspan,T0);
Laboratory Exercise 7
Diffusion with Chemical Reaction in a One-Dimensional Slab
PROBLEM 7
clc;
display ['Diffusion with Chemical Reaction in a One-Dimensional Slab'];
Cao= input('enter the value Ca0:');
K= input('enter the value of K:');
L= input('enter the value of L:');
Dab= input ('enter the value of Dab:');
display ('z=0');
display ('z=L');
switch(choose)
case 1;
a =input('enter the value of z:');
z = 0;
Ca=(Dab/(K*z))*(1/Cao);
fprintf('the value of Ca is %0.2f.\n',Ca);
break;
case 2;
a = input('enter the value of z: ');
z = L;
Ca=(Dab/(K*z))*(1/Cao);
fprintf('the value of Ca is %0.2f.\n',Ca);
break;
end
Laboratory Exercise 9
Reversible, Exothermic, Gas-Phase Reaction In a Catalytic Reactor
%filename Prob_9.m
global Ta delH CPA FA0
%set parameters
Ta = 500;
delH = -40000;
CPA = 40;
FA0=5;
%set initial conditions
var0(1) = 0.;
var0(2) = 450;
var0(3) = 1.0;
Wspan = [0 20];
%integrate equations
[W var]=ode45('react',Wspan,var0)
W=
0
0.0068
0.0137
0.0205
0.0274
0.0616
0.0958
0.1300
0.1642
0.3352
0.5062
0.6772
0.8482
1.3482
1.8482
2.3482
2.8482
3.3482
3.8482
4.3482
4.8482
5.3482
5.8482
6.3482
6.8482
7.3482
7.8482
8.3482
8.8482
9.3482
9.8482
10.3482
var =
1.0e+003 *
0 0.4500 0.0010
0.0000 0.4501 0.0010
0.0000 0.4501 0.0010
0.0000 0.4502 0.0010
0.0000 0.4502 0.0010
0.0000 0.4505 0.0010
0.0000 0.4507 0.0010
0.0000 0.4510 0.0010
0.0000 0.4513 0.0010
0.0000 0.4526 0.0010
0.0000 0.4539 0.0010
0.0000 0.4553 0.0010
0.0000 0.4568 0.0010
0.0000 0.4611 0.0010
0.0000 0.4658 0.0010
0.0000 0.4709 0.0010
10.8482
11.1559
11.4636
11.7713
12.0789
12.2403
12.4017
12.5631
12.7245
12.8859
13.0473
13.2087
13.3701
13.5895
13.8089
14.0283
14.2477
14.4976
14.7476
14.9975
15.2474
15.5887
15.9301
16.2715
16.6128
17.0907
17.5685
18.0463
18.5241
18.8931
19.2621
19.6310
20.0000
0.0000
0.0000
0.0000
0.0000
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0002
0.0002
0.0002
0.0003
0.0003
0.0004
0.0005
0.0005
0.0006
0.4763
0.4823
0.4888
0.4961
0.5041
0.5131
0.5233
0.5350
0.5485
0.5645
0.5837
0.6071
0.6366
0.6741
0.7241
0.7902
0.8735
0.9321
0.9906
1.0437
0.0010
0.0010
0.0010
0.0010
0.0010
0.0010
0.0010
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0006
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
1.0870
1.1049
1.1195
1.1313
1.1405
1.1476
1.1530
1.1569
1.1599
1.1626
1.1643
1.1651
1.1654
1.1655
1.1653
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0009
0.0008
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
0.0007
1.1648
1.1642
1.1634
1.1625
1.1614
1.1604
1.1589
1.1574
1.1559
1.1543
1.1532
1.1520
1.1508
1.1496
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
0.0008
Laboratory Exercise 10
Dynamics of a Heated Tank with Proportional/Integral (PI) Temperature Control
PROBLEM NO. 10
%filename Prob_10.m
clear all
clc
global qsetpt taud taui Kc Tsetpt onoff
qsetpt=1e4; taud=1; taui=2; Tsetpt=80;
Kc=input('enter the gain ');
onoff=input('enter 0 for no integrator, enter 1 if integrator on ');
% initialization
to=0; tfin=200; %limits of integration
tspan = [to tfin];
To=[80 80 80 0]; % initial condition of system. Tank Temp, Outlet
% Temp Thermocouple Temp and error signal
[t,T] = ode45('tempdyn',tspan,To);
% For version 4 use
% [t,T] = ode45('tempdyn',to,tfin,To);
T;
plot(t,T(:,1),'r',t,T(:,2),'ro',t,T(:,3),'r:')
grid
title('Temperature vs time')
xlabel('time in minutes')
ylabel('Temperature in C')
legend('Tank','Outlet T','Measured T')
%filename tempdyn.m
function Tdot=tempdyn (t,T)
global qsetpt taud taui Kc Tsetpt onoff
% Use logical block to model the step change at 10 min.
if t<10
Tinlet = 60;
else
Tinlet = 40;
end
qin= qsetpt+Kc*(Tsetpt-T(3))+onoff*Kc/taui*T(4);% total heat sent in
% use the following statement for part (e)
%qin=max(0,min(2.6*qsetpt,qin));
row(1)= (500*(Tinlet-T(1))+qin)/(4000); % energy balance
row(2) = (T(1)-T(2)-0.5*taud*row(1))*2/taud;
% Pade approximation for delay
row(3) = (T(2)-T(3))/5; % Thermoouple dynamics
row(4) = Tsetpt - T(3); % the error message
% row(4) not needed for part (e), but is calculated anyway
Tdot = row';