Professional Documents
Culture Documents
Modul 1 Dalpros B Kelompok 25
Modul 1 Dalpros B Kelompok 25
A continuous stirred tank heater has been designed to heat water temperature with the aid of an electric
heater. Here, we would like to simulate the dynamics of outlet temperature by varying the Fin ,Tin and Q
values. Note that the change in Fin affects the volume of the water inside the tank and thus will affect the
outlet temperature. The system is considered as an ideal system (well mixed) with constant density and
heat capacity.
1. Derive total mass balance equation showing the dynamic of liquid level in the tank.
3. Rewrite the mass and heat balance equation in the form of linear first order system as:
Y (t )
P Y (t ) Kp X (t )
t
Where: Y(t)=output variable, X(t)=input variable or forcing function, Kp=process gain and
τp=process time constant. Define the τp and Kp by setting up one output and one input variables!
𝑄′ 𝑑𝑇′
−(𝑎. ℎ1 . 𝑇 ′ ) + = 𝐴. ℎ1 .
𝜌. 𝐶𝑝 𝑑𝑡
All section are divided by ( 𝑎. ℎ1), then the equation becomes :
𝐴 𝑑𝑇′ 𝑄′
+ 𝑇′ =
𝑎 𝑑𝑡 𝑎. ℎ1 . 𝜌. 𝐶𝑝
Then,
1
𝐾𝑝 =
𝑎. ℎ1 . 𝜌. 𝐶𝑝
𝐴
𝜏𝑝 =
𝑎
4. We would like to run the open-loop dynamic simulation for the stirred tank heater system. Define
all your parameters for the simulation! Describe the variation of the input variable, Typically, we
would like to have step changes on input variable. Calculate the steady state output values that
you expect with your selected parameters
%Data
rho=1000;%kg/m3
Cp=4200;%J/kgK
A=1;%m2
Tin=300;%Kelvin
a=sqrt(2)*10;%m2
Q=15e5;%J/s
Fin =linspace(1,10,10);
for i=1:length(Fin)
hss(i)=Fin(i)/a;
Tss(i)= Fin(i)*Tin/a/hss(i)+Q/rho/a/hss(i)/Cp;
Hasil(i,:)=[Fin(i),hss(i),Tss(i)];
end
figure(1)
plot(Hasil(:,2))
ylabel('hss')
xlabel('Fin')
title('Hubungan hss terhadap volumetric flowrate')
figure(2)
plot(Hasil(:,3))
ylabel('Tss')
xlabel('Fin')
title('Hubungan Tss terhadap volumetric flowrate')
In this simulation, volumetric flowrate input (Fin) as the input variable. The variation
of Fin from 1 to 10 . The parameters that used in this problem written in the script. From the
simulation we know that steady-state of height (hss) are increase in linear when Fin are
increase. While the steady state of temperature (Tss) are decrease in exponential when Fin are
increase.
5. It is time now to set up and run the simulation which allows simultaneous change of inlet
temperature, electric heat load and level change. Show the results of your simulation for step
changes input. Use interp1 function to aid your simulation. Discuss your results! try to describe
what factors influence the time needed to reach the new steady state conditions!
function dYdt=myfun(t,Y,Data)
global Cp Q rho A a Tin
h=Y(1);T=Y(2);
Fin=interp1(Data(:,1),Data(:,2),t);
Fout=a*h;
dhdt=Fin/A-Fout/A;
dTdt=1/(rho*Cp*A*h)*(rho*Fin*Cp*Tin+Q-rho*Fout*Cp*T-rho*Cp*A*T*dhdt);
dYdt=[dhdt;dTdt];
end
global Cp Q rho A a Tin
%Data
rho=1000;%kg/m3
Cp=4200;%J/kgK
A=1;%m2
Tin=300;%Kelvin
a=sqrt(2)*10;%m2
Q=15e5;%J/s
Data(1:60,1)=1:1:60;
Data(1:15,2)=1;
Data(16:30,2)=2;
Data(31:45,2)=0.5;
Data(46:60,2)=1.5;
Fins=1;
hss=Fins/a;
Tss = Fins*Tin/a/hss+Q/rho/a/hss/Cp;
[t,Y]=ode45(@myfun,Data(:,1),[hss,Tss],[],Data);
figure(1)
plot(t,Y(:,2))
xlabel('time')
ylabel('Temperature,K')
figure(2)
plot(t,Y(:,1))
xlabel('time')
ylabel('Water level,h')
From the simulation we can concluded that the changes in input flow rate is proportional to
the changes in liquid level. The higher the input flow rate, the higher the liquid level. The higher
changes in input flow rate make the liquid temperature lower.
6. In reality, the value of input variable may fluctuate randomly according to the following
equation: X (t ) bottom (top bottom).*rand . Rerun your simulation with new
(random) input variables!
function dYdt=myfun2(t,Y,Data)
global Cp Q rho A a Tin
h=Y(1);
T=Y(2);
Fin=interp1(Data(:,1),Data(:,2),t);
Fout=a*h;
dhdt=Fin/A-Fout/A;
dTdt=1/(rho*Cp*A*h)*(rho*Fin*Cp*Tin+Q-rho*Fout*Cp*T-rho*Cp*A*T*dhdt);
dYdt=[dhdt;dTdt];
end
global Cp Q rho A a Tin
rho=1000;%kg/m3
Cp=4200;%J/kgK
A=1;%m2
Tin=300;%Kelvin
a=sqrt(2)*10;%m2
Q=15e3;%J/s
Fins=1;
hss=Fins/a;
Tss = Fins*Tin/a/hss+Q/rho/a/hss/Cp;
Data(1:60,1)=1:60;
for i=1:60
Data(i,2)=1+(5-1).*rand;
end
figure(1)
plot(Data(:,2))
[t,Y]=ode45(@myfun2,[1 60],[hss,Tss],[],Data);
figure(2)
plot(t,Y(:,2))
xlabel('time')
ylabel('Temperature,K')
figure(3)
plot(t,Y(:,1))
xlabel('time')
ylabel('Water level,h')
From the graph we know that it can be simulated using the simulation using step changes.
It’s can be happen because the variable inputs fluctuate more diversely in each interval, thus
produce a more random pattern.
7. It is time for reflection!. What lessons that you have learnt from the open-loop simulation of part
1? Is it realistic? Discuss on how you may increase the complexity of the system to mimic the real
life situation! Here, you are expected to put your insights on what you have done so far and you
don’t need to run any further simulation for this question.
The transformation of step change more can be calculated, but that’s not make sense because
the transformation go straight. The transformation with the random equation more be
reasonable but the fluctuation not as big as like our results. It’s can be happen because the
random number which take out by Matlab can be reach close to 1.
Part 2. Simulation of Isothermal CSTR
to Describe Van de Vusse reaction
In an ideal CSTR, we would like to run a reaction scheme consisting of following irreversible reactions
namely Van de Vusse reaction:
A B C
k k
1
2A D
2
k
3
This scheme was presented by Van de Vusse (1964) and it was found that the production of cyclopentinol
from cyclopentadiene is based on such a reaction scheme, where A=cyclopentadiene, B=cyclepentenol,
C=cyclopentanediol and D=dicyclopentadiene. In this system, we assume that the feedstream only
contains component A. In addition, we also assume that the reactor operates under isothermal condition.
8. Derive total mass balance as well as component mole balance equation showing the dynamic of
volume and concentrations in the tank.
9. Solve the steady-state concentrations of A,B,C and D with various space velocities. Discuss your
finding!
rb = k1*Ca;
rc = k2*Cb;
rd = k3*Ca^2;
dCadt = (Fin*Ca0-Fin*Ca)/V-rb-rd;
dCbdt = (-Fin*Cb)/V+rb-rc;
dCcdt = (-Fin*Cc)/V+rb;
dCddt = (-Fin*Cd)/V+rd;
dYdt=[dCadt;dCbdt;dCcdt;dCddt];
end
rb = k1*Ca;
rc = k2*Cb;
rd = k3*Ca^2;
Fin=interp1(data(:,1),data(:,2),t);
dCadt = (Fin*Ca0-Fin*Ca)/V-rb-rd;
dCbdt = (-Fin*Cb)/V+rb-rc;
dCcdt = (-Fin*Cc)/V+rb;
dCddt = (-Fin*Cd)/V+rd;
dYdt=[dCadt;dCbdt;dCcdt;dCddt];
end
%KASUS PART 2 NOMOR 9
global Ca0 k1 k2 k3 V
Ca0= 1;
k1=1;
k2=5;
k3=3;
V=1;
Fin =linspace(1,10,10);
for i =1:length(Fin)
[t,Y]=ode45(@ode,[1 60],[1,0,0,0],[],Fin(i));
Hasil(i,:)=[Fin(i),Y(end,:)];
end
Hasil
figure(1)
plot(Fin,Hasil(:,2),'r',Fin,Hasil(:,3),'c',Fin,Hasil(:,4),'b',Fin,Hasil(:,5),'g')
legend('CA','CB','CC','CD')
xlabel('space velocity, 1/menit')
ylabel('konsentrasi, mol/L')
Data(1:60,1)=1:1:60;
Data(1:15,2)=5;
Data(16:30,2)=7.5;
Data(31:45,2)=3;
Data(46:60,2)=6;
[t,Y]=ode45(@myfun1,[1 60],[1,0,0,0],[],Data);
figure(2)
plot(Data(:,2))
ylabel('Fin')
xlabel('waktu(s)')
title('Hubungan volumetric terhadap waktu')
figure(3)
plot(t,Y(:,1));
ylabel('Ca')
xlabel('waktu(s)')
title('Hubungan konsentrasi A terhadap waktu')
figure(4)
plot(t,Y(:,2));
ylabel('Cb')
xlabel('waktu(s)')
title('Hubungan konsentrasi B terhadap waktu')
figure(5)
plot(t,Y(:,3));
ylabel('Cc')
xlabel('waktu(s)')
title('Hubungan konsentrasi C terhadap waktu')
figure(6)
plot(t,Y(:,4));
ylabel('Cd')
xlabel('waktu(s)')
title('Hubungan konsentrasi D terhadap waktu')
Hasil =
11. It is time for reflection!. What lessons that you have learnt from the open-loop simulation of part
2? Is it realistic? Discuss on how you may increase the complexity of the system. Here, you are
expected to put your insights on what you have done so far and you don’t need to run any further
simulation for this question.
It is realistic because the concentration is influenced by space velocity. For some range, the
graph is not fixed as above because its value is influenced by k1, k2, and k3. For its complexity,
it can be added by k variation or by non-constant flow rate.