Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vacuum costing and valve graphic fix #172

Merged
merged 26 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0ffce10
merge remote changes
joyxyz1994 Jan 26, 2023
11754ee
Update `System.isdynamic` property
joyxyz1994 Jan 29, 2023
e253b29
update `scope` docstrings
joyxyz1994 Jan 31, 2023
e2605d5
fix typo
joyxyz1994 Mar 14, 2023
d5d8f4f
Merge branch 'qsdsan_temp' into qsdsan
joyxyz1994 Mar 16, 2023
37283ff
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Mar 19, 2023
0ef5b50
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Mar 25, 2023
404a22b
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Mar 29, 2023
e02e198
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Apr 10, 2023
b890b1a
empirical costing for small vacuum pump
joyxyz1994 May 2, 2023
ae8c24c
try adding one dependency to fix exposan failed test
yalinli2 May 5, 2023
12e45e2
Merge branch 'qsdsan' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 May 5, 2023
2e131f7
revert changes on importlib_metadata, not sure if it is useful
yalinli2 May 5, 2023
35c0c4c
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Jun 11, 2023
d1b6826
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Jun 30, 2023
9876254
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Sep 28, 2023
d7e6a15
fix name attr for valve graphics
yalinli2 Sep 28, 2023
778a855
update costing function for new vacuum pump design
joyxyz1994 Sep 29, 2023
07415d3
updated applicable range of pump sizing
joyxyz1994 Oct 20, 2023
0da3da0
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Oct 24, 2023
36c2cc6
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Dec 19, 2023
dd50f53
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Dec 23, 2023
96feb9b
Merge branch 'master' of https://github.com/BioSTEAMDevelopmentGroup/…
yalinli2 Jan 10, 2024
dc7a6c5
debug multiple recycle streams
joyxyz1994 Feb 13, 2024
15e1a5e
Merge branch 'master' into qsdsan
joyxyz1994 Feb 13, 2024
b124a34
merge submodule changes
joyxyz1994 Feb 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Bioindustrial-Park
1 change: 1 addition & 0 deletions biosteam/_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def tailor_valve_node(node, unit): # pragma: no coverage
# TODO: Remove this fallback once fix for valve svg output in digraph.py
node.clear()
node.update(box_node)
node['name'] = ''
node['fillcolor'] = bst.preferences.unit_color
node['fontcolor'] = bst.preferences.unit_label_color
node['color'] = bst.preferences.unit_periphery_color
Expand Down
7 changes: 4 additions & 3 deletions biosteam/_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -1861,9 +1861,10 @@ def algorithm(self, algorithm):
@property
def isdynamic(self) -> bool:
"""Whether the system contains any dynamic Unit."""
try:
return self._isdynamic
except:
if hasattr(self, '_isdynamic'):
if self._isdynamic is not None:
return self._isdynamic
else:
isdynamic = False
for i in self.units:
if i._isdynamic:
Expand Down
4 changes: 2 additions & 2 deletions biosteam/units/_pump.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def _design(self):
N = max(ceil(q_i / 1500), N)
pump_type = 'Gear'
elif (head_i <= 20000
and power_i <= 200
# and power_i <= 200
and 1 <= power_i <= 200
and nu <= 0.01):
N = max(ceil(q_i / 500), N)
pump_type = 'MeteringPlunger'
Expand Down Expand Up @@ -246,7 +247,6 @@ def _cost(self):
h = Design['Head']
p = Design['Power']
I = bst.CE/567

# TODO: Add cost equation for small pumps
# Head and flow rate is too small, so make conservative estimate on cost
if q < 50: q = 50
Expand Down
43 changes: 35 additions & 8 deletions biosteam/units/design_tools/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
.. [1] Seider, W. D.; Lewin, D. R.; Seader, J. D.; Widagdo, S.; Gani, R.;
Ng, M. K. Cost Accounting and Capital Cost Estimation.
In Product and Process Design Principles; Wiley, 2017; pp 426–485.

.. [2] Amazon. Robinair (15115) VacuMaster Single Stage Vacuum Pump - Single-Stage, 1.5 CFM.
https://www.amazon.com/Robinair-15115-VacuMaster-Single-Vacuum/dp/B005CO9FDW?ref_=ast_sto_dp.
Accessed on 09/28/2023.
.. [3] Amazon. Robinair (15300) VacuMaster Economy Vacuum Pump - 2-Stage, 3 CFM.
https://www.amazon.com/Robinair-15300-VacuMaster-Economy-Vacuum/dp/B000O1E5UQ?ref_=ast_sto_dp
Accessed on 09/28/2023.

"""
from numpy import log as ln
Expand All @@ -26,6 +31,7 @@

# System types of vacuum systems
# Volumetric flowrate ranges, (cfm) and lower limit of suction (torr)
# Rotary vane pumps based on ref. [2], [3]
_steamjet_ejectors = {
'One stage': ((10, 1000000), 100),
'Two stage': ((10, 1000000), 15),
Expand All @@ -38,11 +44,20 @@
'Three stage rotary lobe': ((60, 240), 1.5),
'Three stage claw': ((60, 270), 0.3),
'Screw compressor': ((50, 1400), 0.1)}
_rotary_vane = {
'One stage': ((0, 1.51), 0.115),
'Two stage': ((1.5, 3.01), 0.035)}

_default_vacuum_systems = {'Liquid-ring pump': _liquid_ring,
'Steam-jet ejector': _steamjet_ejectors,
'Dry-vacuum pump': _dry_vacuum}

'Dry-vacuum pump': _dry_vacuum,
'Rotary-vane pump': _rotary_vane}

_default_rotary_vane_work_cost = {
'One stage': (1/5 * 0.7457, 127*1.08), # hp to kW; 2023 USD (including tax & shipping)
'Two stage': (1/3 * 0.7457, 248*1.08)
}

_air_density = 1.2041 # kg/m3 dry air

# %% Calculate vacuum system requirements
Expand Down Expand Up @@ -75,11 +90,12 @@ def compute_vacuum_system_power_and_cost(
else:
F_vol_air = F_mass_air = 0
F_vol_cfm = 0.5886*F_vol + F_vol_air
if F_vol_cfm < 3.01:
factor = 3.01/F_vol_cfm
F_vol_cfm = 3.01
else:
factor = 1
# if F_vol_cfm < 3.01:
# factor = 3.01/F_vol_cfm
# F_vol_cfm = 3.01
# else:
# factor = 1
factor = 1
F_mass_kgph = (F_mass + 0.4536*F_mass_air)*factor # kg/hr
F_mass_lbph = 2.205 * F_mass_kgph
vacuum_systems = get_prefered_vacuum_systems(vacuum_system_preference)
Expand All @@ -92,6 +108,12 @@ def compute_vacuum_system_power_and_cost(
steam = 0.41631 * F_mass_kgph # [kmol/hr] 7.5 weight steam/ weight gas
work = 0.
has_condenser = grade != 'One stage'
elif name == 'Rotary-vane pump':
has_condenser = False
agent = None
steam = 0.
N = 1
work = _default_rotary_vane_work_cost[grade][0]
else:
has_condenser = False
agent = None
Expand Down Expand Up @@ -251,5 +273,10 @@ def calculate_vacuum_cost(vacuum_sys, grade, F_mass_lbph, F_vol_cfm, P_suction):
elif grade == 'Screw compressor':
Cp = 10875*S**0.38
Cost = Cp
elif vacuum_sys == 'Rotary-vane pump':
Cost = _default_rotary_vane_work_cost[grade][1] / 708. * 567. # !!! 708 is the 2021 CEPCI, need to be updated to 2023 CEPCI
return Cost




10 changes: 6 additions & 4 deletions biosteam/utils/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Scope():

See Also
--------
`pandas.MultiIndex <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.MultiIndex.html>`
`pandas.MultiIndex <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.MultiIndex.html>`_

"""
def __init__(self, subject, variables, header=None, **kwargs):
Expand All @@ -59,6 +59,7 @@ def __call__(self, t):
log.append(self.getter(var))

def reset_cache(self):
"""Clears all recorded data."""
self._ts = []
self._record = {var:[] for var in self._record.keys()}

Expand All @@ -81,7 +82,7 @@ def _n_cols(self, make_header=False):
if isa(data, (float, int, str)): ni = 1
else: ni = len(data)
n.append(ni)
names += ['f{var}_i' for i in range(ni)]
names += [f'{var}_{i}' for i in range(ni)]
return n, names
else:
for var in self._record.keys():
Expand Down Expand Up @@ -151,12 +152,12 @@ class SystemScope():
interpolator : callable, optional
An interpolation method that takes in time-series data and returns
an interpolant. Used to export the data at certain time points.
When none specified, will use `scipy.interpolate.InterpolatedUnivariateSpline`
When none specified, will use :class:`scipy.interpolate.InterpolatedUnivariateSpline`
with k=1 (i.e., linear) and will raise error when trying to extrapolate.

See Also
--------
`scipy.interpolate.InterpolatedUnivariateSpline <https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.InterpolatedUnivariateSpline.html>`
`scipy.interpolate.InterpolatedUnivariateSpline <https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.InterpolatedUnivariateSpline.html>`_
"""
def __init__(self, system, *subjects, interpolator=None, **kwargs):
self.system = system
Expand All @@ -178,6 +179,7 @@ def __call__(self, t):
s.scope(t)

def reset_cache(self):
'''Clears all recorded data.'''
self._ts = []
self.sol = None
for s in self.subjects:
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ nbval
SALib
pyglet
ipykernel
CoolProp
CoolProp
31 changes: 31 additions & 0 deletions tests/test_vacuum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020-2023, Yoel Cortes-Pena <[email protected]>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details.
"""
"""

import pytest
import biosteam as bst

def test_rotary_vane_vacuum_pump():

bst.settings.set_thermo(['Water', 'CH4'])
gas = bst.Stream('gas', CH4=2, Water=0.1)
vac = bst.VacuumSystem(F_mass=gas.F_mass, F_vol=gas.F_vol,
P_suction=31325., vessel_volume=1.9e-3)
assert "Rotary-vane pump, one stage" in vac.baseline_purchase_costs
#!!! TODO: add test to purchase cost after updating CEPCI

vac = bst.VacuumSystem(F_mass=gas.F_mass*10, F_vol=gas.F_vol*10,
P_suction=31325., vessel_volume=1.9e-3)
assert "Rotary-vane pump, two stage" in vac.baseline_purchase_costs
pass

if __name__ == '__main__':
test_rotary_vane_vacuum_pump()


Loading