-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMod1_BTX_ideal_VLE.py
227 lines (193 loc) · 9.52 KB
/
Mod1_BTX_ideal_VLE.py
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
##############################################################################
# Institute for the Design of Advanced Energy Systems Process Systems
# Engineering Framework (IDAES PSE Framework) Copyright (c) 2018-2019, by the
# software owners: The Regents of the University of California, through
# Lawrence Berkeley National Laboratory, National Technology & Engineering
# Solutions of Sandia, LLC, Carnegie Mellon University, West Virginia
# University Research Corporation, et al. All rights reserved.
#
# Please see the files COPYRIGHT.txt and LICENSE.txt for full copyright and
# license information, respectively. Both files are also available online
# at the URL "https://github.com/IDAES/idaes-pse".
##############################################################################
"""
Example ideal parameter block for the VLE calucations for a
Benzene-Toluene-o-Xylene system.
"""
# Import Python libraries
import logging
# Import Pyomo libraries
from pyomo.environ import Param, NonNegativeReals, Set
# Import IDAES cores
from idaes.core import declare_process_block_class
from idaes.core.util.misc import extract_data
from Mod1_ideal_prop_pack_VLE import IdealParameterData
# Some more inforation about this module
__author__ = "Jaffer Ghouse"
__version__ = "0.0.1"
# Set up logger
_log = logging.getLogger(__name__)
@declare_process_block_class("BTXParameterBlock")
class BTXParameterData(IdealParameterData):
def build(self):
'''
Callable method for Block construction.
'''
super(BTXParameterData, self).build()
self.component_list_master = Set(initialize=['benzene',
'toluene',
'o-xylene'])
# Component list - a list of component identifiers
# NOTE: User needs to update this list; can be a subset or
# equal to the master component list
self.component_list = Set(initialize=['benzene', 'toluene'])
# List of components in each phase (optional)
self.phase_comp = {"Liq": self.component_list,
"Vap": self.component_list}
# List of phase equilibrium index
self.phase_equilibrium_idx_master = Set(initialize=[1, 2, 3])
self.phase_equilibrium_idx = Set(initialize=[1, 2])
self.phase_equilibrium_list_master = \
{1: ["benzene", ("Vap", "Liq")],
2: ["toluene", ("Vap", "Liq")],
3: ["o-xylene", ("Vap", "Liq")]}
self.phase_equilibrium_list = \
{1: ["benzene", ("Vap", "Liq")],
2: ["toluene", ("Vap", "Liq")]}
# Thermodynamic reference state
self.pressure_ref = Param(mutable=True,
default=101325,
doc='Reference pressure [Pa]')
self.temperature_ref = Param(mutable=True,
default=298.15,
doc='Reference temperature [K]')
# Source: The Properties of Gases and Liquids (1987)
# 4th edition, Chemical Engineering Series - Robert C. Reid
pressure_crit_data = {'benzene': 48.9e5,
'toluene': 41e5,
'o-xylene': 37.3e5
}
self.pressure_crit = Param(
self.component_list,
within=NonNegativeReals,
mutable=False,
initialize=extract_data(pressure_crit_data),
doc='Critical pressure [Pa]')
# Source: The Properties of Gases and Liquids (1987)
# 4th edition, Chemical Engineering Series - Robert C. Reid
temperature_crit_data = {'benzene': 562.2,
'toluene': 591.8,
'o-xylene': 630.3
}
self.temperature_crit = Param(
self.component_list,
within=NonNegativeReals,
mutable=False,
initialize=extract_data(temperature_crit_data),
doc='Critical temperature [K]')
# Source: The Properties of Gases and Liquids (1987)
# 4th edition, Chemical Engineering Series - Robert C. Reid
mw_comp_data = {'benzene': 78.1136E-3,
'toluene': 92.1405E-3,
'o-xylene': 106.167e-3}
self.mw_comp = Param(self.component_list,
mutable=False,
initialize=extract_data(mw_comp_data),
doc="molecular weight Kg/mol")
# Constants for liquid densities
# Source: Perry's Chemical Engineers Handbook
# - Robert H. Perry (Cp_liq)
dens_liq_data = {('benzene', '1'): 1.0162,
('benzene', '2'): 0.2655,
('benzene', '3'): 562.16,
('benzene', '4'): 0.28212,
('toluene', '1'): 0.8488,
('toluene', '2'): 0.26655,
('toluene', '3'): 591.8,
('toluene', '4'): 0.2878,
('o-xylene', '1'): 0.69883,
('o-xylene', '2'): 0.26113,
('o-xylene', '3'): 630.33,
('o-xylene', '4'): 0.27429}
self.dens_liq_params = Param(
self.component_list,
['1', '2', '3', '4'],
mutable=False,
initialize=extract_data(dens_liq_data),
doc="Parameters to compute liquid densities")
# Boiling point at standard pressure
# Source: Perry's Chemical Engineers Handbook
# - Robert H. Perry (Cp_liq)
bp_data = {('benzene'): 353.25,
('toluene'): 383.95,
('o-xylene'): 417.15}
self.temperature_boil = Param(
self.component_list,
mutable=False,
initialize=extract_data(bp_data),
doc="Pure component boiling points at standard pressure [K]")
# Constants for specific heat capacity, enthalpy
# Sources: The Properties of Gases and Liquids (1987)
# 4th edition, Chemical Engineering Series - Robert C. Reid
# Perry's Chemical Engineers Handbook
# - Robert H. Perry (Cp_liq)
cp_ig_data = {('Liq', 'benzene', '1'): 1.29E5,
('Liq', 'benzene', '2'): -1.7E2,
('Liq', 'benzene', '3'): 6.48E-1,
('Liq', 'benzene', '4'): 0,
('Liq', 'benzene', '5'): 0,
('Vap', 'benzene', '1'): -3.392E1,
('Vap', 'benzene', '2'): 4.739E-1,
('Vap', 'benzene', '3'): -3.017E-4,
('Vap', 'benzene', '4'): 7.130E-8,
('Vap', 'benzene', '5'): 0,
('Liq', 'toluene', '1'): 1.40E5,
('Liq', 'toluene', '2'): -1.52E2,
('Liq', 'toluene', '3'): 6.95E-1,
('Liq', 'toluene', '4'): 0,
('Liq', 'toluene', '5'): 0,
('Vap', 'toluene', '1'): -2.435E1,
('Vap', 'toluene', '2'): 5.125E-1,
('Vap', 'toluene', '3'): -2.765E-4,
('Vap', 'toluene', '4'): 4.911E-8,
('Vap', 'toluene', '5'): 0,
('Liq', 'o-xylene', '1'): 3.65e4,
('Liq', 'o-xylene', '2'): 1.0175e3,
('Liq', 'o-xylene', '3'): -2.63,
('Liq', 'o-xylene', '4'): 3.02e-3,
('Liq', 'o-xylene', '5'): 0,
('Vap', 'o-xylene', '1'): -1.585e-1,
('Vap', 'o-xylene', '2'): 5.962e-1,
('Vap', 'o-xylene', '3'): -3.443e-4,
('Vap', 'o-xylene', '4'): 7.528E-8,
('Vap', 'o-xylene', '5'): 0}
self.cp_ig = Param(self.phase_list, self.component_list,
['1', '2', '3', '4', '5'],
mutable=False,
initialize=extract_data(cp_ig_data),
doc="parameters to compute Cp_comp")
# Source: The Properties of Gases and Liquids (1987)
# 4th edition, Chemical Engineering Series - Robert C. Reid
pressure_sat_coeff_data = {('benzene', 'A'): 4.202,
('benzene', 'B'): 1322,
('benzene', 'C'): -38.56,
('toluene', 'A'): 4.216,
('toluene', 'B'): 1435,
('toluene', 'C'): -43.33,
('o-xylene', 'A'): 4.233,
('o-xylene', 'B'): 1548,
('o-xylene', 'C'): -51.65}
self.pressure_sat_coeff = Param(
self.component_list,
['A', 'B', 'C'],
mutable=False,
initialize=extract_data(pressure_sat_coeff_data),
doc="parameters to compute Cp_comp")
# Source: The Properties of Gases and Liquids (1987)
# 4th edition, Chemical Engineering Series - Robert C. Reid
dh_vap = {'benzene': 3.377e4, 'toluene': 3.8262e4,
'o-xylene': 4.34584e4}
self.dh_vap = Param(self.component_list,
mutable=False,
initialize=extract_data(dh_vap),
doc="heat of vaporization")