Skip to content

Commit 79d07e1

Browse files
committed
update
1 parent 0e0de40 commit 79d07e1

File tree

153 files changed

+2217
-643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+2217
-643
lines changed

biosteam.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 1.2
22
Name: biosteam
3-
Version: 1.0.1
3+
Version: 1.0.2
44
Summary: The Biorefinery Simulation and Techno-Economic Analysis Modules
55
Home-page: https://github.com/yoelcortes/biosteam
66
Author: Yoel Cortes-Pena

biosteam/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454

5555
LazyPkg(__name__, ['_equilibrium', 'utils', 'units', 'evaluation',
56-
'inspect', 'compounds', 'reaction', 'thermo'],
56+
'inspect', 'compounds', 'reaction', 'thermo',
57+
'tests'],
5758
unsearchable=biorefineries.__all__)
5859

11 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

biosteam/tests/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Sun Dec 8 01:40:16 2019
4+
5+
@author: yoelr
6+
"""
7+
8+
from . import biorefinery_tests
9+
from . import binary_distillation_tests
10+
11+
__all__ = (*biorefinery_tests.__all__,
12+
*binary_distillation_tests.__all__)
13+
14+
from biorefinery_tests import *
15+
from binary_distillation_tests import *
16+
17+
def test_all():
18+
biorefinery_tests.test_biorefineries()
19+
binary_distillation_tests.test_all()
412 Bytes
Binary file not shown.
1.08 KB
Binary file not shown.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Sun Dec 8 02:13:07 2019
4+
5+
@author: yoelr
6+
"""
7+
from .utils import assert_unit_streams, assert_unit_results
8+
9+
def test_binary_distillation():
10+
from biosteam import Species, Stream
11+
from biosteam.units import Distillation
12+
13+
# Set up stream
14+
Stream.species = Species('Water', 'Methanol', 'Glycerol')
15+
feed = Stream('feed', flow=(80, 100, 25))
16+
feed.T = feed.bubble_T()[0] # Feed at bubble point T
17+
18+
# Set up column
19+
D1 = Distillation('D1', ins=feed, outs=('distillate', 'bottoms'),
20+
LHK=('Methanol', 'Water'),
21+
y_top=0.99, x_bot=0.01, k=2)
22+
D1.is_divided = True
23+
D1.simulate()
24+
25+
assert_unit_streams(D1,
26+
"Distillation: D1\n"
27+
"ins...\n"
28+
"[0] feed\n"
29+
" phase: 'l', T: 349.28 K, P: 101325 Pa\n"
30+
" flow (kmol/hr): Water 80\n"
31+
" Methanol 100\n"
32+
" Glycerol 25\n"
33+
"outs...\n"
34+
"[0] distillate\n"
35+
" phase: 'g', T: 338.06 K, P: 101325 Pa\n"
36+
" flow (kmol/hr): Water 1\n"
37+
" Methanol 99.2\n"
38+
"[1] bottoms\n"
39+
" phase: 'l', T: 373.21 K, P: 101325 Pa\n"
40+
" flow (kmol/hr): Water 79\n"
41+
" Methanol 0.798\n"
42+
" Glycerol 25")
43+
assert_unit_results(
44+
'Distillation Units D1\n'
45+
'Cooling water Duty kJ/hr -4.86e+06\n'
46+
' Flow kmol/hr 7.18e+03\n'
47+
' Cost USD/hr 0\n'
48+
'Low pressure steam Duty kJ/hr 1.01e+07\n'
49+
' Flow kmol/hr 334\n'
50+
' Cost USD/hr 102\n'
51+
'Design Theoretical feed stage 4\n'
52+
' Theoretical stages 13\n'
53+
' Minimum reflux Ratio 0.687\n'
54+
' Reflux Ratio 1.37\n'
55+
' Rectifier stages 6\n'
56+
' Stripper stages 27\n'
57+
' Rectifier height ft 21.4\n'
58+
' Stripper height ft 52.4\n'
59+
' Rectifier diameter ft 7.82\n'
60+
' Stripper diameter ft 3\n'
61+
' Rectifier wall thickness in 0.312\n'
62+
' Stripper wall thickness in 0.25\n'
63+
' Rectifier weight lb 6.96e+03\n'
64+
' Stripper weight lb 5.31e+03\n'
65+
'Cost Rectifier trays USD 1.26e+04\n'
66+
' Stripper trays USD 1.75e+04\n'
67+
' Rectifier tower USD 8.07e+04\n'
68+
' Stripper tower USD 7.81e+04\n'
69+
' Condenser USD 2.62e+04\n'
70+
' Boiler USD 2.2e+04\n'
71+
'Purchase cost USD 2.37e+05\n'
72+
'Utility cost USD/hr 102')
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Sun Dec 8 02:01:41 2019
4+
5+
@author: yoelr
6+
"""
7+
8+
__all__ = ('test_lipidcane', 'test_cornstover')
9+
10+
def test_biorefineries():
11+
test_lipidcane()
12+
test_cornstover()
13+
14+
def test_lipidcane():
15+
from biosteam.biorefineries.lipidcane import system
16+
IRR = system.lipidcane_tea.IRR
17+
assert 0.193 < IRR < 0.196, ("IRR of the lipid-cane biorefinery changed significantly "
18+
f"from 0.1945 to {IRR}")
19+
20+
def test_cornstover():
21+
from biosteam.biorefineries.cornstover import system
22+
value = system.cornstover_tea.solve_price(system.ethanol)
23+
assert 0.746 < value < 0.749, ("MESP of the corn stover biorefinery changed significantly "
24+
f"from 0.747 to ~{MESP} USD/kg")
25+

biosteam/tests/utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Sun Dec 8 02:52:11 2019
4+
5+
@author: yoelr
6+
"""
7+
8+
__all__ = ('assert_unit_results', 'assert_unit_streams')
9+
10+
def assert_unit_results(unit, unit_results):
11+
assert str(unit.results()) == unit_results, "significant changes in simulation results"
12+
13+
def assert_stream_results(unit, stream_results):
14+
assert unit._info('K', 'Pa', 'kmol/hr', False, 1000) == stream_results, "significant changes in stream results"

0 commit comments

Comments
 (0)