-
Notifications
You must be signed in to change notification settings - Fork 0
/
SeborgReactor.mo
95 lines (95 loc) · 2.4 KB
/
SeborgReactor.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package SeborgReactor
// Real time demo of Modelica
// BL, November 4, 2016
//
//
model SimReactor
// Simulation set-up for SeborgReactor
// BL, November 4, 2016
//
// Instantiate reactor model
ModReactor reactor;
ModReactor react1;
ModReactor react2(V=101);
//
// Define variables
Real _Vd1; // input function
Real _Vd2;
Real _cAi; // input function
Real _Ti; // input function
Real _Tci; // input function
Real _cA; // output
Real _cA1;
Real _cA2;
//
equation
_Vd1 = if time < 5 then 100 else 90;
_Vd2 = if time < 5 then 100 else 105;
_cAi = 1;
_Ti = 350;
_Tci = 300;
//
reactor.Vd = _Vd1;
reactor.cAi = _cAi;
reactor.Ti = _Ti;
reactor.Tci = _Tci;
react1.Vd = _Vd2;
react1.cAi = _cAi;
react1.Ti = _Ti;
react1.Tci = _Tci;
react2.Vd = _Vd2;
react2.cAi = _cAi;
react2.Ti = _Ti;
react2.Tci = _Tci;
//
_cA = reactor.cA;
_cA1 = react1.cA;
_cA2 = react2.cA;
//
end SimReactor;
//
model ModReactor
// Model of SeborgReactor
// BL, November 4, 2016
//
// Model parameters
parameter Real V = 100 "Reactor volume, L";
parameter Real k0 = exp(8750/350) "Preexponential factor, min-1";
parameter Real EdR = 8750 "Activation 'temperature', K";
parameter Real dHtr = -5e4 "Molar enthalpy of reaction, J/mol";
parameter Real rho = 1000 "Density, g/L";
parameter Real chp = 0.239 "Specific heat capacity, J/(g.K)";
parameter Real UA = 5e4 "Heat transfer parameter, J/(min.K)";
// Initial value parameters
parameter Real cA0 = 0.5 "Initial concentration, mol/L";
parameter Real nA0 = cA0*V "Initial amount of A, mol";
parameter Real T0 = 350 "Initial reactor temperature, K";
// Variables
Real nA "Amount of A in reactor, mol";
Real T "Reactor temperature, K";
Real r "Reaction rate";
Real Qd "Added heat flow";
// Inputs
input Real Vd "Influent volumetric flow rate, L/min";
input Real cAi "Influent concentrationn, mol/L";
input Real Ti "Influent reactor temperature, K";
input Real Tci "Influent cooling temperature, K";
// Outputs
output Real cA "Reactor concentration of A, mol/L";
//
// Initialize model
initial equation
nA = nA0; // Initializing nA
T = T0; // Initializing temperature
// Equations
equation
der(nA) = Vd*(cAi - nA/V) - r*V;
rho*V*chp*der(T) = rho*chp*Vd*(Ti-T) + (-dHtr)*r*V + Qd;
r = k0*exp(-EdR/T)*nA/V;
Qd = UA*(Tci-T);
//
cA = nA/V;
//
end ModReactor;
//
end SeborgReactor;