PyThermoLinkDB 1.3.0__tar.gz → 1.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/PKG-INFO +7 -1
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/PyThermoLinkDB.egg-info/PKG-INFO +7 -1
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/PyThermoLinkDB.egg-info/SOURCES.txt +2 -1
- pythermolinkdb-1.3.2/pyThermoLinkDB/__init__.py +4 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/app.py +0 -1
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/config/settings.py +1 -1
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/docs/thermodbhub.py +51 -21
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/setup.py +9 -1
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/test/test-3.py +13 -2
- pythermolinkdb-1.3.2/test/test-4.py +365 -0
- pythermolinkdb-1.3.0/pyThermoLinkDB/__init__.py +0 -3
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/LICENSE +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/PyThermoLinkDB.egg-info/dependency_links.txt +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/PyThermoLinkDB.egg-info/requires.txt +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/PyThermoLinkDB.egg-info/top_level.txt +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/README.md +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/config/__init__.py +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/data/__init__.py +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/docs/__init__.py +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/docs/thermolink.py +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/pyThermoLinkDB/docs/utils.py +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/setup.cfg +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/test/test-1.py +0 -0
- {pythermolinkdb-1.3.0 → pythermolinkdb-1.3.2}/test/test-2.py +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyThermoLinkDB
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: PyThermoLinkDB is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications.
|
|
5
|
+
Home-page: https://github.com/sinagilassi/PyThermoLinkDB
|
|
5
6
|
Author: Sina Gilassi
|
|
6
7
|
Author-email: <sina.gilassi@gmail.com>
|
|
7
8
|
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://pythermolinkdb.readthedocs.io/en/latest/
|
|
10
|
+
Project-URL: Source, https://github.com/sinagilassi/PyThermoLinkDB
|
|
11
|
+
Project-URL: Tracker, https://github.com/sinagilassi/PyThermoLinkDB/issues
|
|
8
12
|
Keywords: chemical engineering,thermodynamics,PyThermoDB
|
|
9
13
|
Classifier: Development Status :: 1 - Planning
|
|
10
14
|
Classifier: Intended Audience :: Education
|
|
@@ -22,9 +26,11 @@ Dynamic: author-email
|
|
|
22
26
|
Dynamic: classifier
|
|
23
27
|
Dynamic: description
|
|
24
28
|
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
25
30
|
Dynamic: keywords
|
|
26
31
|
Dynamic: license
|
|
27
32
|
Dynamic: license-file
|
|
33
|
+
Dynamic: project-url
|
|
28
34
|
Dynamic: requires-dist
|
|
29
35
|
Dynamic: requires-python
|
|
30
36
|
Dynamic: summary
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyThermoLinkDB
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: PyThermoLinkDB is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications.
|
|
5
|
+
Home-page: https://github.com/sinagilassi/PyThermoLinkDB
|
|
5
6
|
Author: Sina Gilassi
|
|
6
7
|
Author-email: <sina.gilassi@gmail.com>
|
|
7
8
|
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://pythermolinkdb.readthedocs.io/en/latest/
|
|
10
|
+
Project-URL: Source, https://github.com/sinagilassi/PyThermoLinkDB
|
|
11
|
+
Project-URL: Tracker, https://github.com/sinagilassi/PyThermoLinkDB/issues
|
|
8
12
|
Keywords: chemical engineering,thermodynamics,PyThermoDB
|
|
9
13
|
Classifier: Development Status :: 1 - Planning
|
|
10
14
|
Classifier: Intended Audience :: Education
|
|
@@ -22,9 +26,11 @@ Dynamic: author-email
|
|
|
22
26
|
Dynamic: classifier
|
|
23
27
|
Dynamic: description
|
|
24
28
|
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
25
30
|
Dynamic: keywords
|
|
26
31
|
Dynamic: license
|
|
27
32
|
Dynamic: license-file
|
|
33
|
+
Dynamic: project-url
|
|
28
34
|
Dynamic: requires-dist
|
|
29
35
|
Dynamic: requires-python
|
|
30
36
|
Dynamic: summary
|
|
@@ -49,11 +49,12 @@ class ThermoDBHub(ThermoLink):
|
|
|
49
49
|
except Exception as e:
|
|
50
50
|
raise Exception('Getting components failed!, ', e)
|
|
51
51
|
|
|
52
|
-
def config_thermodb_rule(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
def config_thermodb_rule(
|
|
53
|
+
self,
|
|
54
|
+
config_file: str | Path,
|
|
55
|
+
names: Optional[List[str]] = None,
|
|
56
|
+
disp: bool = False
|
|
57
|
+
) -> bool | str:
|
|
57
58
|
'''
|
|
58
59
|
Configs thermodb rule defined for each component
|
|
59
60
|
|
|
@@ -239,10 +240,11 @@ class ThermoDBHub(ThermoLink):
|
|
|
239
240
|
except Exception as e:
|
|
240
241
|
raise Exception('Configuration failed!, ', e)
|
|
241
242
|
|
|
242
|
-
def add_thermodb_rule(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
def add_thermodb_rule(
|
|
244
|
+
self,
|
|
245
|
+
item: str,
|
|
246
|
+
rules: dict
|
|
247
|
+
) -> bool | str:
|
|
246
248
|
'''
|
|
247
249
|
Adds or update a thermodb rule for a thermodb rule item.
|
|
248
250
|
|
|
@@ -381,7 +383,7 @@ class ThermoDBHub(ThermoLink):
|
|
|
381
383
|
# NOTE: check if log_info is empty
|
|
382
384
|
if len(log_info) == 1:
|
|
383
385
|
# log warning
|
|
384
|
-
log_ =
|
|
386
|
+
log_ = "No thermodb rule found!"
|
|
385
387
|
# log warning
|
|
386
388
|
log_info.append(log_)
|
|
387
389
|
|
|
@@ -391,9 +393,10 @@ class ThermoDBHub(ThermoLink):
|
|
|
391
393
|
except Exception as e:
|
|
392
394
|
raise Exception('Adding new rule failed!, ', e)
|
|
393
395
|
|
|
394
|
-
def delete_thermodb_rule(
|
|
395
|
-
|
|
396
|
-
|
|
396
|
+
def delete_thermodb_rule(
|
|
397
|
+
self,
|
|
398
|
+
name: str
|
|
399
|
+
) -> bool:
|
|
397
400
|
'''
|
|
398
401
|
Deletes an item from thermodb rule
|
|
399
402
|
|
|
@@ -421,10 +424,11 @@ class ThermoDBHub(ThermoLink):
|
|
|
421
424
|
except Exception as e:
|
|
422
425
|
raise Exception('Deleting rule failed!, ', e)
|
|
423
426
|
|
|
424
|
-
def add_thermodb(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
427
|
+
def add_thermodb(
|
|
428
|
+
self,
|
|
429
|
+
name: str,
|
|
430
|
+
data: CompBuilder
|
|
431
|
+
) -> bool:
|
|
428
432
|
'''
|
|
429
433
|
Adds new thermodb such as: CO2_thermodb
|
|
430
434
|
|
|
@@ -449,10 +453,11 @@ class ThermoDBHub(ThermoLink):
|
|
|
449
453
|
except Exception as e:
|
|
450
454
|
raise Exception('Adding new record failed!, ', e)
|
|
451
455
|
|
|
452
|
-
def update_thermodb(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
+
def update_thermodb(
|
|
457
|
+
self,
|
|
458
|
+
name,
|
|
459
|
+
data: CompBuilder
|
|
460
|
+
) -> bool:
|
|
456
461
|
'''
|
|
457
462
|
Updates existing record
|
|
458
463
|
|
|
@@ -599,6 +604,31 @@ class ThermoDBHub(ThermoLink):
|
|
|
599
604
|
except Exception as e:
|
|
600
605
|
raise Exception('Building data/equation source failed!, ', e)
|
|
601
606
|
|
|
607
|
+
def clean(self):
|
|
608
|
+
'''
|
|
609
|
+
Cleans thermodb including thermodb, thermodb_rule, and hub
|
|
610
|
+
|
|
611
|
+
Parameters
|
|
612
|
+
----------
|
|
613
|
+
None
|
|
614
|
+
|
|
615
|
+
Returns
|
|
616
|
+
-------
|
|
617
|
+
None
|
|
618
|
+
'''
|
|
619
|
+
try:
|
|
620
|
+
# reset
|
|
621
|
+
self._thermodb = {}
|
|
622
|
+
# reset
|
|
623
|
+
self._thermodb_rule = {}
|
|
624
|
+
# reset
|
|
625
|
+
self._hub = {}
|
|
626
|
+
|
|
627
|
+
# res
|
|
628
|
+
return True
|
|
629
|
+
except Exception as e:
|
|
630
|
+
raise Exception('Cleaning data/equation source failed!, ', e)
|
|
631
|
+
|
|
602
632
|
def check(self):
|
|
603
633
|
'''
|
|
604
634
|
Checks data/equation source
|
|
@@ -10,9 +10,11 @@ with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
|
|
|
10
10
|
APP_NAME = 'PyThermoLinkDB'
|
|
11
11
|
AUTHOR = 'Sina Gilassi'
|
|
12
12
|
EMAIL = "<sina.gilassi@gmail.com>"
|
|
13
|
-
VERSION = '1.3.
|
|
13
|
+
VERSION = '1.3.2'
|
|
14
14
|
DESCRIPTION = 'PyThermoLinkDB is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications.'
|
|
15
15
|
LONG_DESCRIPTION = "PyThermoLinkDB is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications. It enables seamless thermodynamic data exchange, integration, and analysis. With PyThermoLinkDB, developers can easily link PyThermoDB to various tools, frameworks, and databases, streamlining thermodynamic workflows."
|
|
16
|
+
HOME_PAGE = 'https://github.com/sinagilassi/PyThermoLinkDB'
|
|
17
|
+
DOCUMENTATION = "https://pythermolinkdb.readthedocs.io/en/latest/"
|
|
16
18
|
|
|
17
19
|
# Setting up
|
|
18
20
|
setup(
|
|
@@ -21,6 +23,12 @@ setup(
|
|
|
21
23
|
author=AUTHOR,
|
|
22
24
|
author_email=EMAIL,
|
|
23
25
|
description=DESCRIPTION,
|
|
26
|
+
url=HOME_PAGE,
|
|
27
|
+
project_urls={
|
|
28
|
+
'Documentation': DOCUMENTATION,
|
|
29
|
+
'Source': HOME_PAGE,
|
|
30
|
+
'Tracker': f'{HOME_PAGE}/issues',
|
|
31
|
+
},
|
|
24
32
|
long_description_content_type="text/markdown",
|
|
25
33
|
long_description=long_description,
|
|
26
34
|
packages=find_packages(exclude=['tests', '*.tests', '*.tests.*']),
|
|
@@ -147,7 +147,7 @@ toluene:
|
|
|
147
147
|
vapor-pressure: VaPr
|
|
148
148
|
"""
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
thermodb_config_content_2 = """
|
|
151
151
|
# ThermoDB Config
|
|
152
152
|
|
|
153
153
|
## CO2
|
|
@@ -214,7 +214,7 @@ thermodb_config_content = """
|
|
|
214
214
|
vapor-pressure: VaPr
|
|
215
215
|
"""
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
thermodb_config_content_3 = """
|
|
218
218
|
# CO2
|
|
219
219
|
- DATA:
|
|
220
220
|
Pc: Pc
|
|
@@ -290,6 +290,17 @@ print(thub1.hub)
|
|
|
290
290
|
# check
|
|
291
291
|
print(thub1.check())
|
|
292
292
|
|
|
293
|
+
# NOTE: clean
|
|
294
|
+
# thub1.clean()
|
|
295
|
+
# # hub
|
|
296
|
+
# print(thub1.hub)
|
|
297
|
+
# # check
|
|
298
|
+
# print(thub1.check())
|
|
299
|
+
# # build
|
|
300
|
+
# datasource, equationsource = thub1.build()
|
|
301
|
+
# print(datasource)
|
|
302
|
+
# print(equationsource)
|
|
303
|
+
|
|
293
304
|
# =======================================
|
|
294
305
|
# ✅ TEST
|
|
295
306
|
# =======================================
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# import packages/modules
|
|
2
|
+
import os
|
|
3
|
+
from rich import print
|
|
4
|
+
import pyThermoLinkDB as ptdblink
|
|
5
|
+
import pyThermoDB as ptdb
|
|
6
|
+
|
|
7
|
+
# check version
|
|
8
|
+
print(ptdblink.__version__)
|
|
9
|
+
print(ptdb.__version__)
|
|
10
|
+
# author
|
|
11
|
+
print(ptdblink.__author__)
|
|
12
|
+
|
|
13
|
+
# =======================================
|
|
14
|
+
# 🌍 LOAD THERMODB
|
|
15
|
+
# =======================================
|
|
16
|
+
|
|
17
|
+
# SECTION CO2
|
|
18
|
+
CO2_thermodb_file = os.path.join(
|
|
19
|
+
os.getcwd(), 'test', 'carbon dioxide-1.pkl')
|
|
20
|
+
# load
|
|
21
|
+
CO2_thermodb = ptdb.load_thermodb(CO2_thermodb_file)
|
|
22
|
+
print(type(CO2_thermodb))
|
|
23
|
+
|
|
24
|
+
# check
|
|
25
|
+
print(CO2_thermodb.check())
|
|
26
|
+
|
|
27
|
+
# SECTION 🧪 methanol
|
|
28
|
+
# thermodb file name
|
|
29
|
+
MeOH_thermodb_file = os.path.join(os.getcwd(), 'test', 'methanol-1.pkl')
|
|
30
|
+
print(f"thermodb file: {MeOH_thermodb_file}")
|
|
31
|
+
# load
|
|
32
|
+
MeOH_thermodb = ptdb.load_thermodb(MeOH_thermodb_file)
|
|
33
|
+
print(type(MeOH_thermodb))
|
|
34
|
+
|
|
35
|
+
MeOH_thermodb
|
|
36
|
+
|
|
37
|
+
# check
|
|
38
|
+
print(MeOH_thermodb.check())
|
|
39
|
+
|
|
40
|
+
# SECTION 🧪 toluene
|
|
41
|
+
# thermodb file name
|
|
42
|
+
toluene_thermodb_file = os.path.join(
|
|
43
|
+
os.getcwd(), 'test', 'toluene-1.pkl')
|
|
44
|
+
print(f"thermodb file: {toluene_thermodb_file}")
|
|
45
|
+
# load
|
|
46
|
+
toluene_thermodb = ptdb.load_thermodb(toluene_thermodb_file)
|
|
47
|
+
print(type(toluene_thermodb))
|
|
48
|
+
|
|
49
|
+
# SECTION 🔬 nrtl
|
|
50
|
+
# thermodb file name
|
|
51
|
+
nrtl_thermodb_file = os.path.join(
|
|
52
|
+
os.getcwd(), 'test', 'thermodb_nrtl_1.pkl')
|
|
53
|
+
print(f"thermodb file: {nrtl_thermodb_file}")
|
|
54
|
+
# load
|
|
55
|
+
nrtl_thermodb = ptdb.load_thermodb(nrtl_thermodb_file)
|
|
56
|
+
print(type(nrtl_thermodb))
|
|
57
|
+
|
|
58
|
+
# check
|
|
59
|
+
print(nrtl_thermodb.check())
|
|
60
|
+
|
|
61
|
+
# =======================================
|
|
62
|
+
# 🛠️ INIT THERMODB HUB
|
|
63
|
+
# =======================================
|
|
64
|
+
# init thermodb hub
|
|
65
|
+
thub1 = ptdblink.init()
|
|
66
|
+
print(type(thub1))
|
|
67
|
+
|
|
68
|
+
# add component thermodb
|
|
69
|
+
thub1.add_thermodb('MeOH', MeOH_thermodb)
|
|
70
|
+
thub1.add_thermodb('CO2', CO2_thermodb)
|
|
71
|
+
thub1.add_thermodb('toluene', toluene_thermodb)
|
|
72
|
+
# matrix data
|
|
73
|
+
thub1.add_thermodb('NRTL', nrtl_thermodb)
|
|
74
|
+
|
|
75
|
+
# get components
|
|
76
|
+
print(thub1.items())
|
|
77
|
+
|
|
78
|
+
# =======================================
|
|
79
|
+
# ⚙️ THERMODB LINK CONFIGURATION
|
|
80
|
+
# =======================================
|
|
81
|
+
# add thermodb rule
|
|
82
|
+
# define thermodb rule
|
|
83
|
+
# yml file
|
|
84
|
+
thermodb_config_file = os.path.join(os.getcwd(), 'test', 'thermodb_config.yml')
|
|
85
|
+
|
|
86
|
+
# md file
|
|
87
|
+
thermodb_config_file = os.path.join(os.getcwd(), 'test', 'thermodb_config.md')
|
|
88
|
+
|
|
89
|
+
# txt file
|
|
90
|
+
thermodb_config_file = os.path.join(os.getcwd(), 'test', 'thermodb_config.txt')
|
|
91
|
+
|
|
92
|
+
# all components
|
|
93
|
+
# res_ = thub1.config_thermodb_rule(thermodb_config_file)
|
|
94
|
+
# print(res_)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# NOTE: content
|
|
98
|
+
thermodb_config_content = """
|
|
99
|
+
CO2:
|
|
100
|
+
DATA:
|
|
101
|
+
Pc: Pc
|
|
102
|
+
Tc: Tc
|
|
103
|
+
AcFa: AcFa
|
|
104
|
+
EQUATIONS:
|
|
105
|
+
vapor-pressure: VaPr
|
|
106
|
+
heat-capacity: Cp_IG
|
|
107
|
+
acetylene:
|
|
108
|
+
DATA:
|
|
109
|
+
Pc: Pc
|
|
110
|
+
Tc: Tc
|
|
111
|
+
AcFa: AcFa
|
|
112
|
+
EQUATIONS:
|
|
113
|
+
vapor-pressure: VaPr
|
|
114
|
+
EtOH:
|
|
115
|
+
DATA:
|
|
116
|
+
Pc: Pc1
|
|
117
|
+
Tc: Tc2
|
|
118
|
+
AcFa: AcFa3
|
|
119
|
+
EQUATIONS:
|
|
120
|
+
vapor-pressure: VaPr
|
|
121
|
+
MeOH:
|
|
122
|
+
DATA:
|
|
123
|
+
Pc: Pc
|
|
124
|
+
Tc: Tc
|
|
125
|
+
AcFa: AcFa
|
|
126
|
+
EQUATIONS:
|
|
127
|
+
vapor-pressure: VaPr
|
|
128
|
+
heat-capacity: Cp_LIQ
|
|
129
|
+
n-butane:
|
|
130
|
+
DATA:
|
|
131
|
+
Pc: Pc
|
|
132
|
+
Tc: Tc
|
|
133
|
+
AcFa: AcFa
|
|
134
|
+
EQUATIONS:
|
|
135
|
+
vapor-pressure: VaPr
|
|
136
|
+
NRTL:
|
|
137
|
+
DATA:
|
|
138
|
+
Alpha: alpha_i_j
|
|
139
|
+
EQUATIONS:
|
|
140
|
+
nrtl_tau: tau_i_j
|
|
141
|
+
toluene:
|
|
142
|
+
DATA:
|
|
143
|
+
Pc: Pc
|
|
144
|
+
Tc: Tc
|
|
145
|
+
AcFa: AcFa
|
|
146
|
+
EQUATIONS:
|
|
147
|
+
vapor-pressure: VaPr
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
thermodb_config_content_2 = """
|
|
151
|
+
# ThermoDB Config
|
|
152
|
+
|
|
153
|
+
## CO2
|
|
154
|
+
|
|
155
|
+
- DATA:
|
|
156
|
+
Pc: Pc
|
|
157
|
+
Tc: Tc
|
|
158
|
+
AcFa: AcFa
|
|
159
|
+
- EQUATIONS:
|
|
160
|
+
vapor-pressure: VaPr
|
|
161
|
+
heat-capacity: Cp_IG
|
|
162
|
+
|
|
163
|
+
## acetylene
|
|
164
|
+
|
|
165
|
+
- DATA:
|
|
166
|
+
Pc: Pc
|
|
167
|
+
Tc: Tc
|
|
168
|
+
AcFa: AcFa
|
|
169
|
+
- EQUATIONS:
|
|
170
|
+
vapor-pressure: VaPr
|
|
171
|
+
|
|
172
|
+
## EtOH
|
|
173
|
+
|
|
174
|
+
- DATA:
|
|
175
|
+
Pc: Pc1
|
|
176
|
+
Tc: Tc2
|
|
177
|
+
AcFa: AcFa3
|
|
178
|
+
- EQUATIONS:
|
|
179
|
+
vapor-pressure: VaPr
|
|
180
|
+
|
|
181
|
+
## MeOH
|
|
182
|
+
|
|
183
|
+
-DATA:
|
|
184
|
+
Pc: Pc
|
|
185
|
+
Tc: Tc
|
|
186
|
+
AcFa: AcFa
|
|
187
|
+
- EQUATIONS:
|
|
188
|
+
vapor-pressure: VaPr
|
|
189
|
+
heat-capacity: Cp_LIQ
|
|
190
|
+
|
|
191
|
+
## n-butane
|
|
192
|
+
|
|
193
|
+
- DATA:
|
|
194
|
+
Pc: Pc
|
|
195
|
+
Tc: Tc
|
|
196
|
+
AcFa: AcFa
|
|
197
|
+
- EQUATIONS:
|
|
198
|
+
vapor-pressure: VaPr
|
|
199
|
+
|
|
200
|
+
## NRTL
|
|
201
|
+
|
|
202
|
+
- DATA:
|
|
203
|
+
Alpha: alpha_i_j
|
|
204
|
+
- EQUATIONS:
|
|
205
|
+
nrtl_tau: tau_i_j
|
|
206
|
+
|
|
207
|
+
## toluene
|
|
208
|
+
|
|
209
|
+
- DATA:
|
|
210
|
+
Pc: Pc
|
|
211
|
+
Tc: Tc
|
|
212
|
+
AcFa: AcFa
|
|
213
|
+
- EQUATIONS:
|
|
214
|
+
vapor-pressure: VaPr
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
thermodb_config_content_3 = """
|
|
218
|
+
# CO2
|
|
219
|
+
- DATA:
|
|
220
|
+
Pc: Pc
|
|
221
|
+
Tc: Tc
|
|
222
|
+
AcFa: AcFa
|
|
223
|
+
- EQUATIONS:
|
|
224
|
+
vapor-pressure: VaPr
|
|
225
|
+
heat-capacity: Cp_IG
|
|
226
|
+
|
|
227
|
+
# acetylene
|
|
228
|
+
- DATA:
|
|
229
|
+
Pc: Pc
|
|
230
|
+
Tc: Tc
|
|
231
|
+
AcFa: AcFa
|
|
232
|
+
- EQUATIONS:
|
|
233
|
+
vapor-pressure: VaPr
|
|
234
|
+
|
|
235
|
+
# EtOH
|
|
236
|
+
- DATA:
|
|
237
|
+
Pc: Pc1
|
|
238
|
+
Tc: Tc2
|
|
239
|
+
AcFa: AcFa3
|
|
240
|
+
- EQUATIONS:
|
|
241
|
+
vapor-pressure: VaPr
|
|
242
|
+
|
|
243
|
+
# MeOH
|
|
244
|
+
-DATA:
|
|
245
|
+
Pc: Pc
|
|
246
|
+
Tc: Tc
|
|
247
|
+
AcFa: AcFa
|
|
248
|
+
- EQUATIONS:
|
|
249
|
+
vapor-pressure: VaPr
|
|
250
|
+
heat-capacity: Cp_LIQ
|
|
251
|
+
|
|
252
|
+
# n-butane
|
|
253
|
+
- DATA:
|
|
254
|
+
Pc: Pc
|
|
255
|
+
Tc: Tc
|
|
256
|
+
AcFa: AcFa
|
|
257
|
+
- EQUATIONS:
|
|
258
|
+
vapor-pressure: VaPr
|
|
259
|
+
|
|
260
|
+
# NRTL
|
|
261
|
+
- DATA:
|
|
262
|
+
Alpha: alpha_i_j
|
|
263
|
+
- EQUATIONS:
|
|
264
|
+
nrtl_tau: tau_i_j
|
|
265
|
+
|
|
266
|
+
# toluene
|
|
267
|
+
- DATA:
|
|
268
|
+
Pc: Pc
|
|
269
|
+
Tc: Tc
|
|
270
|
+
AcFa: AcFa
|
|
271
|
+
- EQUATIONS:
|
|
272
|
+
vapor-pressure: VaPr
|
|
273
|
+
"""
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
res_ = thub1.config_thermodb_rule(thermodb_config_content)
|
|
277
|
+
print(res_)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
# =======================================
|
|
281
|
+
# 🏗️ BUILD
|
|
282
|
+
# =======================================
|
|
283
|
+
datasource, equationsource = thub1.build()
|
|
284
|
+
print(datasource)
|
|
285
|
+
print(equationsource)
|
|
286
|
+
|
|
287
|
+
# hub
|
|
288
|
+
print(thub1.hub)
|
|
289
|
+
|
|
290
|
+
# check
|
|
291
|
+
print(thub1.check())
|
|
292
|
+
|
|
293
|
+
# NOTE: clean
|
|
294
|
+
thub1.clean()
|
|
295
|
+
# hub
|
|
296
|
+
print(thub1.hub)
|
|
297
|
+
# check
|
|
298
|
+
print(thub1.check())
|
|
299
|
+
# build
|
|
300
|
+
datasource, equationsource = thub1.build()
|
|
301
|
+
print(datasource)
|
|
302
|
+
print(equationsource)
|
|
303
|
+
|
|
304
|
+
# =======================================
|
|
305
|
+
# 🛠️ AFTER CLEANING HUB
|
|
306
|
+
# =======================================
|
|
307
|
+
# NOTE: already initialized
|
|
308
|
+
# add component thermodb
|
|
309
|
+
thub1.add_thermodb('MeOH', MeOH_thermodb)
|
|
310
|
+
thub1.add_thermodb('CO2', CO2_thermodb)
|
|
311
|
+
thub1.add_thermodb('toluene', toluene_thermodb)
|
|
312
|
+
# matrix data
|
|
313
|
+
thub1.add_thermodb('NRTL', nrtl_thermodb)
|
|
314
|
+
|
|
315
|
+
# get components
|
|
316
|
+
print(thub1.items())
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
# NOTE: re-configure thermodb rule
|
|
320
|
+
res_ = thub1.config_thermodb_rule(thermodb_config_content)
|
|
321
|
+
print(res_)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
# NOTE: build again
|
|
325
|
+
datasource, equationsource = thub1.build()
|
|
326
|
+
print(datasource)
|
|
327
|
+
print(equationsource)
|
|
328
|
+
|
|
329
|
+
# hub
|
|
330
|
+
print(thub1.hub)
|
|
331
|
+
|
|
332
|
+
# check
|
|
333
|
+
print(thub1.check())
|
|
334
|
+
|
|
335
|
+
# =======================================
|
|
336
|
+
# ✅ TEST
|
|
337
|
+
# =======================================
|
|
338
|
+
# CO2 data
|
|
339
|
+
dt1_ = datasource['CO2']['Pc']
|
|
340
|
+
print(type(dt1_))
|
|
341
|
+
print(dt1_)
|
|
342
|
+
|
|
343
|
+
# MeOH data
|
|
344
|
+
dt2_ = datasource['MeOH']['Tc']
|
|
345
|
+
print(type(dt2_))
|
|
346
|
+
print(dt2_)
|
|
347
|
+
|
|
348
|
+
# NRTL data
|
|
349
|
+
dt3_ = datasource['NRTL']['alpha_i_j']
|
|
350
|
+
print(type(dt3_))
|
|
351
|
+
print(dt3_.ij("Alpha_methanol_ethanol"))
|
|
352
|
+
|
|
353
|
+
# CO2 equation
|
|
354
|
+
eq1_ = equationsource['CO2']['Cp_IG']
|
|
355
|
+
print(type(eq1_))
|
|
356
|
+
print(eq1_)
|
|
357
|
+
print(eq1_.args)
|
|
358
|
+
print(eq1_.cal(T=298.15))
|
|
359
|
+
|
|
360
|
+
# nrtl equation
|
|
361
|
+
eq2_ = equationsource['NRTL']['tau_i_j']
|
|
362
|
+
print(type(eq2_))
|
|
363
|
+
print(eq2_)
|
|
364
|
+
print(eq2_.args)
|
|
365
|
+
print(eq2_.cal(T=298.15))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|