Skip to content

Commit

Permalink
merge update
Browse files Browse the repository at this point in the history
  • Loading branch information
yoelcortes committed Feb 19, 2024
2 parents 3481a7f + a0d0aaa commit 32902e3
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 19 deletions.
1 change: 1 addition & 0 deletions biosteam/_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
"""
"""
from thermosteam._graphics import *

7 changes: 4 additions & 3 deletions biosteam/_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -1885,9 +1885,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()


2 changes: 1 addition & 1 deletion thermosteam

0 comments on commit 32902e3

Please sign in to comment.