0% found this document useful (0 votes)
5 views11 pages

PMC ASSIGN 1 ,,, Is A Process Modeling Assignment

This document is an assignment for a course on process modeling and control for metallurgy, focusing on the modeling of a Continuous Stirred Tank Reactor (CSTR) with consecutive first-order reactions. It includes mass balance equations, component continuity equations, and energy equations for components A, B, and C, along with a steady-state analysis and a MATLAB code snippet for simulation. The assignment is drafted by a student and reviewed by a lecturer.

Uploaded by

Rainhold Petrus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views11 pages

PMC ASSIGN 1 ,,, Is A Process Modeling Assignment

This document is an assignment for a course on process modeling and control for metallurgy, focusing on the modeling of a Continuous Stirred Tank Reactor (CSTR) with consecutive first-order reactions. It includes mass balance equations, component continuity equations, and energy equations for components A, B, and C, along with a steady-state analysis and a MATLAB code snippet for simulation. The assignment is drafted by a student and reviewed by a lecturer.

Uploaded by

Rainhold Petrus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Faculty of Agriculture, Engineering and Natural Sciences,

School of Engineering, and the Built Environment


Department of Mechanical and Metallurgical Engineering

PROCESS MODELLING AND CONTROL FOR METALLURGY


(I3881TC)

ASSIGNMENT 1

DRAFTED BY:

Musitu Frans N
221096132

Lecturer: Mr. Mesh M


Question 1
Model the CSTR of Example 2.6 in the lecture notes in which consecutive first-
order reactions occur with exothermic heats of reaction λ1 and λ2. Your model
should include the total mass balance equation, component continuity equations
and the energy equation. Hence, determine the degrees of freedom of the model.

Mass balance equation:

Assuming constant density and perfect mixing:


For component A:
𝑀𝑎𝑠𝑠 𝑓𝑙𝑜𝑤 𝑖𝑛𝑡𝑜 𝑡ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 = 𝜌𝐹𝐴0
𝑀𝑎𝑠𝑠 𝑓𝑙𝑜𝑤 𝑜𝑢𝑡 𝑜𝑓 𝑡ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 = 𝜌𝐹𝐴
𝜕(𝜌𝑉)
𝑡𝑖𝑚𝑒 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐ℎ𝑎𝑛𝑔𝑒 𝑜𝑓 𝑚𝑎𝑠𝑠 𝑖𝑛𝑠𝑖𝑑𝑒 𝑡ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 =
𝜕𝑡
Hence the mass balance for component A is:
𝜕(𝜌𝑉)
= 𝜌0 𝐹𝐴0 − 𝜌𝐹𝐴
𝜕𝑡

For component B:
𝜕(𝜌𝑉)
= 𝜌0 𝐹𝐵0 − 𝜌𝐹𝐵
𝜕𝑡

For component C:
𝜕(𝜌𝑉)
= 𝜌0 𝐹𝐶0 − 𝜌𝐹𝐶
𝜕𝑡
Component continuity equation:

For component A:
𝑓𝑙𝑜𝑤 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝐴 𝑖𝑛𝑡𝑜 𝑠𝑦𝑠𝑡𝑒𝑚 = 𝐶𝐴0 𝐹𝐴0
𝑓𝑙𝑜𝑤 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝑜𝑢𝑡 𝑜𝑓 𝑠𝑦𝑠𝑡𝑒𝑚 = 𝐶𝐴 𝐹𝐴
𝑟𝑎𝑡𝑒 𝑜𝑓 𝑓𝑜𝑟𝑚𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝐴 𝑓𝑟𝑜𝑚 𝑐ℎ𝑒𝑚𝑖𝑐𝑎𝑙 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠
= −𝑘1 𝑉𝐶𝐴
𝜕(𝑉𝐶𝐴 )
𝑡𝑖𝑚𝑒 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐ℎ𝑎𝑛𝑔𝑒 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝐴 𝑖𝑛𝑠𝑖𝑑𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 =
𝜕𝑡
𝜕(𝑉𝐶𝐴 )
Therefore, = 𝐶𝐴0 𝐹𝐴0 − 𝐶𝐴 𝐹𝐴 − 𝑘1 𝑉𝐶𝐴
𝜕𝑡

For component B:
𝜕(𝑉𝐶𝐵 )
= 𝐶𝐵0 𝐹𝐵0 − 𝐶𝐵 𝐹𝐵 + 𝑘1 𝑉𝐶𝐴 − 𝑘2 𝑉𝐶𝐵
𝜕𝑡

For component C:
∂(𝑉𝐶𝐶 )
= 𝐶𝐶0 𝐹𝐶0 − 𝐶𝐶 𝐹𝐶 + 𝑘2 𝑉𝐶𝐵
∂𝑡
Energy Continuity equation:

For component A:
𝑓𝑙𝑜𝑤 𝑜𝑓 𝑖𝑛𝑡𝑒𝑛𝑎𝑙, 𝑘𝑖𝑛𝑒𝑡𝑖𝑐 𝑎𝑛𝑑 𝑝𝑜𝑡𝑒𝑛𝑡𝑖𝑎𝑙 𝑒𝑛𝑒𝑟𝑔𝑦 𝑖𝑛𝑡𝑜 𝑠𝑦𝑠𝑡𝑒𝑚
= 𝜌0 𝐹𝐴0 (𝑈𝐴0 + 𝐾𝐴0 + 𝜙𝐴0 )
𝑓𝑙𝑜𝑤 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑛𝑎𝑙, 𝑘𝑖𝑛𝑒𝑡𝑖𝑐 𝑎𝑛𝑑 𝑝𝑜𝑡𝑒𝑛𝑡𝑖𝑎𝑙 𝑒𝑛𝑒𝑟𝑔𝑦 𝑜𝑢𝑡 𝑜𝑓 𝑠𝑦𝑠𝑡𝑒𝑚
= 𝜌𝐹𝐴 (𝑈𝐴 + 𝐾𝐴 + 𝜙𝐴 )
ℎ𝑒𝑎𝑡 𝑎𝑑𝑑𝑒𝑑 𝑡𝑜 𝑠𝑦𝑠𝑡𝑒𝑚 = (−𝐻)𝑉𝐾1 𝐶𝐴
𝑤𝑜𝑟𝑘𝑑𝑜𝑛𝑒 𝑏𝑦 𝑠𝑦𝑠𝑡𝑒𝑚 𝑜𝑛 𝑠𝑢𝑟𝑟𝑜𝑢𝑛𝑑𝑖𝑛𝑔 = 𝑈𝐴(𝑇1 − 𝑇2 )
𝑡𝑖𝑚𝑒 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐ℎ𝑎𝑛𝑔𝑒 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑛𝑎𝑙, 𝑘𝑖𝑛𝑒𝑡𝑖𝑐 𝑡𝑖𝑚𝑒 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐ℎ𝑎𝑛𝑔𝑒 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑛𝑎𝑙,
𝑑
𝑘𝑖𝑛𝑒𝑡𝑖𝑐 = 𝜌𝑉(𝑈𝐴 + 𝐾𝐴 + 𝜙𝐴 )
𝑑𝑡
𝑑
𝜌𝑉(𝑈𝐴 + 𝐾𝐴 + 𝜙𝐴 )
𝑑𝑡
= 𝜌0 𝐹𝐴0 (𝑈𝐴0 + 𝐾𝐴0 + 𝜙𝐴0 ) − 𝜌𝐹𝐴 (𝑈𝐴 + 𝐾𝐴 + 𝜙𝐴 ) + (−𝐻)𝑉𝐾1 𝐶𝐴
− 𝑈𝐴(𝑇1 − 𝑇2 )
• Assuming that: Kinetic and potential energy are relatively small; thus,
they fall out.
• By assuming that density is constant throughout:
𝑑
𝜌𝑉(𝑈𝐴 ) = 𝜌𝐹𝐴0 (𝑈𝐴0 ) − 𝜌𝐹𝐴 (𝑈𝐴 ) + (−𝐻)𝑉𝐾1 𝐶𝐴 − 𝑈𝐴(𝑇1 − 𝑇2 )
𝑑𝑡
𝑑
𝜌𝑉(𝐶𝑝 𝑇) = 𝜌𝐹𝐴0 (𝐶𝑝 𝑇) − 𝜌𝐹𝐴 (𝐶𝑝 𝑇) + (−𝐻)𝑉𝐾1 𝐶𝐴 − 𝑈𝐴(𝑇1 − 𝑇2 )
𝑑𝑡
𝑑(𝑉𝑇)
𝜌𝐶𝑝 = 𝜌𝐶𝑝 𝑇(𝐹𝐴0 − 𝐹𝐴 ) + (−𝐻)𝑉𝐾1 𝐶𝐴 − 𝑈𝐴(𝑇1 − 𝑇2 )
𝑑𝑡
For component B:
𝑑(𝑉𝑇)
𝜌𝐶𝑝 = 𝜌𝐶𝑝 𝑇(𝐹𝐵0 − 𝐹𝐵 ) + (−𝐻)𝑉𝐾2 𝐶𝐵 − 𝑈𝐴(𝑇1 − 𝑇2 )
𝑑𝑡
For component C:
𝑑(𝑉𝑇)
𝜌𝐶𝑝 = 𝜌𝐶𝑝 𝑇(𝐹𝐶0 − 𝐹𝐶 ) + (−𝐻)𝑉𝐾1 𝐶𝐶 − 𝑈𝐴(𝑇1 − 𝑇2 )
𝑑𝑡
Question 2

a).

b).

𝑑
(𝑐 𝑉) = 𝑞𝑐𝐴𝐹 − 𝑞𝑐𝐴 − 𝑘1 𝑐𝐴 𝑉
𝑑𝑡 𝐴
𝑑
(𝑐 𝑉) = 0 − 𝑞𝑐𝐵 + 𝑘1 𝑐𝐴 𝑉 − 𝑘2 𝑐𝐵 𝑉
𝑑𝑡 𝐵
𝑑
(𝑐 𝑉) = 0 − 𝑞𝑐𝐶 + 𝑘2 𝑐𝐵 𝑉
𝑑𝑡 𝐶
c).
The steady-state concentrations are found by setting the time derivatives to 0.
We find:
𝑞𝑐𝐴𝐹
𝑐𝐴∗ = = 1 kmol/m3
𝑞 + 𝑘1 𝑉
𝑘1 𝑉
𝑐𝐵∗ = 𝑐𝐴∗ = 0.9 kmol/m3
𝑞 + 𝑘2 𝑉
𝑘2 𝑉 ∗
𝑐𝐶∗ = 𝑐𝐵 = 8.1 kmol/m3
𝑞
d).

Figure 1 Concentration response for isothermal CSTR after a step increase in


flowrate

Code:
function DYDT=f(t,y)
% This is file cstr3.m
% INPUT: Time t and state vector y
% OUTPUT: derivatives DYDT
% Usage with ode15s: [T,Y]= ode15s(@cstr3,[0 5],[1.0 0.9 8.1])
%
% I. Data (parameters and independent variables)
cAF=10; cBF=0; cCf=0; % inlet concentrations
V = 0.9; % reactor volume (constant)
q = 0.1*1.2; % 20% increase in q
k1 = 1; k2 = 1; % rate constants
% II. Extract present value of states
cA=y(1);
cB=y(2);
cC=y(3);
% III. Evaluate derivatives of states
f1= (q*cAF - q*cA - k1*cA*V) /V;
f2= (q*cBF - q*cB + k1*cA*V - k2*cB*V) /V;
f3= (q*cCf - q*cC + k2*cB*V) /V;
DYDT=[f1; f2; f3;];
Question 3

𝑓𝑙𝑜𝑤 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑗 𝑡ℎ 𝑓𝑙𝑜𝑤 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑗 𝑡ℎ


a) [ ]−[ ]+
𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝑖𝑛𝑡𝑜 𝑠𝑦𝑠𝑡𝑒𝑚 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝑜𝑢𝑡 𝑜𝑓 𝑠𝑦𝑠𝑡𝑒𝑚
𝑟𝑎𝑡𝑒 𝑜𝑓 𝑓𝑜𝑟𝑚𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓
𝑡𝑖𝑚𝑒 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐ℎ𝑎𝑛𝑔𝑒 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑗 𝑡ℎ
[ 𝑗 𝑡ℎ 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝑓𝑟𝑜𝑚 ]=[ ]
𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝑖𝑛𝑠𝑖𝑑𝑒 𝑠𝑦𝑠𝑡𝑒𝑚
𝑐ℎ𝑒𝑚𝑖𝑐𝑎𝑙 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠
For component A:

𝑓𝑙𝑜𝑤 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝐴 𝑖𝑛𝑡𝑜 𝑠𝑦𝑠𝑡𝑒𝑚 = 𝐶𝐴0 𝐹𝐴0


𝑓𝑙𝑜𝑤 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝑜𝑢𝑡 𝑜𝑓 𝑠𝑦𝑠𝑡𝑒𝑚 = 𝐶𝐴 𝐹𝐴
𝑟𝑎𝑡𝑒 𝑜𝑓 𝑓𝑜𝑟𝑚𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝐴 𝑓𝑟𝑜𝑚 𝑐ℎ𝑒𝑚𝑖𝑐𝑎𝑙 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠
= −𝑘1 𝑉𝐶𝐴 𝐶𝐷
𝜕(𝑉𝐶𝐴 )
𝑡𝑖𝑚𝑒 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐ℎ𝑎𝑛𝑔𝑒 𝑜𝑓 𝑚𝑜𝑙𝑒𝑠 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝐴 𝑖𝑛𝑠𝑖𝑑𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 =
𝜕𝑡
𝜕(𝑉𝐶𝐴 )
Therefore, 𝜕𝑡
= 𝐶𝐴0 𝐹𝐴0 − 𝐶𝐴 𝐹𝐴 − 𝑘1 𝑉𝐶𝐴 𝐶𝐷

For component B:
𝜕(𝑉𝐶𝐵 )
= 𝐶𝐵0 𝐹𝐵0 − 𝐶𝐵 𝐹𝐵 + 𝑘1 𝑉𝐶𝐴 𝐶𝐷 − 𝑘2 𝑉𝐶𝐵 𝐶𝐷
𝜕𝑡
For component C
𝜕(𝑉𝐶𝐶 )
= 𝐶𝐶0 𝐹𝐶0 − 𝐶𝐶 𝐹𝐶 + 𝑘3 𝑉𝐶𝐵 𝐶𝐷
𝜕𝑡
For component D:
𝜕(𝑉𝐶𝐷 )
= 𝐶𝐷0 𝐹𝐷0 − 𝐶𝐷 𝐹𝐷 − 𝑘1 𝑉𝐶𝐴 𝐶𝐷 − 𝑘2 𝑉𝐶𝑩 𝐶𝐷 − 𝑘3 𝑉𝐶𝐷2
𝜕𝑡

Since it’s a batch reactor, generation terms = 0


b) . Runge-Kutta fourth order numerical method in MATLAB
clc; clear; close all;

% Given initial conditions


C_A0 = 0.12; % mol/m^3
C_B0 = 0; % mol/m^3
C_C0 = 0; % mol/m^3
C_D0 = 0.4; % mol/m^3

% Reaction rate constants


k1 = 0.4; % m^3/mol.min
k2 = 0.2; % m^3/mol.min
k3 = 0.05; % m^3/mol.min

% Time step and simulation duration


dt = 0.5; % min
t_final = 10; % min
t_steps = 0:dt:t_final; % Time vector
n = length(t_steps); % Number of time steps

% Initialize concentration arrays


C_A = zeros(n,1);
C_B = zeros(n,1);
C_C = zeros(n,1);
C_D = zeros(n,1);

% Set initial values


C_A(1) = C_A0;
C_B(1) = C_B0;
C_C(1) = C_C0;
C_D(1) = C_D0;

% Define the system of ODEs


reaction_rates = @(A, B, C, D) [
-k1 * A * D; % dC_A/dt
k1 * A * D - k2 * B * D; % dC_B/dt
k2 * B * D; % dC_C/dt
-k1 * A * D - k2 * B * D - 2 * k3 * D^2 % dC_D/dt
];

% Runge-Kutta 4th Order Method


for i = 1:n-1
A = C_A(i); B = C_B(i); C = C_C(i); D = C_D(i);

k1_ = dt * reaction_rates(A, B, C, D);


k2_ = dt * reaction_rates(A + 0.5*k1_(1), B + 0.5*k1_(2), C + 0.5*k1_(3), D +
0.5*k1_(4));
k3_ = dt * reaction_rates(A + 0.5*k2_(1), B + 0.5*k2_(2), C + 0.5*k2_(3), D +
0.5*k2_(4));
k4_ = dt * reaction_rates(A + k3_(1), B + k3_(2), C + k3_(3), D + k3_(4));

C_A(i+1) = A + (1/6) * (k1_(1) + 2*k2_(1) + 2*k3_(1) + k4_(1));


C_B(i+1) = B + (1/6) * (k1_(2) + 2*k2_(2) + 2*k3_(2) + k4_(2));
C_C(i+1) = C + (1/6) * (k1_(3) + 2*k2_(3) + 2*k3_(3) + k4_(3));
C_D(i+1) = D + (1/6) * (k1_(4) + 2*k2_(4) + 2*k3_(4) + k4_(4));
end

% Display results in a table


T = table(t_steps', C_A, C_B, C_C, C_D, ...
'VariableNames', {'Time (min)', 'C_A (mol/m^3)', 'C_B (mol/m^3)', 'C_C
(mol/m^3)', 'C_D (mol/m^3)'});
disp(T);

% Plot the results


figure;
plot(t_steps, C_A, 'r', 'LineWidth', 2); hold on;
plot(t_steps, C_B, 'b', 'LineWidth', 2);
plot(t_steps, C_C, 'g', 'LineWidth', 2);
plot(t_steps, C_D, 'k', 'LineWidth', 2);
xlabel('Time (min)');
ylabel('Concentration (mol/m^3)');
legend('C_A', 'C_B', 'C_C', 'C_D');
title('Concentration Profiles Over Time');
grid on;

Output:
Time (min) C_A (mol/m^3) C_B (mol/m^3) C_C (mol/m^3) C_D (mol/m^3)
__________ _____________ _____________ _____________ _____________

0 0.12 0 0 0.4
0.5 0.11096 0.0088595 0.00017684 0.38312
1 0.10294 0.016406 0.00065364 0.36758
1.5 0.095784 0.022853 0.0013632 0.35322
2 0.089371 0.028377 0.0022525 0.33992
2.5 0.083601 0.033119 0.00328 0.32755
3 0.078391 0.037196 0.0044123 0.31604
3.5 0.07367 0.040707 0.0056232 0.30528
4 0.069377 0.043731 0.0068915 0.29521
4.5 0.065462 0.046338 0.0082002 0.28577
5 0.061881 0.048583 0.0095358 0.2769
5.5 0.058597 0.050516 0.010887 0.26854
6 0.055577 0.052177 0.012246 0.26066
6.5 0.052793 0.053601 0.013606 0.25322
7 0.050222 0.054819 0.014959 0.24618
7.5 0.047841 0.055856 0.016303 0.23951
8 0.045633 0.056734 0.017634 0.23318
8.5 0.04358 0.057472 0.018948 0.22716
9 0.041668 0.058088 0.020244 0.22144
9.5 0.039885 0.058595 0.02152 0.21599
10 0.038219 0.059006 0.022775 0.21079

>>
Plot:

You might also like